X Tutup
The Wayback Machine - https://web.archive.org/web/20210106130917/https://github.com/python-xlib/python-xlib/issues/159
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A case where next_event () get stuck when grabbing the pointer #159

Open
FSpark opened this issue Feb 3, 2020 · 0 comments
Open

A case where next_event () get stuck when grabbing the pointer #159

FSpark opened this issue Feb 3, 2020 · 0 comments

Comments

@FSpark
Copy link

@FSpark FSpark commented Feb 3, 2020

When I grab the mouse event, there is an unexpected situation that it will get stuck in next_event (), so that no subsequent messages can be obtained.

It's very easy to reproduce.
Now I'll simplify this part of the code as follows:

from Xlib.display import Display
from Xlib import X
def handle(event):
    if event.type == X.MotionNotify:
        print("MotionNotify", event.root_x, event.root_y)

disp = Display()
root = disp.screen().root

root.grab_pointer(True,
                  X.ButtonPressMask |
                  X.ButtonReleaseMask |
                  X.PointerMotionMask,
                  X.GrabModeAsync,
                  X.GrabModeAsync,
                  0, 0, X.CurrentTime)

while 1:
    event = disp.next_event()
    handle(event)
    disp.allow_events(X.AsyncPointer, X.CurrentTime)

You can try to run this program when you press the left or right mouse button and hold it still. Any event in the program will not be grabbed or displayed.

It's beyond my ability... Is there anything recommended for debugging?

Many thanks in advance

@FSpark FSpark changed the title A case where next_event () will get stuck when grabbing the pointer A case where next_event () get stuck when grabbing the pointer Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.
X Tutup