Ticket #97 (closed usability: fixed)

Opened 5 years ago

Last modified 3 years ago

Modifier state not reset when X11 regains focus

Reported by: hanche@… Owned by: jeremyhu@…
Priority: Important Milestone: 2.3.1
Component: xserver Version: dev (xorg-server-1.4-apple)
Keywords: Cc:

Description

Observed (only?) in Xquartz-1.4.0-apple5: Xquartz remembers modifier state when regaining focus.

To repeat: With X11 in the foreground, press and hold a modifier key such as Shift. Click on a non-X11 window, then release the modifier key. Click on an X11 window and type a character. It's as if the modifier key is still pressed. Press and release the modifier to return things to normal.

Says JH on the xquartz-dev mailing list: “we probably need to do a darwinUpdateModifiers() or something like that in X11ApplicationSetFrontProcess()”.

Change History

comment:1 Changed 5 years ago by jeremyhu@…

  • Status changed from new to assigned
  • Milestone set to 2.3.0

comment:2 Changed 5 years ago by jeremyhu@…

  • Summary changed from Modifier state remembered too much to Modifier state not reset when X11 regains focus

comment:3 Changed 5 years ago by tgl@…

This seems to be related to the problem I've observed with momentary focus drops that are apparently caused by iCal. The behavior I see in that case is that if I have shift or control pressed when focus drops out, then when focus comes back X11 no longer thinks they are pressed. (The dropout problem would not be nearly so annoying if that weren't the case, as it would just be a momentary droppage of entered text and not lead to wrong keystrokes afterwards.) This seems to be the reverse of what you are describing here, but the fix is probably the same: recheck the key state whenever focus is regained.

comment:4 Changed 5 years ago by jeremyhu@…

  • Milestone changed from 2.3.0 to 2.3.1

comment:5 Changed 5 years ago by deadshort@…

Here's a repeatable case which comes from "standard" Spaces usage. I saw this with 10.5.2 and Xquartz-1.4.0-apple8, and just confirmed it on 10.5.3 and the macosforge 2.3.0-rc2.

  • Launch xev
  • Click on the xev window.
  • Switch to a different Space using the keyboard shortcut (Clover-Option in my case).
  • Switch back to the Space with xev.
  • Click the mouse button twice (*).

[ Note the big value in the KeymapNotify event. ]

  • Hit 'z' (or any non-modifier key).

[ The keycode is correct, but the keysym is nuts. ]

  • Hit any modifier key.

[ Note the KeyRelease events for the Spaces keyboard shortcut. If you had just hit _another_ modifier key, you'll see KeyPress/KeyRelease events for that. ]

  • Hit 'z' again. Looks good.

(*) You only need to hit the mouse twice after switching back to the xev Space in order to see listings of various events (like the KeymapNotify) right away. Whatever.

comment:6 Changed 5 years ago by erniefourman@…

I'm getting something similar on Xquartz-1.4.2-apple5 (X11-2.3.0), but not always reproducible (or rather, I haven't figured out exactly what is needed to reproduce it). If I shift from one Space to another using the keyboard shortcuts, and spend a bit of time in that space doing something, then shift back, also using the keyboard shortcut, X11 acts as though I have Ctrl held down (particularly annoying if my first command is 'cd', as then I get Ctrl-C Ctrl-D, which closes the window!). I can cancel the status by hitting Ctrl a few times before typing. Doesn't always happen, especially if I just flick to another Space briefly and then come back, but it's happening often enough to be a pain.

comment:7 Changed 5 years ago by jeremyhu@…

  • Priority changed from minor to major

comment:8 Changed 5 years ago by jeremyhu@…

I can't reproduce this with 1.4.2-apple8 after addressing the other stuck modifier issue. Please try it and if you still have problems, reopen this bug:

You can install 1.4.2-apple8 over 2.3.1_beta1 or just wait for 2.3.1_beta2 to be released in a few minutes.

comment:9 Changed 5 years ago by jeremyhu@…

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.