[metacity/wip/gtk-theme: 9/41] MetaFrameBorders: Add invisible borders



commit 8cdff694a1ccd5786ef4700d203712b698e30351
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jul 12 00:55:50 2011 -0400

    MetaFrameBorders: Add invisible borders
    
    This just adds the invisible border field and populates it with data
    but doesn't use it in any way.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=644930
    
    NOTE: Metacity is not going to use invisible borders yet.

 src/core/frame.c     |    8 ++++----
 src/include/common.h |    5 +++++
 src/ui/theme.c       |   20 +++++++++++++++++++-
 3 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index e172758..176fad0 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -302,10 +302,10 @@ meta_frame_get_flags (MetaFrame *frame)
 void
 meta_frame_borders_clear (MetaFrameBorders *self)
 {
-  self->visible.top = 0;
-  self->visible.bottom = 0;
-  self->visible.left = 0;
-  self->visible.right = 0;
+  self->visible.top = self->invisible.top = self->total.top = 0;
+  self->visible.bottom = self->invisible.bottom = self->total.bottom = 0;
+  self->visible.left = self->invisible.left = self->total.left = 0;
+  self->visible.right = self->invisible.right = self->total.right = 0;
 }
 
 void
diff --git a/src/include/common.h b/src/include/common.h
index fdd1df1..b0eac30 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -269,6 +269,11 @@ struct _MetaFrameBorders
    * and an outer portion that is invisible but responds to events.
    */
   GtkBorder visible;
+  GtkBorder invisible;
+
+  /* For convenience, we have a "total" border which is equal to the sum
+    * of the two borders above. */
+  GtkBorder total;
 };
 
 /* sets all dimensions to zero */
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 5e2296f..62d8596 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -409,7 +409,7 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
                                MetaFrameFlags         flags,
                                MetaFrameBorders      *borders)
 {
-  int buttons_height, title_height;
+  int buttons_height, title_height, draggable_borders;
 
   g_return_if_fail (layout != NULL);
 
@@ -435,6 +435,24 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
       meta_frame_borders_clear (borders);
       return;
     }
+
+  /* FIXME: ... */
+  /* draggable_borders = meta_prefs_get_draggable_border_width (); */
+  draggable_borders = 0;
+
+  borders->invisible.left = MAX (0, draggable_borders - borders->visible.left);
+  borders->invisible.right = MAX (0, draggable_borders - borders->visible.right);
+  borders->invisible.bottom = MAX (0, draggable_borders - borders->visible.bottom);
+
+  /* borders.visible is the height of the *title bar*. We can't do the same
+   * algorithm here, titlebars are expectedly much bigger. Just subtract a couple
+   * pixels to get a proper feel. */
+  borders->invisible.top = MAX (0, draggable_borders - 2);
+
+  borders->total.left = borders->invisible.left + borders->visible.left;
+  borders->total.right = borders->invisible.right + borders->visible.right;
+  borders->total.bottom = borders->invisible.bottom + borders->visible.bottom;
+  borders->total.top = borders->invisible.top + borders->visible.top;
 }
 
 static MetaButtonType


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