wayland: skip pointer and keyboard events without a surface

Pointer and keyboard events can be received after the surface has been
destroyed, in which case the surface will be NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=693338
This commit is contained in:
Thomas Wood 2013-02-07 15:38:40 +00:00
parent 8568d66a73
commit bfd7137ffb

View File

@ -550,6 +550,9 @@ pointer_handle_enter (void *data,
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
if (!surface)
return;
_gdk_wayland_display_update_serial (wayland_display, serial);
device->pointer_focus = wl_surface_get_user_data(surface);
@ -589,6 +592,9 @@ pointer_handle_leave (void *data,
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
if (!surface)
return;
_gdk_wayland_display_update_serial (wayland_display, serial);
event = gdk_event_new (GDK_LEAVE_NOTIFY);
@ -777,6 +783,9 @@ keyboard_handle_enter (void *data,
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
if (!surface)
return;
_gdk_wayland_display_update_serial (wayland_display, serial);
device->keyboard_focus = wl_surface_get_user_data(surface);
@ -808,6 +817,9 @@ keyboard_handle_leave (void *data,
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
if (!surface)
return;
_gdk_wayland_display_update_serial (wayland_display, serial);
_gdk_wayland_window_remove_focus (device->keyboard_focus);