How to use the xcffib.xproto.GrabMode.Async function in xcffib

To help you get started, we’ve selected a few xcffib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qtile / qtile / libqtile / backend / x11 / xcore.py View on Github external
def grab_key(self, keysym: int, modmask: int) -> None:
        """Map the key to receive events on it"""
        code = self.conn.keysym_to_keycode(keysym)
        for amask in self._auto_modmasks():
            self._root.grab_key(
                code,
                modmask | amask,
                True,
                xcffib.xproto.GrabMode.Async,
                xcffib.xproto.GrabMode.Async,
            )
github qtile / qtile / libqtile / backend / x11 / xcore.py View on Github external
def grab_pointer(self) -> None:
        """Get the focus for pointer events"""
        self._root.grab_pointer(
            True,
            xcbq.ButtonMotionMask | xcbq.AllButtonsMask | xcbq.ButtonReleaseMask,
            xcffib.xproto.GrabMode.Async,
            xcffib.xproto.GrabMode.Async,
        )
github qtile / qtile / libqtile / backend / x11 / xcore.py View on Github external
def grab_button(self, mouse: config.Mouse) -> None:
        """Grab the given mouse button for events"""
        try:
            modmask = xcbq.translate_masks(mouse.modifiers)
        except xcbq.XCBQError as err:
            raise utils.QtileError(err)

        if isinstance(mouse, config.Click) and mouse.focus:
            # Make a freezing grab on mouse button to gain focus
            # Event will propagate to target window
            grabmode = xcffib.xproto.GrabMode.Sync
        else:
            grabmode = xcffib.xproto.GrabMode.Async

        eventmask = xcffib.xproto.EventMask.ButtonPress
        if isinstance(mouse, config.Drag):
            eventmask |= xcffib.xproto.EventMask.ButtonRelease

        for amask in self._auto_modmasks():
            self._root.grab_button(
                mouse.button_code,
                modmask | amask,
                True,
                eventmask,
                grabmode,
                xcffib.xproto.GrabMode.Async,
            )
github qtile / qtile / libqtile / backend / x11 / xcore.py View on Github external
def grab_pointer(self) -> None:
        """Get the focus for pointer events"""
        self._root.grab_pointer(
            True,
            xcbq.ButtonMotionMask | xcbq.AllButtonsMask | xcbq.ButtonReleaseMask,
            xcffib.xproto.GrabMode.Async,
            xcffib.xproto.GrabMode.Async,
        )
github qtile / qtile / libqtile / backend / x11 / xcore.py View on Github external
def grab_key(self, keysym: int, modmask: int) -> None:
        """Map the key to receive events on it"""
        code = self.conn.keysym_to_keycode(keysym)
        for amask in self._auto_modmasks():
            self._root.grab_key(
                code,
                modmask | amask,
                True,
                xcffib.xproto.GrabMode.Async,
                xcffib.xproto.GrabMode.Async,
            )
github qtile / qtile / libqtile / backend / x11 / xcore.py View on Github external
grabmode = xcffib.xproto.GrabMode.Sync
        else:
            grabmode = xcffib.xproto.GrabMode.Async

        eventmask = xcffib.xproto.EventMask.ButtonPress
        if isinstance(mouse, config.Drag):
            eventmask |= xcffib.xproto.EventMask.ButtonRelease

        for amask in self._auto_modmasks():
            self._root.grab_button(
                mouse.button_code,
                modmask | amask,
                True,
                eventmask,
                grabmode,
                xcffib.xproto.GrabMode.Async,
            )