def pick_coordinate(display, cursor): """Changes the cursor and grabs the pointer for every window. Args: display: Xlib display cursor: cursor object or X.NONE """ try: display.screen().root.grab_pointer( 0, X.PointerMotionMask | X.ButtonReleaseMask | X.ButtonPressMask, X.GrabModeAsync, X.GrabModeAsync, X.NONE, cursor, X.CurrentTime) display.flush() yield finally: display.ungrab_pointer(0) display.flush()
def _suppress_stop(self, display): display.ungrab_pointer(Xlib.X.CurrentTime)