From ba5ed296e9faf92a047f68e83e9348eb43a40eec Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:00:01 +0100 Subject: Improve implementation of the macOS Window menu The macOS Window menu is connected to the item array of the macOS menubar via FL_SUBMENU_POINTER. This facilitates memorization of pointers to items of the macOS menubar because the item array no longer changes each time a window opens of gets closed. --- src/Fl_cocoa.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Fl_cocoa.mm') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 9e51a6efa..23efb6e15 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1395,10 +1395,10 @@ static FLWindowDelegate *flwindowdelegate_instance = nil; // select the corresponding Window menu item int index = Fl_MacOS_Sys_Menu_Bar_Driver::driver()->find_first_window() + 1; while (index > 0) { - Fl_Menu_Item *item = (Fl_Menu_Item*)fl_sys_menu_bar->menu() + index; + Fl_Menu_Item *item = Fl_MacOS_Sys_Menu_Bar_Driver::driver()->window_menu_items + index; if (!item->label()) break; if (item->user_data() == window) { - if (!item->value()) fl_sys_menu_bar->setonly(item); + if (!item->value()) item->setonly(); break; } index++; -- cgit v1.2.3