diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index cdd93cb6c..9bfd970fe 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -1,7 +1,7 @@ // // Menu code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2025 by Bill Spitzak and others. +// Copyright 1998-2026 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -1659,12 +1659,18 @@ Fl_Window *Fl_Window_Driver::menu_parent(int *display_height) { return Menu_Window::parent_; } -/* Cast to menuwindow if win is of claa menuwindow and the driver is initialized. */ +/* Cast to Menu_Window* if win is of class Menu_Window and the driver is initialized. */ static Menu_Window *to_menuwindow(Fl_Window *win) { if (!Fl_Window_Driver::driver(win)->popup_window() || !win->menu_window()) return nullptr; return ((Menu_Window_Basetype*)win)->as_menuwindow(); } +/** Returns whether win is from class Menu_Title_Window */ +bool Fl_Window_Driver::to_menutitle(Fl_Window *win) { + if (!Fl_Window_Driver::driver(win)->popup_window() || !win->menu_window()) return false; + return !((Menu_Window_Basetype*)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..0a6fd694e 100644 --- a/src/Fl_Window_Driver.H +++ b/src/Fl_Window_Driver.H @@ -2,7 +2,7 @@ // A base class for platform specific window handling code // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2025 by Bill Spitzak and others. +// Copyright 2010-2026 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -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 b556a6729..f3e52e4b6 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -558,7 +558,7 @@ void Fl_Wayland_Window_Driver::size_range() { pWindow->get_size_range(&minw, &minh, &maxw, &maxh, NULL, NULL, NULL); if (wl_win->kind == DECORATED && wl_win->frame) { int X,Y,W,H; - Fl::screen_work_area(X,Y,W,H, Fl::screen_num(x(),y(),w(),h())); + Fl::screen_work_area(X,Y,W,H, pWindow->screen_num()); if (maxw && maxw < W && maxh && maxh < H) { libdecor_frame_unset_capabilities(wl_win->frame, LIBDECOR_ACTION_FULLSCREEN); } else { @@ -737,7 +737,8 @@ 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("%swindow %p enters screen id=%d length=%d\n", window->fl_win->parent()?"(sub)":"", 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, 0); } }