mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
KeyboardMapper: Port to LibMain
This commit is contained in:
parent
64684cbd5d
commit
017135b44e
2 changed files with 9 additions and 17 deletions
|
@ -11,4 +11,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(KeyboardMapper ICON app-keyboard-mapper)
|
serenity_app(KeyboardMapper ICON app-keyboard-mapper)
|
||||||
target_link_libraries(KeyboardMapper LibGUI LibKeyboard)
|
target_link_libraries(KeyboardMapper LibGUI LibKeyboard LibMain)
|
||||||
|
|
|
@ -6,32 +6,27 @@
|
||||||
|
|
||||||
#include "KeyboardMapperWidget.h"
|
#include "KeyboardMapperWidget.h"
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/FilePicker.h>
|
#include <LibGUI/FilePicker.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/Menubar.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;
|
const char* path = nullptr;
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_positional_argument(path, "Keyboard character mapping file.", "file", Core::ArgsParser::Required::No);
|
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) {
|
TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd unix"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-keyboard-mapper");
|
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();
|
keyboard_mapper_widget->load_from_system();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pledge("stdio thread rpath cpath wpath recvfd sendfd", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio thread rpath cpath wpath recvfd sendfd"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto open_action = GUI::CommonActions::make_open_action(
|
auto open_action = GUI::CommonActions::make_open_action(
|
||||||
[&](auto&) {
|
[&](auto&) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue