-
Notifications
You must be signed in to change notification settings - Fork 341
tinywl: fix crash if there is no keyboard #3152
base: master
Are you sure you want to change the base?
Conversation
Do we need to give keyboard focus and activate the toplevel in any particular order? Do clients care about it? |
I don't think it matters: <entry name="activated" value="4" summary="the surface is now activated">
<description summary="the surface is now activated">
Client window decorations should be painted as if the window is
active. Do not assume this means that the window actually has
keyboard or pointer focus.
</description>
</entry> |
Though I guess it would make more sense to do absolutely nothing in this function if there is no keyboard. |
Hm, but the user could still want to focus a toplevel with the pointer, even if there is no keyboard? |
Yeah, that better matches what sway and river at least actually do as well. Reverted the latest force push. |
To reproduce, run WLR_BACKENDS=headles tinywl -s foot
Now we still send the enter even if there is no actual keyboard, but with no keys or modifiers pressed. |
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat); | ||
if (keyboard != NULL) { | ||
wlr_seat_keyboard_notify_enter(seat, view->xdg_surface->surface, | ||
keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers); | ||
} else { | ||
wlr_seat_keyboard_notify_enter(seat, surface, NULL, 0, NULL); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kinda makes me wonder why wlroots makes compositors do this check themselves, instead wlr_seat_keyboard_notify_enter()
could just take a possibly NULL pointer to a wlr_keyboard
. Or even just call wlr_seat_get_keyboard()
itself internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, yes, that's a good point. At some point we wanted to get rid of wlr_seat_set_keyboard
and de-couple wlr_keyboard
from wlr_seat
(just like wlr_cursor
/wlr_pointer
is decoupled from wlr_seat
), but stopped halfway through. Ref #803
wlr_seat_keyboard_notify_enter(seat, view->xdg_surface->surface, | ||
keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers); | ||
} else { | ||
wlr_seat_keyboard_notify_enter(seat, surface, NULL, 0, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I wonder if it really makes sense to do this…?
Sway may do it because of data device related things (copy/paste relies on keyboard focus).
wlroots has migrated to gitlab.freedesktop.org. This pull request has been moved to: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3152 |
To reproduce, run
WLR_BACKENDS=headles tinywl -s foot