mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
KeyboardSettings: Port to LibMain :^)
This commit is contained in:
parent
10b5393506
commit
31867bed5c
Notes:
sideshowbarker
2024-07-18 00:45:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/31867bed5c2
2 changed files with 12 additions and 33 deletions
|
@ -13,4 +13,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_app(KeyboardSettings ICON app-keyboard-settings)
|
||||
target_link_libraries(KeyboardSettings LibGUI LibKeyboard LibConfig)
|
||||
target_link_libraries(KeyboardSettings LibGUI LibKeyboard LibConfig LibMain)
|
||||
|
|
|
@ -6,51 +6,30 @@
|
|||
*/
|
||||
|
||||
#include "KeyboardSettingsWidget.h"
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/SettingsWindow.h>
|
||||
#include <LibGUI/WindowServerConnection.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
// Including this after to avoid LibIPC errors
|
||||
#include <LibConfig/Client.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
if (pledge("stdio rpath cpath wpath recvfd sendfd unix proc exec", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
TRY(Core::System::pledge("stdio rpath cpath wpath recvfd sendfd unix proc exec", nullptr));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
Config::pledge_domains("KeyboardSettings");
|
||||
|
||||
if (pledge("stdio rpath cpath wpath recvfd sendfd proc exec", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/res", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/bin/keymap", "x") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/proc/keymap", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil(nullptr, nullptr)) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio rpath cpath wpath recvfd sendfd proc exec", nullptr));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil("/bin/keymap", "x"));
|
||||
TRY(Core::System::unveil("/proc/keymap", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-keyboard-settings");
|
||||
|
||||
auto window = GUI::SettingsWindow::construct("Keyboard Settings");
|
||||
auto window = TRY(GUI::SettingsWindow::try_create("Keyboard Settings"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->add_tab<KeyboardSettingsWidget>("Keyboard");
|
||||
|
||||
|
|
Loading…
Reference in a new issue