Commit 602307e6 authored by Jasper St. Pierre's avatar Jasper St. Pierre

Revert "pointer: Remove focus listener"

This reverts commit a8ac2cc2.
parent b2c18c4a
......@@ -63,6 +63,16 @@ meta_wayland_pointer_get_seat (MetaWaylandPointer *pointer)
return seat;
}
static void
lose_pointer_focus (struct wl_listener *listener, void *data)
{
MetaWaylandPointer *pointer =
wl_container_of (listener, pointer, focus_listener);
pointer->focus_resource = NULL;
pointer->focus = NULL;
}
static void
default_grab_focus (MetaWaylandPointerGrab *grab,
MetaWaylandSurface *surface,
......@@ -257,6 +267,7 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
memset (pointer, 0, sizeof *pointer);
wl_list_init (&pointer->resource_list);
pointer->focus_listener.notify = lose_pointer_focus;
pointer->default_grab.interface = &default_pointer_grab_interface;
pointer->default_grab.pointer = pointer;
pointer->grab = &pointer->default_grab;
......@@ -276,6 +287,10 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
void
meta_wayland_pointer_release (MetaWaylandPointer *pointer)
{
/* XXX: What about pointer->resource_list? */
if (pointer->focus_resource)
wl_list_remove (&pointer->focus_listener.link);
pointer->focus = NULL;
pointer->focus_resource = NULL;
}
......@@ -313,6 +328,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
struct wl_display *display = wl_client_get_display (client);
serial = wl_display_next_serial (display);
wl_pointer_send_leave (resource, serial, pointer->focus->resource);
wl_list_remove (&pointer->focus_listener.link);
}
resource = find_resource_for_surface (&pointer->resource_list, surface);
......@@ -345,6 +361,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
wl_fixed_to_int (pointer->x),
wl_fixed_to_int (pointer->y));
wl_pointer_send_enter (resource, serial, surface->resource, sx, sy);
wl_resource_add_destroy_listener (resource, &pointer->focus_listener);
pointer->focus_serial = serial;
}
......
......@@ -48,6 +48,7 @@ struct _MetaWaylandPointer
struct wl_list resource_list;
MetaWaylandSurface *focus;
struct wl_resource *focus_resource;
struct wl_listener focus_listener;
guint32 focus_serial;
guint32 click_serial;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment