mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-03 09:01:42 -05:00
Always reset keyboard and pointer focus
If wl_pointer_set_focus or wl_keyboard_set_focus have been called before a listener has been established for that seat and client combination, the focus window will be set but the focus resource will be NULL. This changes these functions to always attempt to search for the relevant focus resource, allowing the resource to be set by calling wl_keyboard_set_focus and wl_pointer_set_focus again when a listener has been established. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
32add9c6e6
commit
f7a39ff69b
1 changed files with 8 additions and 10 deletions
|
|
@ -704,11 +704,8 @@ wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface,
|
|||
struct wl_resource *resource;
|
||||
uint32_t serial;
|
||||
|
||||
if (pointer->focus == surface)
|
||||
return;
|
||||
|
||||
resource = pointer->focus_resource;
|
||||
if (resource) {
|
||||
if (resource && pointer->focus != surface) {
|
||||
serial = wl_display_next_serial(resource->client->display);
|
||||
wl_pointer_send_leave(resource, serial,
|
||||
&pointer->focus->resource);
|
||||
|
|
@ -717,7 +714,9 @@ wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface,
|
|||
|
||||
resource = find_resource_for_surface(&pointer->resource_list,
|
||||
surface);
|
||||
if (resource) {
|
||||
if (resource &&
|
||||
(pointer->focus != surface ||
|
||||
pointer->focus_resource != resource)) {
|
||||
serial = wl_display_next_serial(resource->client->display);
|
||||
wl_pointer_send_enter(resource, serial, &surface->resource,
|
||||
sx, sy);
|
||||
|
|
@ -737,10 +736,7 @@ wl_keyboard_set_focus(struct wl_keyboard *keyboard, struct wl_surface *surface)
|
|||
struct wl_resource *resource;
|
||||
uint32_t serial;
|
||||
|
||||
if (keyboard->focus == surface)
|
||||
return;
|
||||
|
||||
if (keyboard->focus_resource) {
|
||||
if (keyboard->focus_resource && keyboard->focus != surface) {
|
||||
resource = keyboard->focus_resource;
|
||||
serial = wl_display_next_serial(resource->client->display);
|
||||
wl_keyboard_send_leave(resource, serial,
|
||||
|
|
@ -750,7 +746,9 @@ wl_keyboard_set_focus(struct wl_keyboard *keyboard, struct wl_surface *surface)
|
|||
|
||||
resource = find_resource_for_surface(&keyboard->resource_list,
|
||||
surface);
|
||||
if (resource) {
|
||||
if (resource &&
|
||||
(keyboard->focus != surface ||
|
||||
keyboard->focus_resource != resource)) {
|
||||
serial = wl_display_next_serial(resource->client->display);
|
||||
wl_keyboard_send_enter(resource, serial, &surface->resource,
|
||||
&keyboard->keys);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue