1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-18 05:52:11 +00:00

GWindow: Make destroy-on-close an optional behavior.

Also add missing implementation of GWindow::is_visible().
This commit is contained in:
Andreas Kling 2019-06-22 10:37:03 +02:00
parent ae8eff55a7
commit e9cbda29e9
2 changed files with 7 additions and 2 deletions

View file

@ -47,6 +47,7 @@ void GWindow::close()
{
if (should_exit_event_loop_on_close())
GEventLoop::current().quit(0);
if (should_destroy_on_close())
delete_later();
}
@ -421,7 +422,7 @@ void GWindow::collect_keyboard_activation_targets()
bool GWindow::is_visible() const
{
return false;
return m_window_id != 0;
}
void GWindow::update(const Rect& a_rect)

View file

@ -53,6 +53,9 @@ public:
Color background_color() const { return m_background_color; }
void set_background_color(Color color) { m_background_color = color; }
bool should_destroy_on_close() { return m_destroy_on_close; }
void set_should_destroy_on_close(bool b) { m_destroy_on_close = b; }
int x() const { return rect().x(); }
int y() const { return rect().y(); }
int width() const { return rect().width(); }
@ -158,6 +161,7 @@ private:
GWindowType m_window_type { GWindowType::Normal };
bool m_is_active { false };
bool m_should_exit_app_on_close { false };
bool m_destroy_on_close { true };
bool m_has_alpha_channel { false };
bool m_double_buffering_enabled { true };
bool m_modal { false };