X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65bea426fef46ad16d70f6e0a2ea08c3cfe9c5b3..0bbe61b8c18a1795189f0cf73cc61c14a0fb846d:/src/mac/carbon/window.cpp diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index cfc4c763ab..2a583e69e2 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -168,6 +168,8 @@ static const EventTypeSpec eventList[] = // { kEventClassControl , kEventControlBoundsChanged } , } ; +wxWindowMac* targetWindow = NULL; + static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; @@ -232,17 +234,21 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl bool created = false ; CGContextRef cgContext = NULL ; OSStatus err = cEvent.GetParameter(kEventParamCGContextRef, &cgContext) ; - wxASSERT_MSG( err == noErr , wxT("Unable to retrieve CGContextRef") ) ; + if ( err != noErr ) + { + wxFAIL_MSG("Unable to retrieve CGContextRef"); + } + thisWindow->MacSetCGContextRef( cgContext ) ; { wxMacCGContextStateSaver sg( cgContext ) ; - float alpha = 1.0 ; + CGFloat alpha = (CGFloat)1.0 ; { wxWindow* iter = thisWindow ; while ( iter ) { - alpha *= (float) iter->GetTransparent()/255.0 ; + alpha *= (CGFloat)( iter->GetTransparent()/255.0 ) ; if ( iter->IsTopLevel() ) iter = NULL ; else @@ -340,6 +346,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl inKillFocusEvent = true ; wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId()); event.SetEventObject(thisWindow); + event.SetWindow(targetWindow); thisWindow->HandleWindowEvent(event) ; inKillFocusEvent = false ; } @@ -373,7 +380,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl } #endif ControlPartCode controlPart = cEvent.GetParameter(kEventParamControlPart , typeControlPartCode ); - + if ( controlPart != kControlFocusNoPart ) + targetWindow = thisWindow; + ControlPartCode previousControlPart = 0; verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart)); @@ -1402,7 +1411,7 @@ void wxWindowMac::MacWindowToRootWindow( int *x , int *y ) const if ( !IsTopLevel() ) { - wxTopLevelWindowMac* top = MacGetTopLevelWindow(); + wxNonOwnedWindow* top = MacGetTopLevelWindow(); if (top) { pt.x -= MacGetLeftBorderSize() ; @@ -1445,7 +1454,7 @@ void wxWindowMac::MacRootWindowToWindow( int *x , int *y ) const if ( !IsTopLevel() ) { - wxTopLevelWindowMac* top = MacGetTopLevelWindow(); + wxNonOwnedWindow* top = MacGetTopLevelWindow(); if (top) { wxMacControl::Convert( &pt , top->m_peer , m_peer ) ; @@ -1576,7 +1585,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) wxWindowMac *mouseWin = 0 ; { - wxTopLevelWindowMac *tlw = MacGetTopLevelWindow() ; + wxNonOwnedWindow *tlw = MacGetTopLevelWindow() ; WindowRef window = (WindowRef) ( tlw ? tlw->MacGetWindowRef() : 0 ) ; ControlPartCode part ; @@ -2247,7 +2256,7 @@ void wxWindowMac::MacPaintGrowBox() } else { - CGContextSetRGBFillColor( cgContext, 1.0, 1.0 , 1.0 , 1.0 ); + CGContextSetRGBFillColor( cgContext, (CGFloat) 1.0, (CGFloat)1.0 ,(CGFloat) 1.0 , (CGFloat)1.0 ); } CGContextFillRect( cgContext, cgrect ); CGContextRestoreGState( cgContext ); @@ -2558,14 +2567,14 @@ void wxWindowMac::ClearBackground() void wxWindowMac::Update() { - wxTopLevelWindowMac* top = MacGetTopLevelWindow(); + wxNonOwnedWindow* top = MacGetTopLevelWindow(); if (top) top->MacPerformUpdates() ; } -wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const +wxNonOwnedWindow* wxWindowMac::MacGetTopLevelWindow() const { - wxTopLevelWindowMac* win = NULL ; + wxNonOwnedWindow* win = NULL ; WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ; if ( window ) win = wxFindWinFromMacWindow( window ) ; @@ -2816,7 +2825,7 @@ WXWindow wxWindowMac::MacGetTopLevelWindowRef() const #if wxUSE_POPUPWIN wxPopupWindow* popupwin = wxDynamicCast(iter,wxPopupWindow); if ( popupwin ) - return popupwin->MacGetPopupWindowRef(); + return popupwin->MacGetWindowRef(); #endif } iter = iter->GetParent() ; @@ -3216,13 +3225,13 @@ bool wxWindowMac::IsShownOnScreen() const // CS : put a breakpoint here to investigate differences // between native an wx visibilities // the only place where I've encountered them until now - // are the hiding/showing sequences where the vis-changed event is + // are the hiding/showing sequences where the vis-changed event is // first sent to the innermost control, while wx does things // from the outmost control wxVis = wxWindowBase::IsShownOnScreen(); return wxVis; } - + return m_peer->IsVisible(); } #endif