removing deprecated APIs

This commit is contained in:
Stefan Csomor
2017-06-15 20:51:14 +02:00
parent 1d3ed51eab
commit e2e99f5c91
2 changed files with 19 additions and 14 deletions

View File

@@ -1135,9 +1135,10 @@ void wxNonOwnedWindowCocoaImpl::RequestUserAttention(int flagsWX)
void wxNonOwnedWindowCocoaImpl::ScreenToWindow( int *x, int *y ) void wxNonOwnedWindowCocoaImpl::ScreenToWindow( int *x, int *y )
{ {
wxPoint p((x ? *x : 0), (y ? *y : 0) ); wxPoint p((x ? *x : 0), (y ? *y : 0) );
NSPoint nspt = wxToNSPoint( NULL, p ); NSRect nsrect = NSZeroRect;
nspt = [m_macWindow convertScreenToBase:nspt]; nsrect.origin = wxToNSPoint( NULL, p );
nspt = [[m_macWindow contentView] convertPoint:nspt fromView:nil]; nsrect = [m_macWindow convertRectFromScreen:nsrect];
NSPoint nspt = [[m_macWindow contentView] convertPoint:nsrect.origin fromView:nil];
p = wxFromNSPoint([m_macWindow contentView], nspt); p = wxFromNSPoint([m_macWindow contentView], nspt);
if ( x ) if ( x )
*x = p.x; *x = p.x;
@@ -1150,8 +1151,10 @@ void wxNonOwnedWindowCocoaImpl::WindowToScreen( int *x, int *y )
wxPoint p((x ? *x : 0), (y ? *y : 0) ); wxPoint p((x ? *x : 0), (y ? *y : 0) );
NSPoint nspt = wxToNSPoint( [m_macWindow contentView], p ); NSPoint nspt = wxToNSPoint( [m_macWindow contentView], p );
nspt = [[m_macWindow contentView] convertPoint:nspt toView:nil]; nspt = [[m_macWindow contentView] convertPoint:nspt toView:nil];
nspt = [m_macWindow convertBaseToScreen:nspt]; NSRect nsrect = NSZeroRect;
p = wxFromNSPoint( NULL, nspt); nsrect.origin = nspt;
nsrect = [m_macWindow convertRectToScreen:nsrect];
p = wxFromNSPoint( NULL, nsrect.origin);
if ( x ) if ( x )
*x = p.x; *x = p.x;
if ( y ) if ( y )

View File

@@ -530,19 +530,20 @@ bool g_lastButtonWasFakeRight = false ;
void wxWidgetCocoaImpl::SetupCoordinates(wxCoord &x, wxCoord &y, NSEvent* nsEvent) 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 // adjust coordinates for the window of the target view
if ( [nsEvent window] != [m_osxView window] ) if ( [nsEvent window] != [m_osxView window] )
{ {
if ( [nsEvent window] != nil ) if ( [nsEvent window] != nil )
locationInWindow = [[nsEvent window] convertBaseToScreen:locationInWindow]; locationInWindow = [[nsEvent window] convertRectToScreen:locationInWindow];
if ( [m_osxView window] != nil ) 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 ); wxPoint locationInViewWX = wxFromNSPoint( m_osxView, locationInView );
x = locationInViewWX.x; x = locationInViewWX.x;
@@ -2372,7 +2373,7 @@ bool wxWidgetCocoaImpl::SetFocus()
// TODO remove if no issues arise: should not raise the window, only assign focus // TODO remove if no issues arise: should not raise the window, only assign focus
//[[m_osxView window] makeKeyAndOrderFront:nil] ; //[[m_osxView window] makeKeyAndOrderFront:nil] ;
[[m_osxView window] makeFirstResponder: m_osxView] ; [[m_osxView window] makeFirstResponder: targetView] ;
return true; return true;
} }
@@ -2934,9 +2935,10 @@ void wxWidgetCocoaImpl::SetCursor(const wxCursor& cursor)
{ {
if ( !wxIsBusy() ) if ( !wxIsBusy() )
{ {
NSPoint location = [NSEvent mouseLocation]; NSRect location = NSZeroRect;
location = [[m_osxView window] convertScreenToBase:location]; location.origin = [NSEvent mouseLocation];
NSPoint locationInView = [m_osxView convertPoint:location fromView:nil]; location = [[m_osxView window] convertRectFromScreen:location];
NSPoint locationInView = [m_osxView convertPoint:location.origin fromView:nil];
if( NSMouseInRect(locationInView, [m_osxView bounds], YES) ) if( NSMouseInRect(locationInView, [m_osxView bounds], YES) )
{ {