mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:44:58 +00:00
LibGUI: Make Application
's construction fallible
The pattern to construct `Application` was to use the `try_create` method from the `C_OBJECT` macro. While being safe from an OOM perspective, this method doesn't propagate errors from the constructor. This patch make `Application` use the `C_OBJECT_ABSTRACT` and manually define a `create` method that can bubble up errors from the construction stage. This commit also removes the ability to use `argc` and `argv` to create an `Application`, only `Main`'s `Arguments` can be used. From a user point of view, the patch renames `try_create` => `create`, hence the huge number of modified files.
This commit is contained in:
parent
f132751fae
commit
1a97382305
93 changed files with 121 additions and 118 deletions
|
@ -11,7 +11,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix thread"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("AudioApplet");
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/audio", "rw"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("ClipboardHistory");
|
||||
Config::monitor_domain("ClipboardHistory");
|
||||
|
|
|
@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix getkeymap proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
auto window = TRY(KeymapStatusWindow::try_create());
|
||||
window->set_has_alpha_channel(true);
|
||||
|
|
|
@ -164,7 +164,7 @@ private:
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/notify", "rw"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath"));
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
app->set_quit_when_last_window_deleted(false);
|
||||
|
||||
// We need to obtain the WM connection here as well before the pledge shortening.
|
||||
|
|
|
@ -348,7 +348,7 @@ bool GLContextWidget::load_file(String const& filename, NonnullOwnPtr<Core::File
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix prot_exec map_fixed"));
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
TRY(Core::System::unveil("/etc/timezone", "r"));
|
||||
|
|
|
@ -160,7 +160,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 0;
|
||||
}
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_minimizable(false);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Browser");
|
||||
Config::monitor_domain("Browser");
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("Browser");
|
||||
|
||||
StringView selected_tab;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Calendar");
|
||||
Config::monitor_domain("Calendar");
|
||||
|
|
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Calendar");
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(args));
|
||||
auto app = TRY(GUI::Application::create(args));
|
||||
|
||||
TRY(Core::System::unveil(TRY(String::formatted("{}/.config/certs.pem", Core::StandardPaths::home_directory())), "rwc"_short_string));
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));
|
||||
|
|
|
@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("CharacterMap");
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/Applications/CharacterMap.md") }));
|
||||
|
|
|
@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Taskbar");
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd cpath rpath unix proc exec thread"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
DeprecatedString coredump_path {};
|
||||
bool unlink_on_exit = false;
|
||||
|
|
|
@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("WindowManager");
|
||||
|
||||
StringView selected_tab;
|
||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd thread cpath rpath wpath unix proc exec id"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
auto executable_path = FileSystem::resolve_executable_from_environment(command[0]);
|
||||
if (executable_path.is_error()) {
|
||||
|
|
|
@ -89,7 +89,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(initial_location, "Path to open", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd cpath rpath wpath fattr proc exec unix"));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath unix cpath wpath"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/Applications/FontEditor.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix thread"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("Games");
|
||||
|
||||
StringView selected_tab;
|
||||
|
|
|
@ -21,7 +21,7 @@ using namespace Help;
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
// We specifically don't want to load this path from a library, as that can be hijacked with LD_PRELOAD.
|
||||
|
|
|
@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix cpath wpath thread"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/Applications/HexEditor.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
|
|
@ -41,7 +41,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix thread"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domains({ "ImageViewer", "WindowManager" });
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd"));
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix proc exec"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("KeyboardSettings");
|
||||
|
||||
StringView selected_tab;
|
||||
|
|
|
@ -40,7 +40,7 @@ static ErrorOr<ByteBuffer> dump_bitmap(RefPtr<Gfx::Bitmap> bitmap, AK::StringVie
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/Applications/Magnifier.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix inet"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Mail");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Mail");
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd"));
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
parser.add_positional_argument(adapter, "Adapter to display settings for", "adapter", Core::ArgsParser::Required::No);
|
||||
parser.parse(args);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(args));
|
||||
auto app = TRY(GUI::Application::create(args));
|
||||
|
||||
if (getuid() != 0) {
|
||||
GUI::MessageBox::show_error(nullptr, "You need to be root to run Network Settings!"sv);
|
||||
|
|
|
@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(file_path, "PDF file to open", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = GUI::Icon::default_icon("app-pdf-viewer"sv);
|
||||
|
||||
Config::pledge_domain("PDFViewer");
|
||||
|
|
|
@ -41,7 +41,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio thread proc rpath cpath wpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TrackManager track_manager;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix wpath cpath"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("PixelPaint");
|
||||
app->set_config_domain(TRY(String::from_utf8("PixelPaint"sv)));
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
argument_parser.add_positional_argument(file_to_load, "Presentation to load", "file", Core::ArgsParser::Required::No);
|
||||
argument_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
window->set_title("Presenter");
|
||||
window->set_icon(GUI::Icon::default_icon("app-presenter"sv).bitmap_for_size(16));
|
||||
|
|
|
@ -14,7 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd thread cpath rpath wpath unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto window = TRY(RunWindow::try_create());
|
||||
|
||||
window->move_to(16, GUI::Desktop::the().rect().bottom() - GUI::Desktop::the().taskbar_height() - 16 - window->height());
|
||||
|
|
|
@ -82,7 +82,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath proc exec"));
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(file_path, "Path to audio file to play", "file", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto audio_client = TRY(Audio::ConnectionToServer::try_create());
|
||||
auto decoder_client = TRY(ImageDecoderClient::Client::try_create());
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ static DeprecatedString get_absolute_path_to_selected_node(SpaceAnalyzer::TreeMa
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
// Configure application window.
|
||||
auto app_icon = GUI::Icon::default_icon("app-space-analyzer"sv);
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath fattr unix cpath wpath thread"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
StringView filename;
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio thread proc recvfd sendfd rpath exec unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("SystemMonitor");
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::sigaction(SIGCHLD, &act, nullptr));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio tty rpath cpath wpath recvfd sendfd proc exec unix"));
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domain("Terminal");
|
||||
|
||||
StringView selected_tab;
|
||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("TextEditor");
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
StringView file_to_edit;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(filename, "The video file to display.", "filename", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
window->resize(640, 480);
|
||||
window->set_resizable(true);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("SystemServer");
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-catdog"sv));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
|
|
|
@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix cpath wpath thread"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/launch", "rw"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -89,7 +89,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -185,7 +185,7 @@ void Canvas::draw()
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -105,7 +105,7 @@ void Canvas::draw(Gfx::Painter& painter)
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -396,7 +396,7 @@ ErrorOr<void> Mandelbrot::export_image(DeprecatedString const& export_path, Imag
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath wpath cpath"));
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath proc exec"));
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(speed, "Speed (default = 1)", "speed", 's', "number");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(refresh_rate, "Refresh rate", "rate", 'r', "milliseconds");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath prot_exec map_fixed"));
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix thread"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -66,7 +66,7 @@ void UnregisteredWidget::paint_event(GUI::PaintEvent& event)
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd cpath rpath wpath unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domains({ "GMLPlayground", "Calendar" });
|
||||
app->set_config_domain(TRY("GMLPlayground"_string));
|
||||
|
|
|
@ -41,7 +41,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd tty rpath cpath wpath proc exec unix fattr thread ptrace"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domains({ "HackStudio", "Terminal", "FileManager" });
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
|
|
|
@ -58,7 +58,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-profiler"sv));
|
||||
|
||||
DeprecatedString perfcore_file;
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(file_to_open, "Path to SQL script or DB", "file", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-sql-studio"sv);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
srand(time(nullptr));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-2048"sv));
|
||||
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
|
|
|
@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
auto const app_name = "BrickGame"sv;
|
||||
auto const title = "Brick Game"sv;
|
||||
|
|
|
@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd thread proc exec unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Games");
|
||||
Config::monitor_domain("Games");
|
||||
|
|
|
@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
auto const app_name = "ColorLines"sv;
|
||||
auto const title = "Color Lines"sv;
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("FlappyBug");
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ static int get_number_of_moves_from_ai(Board const& board)
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-flood"sv));
|
||||
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
|
|
|
@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man6/GameOfLife.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-hearts"sv));
|
||||
|
||||
Config::pledge_domains({ "Games", "Hearts" });
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("MasterWord");
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Minesweeper");
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Config::pledge_domain("Snake");
|
||||
Config::monitor_domain("Snake");
|
||||
|
|
|
@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-solitaire"sv));
|
||||
|
||||
auto const man_file = "/usr/share/man/man6/Solitaire.md"sv;
|
||||
|
|
|
@ -42,7 +42,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-spider"sv));
|
||||
|
||||
Config::pledge_domains({ "Games", "Spider" });
|
||||
|
|
|
@ -68,37 +68,43 @@ Application* Application::the()
|
|||
return *s_the;
|
||||
}
|
||||
|
||||
Application::Application(int argc, char** argv)
|
||||
ErrorOr<NonnullRefPtr<Application>> Application::create(Main::Arguments const& arguments)
|
||||
{
|
||||
VERIFY(!*s_the);
|
||||
*s_the = *this;
|
||||
m_event_loop = make<Core::EventLoop>();
|
||||
if (*s_the)
|
||||
return Error::from_string_literal("An Application has already been created for this process!");
|
||||
|
||||
auto application = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Application {}));
|
||||
*s_the = *application;
|
||||
|
||||
application->m_event_loop = TRY(try_make<Core::EventLoop>());
|
||||
|
||||
ConnectionToWindowServer::the();
|
||||
Clipboard::initialize({});
|
||||
if (argc > 0)
|
||||
m_invoked_as = argv[0];
|
||||
|
||||
if (arguments.argc > 0)
|
||||
application->m_invoked_as = arguments.argv[0];
|
||||
|
||||
if (getenv("GUI_FOCUS_DEBUG"))
|
||||
m_focus_debugging_enabled = true;
|
||||
application->m_focus_debugging_enabled = true;
|
||||
|
||||
if (getenv("GUI_HOVER_DEBUG"))
|
||||
m_hover_debugging_enabled = true;
|
||||
application->m_hover_debugging_enabled = true;
|
||||
|
||||
if (getenv("GUI_DND_DEBUG"))
|
||||
m_dnd_debugging_enabled = true;
|
||||
application->m_dnd_debugging_enabled = true;
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
DeprecatedString arg(argv[i]);
|
||||
m_args.append(move(arg));
|
||||
}
|
||||
for (auto arg : arguments.strings.slice(1))
|
||||
TRY(application->m_args.try_append(arg));
|
||||
|
||||
m_tooltip_show_timer = Core::Timer::create_single_shot(700, [this] {
|
||||
request_tooltip_show();
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
application->m_tooltip_show_timer = TRY(Core::Timer::create_single_shot(700, [weak_application = application->make_weak_ptr<Application>()] {
|
||||
weak_application->request_tooltip_show();
|
||||
}));
|
||||
|
||||
m_tooltip_hide_timer = Core::Timer::create_single_shot(50, [this] {
|
||||
tooltip_hide_timer_did_fire();
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
application->m_tooltip_hide_timer = TRY(Core::Timer::create_single_shot(50, [weak_application = application->make_weak_ptr<Application>()] {
|
||||
weak_application->tooltip_hide_timer_did_fire();
|
||||
}));
|
||||
|
||||
return application;
|
||||
}
|
||||
|
||||
static bool s_in_teardown;
|
||||
|
|
|
@ -22,11 +22,13 @@
|
|||
namespace GUI {
|
||||
|
||||
class Application : public Core::Object {
|
||||
C_OBJECT(Application);
|
||||
C_OBJECT_ABSTRACT(Application);
|
||||
|
||||
public:
|
||||
static Application* the();
|
||||
|
||||
static ErrorOr<NonnullRefPtr<Application>> create(Main::Arguments const& arguments);
|
||||
|
||||
~Application();
|
||||
|
||||
static bool in_teardown();
|
||||
|
@ -97,11 +99,7 @@ public:
|
|||
void register_recent_file_actions(Badge<GUI::Menu>, Vector<NonnullRefPtr<GUI::Action>>);
|
||||
|
||||
private:
|
||||
Application(int argc, char** argv);
|
||||
Application(Main::Arguments const& arguments)
|
||||
: Application(arguments.argc, arguments.argv)
|
||||
{
|
||||
}
|
||||
Application() = default;
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
#include <LibIPC/SingleServer.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath cpath wpath unix thread"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(0, nullptr));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
app->set_quit_when_last_window_deleted(false);
|
||||
|
||||
auto client = TRY(IPC::take_over_accepted_client_from_system_server<FileSystemAccessServer::ConnectionFromClient>());
|
||||
|
|
|
@ -61,7 +61,7 @@ static void login(Core::Account const& account, LoginWindow& window)
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd cpath chown rpath exec proc id"));
|
||||
TRY(Core::System::unveil("/home", "r"));
|
||||
|
|
|
@ -14,7 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd accept rpath unix"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto server = TRY(IPC::MultiServer<NotificationServer::ConnectionFromClient>::try_create());
|
||||
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -41,7 +41,7 @@ static ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window&);
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath unix sigaction"));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Config::pledge_domains({ "Taskbar", "Calendar" });
|
||||
Config::monitor_domain("Taskbar");
|
||||
Config::monitor_domain("Calendar");
|
||||
|
|
|
@ -25,8 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
// A Core::EventLoop is all we need, but ConnectionToWindowServer needs a full Application object.
|
||||
char* dummy_argv[] = { arguments.argv[0] };
|
||||
auto app = TRY(GUI::Application::try_create(1, dummy_argv));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto screen_layout = GUI::ConnectionToWindowServer::the().get_screen_layout();
|
||||
if (screen < 0 || (size_t)screen >= screen_layout.screens.size()) {
|
||||
warnln("invalid screen index: {}", screen);
|
||||
|
|
|
@ -59,7 +59,7 @@ static ErrorOr<Options> parse_options(Main::Arguments arguments)
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Options options = TRY(parse_options(arguments));
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
StringView title {};
|
||||
|
|
|
@ -62,7 +62,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(watch_command, "Command to run in watch mode", "command", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
auto& clipboard = GUI::Clipboard::the();
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
output_path = Core::DateTime::now().to_deprecated_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv);
|
||||
}
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
Optional<Gfx::IntRect> crop_region;
|
||||
if (select_region) {
|
||||
auto window = GUI::Window::construct();
|
||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(path, "Wallpaper to set", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Core::System::pledge("stdio rpath unix sendfd"));
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
int flash_flush = -1;
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue