wayland: Only process enter and leave events Clutter created surfaces

When combining with GTK we will receive enter and leave events for surfaces
from both toolkits therefore we must filter our events appropriately.
This commit is contained in:
Rob Bradford 2013-08-04 15:38:40 +01:00
parent 66044b665f
commit 9808da7efe

View File

@ -356,6 +356,9 @@ clutter_wayland_handle_pointer_enter (void *data,
ClutterBackend *backend; ClutterBackend *backend;
ClutterBackendWayland *backend_wayland; ClutterBackendWayland *backend_wayland;
if (!CLUTTER_IS_STAGE_COGL (wl_surface_get_user_data (surface)))
return;
stage_cogl = wl_surface_get_user_data (surface); stage_cogl = wl_surface_get_user_data (surface);
device->pointer_focus = stage_cogl; device->pointer_focus = stage_cogl;
@ -407,6 +410,9 @@ clutter_wayland_handle_pointer_leave (void *data,
ClutterStageCogl *stage_cogl; ClutterStageCogl *stage_cogl;
ClutterEvent *event; ClutterEvent *event;
if (!CLUTTER_IS_STAGE_COGL (wl_surface_get_user_data (surface)))
return;
stage_cogl = wl_surface_get_user_data (surface); stage_cogl = wl_surface_get_user_data (surface);
g_assert (device->pointer_focus == stage_cogl); g_assert (device->pointer_focus == stage_cogl);
@ -434,6 +440,9 @@ clutter_wayland_handle_keyboard_enter (void *data,
ClutterInputDeviceWayland *device = data; ClutterInputDeviceWayland *device = data;
ClutterStageCogl *stage_cogl; ClutterStageCogl *stage_cogl;
if (!CLUTTER_IS_STAGE_COGL (wl_surface_get_user_data (surface)))
return;
stage_cogl = wl_surface_get_user_data (surface); stage_cogl = wl_surface_get_user_data (surface);
g_assert (device->keyboard_focus == NULL); g_assert (device->keyboard_focus == NULL);
device->keyboard_focus = stage_cogl; device->keyboard_focus = stage_cogl;
@ -452,6 +461,11 @@ clutter_wayland_handle_keyboard_leave (void *data,
ClutterInputDeviceWayland *device = data; ClutterInputDeviceWayland *device = data;
ClutterStageCogl *stage_cogl; ClutterStageCogl *stage_cogl;
if (!surface)
return;
if (!CLUTTER_IS_STAGE_COGL (wl_surface_get_user_data (surface)))
return;
stage_cogl = wl_surface_get_user_data (surface); stage_cogl = wl_surface_get_user_data (surface);
g_assert (device->keyboard_focus == stage_cogl); g_assert (device->keyboard_focus == stage_cogl);