[mutter] MetaFrameBorders: Add invisible borders
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaFrameBorders: Add invisible borders
- Date: Wed, 10 Aug 2011 12:42:34 +0000 (UTC)
commit a1a2527c75ab0c135f89396ea036336fb67ac538
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
src/core/frame.c | 8 ++++----
src/meta/common.h | 5 +++++
src/ui/theme.c | 19 ++++++++++++++++++-
3 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index e42a13d..a203253 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -304,10 +304,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/meta/common.h b/src/meta/common.h
index a78516d..3f31267 100644
--- a/src/meta/common.h
+++ b/src/meta/common.h
@@ -310,6 +310,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 b878d92..bad8842 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -56,6 +56,7 @@
#include "theme-private.h"
#include <meta/util.h>
#include <meta/gradient.h>
+#include <meta/prefs.h>
#include <gtk/gtk.h>
#include <string.h>
#include <stdlib.h>
@@ -402,7 +403,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);
@@ -428,6 +429,22 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
meta_frame_borders_clear (borders);
return;
}
+
+ draggable_borders = meta_prefs_get_draggable_border_width ();
+
+ 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]