summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Fl_cocoa.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 6a9654f75..33dda8694 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -2385,7 +2385,9 @@ void Fl_Window::make_current()
win = (Fl_Window*)win->window();
}
- [[NSView focusView] unlockFocus];
+ NSView *current_focus = [NSView focusView];
+ // sometimes current_focus is set to a non-FLTK view: don't touch that
+ if ( [current_focus isKindOfClass:[FLView class]] ) [current_focus unlockFocus];
[[(NSWindow*)i->xid contentView] lockFocus];
i->gc = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
fl_gc = i->gc;