summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2011-02-01 20:28:32 -0500
committerKristian Høgsberg <krh@bitplanet.net>2011-02-01 20:28:32 -0500
commit181f52ea96afed2ebeaf8dc9c1fb793b7064f39e (patch)
treec3ec8aa6f905f743848bcc1f8952611f179daba9
parent5a2218aa15fa3be7d7e9e97ee9787923c3b61265 (diff)
Update compositor initiated resize to use a 3x3 grid
This lets us do all combinations of resize edges.
-rw-r--r--compositor/compositor.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/compositor/compositor.c b/compositor/compositor.c
index 365344a..b8591bf 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -773,6 +773,7 @@ notify_button(struct wl_input_device *device,
surface = (struct wlsc_surface *) device->pointer_focus;
uint32_t edges = 0;
+ int32_t x, y;
if (state && surface && device->grab == NULL) {
wlsc_surface_raise(surface);
@@ -797,13 +798,20 @@ notify_button(struct wl_input_device *device,
else if (state && surface && button == BTN_MIDDLE &&
(wd->modifier_state & MODIFIER_SUPER)) {
- if ((device->grab_x - surface->x) < surface->width / 2)
+ x = device->grab_x - surface->x;
+ y = device->grab_y - surface->y;
+
+ if (x < surface->width / 3)
edges |= WL_SHELL_RESIZE_LEFT;
+ else if (x < 2 * surface->width / 3)
+ edges |= 0;
else
edges |= WL_SHELL_RESIZE_RIGHT;
- if ((device->grab_y - surface->y) < surface->height / 2)
+ if (y < surface->height / 3)
edges |= WL_SHELL_RESIZE_TOP;
+ else if (y < 2 * surface->height / 3)
+ edges |= 0;
else
edges |= WL_SHELL_RESIZE_BOTTOM;