[PATCH weston 2/2] shell: Add resize-from-center binding

Scott Moreau oreaus at gmail.com
Mon Feb 11 03:45:40 PST 2013


Each binding is a specific key combination which means 'mod+button' is not the
same as 'mod|shift+button'. The new resize functionality detects shift button
state to toggle modes during the resize grab. However, attempting to initiate
a grab with mod|shift+button fails (when not clicking a grabbable edge) because
there is no key binding for this combination. Here we install a binding that
simply calls the resize function so resize can be initiated with either binding
combination.

---
 src/shell.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/shell.c b/src/shell.c
index a5fc83a..d4fd544 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2451,6 +2451,12 @@ resize_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data)
 }
 
 static void
+resize_from_center_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data)
+{
+	resize_binding(seat, time, button, data);
+}
+
+static void
 surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis,
 			wl_fixed_t value, void *data)
 {
@@ -3985,6 +3991,8 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
 					     shell);
 	weston_compositor_add_button_binding(ec, BTN_MIDDLE, mod,
 					     resize_binding, shell);
+	weston_compositor_add_button_binding(ec, BTN_MIDDLE, mod | MODIFIER_SHIFT,
+					     resize_from_center_binding, shell);
 	weston_compositor_add_button_binding(ec, BTN_RIGHT, mod,
 					     rotate_binding, NULL);
 	weston_compositor_add_key_binding(ec, KEY_TAB, mod, switcher_binding,
-- 
1.7.10.4



More information about the wayland-devel mailing list