xwayland: Activate and enable device on first capability reporting
Commit 2172714c
changed behavior of capability handling, but it only
solved part of the problem. If Xwayland is launched without a capability
(e.g. no pointer device is connected when Xwayland was spinned up), and
later that capability comes, the device added will not be automatically
initialized. This patch initializes the device when the capability is
reported for the first time, thus avoiding the problem.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=81819
Signed-off-by: Boyan Ding <stu_dby@126.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
f1995de1c4
commit
1ba4fde101
|
@ -692,13 +692,13 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
|
||||||
wl_pointer_add_listener(xwl_seat->wl_pointer,
|
wl_pointer_add_listener(xwl_seat->wl_pointer,
|
||||||
&pointer_listener, xwl_seat);
|
&pointer_listener, xwl_seat);
|
||||||
|
|
||||||
if (xwl_seat->pointer)
|
if (xwl_seat->pointer == NULL) {
|
||||||
EnableDevice(xwl_seat->pointer, TRUE);
|
|
||||||
else {
|
|
||||||
xwl_seat_set_cursor(xwl_seat);
|
xwl_seat_set_cursor(xwl_seat);
|
||||||
xwl_seat->pointer =
|
xwl_seat->pointer =
|
||||||
add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc);
|
add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc);
|
||||||
|
ActivateDevice(xwl_seat->pointer, TRUE);
|
||||||
}
|
}
|
||||||
|
EnableDevice(xwl_seat->pointer, TRUE);
|
||||||
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->wl_pointer) {
|
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->wl_pointer) {
|
||||||
wl_pointer_release(xwl_seat->wl_pointer);
|
wl_pointer_release(xwl_seat->wl_pointer);
|
||||||
xwl_seat->wl_pointer = NULL;
|
xwl_seat->wl_pointer = NULL;
|
||||||
|
@ -712,12 +712,12 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
|
||||||
wl_keyboard_add_listener(xwl_seat->wl_keyboard,
|
wl_keyboard_add_listener(xwl_seat->wl_keyboard,
|
||||||
&keyboard_listener, xwl_seat);
|
&keyboard_listener, xwl_seat);
|
||||||
|
|
||||||
if (xwl_seat->keyboard)
|
if (xwl_seat->keyboard == NULL) {
|
||||||
EnableDevice(xwl_seat->keyboard, TRUE);
|
|
||||||
else {
|
|
||||||
xwl_seat->keyboard =
|
xwl_seat->keyboard =
|
||||||
add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc);
|
add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc);
|
||||||
|
ActivateDevice(xwl_seat->keyboard, TRUE);
|
||||||
}
|
}
|
||||||
|
EnableDevice(xwl_seat->keyboard, TRUE);
|
||||||
} else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->wl_keyboard) {
|
} else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->wl_keyboard) {
|
||||||
wl_keyboard_release(xwl_seat->wl_keyboard);
|
wl_keyboard_release(xwl_seat->wl_keyboard);
|
||||||
xwl_seat->wl_keyboard = NULL;
|
xwl_seat->wl_keyboard = NULL;
|
||||||
|
|
Loading…
Reference in New Issue