commit 93fae41fc286d74b38cdce3b7c107e86f2bd730d
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Wed Sep 3 09:00:34 2025 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Wed Sep 3 09:00:34 2025 +0200
Fix "Focus event lost if opening window on macOS" (#1300)
src/Fl_cocoa.mm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index cde6087..ccafa20 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -1143,6 +1143,7 @@ static void cocoaMouseHandler(NSEvent *theEvent)
}
break;
case NSEventTypeMouseEntered :
+ if ([theEvent window]) update_e_xy_and_e_xy_root([theEvent window]);
Fl::handle(FL_ENTER, window);
break;
case NSEventTypeMouseExited :
@@ -1465,7 +1466,6 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
Fl_Window *window = [nsw getFl_Window];
Fl::first_window(window);
if (!window->parent()) [nsw orderFront:nil];
- update_e_xy_and_e_xy_root(nsw);
if (fl_sys_menu_bar && Fl_MacOS_Sys_Menu_Bar_Driver::window_menu_style()) {
// select the corresponding Window menu item
int index = Fl_MacOS_Sys_Menu_Bar_Driver::driver()->first_window_menu_item;
[ Direct Link to Message ]