I was just trying to play a racing game remotely. It uses the Up arrow key to accelerate and the LEFT and RIGHT arrow key to turn the car. When i push the UP arrow key to accelerate and then use LEFT or RIGHT while keeping UP pushed, the car slows down.
A quick tool i found to test out is xkeycaps, it shows a keyboard and lights up the keys pressed, you can check by yourself that pushing two keys at once wont work with xpra.
Forgot to set the version, sorry. I'm using 0.14.3 by winswitch.
Confirmed.
Here's what I'm seeing with -d keyboard
:
parse_key_event(<gtk.gdk.Event at 0x33635f8: GDK_KEY_PRESS keyval=Up>, True)= <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Up', 'pressed': True, 'keyval': 65362, 'keycode': 111}> handle_key_action(ClientWindow(1), <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Up', 'pressed': True, 'keyval': 65362, 'keycode': 111}>) wid=1 send_key_action(1, <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Up', 'pressed': True, 'keyval': 65362, 'keycode': 111}>) parse_key_event(<gtk.gdk.Event at 0x3363508: GDK_KEY_PRESS keyval=Left>, True)= <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Left', 'pressed': True, 'keyval': 65361, 'keycode': 113}> handle_key_action(ClientWindow(1), <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Left', 'pressed': True, 'keyval': 65361, 'keycode': 113}>) wid=1 send_key_action(1, <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Left', 'pressed': True, 'keyval': 65361, 'keycode': 113}>) parse_key_event(<gtk.gdk.Event at 0x33635d0: GDK_KEY_PRESS keyval=Left>, True)= <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Left', 'pressed': True, 'keyval': 65361, 'keycode': 113}> handle_key_action(ClientWindow(1), <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Left', 'pressed': True, 'keyval': 65361, 'keycode': 113}>) wid=1 send_key_action(1, <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'group': 0, 'string': '', 'keyname': 'Left', 'pressed': True, 'keyval': 65361, 'keycode': 113}>)
etc..
So we stop getting the repeat key event for Up
as soon as we get the Left
key press.
handle keycode pressing 111: key Up fake_key(111, True) scheduling key repeat timer with delay 660 for Up / 111 get_keycode(113, Left, ('mod2',)) native keymap, using unmodified keycode: 113 handle_key(1,True,Left,65361,113,('mod2',)) keyboard_sync=True is_modifier(113) not found handle keycode pressing 113: key Left fake_key(113, True) scheduling key repeat timer with delay 660 for Left / 113 key repeat timeout for Up / '111' - clearing it, now=1409831009.26, scheduled at 1409831008.6 with delay=660 handle_key(1,False,Up,65362,111,('mod2',)) keyboard_sync=True is_modifier(111) not found handle keycode unpressing 111: key Up
And so the server is expecting the repeat event for all the pressed keys, doesn't receive it and so it unpresses the key...
What makes this much more difficult to fix is that it behaves differently on win32 (haven't tried OSX yet): we're still missing the other key, but we get both a key up and a key down on win32...
This is the minimal fix:
--- src/xpra/server/server_base.py (revision 7502) +++ src/xpra/server/server_base.py (working copy) @@ -1535,6 +1535,11 @@ self.fake_key(keycode, False) is_mod = self.is_modifier(name, keycode) if pressed: + #cancel all repeat timers: + for timer in self.keys_repeat_timers.values(): + self.source_remove(timer) + self.keys_repeat_timers = {} + if keycode not in self.keys_pressed: press() if not self.keyboard_sync and not is_mod:
But I'm not sure if this is what I'll merge yet.
Better fix in r7512 + r7513, we may backport this to the 0.14.x branch but since this bug has been present for a very long time, let's not rush this.
@kokoko3k: does that fix things for you?
@afarr: can you confirm that we can now press multiple (non modifier) keys concurrently (xkeycaps
is good for testing this), and that it doesn't break anything. In particular, I am worried that if multiple keys are pressed, one may get stuck if we somehow miss the key-release event (not sure how that would happen, but maybe alt-tabbing away or clicking away then releasing the key whilst xpra does not have keyboard focus).
It seems fixed to me, thank you very much for looking into this and for the fast fix!
However often during playing it seems that the keys are sent with a delay of 1..2 seconds, wvwn if the game stays smooth. I don't know if this issue is related to the fix.
Would you like -d keyboard
logs for both?
Replying to kokoko3k:
However often during playing it seems that the keys are sent with a delay of 1..2 seconds
That's a different issue, and one I am not seeing this time.
Do you see the key events on the client with -d keyboard
?
If so, they should be forwarded to the server instantly (bar network latency)
Replying to afarr:
I'm not seeing any keys light up
OK, taking the ticket back, I'll test more on osx next week.
but the original two keys likewise remain lit (on windows)
This one sounded like a bug, but then I tried it without xpra and got the same behaviour.
Overall, it looks OK for backports I think.
Backport of r7512 + r7513 was in r7527.
It seems to work well enough for win32 and x11, and I don't see an easy way to coerce OSX into not acting stoopid. (not for the first time, see #708 for example)
So I am closing this ticket, feel free to re-open.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/668