[gtk/wip.win32.fixes: 147/151] GDK-Win32: Fix AeroSnap




commit 83cfa972d0ff90babf03e8a23e3f951724d9d3f5
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 e07013f3da..38bdff2ded 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -2310,15 +2310,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;
@@ -2346,8 +2342,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;
 
@@ -2381,8 +2377,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;
 
@@ -3023,6 +3019,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;
 
@@ -3175,6 +3172,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]