pointer/keyboard: Do a series of renames to our listener as well

This commit is contained in:
Jasper St. Pierre 2014-02-17 19:13:16 -05:00
parent 2e7a56a28f
commit 515dc08a97
4 changed files with 14 additions and 16 deletions

View File

@ -222,10 +222,9 @@ err_keymap_str:
} }
static void static void
lose_keyboard_focus (struct wl_listener *listener, void *data) keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
{ {
MetaWaylandKeyboard *keyboard = MetaWaylandKeyboard *keyboard = wl_container_of (listener, keyboard, focus_surface_listener);
wl_container_of (listener, keyboard, focus_listener);
keyboard->focus_resource = NULL; keyboard->focus_resource = NULL;
keyboard->focus = NULL; keyboard->focus = NULL;
@ -340,7 +339,7 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
wl_list_init (&keyboard->resource_list); wl_list_init (&keyboard->resource_list);
wl_array_init (&keyboard->keys); wl_array_init (&keyboard->keys);
keyboard->focus_listener.notify = lose_keyboard_focus; keyboard->focus_surface_listener.notify = keyboard_handle_focus_surface_destroy;
keyboard->default_grab.interface = &default_keyboard_grab_interface; keyboard->default_grab.interface = &default_keyboard_grab_interface;
keyboard->default_grab.keyboard = keyboard; keyboard->default_grab.keyboard = keyboard;
keyboard->grab = &keyboard->default_grab; keyboard->grab = &keyboard->default_grab;
@ -522,7 +521,7 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
struct wl_display *display = wl_client_get_display (client); struct wl_display *display = wl_client_get_display (client);
serial = wl_display_next_serial (display); serial = wl_display_next_serial (display);
wl_keyboard_send_leave (resource, serial, keyboard->focus->resource); wl_keyboard_send_leave (resource, serial, keyboard->focus->resource);
wl_list_remove (&keyboard->focus_listener.link); wl_list_remove (&keyboard->focus_surface_listener.link);
meta_wayland_surface_focused_unset (keyboard->focus); meta_wayland_surface_focused_unset (keyboard->focus);
} }
@ -557,7 +556,7 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
wl_keyboard_send_enter (resource, serial, surface->resource, wl_keyboard_send_enter (resource, serial, surface->resource,
&keyboard->keys); &keyboard->keys);
} }
wl_resource_add_destroy_listener (resource, &keyboard->focus_listener); wl_resource_add_destroy_listener (resource, &keyboard->focus_surface_listener);
keyboard->focus_serial = serial; keyboard->focus_serial = serial;
meta_wayland_surface_focused_set (surface); meta_wayland_surface_focused_set (surface);
@ -591,7 +590,7 @@ meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard)
/* XXX: What about keyboard->resource_list? */ /* XXX: What about keyboard->resource_list? */
if (keyboard->focus_resource) if (keyboard->focus_resource)
wl_list_remove (&keyboard->focus_listener.link); wl_list_remove (&keyboard->focus_surface_listener.link);
wl_array_release (&keyboard->keys); wl_array_release (&keyboard->keys);
} }

View File

@ -94,7 +94,7 @@ struct _MetaWaylandKeyboard
struct wl_list resource_list; struct wl_list resource_list;
MetaWaylandSurface *focus; MetaWaylandSurface *focus;
struct wl_resource *focus_resource; struct wl_resource *focus_resource;
struct wl_listener focus_listener; struct wl_listener focus_surface_listener;
uint32_t focus_serial; uint32_t focus_serial;
MetaWaylandKeyboardGrab *grab; MetaWaylandKeyboardGrab *grab;

View File

@ -64,10 +64,9 @@ meta_wayland_pointer_get_seat (MetaWaylandPointer *pointer)
} }
static void static void
lose_pointer_focus (struct wl_listener *listener, void *data) pointer_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
{ {
MetaWaylandPointer *pointer = MetaWaylandPointer *pointer = wl_container_of (listener, pointer, focus_surface_listener);
wl_container_of (listener, pointer, focus_listener);
pointer->focus_resource = NULL; pointer->focus_resource = NULL;
pointer->focus = NULL; pointer->focus = NULL;
@ -267,7 +266,7 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
memset (pointer, 0, sizeof *pointer); memset (pointer, 0, sizeof *pointer);
wl_list_init (&pointer->resource_list); wl_list_init (&pointer->resource_list);
pointer->focus_listener.notify = lose_pointer_focus; pointer->focus_surface_listener.notify = pointer_handle_focus_surface_destroy;
pointer->default_grab.interface = &default_pointer_grab_interface; pointer->default_grab.interface = &default_pointer_grab_interface;
pointer->default_grab.pointer = pointer; pointer->default_grab.pointer = pointer;
pointer->grab = &pointer->default_grab; pointer->grab = &pointer->default_grab;
@ -289,7 +288,7 @@ meta_wayland_pointer_release (MetaWaylandPointer *pointer)
{ {
/* XXX: What about pointer->resource_list? */ /* XXX: What about pointer->resource_list? */
if (pointer->focus_resource) if (pointer->focus_resource)
wl_list_remove (&pointer->focus_listener.link); wl_list_remove (&pointer->focus_surface_listener.link);
pointer->focus = NULL; pointer->focus = NULL;
pointer->focus_resource = NULL; pointer->focus_resource = NULL;
@ -332,7 +331,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
wl_pointer_send_leave (resource, serial, pointer->focus->resource); wl_pointer_send_leave (resource, serial, pointer->focus->resource);
} }
wl_list_remove (&pointer->focus_listener.link); wl_list_remove (&pointer->focus_surface_listener.link);
} }
resource = find_resource_for_surface (&pointer->resource_list, surface); resource = find_resource_for_surface (&pointer->resource_list, surface);
@ -365,7 +364,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
wl_fixed_to_int (pointer->x), wl_fixed_to_int (pointer->x),
wl_fixed_to_int (pointer->y)); wl_fixed_to_int (pointer->y));
wl_pointer_send_enter (resource, serial, surface->resource, sx, sy); wl_pointer_send_enter (resource, serial, surface->resource, sx, sy);
wl_resource_add_destroy_listener (resource, &pointer->focus_listener); wl_resource_add_destroy_listener (resource, &pointer->focus_surface_listener);
pointer->focus_serial = serial; pointer->focus_serial = serial;
} }

View File

@ -48,7 +48,7 @@ struct _MetaWaylandPointer
struct wl_list resource_list; struct wl_list resource_list;
MetaWaylandSurface *focus; MetaWaylandSurface *focus;
struct wl_resource *focus_resource; struct wl_resource *focus_resource;
struct wl_listener focus_listener; struct wl_listener focus_surface_listener;
guint32 focus_serial; guint32 focus_serial;
guint32 click_serial; guint32 click_serial;