From 347754de61e983a3fa39232b6e49d998071bb1a8 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Tue, 18 May 2010 14:21:45 +0000 Subject: Fixed "Unlock focus on wrong view" error that occurred sometimes. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7611 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3