[PATCH 2/2] Only trigger key bindings if no other key is pressed.

Scott Moreau oreaus at gmail.com
Sat Mar 3 07:48:30 PST 2012


---
 src/util.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/util.c b/src/util.c
index 3ca940f..491516e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -240,8 +240,18 @@ weston_compositor_run_binding(struct weston_compositor *compositor,
 	wl_list_for_each(b, &compositor->binding_list, link) {
 		if (b->key == key && b->button == button &&
 		    b->modifier == device->modifier_state && state) {
-			b->handler(&device->input_device,
-				   time, key, button, state, b->data);
+			if (key != 0) {
+				/* Activate binding only if all keys
+				 * are up except the trigger key */
+				if (device->input_device.keys.size == 4) {
+					b->handler(&device->input_device,
+						   time, key, button, state, b->data);
+				}
+			}
+			else {
+				b->handler(&device->input_device,
+					   time, key, button, state, b->data);
+			}
 			break;
 		}
 	}
-- 
1.7.4.1



More information about the wayland-devel mailing list