[metacity] libmetacity: make sure invisible area is large enough



commit d87459dd8310b5e29ad00ab03fb2913b795ba3f7
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Feb 7 18:27:24 2016 +0200

    libmetacity: make sure invisible area is large enough

 configure.ac                    |    2 +-
 libmetacity/meta-frame-layout.h |    4 ++++
 libmetacity/meta-theme-gtk.c    |   36 ++++++++++++++++++++++++++++++++----
 3 files changed, 37 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 73cca30..806f2ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ dnl Check for required packages
 dnl **************************************************************************
 
 GLIB_REQUIRED_VERSION=2.44.0
-GTK_REQUIRED_VERSION=3.19.7
+GTK_REQUIRED_VERSION=3.19.8
 
 PKG_CHECK_MODULES([LIBMETACITY], [
   glib-2.0 >= $GLIB_REQUIRED_VERSION
diff --git a/libmetacity/meta-frame-layout.h b/libmetacity/meta-frame-layout.h
index 23b9791..edcf270 100644
--- a/libmetacity/meta-frame-layout.h
+++ b/libmetacity/meta-frame-layout.h
@@ -56,6 +56,10 @@ struct _MetaFrameLayout
   struct {
     /** Border/padding of the entire frame */
     GtkBorder frame_border;
+
+    /** Shadow border used in invisible resize area */
+    GtkBorder shadow_border;
+
     /** Border/padding of the titlebar region */
     GtkBorder titlebar_border;
     /** Border/padding of titlebar buttons */
diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c
index 1bf1221..24c46a8 100644
--- a/libmetacity/meta-theme-gtk.c
+++ b/libmetacity/meta-theme-gtk.c
@@ -18,6 +18,7 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "meta-frame-style.h"
@@ -193,6 +194,20 @@ scale_border (GtkBorder *border,
 }
 
 static void
+get_shadow_extents (GtkStyleContext *style,
+                    GtkBorder       *border)
+{
+  GdkRectangle clip;
+
+  gtk_render_background_get_clip (style, 0, 0, 0, 0, &clip);
+
+  border->left = abs (clip.x);
+  border->top = abs (clip.y);
+  border->right = clip.width - border->left;
+  border->bottom = clip.height - border->bottom;
+}
+
+static void
 frame_layout_sync_with_style (MetaFrameLayout *layout,
                               MetaStyleInfo   *style_info,
                               gboolean         composited,
@@ -213,6 +228,7 @@ frame_layout_sync_with_style (MetaFrameLayout *layout,
     {
       /* With compositing manager: margin is resize area */
       get_margin (style, &layout->invisible_resize_border);
+      get_shadow_extents (style, &layout->gtk.shadow_border);
     }
   else
     {
@@ -222,6 +238,11 @@ frame_layout_sync_with_style (MetaFrameLayout *layout,
       layout->invisible_resize_border.left = 0;
       layout->invisible_resize_border.right = 0;
 
+      layout->gtk.shadow_border.top = 0;
+      layout->gtk.shadow_border.bottom = 0;
+      layout->gtk.shadow_border.left = 0;
+      layout->gtk.shadow_border.right = 0;
+
       /* Without compositing manager: margin is part of border */
       get_margin (style, &border);
 
@@ -339,18 +360,25 @@ meta_theme_gtk_get_frame_borders (MetaThemeImpl    *impl,
   borders->visible.right = layout->gtk.frame_border.right;
   borders->visible.bottom = layout->gtk.frame_border.bottom;
 
+  borders->invisible = layout->gtk.shadow_border;
+
   if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
     {
-      borders->invisible.left = layout->invisible_resize_border.left;
-      borders->invisible.right = layout->invisible_resize_border.right;
+      borders->invisible.left = MAX (borders->invisible.left,
+                                     layout->invisible_resize_border.left);
+
+      borders->invisible.right = MAX (borders->invisible.right,
+                                      layout->invisible_resize_border.right);
     }
 
   if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
     {
-      borders->invisible.bottom = layout->invisible_resize_border.bottom;
+      borders->invisible.bottom = MAX (borders->invisible.bottom,
+                                       layout->invisible_resize_border.bottom);
 
       if (type != META_FRAME_TYPE_ATTACHED)
-        borders->invisible.top = layout->invisible_resize_border.top;
+        borders->invisible.top = MAX (borders->invisible.top,
+                                      layout->invisible_resize_border.top);
     }
 
   borders->total.left = borders->invisible.left + borders->visible.left;


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