compositor: Setup for keyboard grabs.
authorScott Moreau <oreaus@gmail.com>
Sat, 18 Feb 2012 12:05:30 +0000 (05:05 -0700)
committerKristian Høgsberg <krh@bitplanet.net>
Sun, 19 Feb 2012 23:57:34 +0000 (18:57 -0500)
src/compositor.c

index e762283..45a52d4 100644 (file)
@@ -1436,10 +1436,13 @@ notify_key(struct wl_input_device *device,
        struct weston_compositor *compositor = wd->compositor;
        uint32_t *k, *end;
 
-       if (state)
+       if (state) {
                weston_compositor_idle_inhibit(compositor);
-       else
+               device->grab_key = key;
+               device->grab_time = time;
+       } else {
                weston_compositor_idle_release(compositor);
+       }
 
        weston_compositor_run_binding(compositor, wd, time, key, 0, state);
 
@@ -1455,9 +1458,8 @@ notify_key(struct wl_input_device *device,
                *k = key;
        }
 
-       if (device->keyboard_focus_resource)
-               wl_resource_post_event(device->keyboard_focus_resource,
-                                      WL_INPUT_DEVICE_KEY, time, key, state);
+       device->keyboard_grab->interface->key(device->keyboard_grab,
+                                             time, key, state);
 }
 
 WL_EXPORT void