From 0636c0b3e69c80a11a385ebb7fa3db5c8ff06a42 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 24 Oct 2023 19:25:59 +0200 Subject: Wayland: implement scale factor windows as popups - cont'd --- src/Fl_Screen_Driver.H | 3 ++- src/Fl_Screen_Driver.cxx | 4 ++-- src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Fl_Screen_Driver.H b/src/Fl_Screen_Driver.H index ec3de15c0..0772281a6 100644 --- a/src/Fl_Screen_Driver.H +++ b/src/Fl_Screen_Driver.H @@ -79,8 +79,9 @@ public: static const int fl_YValue; static const int fl_XNegative; static const int fl_YNegative; - // Used when transient scale windows are implemented as popups + // Next 2 are used when transient scale windows are implemented as popups static Fl_Window *transient_scale_parent; + static void del_transient_window(void *); // key_table and key_table_size are used in fl_shortcut to translate key names struct Keyname { unsigned int key; diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index f9a40f132..877576fdf 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -388,8 +388,8 @@ static Fl_Window *transient_scale_window = NULL; Fl_Window *Fl_Screen_Driver::transient_scale_parent = NULL; -static void del_transient_window(void *) { - Fl_Screen_Driver::transient_scale_parent = NULL; +void Fl_Screen_Driver::del_transient_window(void *) { + transient_scale_parent = NULL; delete (Fl_Image*)transient_scale_window->shape(); delete transient_scale_window; transient_scale_window = NULL; diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 73a8c442d..e844dbb90 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -435,9 +435,11 @@ static void destroy_surface_caution_pointer_focus(struct wl_surface *surface, void Fl_Wayland_Window_Driver::hide() { if (pWindow == Fl_Screen_Driver::transient_scale_parent) { - // Don't hide the parent of a running transient scale window - // because the transient is a popup and MUST be deleted first. - return; + // Delete also the running transient scale window + // because the transient is a popup and MUST be deleted + // before its parent. + Fl::remove_timeout(Fl_Screen_Driver::del_transient_window); + Fl_Screen_Driver::del_transient_window(NULL); } Fl_X* ip = Fl_X::flx(pWindow); if (hide_common()) return; -- cgit v1.2.3