diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index b722a7e042..735ed8f5e4 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -1135,9 +1135,10 @@ void wxNonOwnedWindowCocoaImpl::RequestUserAttention(int flagsWX) void wxNonOwnedWindowCocoaImpl::ScreenToWindow( int *x, int *y ) { wxPoint p((x ? *x : 0), (y ? *y : 0) ); - NSPoint nspt = wxToNSPoint( NULL, p ); - nspt = [m_macWindow convertScreenToBase:nspt]; - nspt = [[m_macWindow contentView] convertPoint:nspt fromView:nil]; + NSRect nsrect = NSZeroRect; + nsrect.origin = wxToNSPoint( NULL, p ); + nsrect = [m_macWindow convertRectFromScreen:nsrect]; + NSPoint nspt = [[m_macWindow contentView] convertPoint:nsrect.origin fromView:nil]; p = wxFromNSPoint([m_macWindow contentView], nspt); if ( x ) *x = p.x; @@ -1150,8 +1151,10 @@ void wxNonOwnedWindowCocoaImpl::WindowToScreen( int *x, int *y ) wxPoint p((x ? *x : 0), (y ? *y : 0) ); NSPoint nspt = wxToNSPoint( [m_macWindow contentView], p ); nspt = [[m_macWindow contentView] convertPoint:nspt toView:nil]; - nspt = [m_macWindow convertBaseToScreen:nspt]; - p = wxFromNSPoint( NULL, nspt); + NSRect nsrect = NSZeroRect; + nsrect.origin = nspt; + nsrect = [m_macWindow convertRectToScreen:nsrect]; + p = wxFromNSPoint( NULL, nsrect.origin); if ( x ) *x = p.x; if ( y ) diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 682ffa9f26..0483ff9d5c 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -530,19 +530,20 @@ bool g_lastButtonWasFakeRight = false ; void wxWidgetCocoaImpl::SetupCoordinates(wxCoord &x, wxCoord &y, NSEvent* nsEvent) { - NSPoint locationInWindow = [nsEvent locationInWindow]; + NSRect locationInWindow = NSZeroRect; + locationInWindow.origin = [nsEvent locationInWindow]; // adjust coordinates for the window of the target view if ( [nsEvent window] != [m_osxView window] ) { if ( [nsEvent window] != nil ) - locationInWindow = [[nsEvent window] convertBaseToScreen:locationInWindow]; + locationInWindow = [[nsEvent window] convertRectToScreen:locationInWindow]; if ( [m_osxView window] != nil ) - locationInWindow = [[m_osxView window] convertScreenToBase:locationInWindow]; + locationInWindow = [[m_osxView window] convertRectFromScreen:locationInWindow]; } - NSPoint locationInView = [m_osxView convertPoint:locationInWindow fromView:nil]; + NSPoint locationInView = [m_osxView convertPoint:locationInWindow.origin fromView:nil]; wxPoint locationInViewWX = wxFromNSPoint( m_osxView, locationInView ); x = locationInViewWX.x; @@ -2372,7 +2373,7 @@ bool wxWidgetCocoaImpl::SetFocus() // TODO remove if no issues arise: should not raise the window, only assign focus //[[m_osxView window] makeKeyAndOrderFront:nil] ; - [[m_osxView window] makeFirstResponder: m_osxView] ; + [[m_osxView window] makeFirstResponder: targetView] ; return true; } @@ -2934,10 +2935,11 @@ void wxWidgetCocoaImpl::SetCursor(const wxCursor& cursor) { if ( !wxIsBusy() ) { - NSPoint location = [NSEvent mouseLocation]; - location = [[m_osxView window] convertScreenToBase:location]; - NSPoint locationInView = [m_osxView convertPoint:location fromView:nil]; - + NSRect location = NSZeroRect; + location.origin = [NSEvent mouseLocation]; + location = [[m_osxView window] convertRectFromScreen:location]; + NSPoint locationInView = [m_osxView convertPoint:location.origin fromView:nil]; + if( NSMouseInRect(locationInView, [m_osxView bounds], YES) ) { [(NSCursor*)cursor.GetHCURSOR() set];