So xserver 1.20 started sending out a few more events for XGrabKeyboard():
Unfortunately this breaks TigerVNC's vncviewer, and it isn't obvious how it should be fixed.
The issue is that TigerVNC tries to be a good citizen and release the grab when it loses focus (e.g. the user clicks another window with the ouse). However with the new commit we end up with:
1. TigerVNC grabs keyboard
2. TigerVNC recieves FocusOut
3. TigerVNC ungrabs keyboard
4. TigerVNC recieves FocusIn
5. goto 1
The obvious fix is to ignore these no-op focus events, but I cannot see a clear way to detect them.
FocusOut could be handled by calling XGetInputFocus(), even though that probably introduces a small race.
FocusIn is more difficult. It's too late to check things with XGetInputFocus(), and there is no call to see if TigerVNC already has the grab. Perhaps manually track the focus state, but that's a bit annoying and I'm concerned there might be corner cases.
I was thinking that something might be possible to do by tracking request serial numbers, but that's a bit hacky.
Some input on this would be nice. It will start breaking things for a lot of users once 1.20 becomes common.
Despite the hackishness, filtering events seems like the best approach (unless you have a better suggestion). This is the intended workaround:
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/587.