[clutter/clutter-1.16] wayland: Check there is valid pointer or keyboard focus for events



commit 66044b665f9fee364c112e0611200c23e604992f
Author: Rob Bradford <rob linux intel com>
Date:   Sun Aug 4 15:33:30 2013 +0100

    wayland: Check there is valid pointer or keyboard focus for events

 clutter/wayland/clutter-input-device-wayland.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/clutter/wayland/clutter-input-device-wayland.c b/clutter/wayland/clutter-input-device-wayland.c
index 9e91eae..25b611c 100644
--- a/clutter/wayland/clutter-input-device-wayland.c
+++ b/clutter/wayland/clutter-input-device-wayland.c
@@ -74,9 +74,14 @@ clutter_wayland_handle_motion (void *data,
                                wl_fixed_t x, wl_fixed_t y)
 {
   ClutterInputDeviceWayland *device = data;
-  ClutterStageCogl          *stage_cogl = device->pointer_focus;
+  ClutterStageCogl          *stage_cogl;
   ClutterEvent              *event;
 
+  if (!device->pointer_focus)
+    return;
+
+  stage_cogl = device->pointer_focus;
+
   event = clutter_event_new (CLUTTER_MOTION);
   event->motion.stage = stage_cogl->wrapper;
   event->motion.device = CLUTTER_INPUT_DEVICE (device);
@@ -98,10 +103,15 @@ clutter_wayland_handle_button (void *data,
                                uint32_t button, uint32_t state)
 {
   ClutterInputDeviceWayland *device = data;
-  ClutterStageCogl          *stage_cogl = device->pointer_focus;
+  ClutterStageCogl          *stage_cogl;
   ClutterEvent              *event;
   ClutterEventType           type;
 
+  if (!device->pointer_focus)
+    return;
+
+  stage_cogl = device->pointer_focus;
+
   if (state)
     type = CLUTTER_BUTTON_PRESS;
   else
@@ -140,10 +150,14 @@ clutter_wayland_handle_axis (void *data,
                              wl_fixed_t value)
 {
   ClutterInputDeviceWayland *device = data;
-  ClutterStageCogl          *stage_cogl = device->pointer_focus;
+  ClutterStageCogl          *stage_cogl;
   ClutterEvent              *event;
   gdouble                    delta_x, delta_y;
 
+  if (!device->pointer_focus)
+    return;
+
+  stage_cogl = device->pointer_focus;
   event = clutter_event_new (CLUTTER_SCROLL);
   event->scroll.time = _clutter_wayland_get_time();
   event->scroll.stage = stage_cogl->wrapper;
@@ -272,6 +286,8 @@ clutter_wayland_handle_key (void *data,
   ClutterStageCogl          *stage_cogl = device->keyboard_focus;
   ClutterEvent              *event;
 
+  if (!device->keyboard_focus)
+    return;
   if (!device->xkb)
     return;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]