From b3a683812883f6f8821c9848fd8414025b85c2aa Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 2 Nov 2024 07:37:43 +0100 Subject: [PATCH] Fix Mac: "Merge All Windows" fails if focused window is borderless (#1100) --- src/Fl_MacOS_Sys_Menu_Bar.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Fl_MacOS_Sys_Menu_Bar.mm b/src/Fl_MacOS_Sys_Menu_Bar.mm index 950a52e29..b76deb27e 100644 --- a/src/Fl_MacOS_Sys_Menu_Bar.mm +++ b/src/Fl_MacOS_Sys_Menu_Bar.mm @@ -593,10 +593,12 @@ static void move_tab_cb(Fl_Widget *, void *data) static void merge_all_windows_cb(Fl_Widget *, void *) { - Fl_Window *first = Fl::first_window(); - if (first) { - [(NSWindow*)fl_xid(first) mergeAllWindows:nil]; - } + Fl_Window *first = Fl::first_window(); + while (first && (first->parent() || !first->border())) + first = Fl::next_window(first); + if (first) { + [(NSWindow*)fl_xid(first) mergeAllWindows:nil]; + } } #endif