X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc710171423c158f73d0713e4cd625bf533635f9..f239a20092359e3c914adb79bd39f3f5d2b2e06f:/src/osx/cocoa/window.mm diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index ccea61277c..ec4381d4c0 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -368,7 +368,16 @@ void wxWidgetCocoaImpl::SetupKeyEvent(wxKeyEvent &wxevent , NSEvent * nsEvent, N } #if wxUSE_UNICODE - wxevent.m_uniChar = aunichar; + // OS X generates events with key codes in Unicode private use area for + // unprintable symbols such as cursor arrows (WXK_UP is mapped to U+F700) + // and function keys (WXK_F2 is U+F705). We don't want to use them as the + // result of wxKeyEvent::GetUnicodeKey() however as it's supposed to return + // WXK_NONE for "non characters" so explicitly exclude them. + // + // We only exclude the private use area inside the Basic Multilingual Plane + // as key codes beyond it don't seem to be currently used. + if ( !(aunichar >= 0xe000 && aunichar < 0xf900) ) + wxevent.m_uniChar = aunichar; #endif wxevent.m_keyCode = keyval; @@ -802,12 +811,32 @@ void wxOSX_drawRect(NSView* self, SEL _cmd, NSRect rect) // [NSWindow setAllowsConcurrentViewDrawing:NO] does not affect it. if ( !wxThread::IsMain() ) { - // just call the superclass handler, we don't need any custom wx drawing - // here and it seems to work fine: - wxOSX_DrawRectHandlerPtr - superimpl = (wxOSX_DrawRectHandlerPtr) - [[self superclass] instanceMethodForSelector:_cmd]; - superimpl(self, _cmd, rect); + if ( impl->IsUserPane() ) + { + wxWindow* win = impl->GetWXPeer(); + if ( win->UseBgCol() ) + { + + CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; + CGContextSaveGState( context ); + + CGContextSetFillColorWithColor( context, win->GetBackgroundColour().GetCGColor()); + CGRect r = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + CGContextFillRect( context, r ); + + CGContextRestoreGState( context ); + } + } + else + { + // just call the superclass handler, we don't need any custom wx drawing + // here and it seems to work fine: + wxOSX_DrawRectHandlerPtr + superimpl = (wxOSX_DrawRectHandlerPtr) + [[self superclass] instanceMethodForSelector:_cmd]; + superimpl(self, _cmd, rect); + } + return; } #endif // wxUSE_THREADS @@ -1424,7 +1453,7 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible ) - (id)init:(wxWindow *)win { - [super init]; + self = [super init]; m_win = win; m_isDone = false;