Skip to content

Patches for grabbing - #39

Open
SumiTomohiko wants to merge 4 commits into
mattkwan-zz:masterfrom
SumiTomohiko:master
Open

Patches for grabbing#39
SumiTomohiko wants to merge 4 commits into
mattkwan-zz:masterfrom
SumiTomohiko:master

Conversation

@SumiTomohiko

@SumiTomohiko SumiTomohiko commented Mar 7, 2017

Copy link
Copy Markdown

I fixed two problems on grabbing. Please read the commit log.

In the previous version, ScreenView._grabPointerTime was later than
timestamp of ButtonPress event. motif did not work because of it. As
seen in lib/Xm/DragC.c in the motif source tree, motif gives a last
event timestamp to XGrabPointer().

When a user pressed the left button, the X server and motif worked in
this order:

  1. The X server sent a ButtonPress event.
  2. The X server updated the _grabPointerTime in the ScreenView.
  3. motif called XGrabPointer() with the timestamp given in the step 1.
  4. The X server called ScreenView.processGrabPointerRequest().

In the step 4, the X server responsed "invalid time" in comparing the
timestamp at the step 2 with the timestamp at the step 3 (which is same
as the timestamp at the step 1).

This patch fixes the X server to use same timestamp in the step 1 and 2.
The man page of XGrabKeyboard(3) is saying:

  XGrabKeyboard overrides any active keyboard grab by this client.
  :
  :
  If the keyboard is actively grabbed by some other client,
  XGrabKeyboard fails and returns AlreadyGrabbed.

This patch fixes keyboard grabbing to test if the client is a grabbing
owner or not.
@SumiTomohiko

Copy link
Copy Markdown
Author

xshisen can reproduce this bug. The menu in xshisen does not work for this bug.

This code does not support ReplayPointer, ReplayKeyboard, AsyncBoth and
SyncBoth.

I read the manpage[1] and the source code of the X server[2] to write
this code, but honestly I do not know if this implementation is correct.

[1] https://tronche.com/gui/x/xlib/input/XAllowEvents.html
[2] https://www.x.org/releases/X11R7.7/src/xserver/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant