From: Stefan Csomor Date: Thu, 29 Apr 2004 04:26:17 +0000 (+0000) Subject: workaround for incorrect find control results because of our non-embedding group... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/30e0b1c9720fcef5fb2fa0969ef4cc12a168cf97 workaround for incorrect find control results because of our non-embedding group boxing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index c7f7fd7c0f..5a126f299b 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -372,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 ) { @@ -496,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 ;