Exemple #1
0
COPY_FROM_PARENT = 0
WINDOW_CLASS_INPUT_ONLY = 2
CW_OVERRIDE_REDIRECT = 512
CW_EVENT_MASK = 2048

EVENT_MASK_KEY_PRESS = 1
EVENT_MASK_KEY_RELEASE = 2

CURRENT_TIME = 0
GRAB_MODE_ASYNC = 1

WINDOW_NONE = 0

KEY_PRESS = 2

libxcb = check_and_load_library('xcb')
libxcb_image = check_and_load_library('xcb-image')
libc = check_and_load_library('c')

connect = libxcb.xcb_connect
connect.argtypes = [c_char_p, POINTER(c_int)]
connect.restype = POINTER(Connection)

get_setup = libxcb.xcb_get_setup
get_setup.argtypes = [POINTER(Connection)]
get_setup.restype = POINTER(Setup)

setup_roots_iterator = libxcb.xcb_setup_roots_iterator
setup_roots_iterator.argtypes = [POINTER(Setup)]
setup_roots_iterator.restype = ScreenIterator
Exemple #2
0
from ctypes import *
from pyxtrlock.utils import check_and_load_library

import pyxtrlock.xcb as xcb

libx_xcb = check_and_load_library('X11-xcb')
libx = check_and_load_library('X11')


class Display(Structure):
    pass


Time = c_ulong
Bool = c_int
Window = c_ulong


class KeyEvent(Structure):
    _fields_ = [
        ("type", c_int),
        ("serial", c_ulong),
        ("send_event", Bool),
        ("display", POINTER(Display)),
        ("window", Window),
        ("root", Window),
        ("subwindow", Window),
        ("time", Time),
        ("x", c_int),
        ("y", c_int),
        ("x_root", c_int),