From 3a2f4b3a94132122bc2cd4eb94b2c7c88f3505ed Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Wed, 18 Mar 2026 19:45:24 +0100 Subject: [PATCH] Wayland: Fix resize of menutitle windows when across 2 screens with diverse scaling - cont'd. --- src/Fl_Menu.cxx | 6 ++++++ src/Fl_Window_Driver.H | 1 + src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index b020d6845..f506c96db 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -190,6 +190,12 @@ static menuwindow *to_menuwindow(Fl_Window *win) { return ((window_with_items*)win)->as_menuwindow(); } +/** Returns whether win is from class menutitle */ +bool Fl_Window_Driver::to_menutitle(Fl_Window *win) { + if (!Fl_Window_Driver::driver(win)->popup_window() || !win->menu_window()) return false; + return !((window_with_items*)win)->as_menuwindow(); +} + /** Accessor to the "origin" member variable of class menuwindow. Variable origin is not NULL when 2 menuwindow's occur, one being a submenu of the other; it links the menuwindow at right to the one at left. */ diff --git a/src/Fl_Window_Driver.H b/src/Fl_Window_Driver.H index afa7017c5..fc4651dab 100644 --- a/src/Fl_Window_Driver.H +++ b/src/Fl_Window_Driver.H @@ -197,6 +197,7 @@ public: // when that's not the case, as with Wayland. virtual void reposition_menu_window(int x, int y); virtual void menu_window_area(int &X, int &Y, int &W, int &H, int nscreen = -1); + static bool to_menutitle(Fl_Window*); static Fl_Window *menu_parent(int *display_height = NULL); static Fl_Window *menu_leftorigin(Fl_Window*); static Fl_Window *menu_title(Fl_Window*); diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index ad7284b1f..2aad8f0c6 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -723,7 +723,7 @@ static void surface_enter(void *data, struct wl_surface *wl_surface, while (e->next != &window->outputs) e = e->next; // move e to end of linked list wl_list_insert(e, &surface_output->link); //printf("window %p enters screen id=%d length=%d\n", window->fl_win, output->id, wl_list_length(&window->outputs)); - if (list_was_empty && !window->fl_win->parent() && !window->fl_win->menu_window()) { + if (list_was_empty && !window->fl_win->parent() && !Fl_Window_Driver::to_menutitle(window->fl_win)) { change_scale(output, window, pre_scale); } }