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

About: Center the window on screen and make it non-resizable.

This commit is contained in:
Andreas Kling 2019-05-10 22:11:18 +02:00
parent d643daebb2
commit 3a2f10fbbe

View file

@ -3,6 +3,7 @@
#include <LibGUI/GLabel.h> #include <LibGUI/GLabel.h>
#include <LibGUI/GButton.h> #include <LibGUI/GButton.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibGUI/GDesktop.h>
#include <sys/utsname.h> #include <sys/utsname.h>
int main(int argc, char** argv) int main(int argc, char** argv)
@ -12,7 +13,8 @@ int main(int argc, char** argv)
auto* window = new GWindow; auto* window = new GWindow;
window->set_title("About Serenity"); window->set_title("About Serenity");
Rect window_rect { 0, 0, 240, 150 }; Rect window_rect { 0, 0, 240, 150 };
window_rect.center_within({ 0, 0, 1024, 768 }); window_rect.center_within(GDesktop::the().rect());
window->set_resizable(false);
window->set_rect(window_rect); window->set_rect(window_rect);
window->set_should_exit_event_loop_on_close(true); window->set_should_exit_event_loop_on_close(true);