X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b16f4bfab29a541cbb24febe07983087776388cb..0d28c9eb31e706d076838b19c44fb88dce3a8cd8:/src/mac/carbon/toplevel.cpp diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 18b9a9b984..a459279ecc 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -49,6 +49,9 @@ #include +//For targeting OSX +#include "wx/mac/private.h" + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -444,7 +447,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev else { currentMouseWindow = wxFindControlFromMacControl( control ) ; - if ( currentMouseWindow == NULL ) + if ( currentMouseWindow == NULL && cEvent.GetKind() == kEventMouseMoved ) { // for wxToolBar to function we have to send certaint events to it // instead of its children (wxToolBarTools) @@ -518,15 +521,6 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev cursorPoint += cursorTarget->GetPosition() ; } - // update focus - - if ( wxevent.GetEventType() == wxEVT_LEFT_DOWN ) - { - // set focus to this window - if (currentMouseWindow->AcceptsFocus() && wxWindow::FindFocus()!=currentMouseWindow) - currentMouseWindow->SetFocus(); - } - // make tooltips current #if wxUSE_TOOLTIPS @@ -539,6 +533,15 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev result = noErr; else { + // if the user code did _not_ handle the event, then perform the + // default processing + if ( wxevent.GetEventType() == wxEVT_LEFT_DOWN ) + { + // ... that is set focus to this window + if (currentMouseWindow->AcceptsFocus() && wxWindow::FindFocus()!=currentMouseWindow) + currentMouseWindow->SetFocus(); + } + 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 @@ -945,10 +948,14 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, int x = (int)pos.x; int y = (int)pos.y; - if ( y < 50 ) - y = 50 ; - if ( x < 20 ) - x = 20 ; + + wxRect display = wxGetClientDisplayRect() ; + + if ( x == wxDefaultPosition.x ) + x = display.x ; + + if ( y == wxDefaultPosition.y ) + y = display.y ; int w = WidthDefault(size.x); int h = HeightDefault(size.y); @@ -983,6 +990,16 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, { wclass = kDocumentWindowClass ; } +#if defined( __WXMAC__ ) && TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) + else if ( HasFlag( wxFRAME_DRAWER ) ) + { + wclass = kDrawerWindowClass; + // Should this be left for compositing check below? + // CreateNewWindow will fail without it, should wxDrawerWindow turn + // on compositing before calling MacCreateRealWindow? + attr |= kWindowCompositingAttribute;// | kWindowStandardHandlerAttribute; + } +#endif //10.2 and up else { if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||