[gtk/wip/chergert/quartz4u] macos: breakout functionality by coordinate type
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/quartz4u] macos: breakout functionality by coordinate type
- Date: Fri, 15 May 2020 00:07:45 +0000 (UTC)
commit be5af842e654b6cca6ee446fb69778395d0738b2
Author: Christian Hergert <chergert redhat com>
Date: Thu May 14 17:05:45 2020 -0700
macos: breakout functionality by coordinate type
gdk/macos/gdkmacosdisplay.c | 49 ++++++++++++++++++++++++++++-----------------
1 file changed, 31 insertions(+), 18 deletions(-)
---
diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c
index 12bbb01442..ab9de08a28 100644
--- a/gdk/macos/gdkmacosdisplay.c
+++ b/gdk/macos/gdkmacosdisplay.c
@@ -858,22 +858,17 @@ _gdk_macos_display_queue_events (GdkMacosDisplay *self)
gdk_macos_display_queue_events (GDK_DISPLAY (self));
}
-GdkMacosSurface *
-_gdk_macos_display_get_surface_at_display_coords (GdkMacosDisplay *self,
- double x,
- double y,
- int *surface_x,
- int *surface_y)
+static GdkMacosSurface *
+_gdk_macos_display_get_surface_at_coords (GdkMacosDisplay *self,
+ int x,
+ int y,
+ int *surface_x,
+ int *surface_y)
{
- int x_gdk;
- int y_gdk;
-
g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (self), NULL);
g_return_val_if_fail (surface_x != NULL, NULL);
g_return_val_if_fail (surface_y != NULL, NULL);
- _gdk_macos_display_from_display_coords (self, x, y, &x_gdk, &y_gdk);
-
for (const GList *iter = self->sorted_surfaces.head; iter; iter = iter->next)
{
GdkSurface *surface = iter->data;
@@ -882,17 +877,16 @@ _gdk_macos_display_get_surface_at_display_coords (GdkMacosDisplay *self,
g_assert (GDK_IS_MACOS_SURFACE (surface));
nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface));
-
if (![nswindow isVisible])
continue;
- if (x_gdk >= surface->x &&
- y_gdk >= surface->y &&
- x_gdk <= (surface->x + surface->width) &&
- y_gdk <= (surface->y + surface->height))
+ if (x >= surface->x &&
+ y >= surface->y &&
+ x <= (surface->x + surface->width) &&
+ y <= (surface->y + surface->height))
{
- *surface_x = x_gdk - surface->x;
- *surface_y = y_gdk - surface->y;
+ *surface_x = x - surface->x;
+ *surface_y = y - surface->y;
return GDK_MACOS_SURFACE (surface);
}
@@ -904,6 +898,25 @@ _gdk_macos_display_get_surface_at_display_coords (GdkMacosDisplay *self,
return NULL;
}
+GdkMacosSurface *
+_gdk_macos_display_get_surface_at_display_coords (GdkMacosDisplay *self,
+ double x,
+ double y,
+ int *surface_x,
+ int *surface_y)
+{
+ int x_gdk;
+ int y_gdk;
+
+ g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (self), NULL);
+ g_return_val_if_fail (surface_x != NULL, NULL);
+ g_return_val_if_fail (surface_y != NULL, NULL);
+
+ _gdk_macos_display_from_display_coords (self, x, y, &x_gdk, &y_gdk);
+
+ return _gdk_macos_display_get_surface_at_coords (self, x_gdk, y_gdk, surface_x, surface_y);
+}
+
void
_gdk_macos_display_add_frame_callback (GdkMacosDisplay *self,
GdkMacosSurface *surface)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]