[PATCH xserver] xwayland: Do not assume we have a seat
Peter Hutterer
peter.hutterer at who-t.net
Wed Mar 1 04:17:38 UTC 2017
On Tue, Feb 28, 2017 at 03:46:55AM -0500, Olivier Fourdan wrote:
> Hi Peter,
>
> > what device is this called for? quick skim of the xwayland sources indicates
> > that a device is only created if we have a seat, so I wonder if the repeat is
> > called for the wrong device here?
>
> The keyboard_check_repeat() handler is called directly from AccessXRepeatKeyExpire() [1].
>
> It's set in init_keyboard() [2] on the seat's keyboard and on the master keyboard as well.
>
> IIRC that was needed otherwise the keyboard_check_repeat() would not avoid
> spurious key repeats in all cases when the compositor becomes "busy".
>
> The device that causes the issue is the virtual core keyboard:
ok, but in that case we have another bug:
* init_keyboard() is called from seat_handle_capabilities()
* seat_handle_capabilities() is part of the seat listener, which rather
* strongly implies we have a seat :)
But the function pointer is set up for the master device. So from what I can
tell, this situation can only happen if we had a seat and don't have one
anymore, and the event is generated elsewhere (i.e. not through the input
device). Is this what's happening here? because if so, that suggests that
the cleanup isn't quite correct, or that the initialization isn't correct
because this shouldn't depend on whether we had a seat in the past.
I'm assuming we need keyboard_check_repeat() even if we don't have a seat,
so this suggests moving it to the right init place. Replacing it with a
ddx-specific stub that is assigned during InitKeyboardDeviceStructInternal()
seems like the correct solution.
We'll still need this patch, but only this patch alone would just paper over
the real issue.
Cheers,
Peter
>
> (gdb) bt
> #0 keyboard_check_repeat (dev=0x3092040, xkbi=0x30932b0, key=111)
> at xwayland-input.c:751
> #1 0x00000000005245e7 in AccessXRepeatKeyExpire (
> timer=<optimized out>, now=<optimized out>, arg=0x3092040)
> at xkbAccessX.c:321
> #2 0x000000000058aa40 in DoTimer (timer=0x35fc3c0,
> now=now at entry=68761551) at WaitFor.c:294
> #3 0x000000000058aab8 in DoTimers (now=68761551) at WaitFor.c:308
> #4 0x000000000058adf7 in check_timers () at WaitFor.c:151
> #5 WaitForSomething (are_ready=<optimized out>) at WaitFor.c:217
> #6 0x000000000055660a in Dispatch () at dispatch.c:422
> #7 0x000000000055a858 in dix_main (argc=10, argv=0x7fffc3408528,
> envp=<optimized out>) at main.c:287
> #8 0x00007fda223c7401 in __libc_start_main (main=0x423d80 <main>,
> argc=10, argv=0x7fffc3408528, init=<optimized out>,
> fini=<optimized out>, rtld_fini=<optimized out>,
> stack_end=0x7fffc3408518) at ../csu/libc-start.c:289
> #9 0x0000000000423dba in _start ()
>
> (gdb) p *dev
> $2 = {public = {devicePrivate = 0x0,
> processInputProc = 0x52c870 <ProcessKeyboardEvent>,
> realInputProc = 0x52c870 <ProcessKeyboardEvent>,
> enqueueInputProc = 0x55fa10 <EnqueueEvent>, on = 0},
> next = 0x309fff0, startup = 1,
> deviceProc = 0x54a820 <CoreKeyboardProc>, inited = 1, enabled = 1,
> coreEvents = 1, deviceGrab = {grabTime = {months = 0,
> milliseconds = 86921}, fromPassiveGrab = 0, implicitGrab = 0,
> unused = 0x0, grab = 0x0, activatingKey = 0 '\000',
> ActivateGrab = 0x566bd0 <ActivateKeyboardGrab>,
> DeactivateGrab = 0x566f90 <DeactivateKeyboardGrab>, sync = {
> frozen = 0, state = 0, other = 0x0, event = 0x3092400}},
> type = 2, xinput_type = 0,
> name = 0x30926a0 "Virtual core keyboard", id = 3, key = 0x30931c0,
> valuator = 0x0, touch = 0x0, button = 0x0, focus = 0x309f380,
> proximity = 0x0, kbdfeed = 0x3093240, ptrfeed = 0x0, intfeed = 0x0,
> stringfeed = 0x0, bell = 0x0, leds = 0x0, xkb_interest = 0x3714540,
> config_info = 0x0, unused_classes = 0x30926c0, saved_master_id = 0,
> devPrivates = 0x30923d0, unwrapProc = 0x52ae60 <xkbUnwrapProc>,
> spriteInfo = 0x3092398, master = 0x0, lastSlave = 0x30a0650,
> last = {valuators = {0 <repeats 36 times>}, numValuators = 0,
> slave = 0x30a0650, scroll = 0x0, num_touches = 0, touches = 0x0},
> properties = {properties = 0x3092610, handlers = 0x3092670},
> relative_transform = {m = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}},
> scale_and_transform = {m = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}},
> xtest_master_id = 0, idle_counter = 0x309f5d0}
>
> Cheers,
> Olivier
>
>
> [1] https://cgit.freedesktop.org/xorg/xserver/tree/xkb/xkbAccessX.c#n312
> [2] https://cgit.freedesktop.org/xorg/xserver/tree/hw/xwayland/xwayland-input.c#n1021
More information about the xorg-devel
mailing list