X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/29281095c4959cbadfcc66efccf679c6c25c7dc7..7f1de2b26e841b21110dadf3b9f2d543703eaf45:/src/mac/carbon/toplevel.cpp diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 987aba9955..64d7065dd5 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -158,6 +158,9 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event OSStatus result = eventNotHandledErr ; wxWindow* focus = wxWindow::FindFocus() ; + if ( focus == NULL ) + return result ; + char charCode ; UInt32 keyCode ; UInt32 modifiers ; @@ -294,7 +297,7 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) if ( button == kEventMouseButtonSecondary ) { if (cEvent.GetKind() == kEventMouseDown ) - wxevent.SetEventType( clickCount > 1 ? wxEVT_RIGHT_DOWN : wxEVT_RIGHT_DCLICK ) ; + wxevent.SetEventType( clickCount > 1 ? wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN ) ; else if ( cEvent.GetKind() == kEventMouseUp ) wxevent.SetEventType(wxEVT_RIGHT_UP ) ; } @@ -369,12 +372,13 @@ ControlRef wxMacFindSubControl( Point location , ControlRef superControl , Contr ControlRef wxMacFindControlUnderMouse( Point location , WindowRef window , ControlPartCode *outPart ) { #if TARGET_API_MAC_OSX - return FindControlUnderMouse( location , window , outPart ) ; -#else + if ( UMAGetSystemVersion() >= 1030 ) + return FindControlUnderMouse( location , window , outPart ) ; +#endif ControlRef rootControl = NULL ; verify_noerr( GetRootControl( window , &rootControl ) ) ; return wxMacFindSubControl( location , rootControl , outPart ) ; -#endif + } pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { @@ -493,6 +497,22 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev #endif // wxUSE_TOOLTIPS if ( currentMouseWindow->GetEventHandler()->ProcessEvent(wxevent) ) result = noErr; + else + { + ControlPartCode dummyPart ; + // if built-in find control is finding the wrong control (ie static box instead of overlaid + // button, we cannot let the standard handler do its job, but must handle manually + + if ( ( cEvent.GetKind() == kEventMouseDown ) && + (FindControlUnderMouse(windowMouseLocation , window , &dummyPart) != + wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) ) + { + EventModifiers modifiers = cEvent.GetParameter(kEventParamKeyModifiers, typeUInt32) ; + HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , windowMouseLocation , + modifiers , (ControlActionUPP ) -1 ) ; + result = noErr ; + } + } if ( cEvent.GetKind() == kEventMouseUp && wxTheApp->s_captureWindow ) { wxTheApp->s_captureWindow = NULL ; @@ -602,7 +622,7 @@ static pascal OSStatus wxMacTopLevelWindowEventHandler( EventHandlerCallRef hand adjustR.SetWidth( toplevelWindow->GetMinWidth() ) ; if ( toplevelWindow->GetMinHeight() != -1 && adjustR.GetHeight() < toplevelWindow->GetMinHeight() ) adjustR.SetHeight( toplevelWindow->GetMinHeight() ) ; - Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height + bottom , adjustR.x + adjustR.width + right } ; + Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height - bottom , adjustR.x + adjustR.width - right } ; if ( !EqualRect( &newRect , &adjustedRect ) ) cEvent.SetParameter( kEventParamCurrentBounds , &adjustedRect ) ; } @@ -720,8 +740,6 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent, // init our fields Init(); - style = style & ~wxFRAME_SHAPED ; - m_windowStyle = style; SetName(name); @@ -961,6 +979,11 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, } wxCHECK_RET( err == noErr, wxT("Mac OS error when trying to create new window") ); + + // the create commands are only for content rect, so we have to set the size again as + // structure bounds + SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ; + wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ; if ( m_macUsesCompositing )