[Wayland-bugs] [Bug 781285] Key repeat cancel under Wayland should depend on which key is repeating

gtk+ (GNOME Bugzilla) bugzilla at gnome.org
Wed May 3 18:56:24 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=781285

--- Comment #2 from Dan Torop <dant at pnym.net> ---
(In reply to Olivier Fourdan from comment #1)

Hi Olivier,

Glad to hear back! 

> That looks very similar to bug 781896 and attachment 350636

Indeed bug 781896 and this one both address the same underlying problem. 

> 
> Can you see if this works for you?

Mixed results: attachment 350636 does solve bug 781896, but it doesn't produce
expected behavior in the second case of this bug. To rewrite that case as in
your (clearer) steps in bug 781896:

Steps to reproduce:

1. Press key "a" and keep the key pressed.
2. Press key "b" and release.
3. Press key "b" and keep the key pressed.
4. Release key "a".

Actual result:

Key "a" is repeated. Once key "b" is pressed and released, all repeats stop.
Then key "b" is repeated when it is pressed again, but all repeat stops when
key "a" is released.

Expected result:

Once key "a" is released, key "b" should continue to repeat, as it is still
depressed and was one repeating.


The expected result may well be debatable, and is the proverbial corner case!
But I put it in to suggest that counting the number of keys pressed is not
actually pertinent. And this counting is easy to fool. So in the case above, in
your patch, I believe that this is happening:

1. Press key "a" and keep the key pressed [nkeys = 1]
2. Press key "b" [nkeys = 2] and release [nkeys = 0, as have released the
repeated key]
3. Press key "b" and keep the key pressed [nkeys = 1]
4. Release key "a". [nkeys = 0, and hence repeating stops, though "b" is still
pressed and was repeating]

I'd argue that what really matters here isn't the count of keys pressed, but
rather whether the key released is the currently repeated key. Hence my
attachment 349836 entirely eliminates the nkeys counter, and just uses a flag
(repeat_active).

As an aside, in your patch, you init repeat_key to 0. In my patch, I didn't
initialize repeat_key, but do test it, assuming that, as it was only tested
after a key release, it would by then have already been set by a keypress. Your
approach is certainly safer!

This bug report came from a problem with darktable to under Wayland
(https://redmine.darktable.org/issues/11535#note-14), and both your attachment
350636 and my attachment 349836 solve that problem. I don't have the big
picture of Wayland devices which you have, and would hate to blithely advocate
removal of nkeys, but do want to put it out there for consideration!

Thank you,
Dan

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-bugs/attachments/20170503/8ef2ffd4/attachment.html>


More information about the wayland-bugs mailing list