snegg.eis module

Wrapper module around the libeis C library. This is a thin API wrapper with most of the semantics of the underlying C library preserved. See the libeis documentation for details on each API.

Warning

Most objects in this module are refcounted and automatically destroy the underlying C object when the Python reference is dropped. This may cause all sub-objects in the underlying C object to be destroyed as well. Care must be taken to preserve the Python object across multiple invocations.

class snegg.eis.ButtonEvent(button: int, is_press: bool)

Bases: object

button: int
is_press: bool
class snegg.eis.Client(cobj)

Bases: CObjectWrapper

connect()
disconnect()
property is_sender: bool
property name: str
new_seat(*, name: str = 'default seat', capabilities: tuple[snegg.eis.DeviceCapability, ...] = (<DeviceCapability.POINTER: 1>, <DeviceCapability.POINTER_ABSOLUTE: 2>, <DeviceCapability.KEYBOARD: 4>, <DeviceCapability.TOUCH: 8>, <DeviceCapability.SCROLL: 16>, <DeviceCapability.BUTTON: 32>))
class snegg.eis.ConfigureKeymap(keymap_type: snegg.eis.KeymapType, fd: <class 'IO'>, size: int)

Bases: object

fd: IO
keymap_type: KeymapType
size: int
class snegg.eis.ConfigureRegion(dimension: snegg.eis.Dimension, position: snegg.eis.Position = <factory>, physical_scale: float = 1.0, mapping_id: Optional[str] = None)

Bases: object

dimension: Dimension
mapping_id: Optional[str] = None
physical_scale: float = 1.0
position: Position
class snegg.eis.Device(cobject)

Bases: CObjectWrapper

add()
button_button(button: int, is_press: bool) Device
property capabilities: tuple[snegg.eis.DeviceCapability]
property device_type: DeviceType
frame(timestamp: Optional[int] = None) Device
property height: int
property keyboard_get_keymap: Optional[Keymap]
keyboard_key(key: int, is_press: bool) Device
keyboard_xkb_modifiers(mods: XkbModifiersEvent)
property name: str
pause()
pointer_motion(x: float, y: float) Device
pointer_motion_absolute(x: float, y: float) Device
property regions: tuple[snegg.eis.Region]
remove()
resume()
property seat: Seat
start_emulating(sequence: Optional[int] = None) Device
stop_emulating() Device
touch_new() Touch
property width: int
class snegg.eis.DeviceCapability(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntFlag

BUTTON = 32
KEYBOARD = 4
POINTER = 1
POINTER_ABSOLUTE = 2
SCROLL = 16
TOUCH = 8
static all() int
class snegg.eis.DeviceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

PHYSICAL = 2
VIRTUAL = 1
class snegg.eis.Dimension(width: int, height: int)

Bases: object

height: int
width: int
class snegg.eis.Eis

Bases: CObjectWrapper

add_client_fd(fd: IO)
classmethod create_for_fd(path: Optional[str]) Eis
classmethod create_for_socket(path: Path) Eis
dispatch() None
property events: Iterator[Event]
property fd: int
property now: int
exception snegg.eis.Error(message: str, errno: Optional[int] = None)

Bases: Exception

class snegg.eis.Event(cobj)

Bases: CObjectWrapper

property button_event: ButtonEvent
property client: Client
property device: Optional[Device]
property emulating_sequence: int
property event_type: EventType
property key_event: KeyEvent
property pointer_absolute_event: PointerAbsoluteEvent
property pointer_event: PointerEvent
property scroll_discrete_event: ScrollDiscreteEvent
property scroll_event: ScrollEvent
property scroll_stop_event: ScrollStopEvent
property seat: Optional[Seat]
property seat_event: SeatEvent
property time: int
property touch_event: TouchEvent
class snegg.eis.EventType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

BUTTON_BUTTON = 500
CLIENT_CONNECT = 1
CLIENT_DISCONNECT = 2
DEVICE_CLOSED = 4
DEVICE_START_EMULATING = 200
DEVICE_STOP_EMULATING = 201
FRAME = 100
KEYBOARD_KEY = 700
POINTER_MOTION = 300
POINTER_MOTION_ABSOLUTE = 400
SCROLL_CANCEL = 602
SCROLL_DELTA = 600
SCROLL_DISCRETE = 603
SCROLL_STOP = 601
SEAT_BIND = 3
TOUCH_DOWN = 800
TOUCH_MOTION = 802
TOUCH_UP = 801
class snegg.eis.KeyEvent(key: int, is_press: bool)

Bases: object

is_press: bool
key: int
class snegg.eis.Keymap(cobj)

Bases: CObjectWrapper

property device: Device
property fd: IO
property keymap_type: KeymapType
property size: int
class snegg.eis.KeymapType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

XKB = 1
class snegg.eis.PointerAbsoluteEvent(x: float, y: float)

Bases: object

x: float
y: float
class snegg.eis.PointerEvent(dx: float, dy: float)

Bases: object

dx: float
dy: float
class snegg.eis.Position(x: int, y: int)

Bases: object

x: int
y: int
class snegg.eis.Region(cobject)

Bases: CObjectWrapper

contains(x: float, y: float) bool
property dimension: Dimension
property mapping_id: Optional[str]
property physical_scale: float
property position: Position
class snegg.eis.ScrollDiscreteEvent(dx: int, dy: int)

Bases: object

dx: int
dy: int
class snegg.eis.ScrollEvent(dx: float, dy: float)

Bases: object

dx: float
dy: float
class snegg.eis.ScrollStopEvent(x: bool, y: bool)

Bases: object

x: bool
y: bool
class snegg.eis.Seat(cobj)

Bases: CObjectWrapper

add()
property capabilities: tuple[snegg.eis.DeviceCapability, ...]
property client: Client
property name: str
new_device(*, name: Optional[str] = None, device_type: DeviceType = DeviceType.VIRTUAL, size: Optional[Dimension] = None, capabilities: Optional[list[snegg.eis.DeviceCapability]] = None, regions: list[snegg.eis.ConfigureRegion] = [], keymap: Optional[ConfigureKeymap] = None) Device
remove()
class snegg.eis.SeatEvent(capabilities: list[snegg.eis.DeviceCapability])

Bases: object

capabilities: list[snegg.eis.DeviceCapability]
class snegg.eis.Touch(cobj)

Bases: CObjectWrapper

property device: Device
down(x: float, y: float) Device
motion(x: float, y: float) Device
up() Device
class snegg.eis.TouchEvent(touchid: int, x: float, y: float)

Bases: object

touchid: int
x: float
y: float
class snegg.eis.XkbModifiersEvent(depressed: int, latched: int, locked: int, group: int)

Bases: object

depressed: int
group: int
latched: int
locked: int