From 6dfdc6d6ec8ab917c5959986d216310e059db6f9 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 30 Sep 2014 17:14:07 +0200 Subject: [PATCH] wayland: Add emit_crossing argument to meta_wayland_pointer_set_focus() This is TRUE in every place it was previously called. https://bugzilla.gnome.org/show_bug.cgi?id=728030 --- src/wayland/meta-wayland-data-device.c | 2 +- src/wayland/meta-wayland-pointer.c | 24 ++++++++++++++---------- src/wayland/meta-wayland-pointer.h | 3 ++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index 877eacedd..76fcb138a 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -483,7 +483,7 @@ data_device_start_drag (struct wl_client *client, &drag_grab->drag_icon_listener); } - meta_wayland_pointer_set_focus (&seat->pointer, NULL); + meta_wayland_pointer_set_focus (&seat->pointer, NULL, TRUE); meta_wayland_pointer_start_grab (&seat->pointer, (MetaWaylandPointerGrab*)drag_grab); drag_grab_update_dnd_surface_position (drag_grab); drag_grab_update_dnd_surface (drag_grab); diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index 3fc05ecb7..93a1e6c42 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -95,7 +95,7 @@ pointer_handle_focus_surface_destroy (struct wl_listener *listener, void *data) { MetaWaylandPointer *pointer = wl_container_of (listener, pointer, focus_surface_listener); - meta_wayland_pointer_set_focus (pointer, NULL); + meta_wayland_pointer_set_focus (pointer, NULL, TRUE); } static void @@ -107,7 +107,7 @@ default_grab_focus (MetaWaylandPointerGrab *grab, if (pointer->button_count > 0) return; - meta_wayland_pointer_set_focus (pointer, surface); + meta_wayland_pointer_set_focus (pointer, surface, TRUE); } static void @@ -178,7 +178,7 @@ default_grab_button (MetaWaylandPointerGrab *grab, } if (pointer->button_count == 0 && event_type == CLUTTER_BUTTON_RELEASE) - meta_wayland_pointer_set_focus (pointer, pointer->current); + meta_wayland_pointer_set_focus (pointer, pointer->current, TRUE); } static const MetaWaylandPointerGrabInterface default_pointer_grab_interface = { @@ -218,7 +218,7 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer, void meta_wayland_pointer_release (MetaWaylandPointer *pointer) { - meta_wayland_pointer_set_focus (pointer, NULL); + meta_wayland_pointer_set_focus (pointer, NULL, TRUE); set_cursor_surface (pointer, NULL); pointer->display = NULL; @@ -480,7 +480,8 @@ broadcast_focus (MetaWaylandPointer *pointer, void meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer, - MetaWaylandSurface *surface) + MetaWaylandSurface *surface, + gboolean emit_crossing) { if (pointer->display == NULL) return; @@ -500,9 +501,12 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer, struct wl_display *display = wl_client_get_display (client); uint32_t serial = wl_display_next_serial (display); - wl_resource_for_each (resource, l) + if (emit_crossing) { - wl_pointer_send_leave (resource, serial, pointer->focus_surface->resource); + wl_resource_for_each (resource, l) + { + wl_pointer_send_leave (resource, serial, pointer->focus_surface->resource); + } } move_resources (&pointer->resource_list, &pointer->focus_resource_list); @@ -533,7 +537,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer, wl_resource_get_client (pointer->focus_surface->resource)); l = &pointer->focus_resource_list; - if (!wl_list_empty (l)) + if (emit_crossing && !wl_list_empty (l)) { struct wl_client *client = wl_resource_get_client (pointer->focus_surface->resource); struct wl_display *display = wl_client_get_display (client); @@ -595,9 +599,9 @@ popup_grab_focus (MetaWaylandPointerGrab *grab, /* Popup grabs are in owner-events mode (ie, events for the same client are reported as normal) */ if (surface && wl_resource_get_client (surface->resource) == popup_grab->grab_client) - meta_wayland_pointer_set_focus (grab->pointer, surface); + meta_wayland_pointer_set_focus (grab->pointer, surface, TRUE); else - meta_wayland_pointer_set_focus (grab->pointer, NULL); + meta_wayland_pointer_set_focus (grab->pointer, NULL, TRUE); } static void diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h index 6bd01a88d..914c2041c 100644 --- a/src/wayland/meta-wayland-pointer.h +++ b/src/wayland/meta-wayland-pointer.h @@ -86,7 +86,8 @@ gboolean meta_wayland_pointer_handle_event (MetaWaylandPointer *pointer, const ClutterEvent *event); void meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer, - MetaWaylandSurface *surface); + MetaWaylandSurface *surface, + gboolean emit_crossing); void meta_wayland_pointer_start_grab (MetaWaylandPointer *pointer, MetaWaylandPointerGrab *grab);