mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +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:
parent
d0078b6574
commit
11db8c1697
14 changed files with 103 additions and 1 deletions
|
@ -27,12 +27,15 @@ public:
|
|||
int register_timer(GObject&, int milliseconds, bool should_reload);
|
||||
bool unregister_timer(int timer_id);
|
||||
|
||||
void exit(int);
|
||||
|
||||
private:
|
||||
void wait_for_event();
|
||||
void handle_paint_event(const GUI_Event&, GWindow&);
|
||||
void handle_mouse_event(const GUI_Event&, GWindow&);
|
||||
void handle_key_event(const GUI_Event&, GWindow&);
|
||||
void handle_window_activation_event(const GUI_Event&, GWindow&);
|
||||
void handle_window_close_request_event(const GUI_Event&, GWindow&);
|
||||
|
||||
void get_next_timer_expiration(timeval&);
|
||||
|
||||
|
@ -44,6 +47,8 @@ private:
|
|||
|
||||
int m_event_fd { -1 };
|
||||
bool m_running { false };
|
||||
bool m_exit_requested { false };
|
||||
int m_exit_code { 0 };
|
||||
|
||||
int m_next_timer_id { 1 };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue