[gtk/wip/chergert/fix-macos-pointer-position-over-surface] macos: fix calculation of mouse position




commit c31c3848df45932ea1229e5b3b76ab0b308b42e7
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 4 18:02:04 2020 -0800

    macos: fix calculation of mouse position
    
    This fixes the calculation of the position of the pointer over the surface
    which was incorrectly providing negative values.

 gdk/macos/gdkmacossurface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 9925407d46..2360e1c476 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -256,7 +256,7 @@ gdk_macos_surface_get_device_state (GdkSurface      *surface,
         | _gdk_macos_display_get_current_mouse_modifiers (GDK_MACOS_DISPLAY (display));
 
   *x = point.x;
-  *y = point.y - surface->height;
+  *y = surface->height - point.y;
 
   return *x >= 0 && *y >= 0 && *x < surface->width && *y < surface->height;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]