mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-21 06:59:46 -05:00
Fix double remove from surface destroy_listener_list
We remove the listener when a device loses its pointer focus, but doesn't insert it in another destroy_listener list if surface is NULL. When we set another pointer focus surface, we remove it again. Tracked down and tested by Iskren Chernev.
This commit is contained in:
parent
5acf6b4b03
commit
6d22c1bdc7
1 changed files with 13 additions and 11 deletions
|
|
@ -360,19 +360,21 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device,
|
|||
&device->object,
|
||||
WL_INPUT_DEVICE_POINTER_FOCUS,
|
||||
time, NULL, 0, 0, 0, 0);
|
||||
if (surface)
|
||||
if (device->pointer_focus)
|
||||
wl_list_remove(&device->pointer_focus_listener.link);
|
||||
|
||||
if (surface) {
|
||||
wl_client_post_event(surface->client,
|
||||
&device->object,
|
||||
WL_INPUT_DEVICE_POINTER_FOCUS,
|
||||
time, surface, x, y, sx, sy);
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
&device->pointer_focus_listener.link);
|
||||
}
|
||||
|
||||
device->pointer_focus = surface;
|
||||
device->pointer_focus_time = time;
|
||||
|
||||
wl_list_remove(&device->pointer_focus_listener.link);
|
||||
if (surface)
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
&device->pointer_focus_listener.link);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
|
|
@ -389,20 +391,20 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device,
|
|||
&device->object,
|
||||
WL_INPUT_DEVICE_KEYBOARD_FOCUS,
|
||||
time, NULL, &device->keys);
|
||||
if (device->keyboard_focus)
|
||||
wl_list_remove(&device->keyboard_focus_listener.link);
|
||||
|
||||
if (surface)
|
||||
if (surface) {
|
||||
wl_client_post_event(surface->client,
|
||||
&device->object,
|
||||
WL_INPUT_DEVICE_KEYBOARD_FOCUS,
|
||||
time, surface, &device->keys);
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
&device->keyboard_focus_listener.link);
|
||||
}
|
||||
|
||||
device->keyboard_focus = surface;
|
||||
device->keyboard_focus_time = time;
|
||||
|
||||
wl_list_remove(&device->keyboard_focus_listener.link);
|
||||
if (surface)
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
&device->keyboard_focus_listener.link);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue