[gtk/master.win32: 6/10] gdksurface-win32.c: Fix Aerosnap computation




commit 93d8c3f52293e29b5baed7bca552a29e49cea222
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Aug 3 16:01:40 2020 +0800

    gdksurface-win32.c: Fix Aerosnap computation
    
    Don't get the default display when we compute the Aerosnap region, but instead
    get it from the underlying GdkSurface that we are using for the computation.
    
    Also, don't unref the monitors that we obtain from the display in the wrong
    place, which was why we had crashes whenever we triggered AeroSnap code (and we
    are actually not supposed to do that as they are owned by the GdkDisplay that
    is owned by the GdkSurface we are using), and this will eliminate lots of
    criticals that are spewed as a result.

 gdk/win32/gdksurface-win32.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index fc52a82a5a..ca8b765113 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -1979,7 +1979,7 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
   int i;
 #endif
 
-  display = gdk_display_get_default ();
+  display = gdk_surface_get_display (context->window);
   monitors = gdk_display_get_monitors (display);
 
 #define _M_UP 0
@@ -1999,7 +1999,6 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
       GdkMonitor *monitor;
 
       monitor = g_list_model_get_item (monitors, monitor_idx);
-      g_object_unref (monitors);
       gdk_win32_monitor_get_workarea (monitor, &wa);
       gdk_monitor_get_geometry (monitor, &geometry);
 
@@ -3428,8 +3427,8 @@ setup_drag_move_resize_context (GdkSurface                   *window,
                                 GdkSurfaceEdge                edge,
                                 GdkDevice                   *device,
                                 int                          button,
-                                int                          x,
-                                int                          y,
+                                double                       x,
+                                double                       y,
                                 guint32                      timestamp)
 {
   RECT rect;


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