mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
PixelPaint: Port to LibMain
This commit is contained in:
parent
55db1811c7
commit
bec7ffaf0a
2 changed files with 12 additions and 35 deletions
|
@ -45,4 +45,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(PixelPaint ICON app-pixel-paint)
|
serenity_app(PixelPaint ICON app-pixel-paint)
|
||||||
target_link_libraries(PixelPaint LibImageDecoderClient LibGUI LibGfx LibFileSystemAccessClient LibConfig)
|
target_link_libraries(PixelPaint LibImageDecoderClient LibGUI LibGfx LibFileSystemAccessClient LibConfig LibMain)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "MainWidget.h"
|
#include "MainWidget.h"
|
||||||
#include <LibConfig/Client.h>
|
#include <LibConfig/Client.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
|
||||||
#include <LibFileSystemAccessClient/Client.h>
|
#include <LibFileSystemAccessClient/Client.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
|
@ -17,48 +16,26 @@
|
||||||
#include <LibGUI/Statusbar.h>
|
#include <LibGUI/Statusbar.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
||||||
#include <stdio.h>
|
#include <LibMain/Main.h>
|
||||||
#include <unistd.h>
|
#include <LibSystem/Wrappers.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio thread recvfd sendfd rpath unix wpath cpath", nullptr) < 0) {
|
TRY(System::pledge("stdio thread recvfd sendfd rpath unix wpath cpath", nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||||
Config::pledge_domains("PixelPaint");
|
Config::pledge_domains("PixelPaint");
|
||||||
|
|
||||||
const char* image_file = nullptr;
|
const char* image_file = nullptr;
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_positional_argument(image_file, "Image file to open", "path", Core::ArgsParser::Required::No);
|
args_parser.add_positional_argument(image_file, "Image file to open", "path", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments.argc, arguments.argv);
|
||||||
|
|
||||||
if (unveil("/res", "r") < 0) {
|
TRY(System::unveil("/res", "r"));
|
||||||
perror("unveil");
|
TRY(System::unveil("/tmp/portal/clipboard", "rw"));
|
||||||
return 1;
|
TRY(System::unveil("/tmp/portal/filesystemaccess", "rw"));
|
||||||
}
|
TRY(System::unveil("/tmp/portal/image", "rw"));
|
||||||
|
TRY(System::unveil(nullptr, nullptr));
|
||||||
if (unveil("/tmp/portal/clipboard", "rw") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/tmp/portal/filesystemaccess", "rw") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/tmp/portal/image", "rw") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-pixel-paint");
|
auto app_icon = GUI::Icon::default_icon("app-pixel-paint");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue