mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
chres: Port to LibMain :^)
This commit is contained in:
parent
cc3710e19f
commit
67a18d51c7
Notes:
sideshowbarker
2024-07-17 22:56:33 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/67a18d51c7b Pull-request: https://github.com/SerenityOS/serenity/pull/11101 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/bgianfo ✅ Reviewed-by: https://github.com/creator1creeper1 ✅ Reviewed-by: https://github.com/kleinesfilmroellchen ✅
2 changed files with 7 additions and 4 deletions
|
@ -66,7 +66,7 @@ target_link_libraries(checksum LibCrypto LibMain)
|
|||
target_link_libraries(chmod LibMain)
|
||||
target_link_libraries(chgrp LibMain)
|
||||
target_link_libraries(chown LibMain)
|
||||
target_link_libraries(chres LibGUI)
|
||||
target_link_libraries(chres LibGUI LibMain)
|
||||
target_link_libraries(cksum LibCrypto)
|
||||
target_link_libraries(config LibConfig)
|
||||
target_link_libraries(copy LibGUI LibMain)
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/WindowServerConnection.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
int screen = 0;
|
||||
int width = -1;
|
||||
|
@ -21,10 +22,10 @@ int main(int argc, char** argv)
|
|||
args_parser.add_positional_argument(width, "Width", "width");
|
||||
args_parser.add_positional_argument(height, "Height", "height");
|
||||
args_parser.add_positional_argument(scale, "Scale Factor", "scale", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
// A Core::EventLoop is all we need, but WindowServerConnection needs a full Application object.
|
||||
char* dummy_argv[] = { argv[0] };
|
||||
char* dummy_argv[] = { arguments.argv[0] };
|
||||
auto app = GUI::Application::construct(1, dummy_argv);
|
||||
auto screen_layout = GUI::WindowServerConnection::the().get_screen_layout();
|
||||
if (screen < 0 || (size_t)screen >= screen_layout.screens.size()) {
|
||||
|
@ -40,4 +41,6 @@ int main(int argc, char** argv)
|
|||
warnln("failed to set resolution: {}", set_result.error_msg());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue