summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-12-10 17:03:54 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-12-10 17:03:54 +0800
commitdebc4933f8075dc134adaefba8d2f12b8314db17 (patch)
tree7b517bc2040789305189d0ad7857504588ad3eb8 /src
parent8721c49b5b74f53d46068f400a6b72e440a468d8 (diff)
downloadunity-window-decorator-debc4933f8075dc134adaefba8d2f12b8314db17.tar.gz
unity-window-decorator-debc4933f8075dc134adaefba8d2f12b8314db17.tar.bz2
Allow decoration to specify an invisible grab region for the frame (to handle small frame sizes)
Diffstat (limited to 'src')
-rw-r--r--src/metacity.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/metacity.c b/src/metacity.c
index b63f8c1..8e9e556 100644
--- a/src/metacity.c
+++ b/src/metacity.c
@@ -30,6 +30,8 @@ decor_update_meta_window_property (decor_t *d,
gint bottom_stretch_offset;
gint left_stretch_offset;
gint right_stretch_offset;
+ MetaFrameStyle *frame_style;
+ MetaInvisibleGrabAreaProperties *invisible_grab_area_properties;
w = d->border_layout.top.x2 - d->border_layout.top.x1 -
d->context->left_space - d->context->right_space;
@@ -62,6 +64,23 @@ decor_update_meta_window_property (decor_t *d,
extents = _win_extents;
max_extents = _max_win_extents;
+ /* Add the invisible grab area padding, but only for
+ * pixmap type decorations */
+ frame_style = meta_theme_get_frame_style (theme, META_FRAME_TYPE_NORMAL, flags);
+
+ if (!frame_style)
+ return;
+
+ invisible_grab_area_properties =
+ meta_frame_style_get_invisible_grab_area_properties (frame_style);
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ extents.left += invisible_grab_area_properties->left;
+ extents.right += invisible_grab_area_properties->right;
+ extents.bottom += invisible_grab_area_properties->bottom;
+ }
+
extents.top += titlebar_height;
max_extents.top += max_titlebar_height;
@@ -1197,6 +1216,8 @@ meta_get_event_window_position (decor_t *d,
MetaButtonLayout button_layout;
MetaFrameGeometry fgeom;
MetaFrameFlags flags;
+ MetaFrameStyle *frame_style;
+ MetaInvisibleGrabAreaProperties *invisible_grab_area_properties;
MetaTheme *theme;
GdkRectangle clip;
@@ -1205,6 +1226,14 @@ meta_get_event_window_position (decor_t *d,
meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
&clip);
+ frame_style = meta_theme_get_frame_style (theme, META_FRAME_TYPE_NORMAL, flags);
+
+ if (!frame_style)
+ return;
+
+ invisible_grab_area_properties =
+ meta_frame_style_get_invisible_grab_area_properties (frame_style);
+
width += fgeom.right_width + fgeom.left_width;
height += fgeom.top_height + fgeom.bottom_height;
@@ -1226,6 +1255,14 @@ meta_get_event_window_position (decor_t *d,
}
*w = fgeom.right_width + RESIZE_EXTENDS;
*h = fgeom.bottom_height + RESIZE_EXTENDS;
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *x += invisible_grab_area_properties->left;
+ *w += invisible_grab_area_properties->right;
+ *h += invisible_grab_area_properties->bottom;
+ }
+
break;
case 1: /* bottom */
*x = fgeom.left_width + RESIZE_EXTENDS;
@@ -1235,6 +1272,16 @@ meta_get_event_window_position (decor_t *d,
*w = width - fgeom.left_width - fgeom.right_width -
(2 * RESIZE_EXTENDS);
*h = fgeom.bottom_height;
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *x -= invisible_grab_area_properties->left;
+ *h += invisible_grab_area_properties->bottom;
+ *w += invisible_grab_area_properties->left +
+ invisible_grab_area_properties->right;
+ }
+
+
break;
case 0: /* bottom left */
default:
@@ -1247,6 +1294,13 @@ meta_get_event_window_position (decor_t *d,
}
*w = fgeom.left_width + RESIZE_EXTENDS;
*h = fgeom.bottom_height + RESIZE_EXTENDS;
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *w += invisible_grab_area_properties->left;
+ *h += invisible_grab_area_properties->bottom;
+ }
+
break;
}
break;
@@ -1259,12 +1313,25 @@ meta_get_event_window_position (decor_t *d,
*w = fgeom.right_width;
*h = height - fgeom.top_height - fgeom.bottom_height -
(2 * RESIZE_EXTENDS);
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *x += invisible_grab_area_properties->left;
+ *w += invisible_grab_area_properties->right;
+ *h += invisible_grab_area_properties->bottom;
+ }
+
break;
case 1: /* middle */
*x = fgeom.left_width;
*y = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
*w = width - fgeom.left_width - fgeom.right_width;
*h = height - fgeom.top_titlebar_edge - fgeom.bottom_height;
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *x += invisible_grab_area_properties->left;
+ }
break;
case 0: /* left */
default:
@@ -1275,6 +1342,13 @@ meta_get_event_window_position (decor_t *d,
*w = fgeom.left_width;
*h = height - fgeom.top_height - fgeom.bottom_height -
(2 * RESIZE_EXTENDS);
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *h += invisible_grab_area_properties->bottom;
+ *w += invisible_grab_area_properties->left;
+ }
+
break;
}
break;
@@ -1291,6 +1365,12 @@ meta_get_event_window_position (decor_t *d,
}
*w = fgeom.right_width + RESIZE_EXTENDS;
*h = fgeom.top_height + RESIZE_EXTENDS;
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *x += invisible_grab_area_properties->left;
+ *w += invisible_grab_area_properties->right;
+ }
break;
case 1: /* top */
*x = fgeom.left_width + RESIZE_EXTENDS;
@@ -1300,6 +1380,14 @@ meta_get_event_window_position (decor_t *d,
*w = width - fgeom.left_width - fgeom.right_width -
(2 * RESIZE_EXTENDS);
*h = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ {
+ *x -= invisible_grab_area_properties->left;
+ *w += invisible_grab_area_properties->right +
+ invisible_grab_area_properties->left;
+ }
+
break;
case 0: /* top left */
default:
@@ -1312,6 +1400,10 @@ meta_get_event_window_position (decor_t *d,
}
*w = fgeom.left_width + RESIZE_EXTENDS;
*h = fgeom.top_height + RESIZE_EXTENDS;
+
+ if (!d->frame_window && invisible_grab_area_properties)
+ *w += invisible_grab_area_properties->left;
+
break;
}
}