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
This commit is contained in:
Jasper St. Pierre 2011-07-12 00:55:50 -04:00
parent 6f5882302f
commit a1a2527c75
3 changed files with 27 additions and 5 deletions

View File

@ -304,10 +304,10 @@ meta_frame_get_flags (MetaFrame *frame)
void void
meta_frame_borders_clear (MetaFrameBorders *self) meta_frame_borders_clear (MetaFrameBorders *self)
{ {
self->visible.top = 0; self->visible.top = self->invisible.top = self->total.top = 0;
self->visible.bottom = 0; self->visible.bottom = self->invisible.bottom = self->total.bottom = 0;
self->visible.left = 0; self->visible.left = self->invisible.left = self->total.left = 0;
self->visible.right = 0; self->visible.right = self->invisible.right = self->total.right = 0;
} }
void void

View File

@ -310,6 +310,11 @@ struct _MetaFrameBorders
* and an outer portion that is invisible but responds to events. * and an outer portion that is invisible but responds to events.
*/ */
GtkBorder visible; 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 */ /* sets all dimensions to zero */

View File

@ -56,6 +56,7 @@
#include "theme-private.h" #include "theme-private.h"
#include <meta/util.h> #include <meta/util.h>
#include <meta/gradient.h> #include <meta/gradient.h>
#include <meta/prefs.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -402,7 +403,7 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
MetaFrameFlags flags, MetaFrameFlags flags,
MetaFrameBorders *borders) MetaFrameBorders *borders)
{ {
int buttons_height, title_height; int buttons_height, title_height, draggable_borders;
g_return_if_fail (layout != NULL); g_return_if_fail (layout != NULL);
@ -428,6 +429,22 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
meta_frame_borders_clear (borders); meta_frame_borders_clear (borders);
return; 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 static MetaButtonType