macOS Window menu: select in menu new top window after window deletion

This commit is contained in:
ManoloFLTK 2020-06-17 20:08:42 +02:00
parent 5005d04765
commit 87b73723ed
1 changed files with 2 additions and 1 deletions

View File

@ -631,8 +631,9 @@ void Fl_MacOS_Sys_Menu_Bar_Driver::remove_window(Fl_Window *win)
if (item->user_data() == win) { if (item->user_data() == win) {
bool doit = item->value(); bool doit = item->value();
remove(index); remove(index);
if (doit) { if (doit) { // select Fl::first_window() in Window menu
item = (Fl_Menu_Item*)bar->menu() + find_first_window() + 1; item = (Fl_Menu_Item*)bar->menu() + find_first_window() + 1;
while (item->label() && item->user_data() != Fl::first_window()) item++;
if (item->label()) { if (item->label()) {
((Fl_Window*)item->user_data())->show(); ((Fl_Window*)item->user_data())->show();
setonly(item); setonly(item);