[gtk/wip.win32.fixes: 1/5] GDK-Win32: Fix AeroSnap




commit c1bdef4e57dc063bcb2c3169964cea0204edfcbb
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jul 6 17:15:39 2021 +0800

    GDK-Win32: Fix AeroSnap
    
    As we are constantly asking the toplevel surface to configure during a
    request layout for most cases, we can now try to fix things in the
    AeroSnap snap_up(), as we removed the need to call compute_toplevel_size()
    there.
    
    The snap up indicator drawing and positioning should now be in their
    proper locations, and the positioning of the surfaces upon snap
    left/right/up should be corrected on systems with HiDPI displays.

 gdk/win32/gdksurface-win32.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 53f4fdd1f3..30e71e9de7 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -2308,15 +2308,11 @@ snap_up (GdkSurface *window)
   y = 0;
   height = maxysize;
 
-  x = x - impl->shadow.left;
-  y = y - impl->shadow.top;
+  x = surface->x - impl->shadow.left / impl->surface_scale;
+  y = y - impl->shadow.top / impl->surface_scale;
   width += impl->shadow_x;
   height += impl->shadow_y;
 
-  /* XXX: FIXME, AeroSnap snap_up() not really working well,
-   *      The snap_up() puts the surface at the top left corner.
-   */
-
   if (GDK_IS_TOPLEVEL (window))
     {
       impl->drag_move_resize_context.native_move_resize_pending = FALSE;
@@ -2344,8 +2340,8 @@ snap_left (GdkSurface  *window,
 
   rect.width = rect.width / 2;
 
-  rect.x = rect.x - impl->shadow.left;
-  rect.y = rect.y - impl->shadow.top;
+  rect.x = rect.x - impl->shadow.left / impl->surface_scale;
+  rect.y = rect.y - impl->shadow.top / impl->surface_scale;
   rect.width = rect.width + impl->shadow_x;
   rect.height = rect.height + impl->shadow_y;
 
@@ -2379,8 +2375,8 @@ snap_right (GdkSurface  *window,
   rect.width = rect.width / 2;
   rect.x += rect.width;
 
-  rect.x = rect.x - impl->shadow.left;
-  rect.y = rect.y - impl->shadow.top;
+  rect.x = rect.x - impl->shadow.left / impl->surface_scale;
+  rect.y = rect.y - impl->shadow.top / impl->surface_scale;
   rect.width = rect.width + impl->shadow_x;
   rect.height = rect.height + impl->shadow_y;
 
@@ -3021,6 +3017,7 @@ update_fullup_indicator (GdkSurface                   *window,
   to.height = gdk_surface_get_height (window);
 
   to.y = 0;
+  to.x = window->x;
   to.height = maxysize;
   from = context->indicator_target;
 
@@ -3173,6 +3170,7 @@ start_indicator (GdkSurface                   *window,
       end_size.height = workarea.height;
       break;
     case GDK_WIN32_AEROSNAP_STATE_FULLUP:
+      start_size.x = end_size.x = window->x;
       end_size.y = 0;
       end_size.height = maxysize;
       break;


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