Refine GdkQuartzNSWindow convertPointToScreen:

and convertPointFromScreen:, making them handle all MacOS versions
so that all of the if-deffing happens in the function definitions.
This happens to fix issue 1518 because it turns out that contrary
to the annotation in the 10.14 nNSWindow.h, convertPointToScreen and
convertPointFromScreen originate in 10.14, not 10.12.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1518
This commit is contained in:
John Ralls
2018-12-14 16:10:35 -08:00
parent baa283b73b
commit aeec73f53f
3 changed files with 36 additions and 53 deletions

View File

@ -379,12 +379,7 @@ get_window_point_from_screen_point (GdkWindow *window,
GdkQuartzNSWindow *nswindow;
nswindow = (GdkQuartzNSWindow*)(((GdkWindowImplQuartz *)window->impl)->toplevel);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
point = [nswindow convertScreenToBase:screen_point];
#else
point = [nswindow convertPointFromScreen:screen_point];
#endif
*x = point.x;
*y = window->height - point.y;
}
@ -460,12 +455,7 @@ get_toplevel_from_ns_event (NSEvent *nsevent,
}
else
{
if (gdk_quartz_osx_version () >= GDK_OSX_LION)
*screen_point = [(GdkQuartzNSWindow*)[nsevent window] convertPointToScreen:point];
#if MAC_OS_X_VERSION_MIN_REQUIRED < 10700
else
*screen_point = [[nsevent window] convertBaseToScreen:point];
#endif
*screen_point = [(GdkQuartzNSWindow*)[nsevent window] convertPointToScreen:point];
*x = point.x;
*y = toplevel->height - point.y;
}