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.Client(cobj)
Bases:
CObjectWrapper- connect()
- disconnect()
- new_ping() Ping
Create a new
Pingobject to trigger a roundtrip to the client. UsePing.ping()to issue the request.The resulting
EventType.PONGevent will contain the associatedPing, accessible viaEvent.pong_ping.
- 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>, <DeviceCapability.TEXT: 64>, <DeviceCapability.GESTURES: 128>))
- class snegg.eis.ConfigureKeymap(keymap_type: snegg.eis.KeymapType, fd: <class 'IO'>, size: int)
Bases:
object- keymap_type: KeymapType
- class snegg.eis.ConfigureRegion(dimension: snegg.eis.Dimension, position: snegg.eis.Position = <factory>, physical_scale: float = 1.0, mapping_id: str | None = None)
Bases:
object
- class snegg.eis.Device(cobject)
Bases:
CObjectWrapper- add()
- property capabilities: tuple[DeviceCapability]
- property device_type: DeviceType
- hold_abort() Device
Abort the current hold gesture, sending an aborted event to reject the sender client’s gesture.
This method is only available on an eis sender context.
Returns
selffor easy chaining of events.
- hold_begin(nfingers: int) Device
Begin a hold gesture with the given number of fingers. Only one hold may be active at a time per device.
Returns
selffor easy chaining of events.
- hold_cancel() Device
Cancel the current hold gesture. This ends the gesture with the is_cancelled flag set.
This method is only available on an eis receiver context.
Returns
selffor easy chaining of events.
- keyboard_xkb_modifiers(mods: XkbModifiersEvent)
- pause()
- pinch_abort() Device
Abort the current pinch gesture, sending an aborted event to reject the sender client’s gesture.
This method is only available on an eis sender context.
Returns
selffor easy chaining of events.
- pinch_begin(nfingers: int) Device
Begin a pinch gesture with the given number of fingers. The number of fingers must be >= 2. Only one pinch may be active at a time per device.
Returns
selffor easy chaining of events.
- pinch_cancel() Device
Cancel the current pinch gesture. This ends the gesture with the is_cancelled flag set.
This method is only available on an eis receiver context.
Returns
selffor easy chaining of events.
- pinch_end() Device
End the current pinch gesture normally.
Returns
selffor easy chaining of events.
- pinch_update(dx: float, dy: float, scale: float, rotation: float) Device
Update the current pinch gesture. The delta is in logical pixels or mm relative to the previous begin/update. The scale is absolute normalized (starts at 1.0). The rotation is relative angle in degrees (positive = clockwise).
Returns
selffor easy chaining of events.
- remove()
- resume()
- swipe_abort() Device
Abort the current swipe gesture, sending an aborted event to reject the sender client’s gesture.
This method is only available on an eis sender context.
Returns
selffor easy chaining of events.
- swipe_begin(nfingers: int) Device
Begin a swipe gesture with the given number of fingers. Only one swipe may be active at a time per device.
Returns
selffor easy chaining of events.
- swipe_cancel() Device
Cancel the current swipe gesture. This ends the gesture with the is_cancelled flag set.
This method is only available on an eis receiver context.
Returns
selffor easy chaining of events.
- swipe_end() Device
End the current swipe gesture normally.
Returns
selffor easy chaining of events.
- swipe_update(dx: float, dy: float) Device
Update the current swipe gesture with the given delta. The delta is in logical pixels or mm relative to the previous begin/update.
Returns
selffor easy chaining of events.
- text_keysym(keysym: int, is_press: bool) Device
Generate a keysym event on a device with the
DeviceCapability.TEXTcapability. Keysyms are XKB-compatible keysyms and are independent of any keymap – the keysym may not exist on any active keymap.This method is only available on a receiver context.
Returns
selffor easy chaining of events.
- text_utf8(text: str) Device
Generate a UTF-8 text event on a device with the
DeviceCapability.TEXTcapability.This method is only available on a receiver context.
Returns
selffor easy chaining of events.
- class snegg.eis.DeviceCapability(*values)
Bases:
IntFlag- BUTTON = 32
- GESTURES = 128
- KEYBOARD = 4
- POINTER = 1
- POINTER_ABSOLUTE = 2
- SCROLL = 16
- TEXT = 64
- TOUCH = 8
- class snegg.eis.Event(cobj)
Bases:
CObjectWrapper- property button_event: ButtonEvent
- property pinch_event: PinchEvent
- property pointer_absolute_event: PointerAbsoluteEvent
- property pointer_event: PointerEvent
- property pong_event: PongEvent
For events of type
EventType.PONG, return the associatedPingobject. For all other event types, returnNone.
- property scroll_discrete_event: ScrollDiscreteEvent
- property scroll_event: ScrollEvent
- property scroll_stop_event: ScrollStopEvent
- property swipe_event: SwipeEvent
- property text_keysym_event: TextKeysymEvent
- property text_utf8_event: TextUtf8Event
- property touch_event: TouchEvent
- class snegg.eis.EventType(*values)
Bases:
IntEnum- BUTTON_BUTTON = 500
- CLIENT_CONNECT = 1
- CLIENT_DISCONNECT = 2
- DEVICE_CLOSED = 4
- DEVICE_READY = 5
- DEVICE_START_EMULATING = 200
- DEVICE_STOP_EMULATING = 201
- FRAME = 100
- HOLD_BEGIN = 1020
- HOLD_END = 1021
- KEYBOARD_KEY = 700
- PINCH_BEGIN = 1010
- PINCH_END = 1012
- PINCH_UPDATE = 1011
- POINTER_MOTION = 300
- POINTER_MOTION_ABSOLUTE = 400
- PONG = 90
- SCROLL_CANCEL = 602
- SCROLL_DELTA = 600
- SCROLL_DISCRETE = 603
- SCROLL_STOP = 601
- SEAT_BIND = 3
- SEAT_DEVICE_REQUESTED = 6
- SWIPE_BEGIN = 1000
- SWIPE_END = 1002
- SWIPE_UPDATE = 1001
- SYNC = 91
- TEXT_KEYSYM = 900
- TEXT_UTF8 = 901
- TOUCH_DOWN = 800
- TOUCH_MOTION = 802
- TOUCH_UP = 801
- class snegg.eis.Keymap(cobj)
Bases:
CObjectWrapper- property keymap_type: KeymapType
- class snegg.eis.PinchEvent(finger_count: int, dx: float = 0.0, dy: float = 0.0, scale: float = 1.0, rotation: float = 0.0, is_cancelled: bool = False)
Bases:
object
- class snegg.eis.Ping(cobj)
Bases:
CObjectWrapperA roundtrip synchronization object. Create with
Client.new_ping()and issue withping(). When the client has processed the roundtrip, an event of typeEventType.PONGis returned.- ping()
Issue the roundtrip request. Results in an event of type
EventType.PONGwhen processed by the client.
- class snegg.eis.Region(cobject)
Bases:
CObjectWrapper
- class snegg.eis.Seat(cobj)
Bases:
CObjectWrapper- add()
- property capabilities: tuple[DeviceCapability, ...]
- new_device(*, name: str | None = None, device_type: DeviceType = DeviceType.VIRTUAL, size: Dimension | None = None, capabilities: list[DeviceCapability] | None = None, regions: list[ConfigureRegion] = [], keymap: ConfigureKeymap | None = None) Device
- remove()
- class snegg.eis.SeatEvent(capabilities: list[snegg.eis.DeviceCapability])
Bases:
object- capabilities: list[DeviceCapability]
- class snegg.eis.SwipeEvent(finger_count: int, dx: float = 0.0, dy: float = 0.0, is_cancelled: bool = False)
Bases:
object
- class snegg.eis.Touch(cobj)
Bases:
CObjectWrapper