summaryrefslogtreecommitdiff
path: root/src/Fl_cocoa.mm
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-20 16:00:01 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-20 16:00:01 +0100
commitba5ed296e9faf92a047f68e83e9348eb43a40eec (patch)
tree4edae89c3cf0ce5bf499ef1ceb8f86926d0ed40e /src/Fl_cocoa.mm
parent4649188cf67c1c19dac8262dce7789384ded2ded (diff)
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.
Diffstat (limited to 'src/Fl_cocoa.mm')
-rw-r--r--src/Fl_cocoa.mm4
1 files changed, 2 insertions, 2 deletions
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++;