1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

KeyboardMapper: Port to LibMain

This commit is contained in:
RasmusNylander 2021-12-16 14:20:25 +01:00 committed by Andreas Kling
parent 64684cbd5d
commit 017135b44e
2 changed files with 9 additions and 17 deletions

View file

@ -6,32 +6,27 @@
#include "KeyboardMapperWidget.h"
#include <LibCore/ArgsParser.h>
#include <LibCore/System.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/FilePicker.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Menubar.h>
#include <unistd.h>
#include <LibMain/Main.h>
int main(int argc, char** argv)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
const char* path = nullptr;
Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "Keyboard character mapping file.", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
args_parser.parse(arguments);
if (pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd unix", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd unix"));
auto app = GUI::Application::construct(argc, argv);
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
if (pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd"));
auto app_icon = GUI::Icon::default_icon("app-keyboard-mapper");
@ -49,10 +44,7 @@ int main(int argc, char** argv)
keyboard_mapper_widget->load_from_system();
}
if (pledge("stdio thread rpath cpath wpath recvfd sendfd", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(Core::System::pledge("stdio thread rpath cpath wpath recvfd sendfd"));
auto open_action = GUI::CommonActions::make_open_action(
[&](auto&) {