2020-01-18 05:38:21 -03:00
|
|
|
/*
|
2021-11-23 11:20:11 -03:00
|
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
2021-04-22 17:51:19 -03:00
|
|
|
* Copyright (c) 2020, Linus Groh <linusg@serenityos.org>
|
2020-01-18 05:38:21 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2021-03-11 17:27:09 -03:00
|
|
|
#include "GalleryWidget.h"
|
2021-11-23 11:20:11 -03:00
|
|
|
#include <LibCore/System.h>
|
2020-02-06 16:33:02 -03:00
|
|
|
#include <LibGUI/Application.h>
|
2020-07-08 15:44:32 -03:00
|
|
|
#include <LibGUI/Icon.h>
|
2020-02-06 16:33:02 -03:00
|
|
|
#include <LibGUI/Window.h>
|
2021-11-23 11:20:11 -03:00
|
|
|
#include <LibMain/Main.h>
|
2020-07-14 21:10:26 -03:00
|
|
|
|
2021-11-23 11:20:11 -03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
2019-05-24 17:47:01 -03:00
|
|
|
{
|
2021-11-27 19:26:34 -03:00
|
|
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix thread"));
|
2022-07-03 14:39:30 -03:00
|
|
|
auto app = TRY(GUI::Application::try_create(arguments, Core::EventLoop::MakeInspectable::Yes));
|
2021-11-23 11:20:11 -03:00
|
|
|
|
|
|
|
|
TRY(Core::System::unveil("/res", "r"));
|
2022-09-10 08:12:35 -03:00
|
|
|
TRY(Core::System::unveil("/tmp/user/%uid/portal/filesystemaccess", "rw"));
|
2021-11-23 11:20:11 -03:00
|
|
|
TRY(Core::System::unveil("/etc/FileIconProvider.ini", "r"));
|
|
|
|
|
TRY(Core::System::unveil(nullptr, nullptr));
|
2022-07-11 14:32:29 -03:00
|
|
|
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-widget-gallery"sv));
|
2020-07-08 15:44:32 -03:00
|
|
|
|
2021-11-23 11:20:11 -03:00
|
|
|
auto window = TRY(GUI::Window::try_create());
|
Misc: Use automatic window positioning in more applications
This is a follow up to #2936 / d3e3b4ae56aa79d9bde12ca1f143dcf116f89a4c.
Affected programs:
- Applications: Browser (Download, View source, Inspect DOM tree, JS
console), Terminal (Settings)
- Demos: Cube, Eyes, Fire, HelloWorld, LibGfxDemo, WebView,
WidgetGallery
- DevTools: HackStudio, Inspector, Profiler
- Games: 2048, Minesweeper, Snake, Solitaire
- Userland: test-web
A few have been left out where manual positioning is done on purpose,
e.g. ClipboardManager (to be close to the menu bar) or VisualBuilder (to
preserve alignment of the multiple application windows).
2020-08-15 12:24:05 -03:00
|
|
|
window->resize(430, 480);
|
2019-05-24 17:47:01 -03:00
|
|
|
window->set_title("Widget Gallery");
|
2020-07-08 15:44:32 -03:00
|
|
|
window->set_icon(app_icon.bitmap_for_size(16));
|
2021-12-03 06:47:48 -03:00
|
|
|
(void)TRY(window->try_set_main_widget<GalleryWidget>());
|
2019-05-24 17:47:01 -03:00
|
|
|
window->show();
|
|
|
|
|
|
2020-07-04 09:05:19 -03:00
|
|
|
return app->exec();
|
2019-05-24 17:47:01 -03:00
|
|
|
}
|