[gtk/gtk-4-2: 65/91] window: Fix up resize borders




commit 10b302ac29a5255229d1e165ad61787d7492d307
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Apr 21 20:00:49 2021 -0400

    window: Fix up resize borders
    
    The invisible resize borders have been wider than they
    should, for a while. Go back to a size close to what
    we have in GTK3.
    
    To summarize: resize borders will be at most 12 pixels
    on each size, but never wider than the windows shadow.
    The resize corners have 'legs' of 24 pixels where you
    still get a corner resize cursor.
    
    Fixes: #3856

 gtk/gtkwindow.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index b8ea6e3e21..7e66830a20 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -149,7 +149,8 @@
  */
 
 #define MENU_BAR_ACCEL GDK_KEY_F10
-#define RESIZE_HANDLE_SIZE 20
+#define RESIZE_HANDLE_SIZE 12 /* Width of resize borders */
+#define RESIZE_HANDLE_CORNER_SIZE 24 /* How resize corners extend */
 #define MNEMONICS_DELAY 300 /* ms */
 #define NO_CONTENT_CHILD_NAT 200 /* ms */
 #define VISIBLE_FOCUS_DURATION 3 /* s */
@@ -1421,10 +1422,10 @@ get_edge_for_coordinates (GtkWindow *window,
 
   if (x < left && x >= left - handle_size.left)
     {
-      if (y < top + handle_size.top && y >= top - handle_size.top)
+      if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
 
-      if (y > top + border_rect->size.height - handle_size.bottom &&
+      if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE &&
           y <= top + border_rect->size.height + handle_size.bottom)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
 
@@ -1433,10 +1434,10 @@ get_edge_for_coordinates (GtkWindow *window,
   else if (x > left + border_rect->size.width &&
            x <= left + border_rect->size.width + handle_size.right)
     {
-      if (y < top + handle_size.top && y >= top - handle_size.top)
+      if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
 
-      if (y > top + border_rect->size.height - handle_size.bottom &&
+      if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE &&
           y <= top + border_rect->size.height + handle_size.bottom)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
 
@@ -1444,10 +1445,10 @@ get_edge_for_coordinates (GtkWindow *window,
     }
   else if (y < top && y >= top - handle_size.top)
     {
-      if (x < left + handle_size.left && x >= left - handle_size.left)
+      if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
 
-      if (x > left + border_rect->size.width - handle_size.right &&
+      if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE &&
           x <= left + border_rect->size.width + handle_size.right)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
 
@@ -1456,10 +1457,10 @@ get_edge_for_coordinates (GtkWindow *window,
   else if (y > top + border_rect->size.height &&
            y <= top + border_rect->size.height + handle_size.bottom)
     {
-      if (x < left + handle_size.left && x >= left - handle_size.left)
+      if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
 
-      if (x > left + border_rect->size.width - handle_size.right &&
+      if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE &&
           x <= left + border_rect->size.width + handle_size.right)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
 


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