1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:58:11 +00:00

Add a simple close button ("X") to windows.

Clicking the button generates a WindowCloseRequest event which the client app
then has to deal with. The default behavior for GWindow is to close() itself.

I also added a flag, GWindow::should_exit_event_loop_on_close() which does
what it sounds like it does.

This patch exposed some bugs in GWindow and GWidget teardown.
This commit is contained in:
Andreas Kling 2019-02-05 10:31:37 +01:00
parent d0078b6574
commit 11db8c1697
14 changed files with 103 additions and 1 deletions

View file

@ -53,6 +53,9 @@ public:
GWidget* global_cursor_tracking_widget() { return m_global_cursor_tracking_widget.ptr(); }
const GWidget* global_cursor_tracking_widget() const { return m_global_cursor_tracking_widget.ptr(); }
bool should_exit_app_on_close() const { return m_should_exit_app_on_close; }
void set_should_exit_app_on_close(bool b) { m_should_exit_app_on_close = b; }
private:
RetainPtr<GraphicsBitmap> m_backing;
int m_window_id { 0 };
@ -62,5 +65,6 @@ private:
WeakPtr<GWidget> m_global_cursor_tracking_widget;
Rect m_rect_when_windowless;
String m_title_when_windowless;
bool m_should_exit_app_on_close { false };
};