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 )
{
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 )

View File

@@ -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,9 +2935,10 @@ 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) )
{