/usr/lib/python3/dist-packages/xcffib/xevie.py is in python3-xcffib 0.5.1-1build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 0
key = xcffib.ExtensionKey("XEVIE")
_events = {}
_errors = {}
class QueryVersionReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
self.server_major_version, self.server_minor_version = unpacker.unpack("xx2x4xHH20x")
self.bufsize = unpacker.offset - base
class QueryVersionCookie(xcffib.Cookie):
reply_type = QueryVersionReply
class StartReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
unpacker.unpack("xx2x4x24x")
self.bufsize = unpacker.offset - base
class StartCookie(xcffib.Cookie):
reply_type = StartReply
class EndReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
unpacker.unpack("xx2x4x24x")
self.bufsize = unpacker.offset - base
class EndCookie(xcffib.Cookie):
reply_type = EndReply
class Datatype:
Unmodified = 0
Modified = 1
class Event(xcffib.Struct):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Struct.__init__(self, unpacker)
base = unpacker.offset
unpacker.unpack("32x")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=32x"))
return buf.getvalue()
fixed_size = 32
class SendReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
unpacker.unpack("xx2x4x24x")
self.bufsize = unpacker.offset - base
class SendCookie(xcffib.Cookie):
reply_type = SendReply
class SelectInputReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
unpacker.unpack("xx2x4x24x")
self.bufsize = unpacker.offset - base
class SelectInputCookie(xcffib.Cookie):
reply_type = SelectInputReply
class xevieExtension(xcffib.Extension):
def QueryVersion(self, client_major_version, client_minor_version, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xHH", client_major_version, client_minor_version))
return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked)
def Start(self, screen, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", screen))
return self.send_request(1, buf, StartCookie, is_checked=is_checked)
def End(self, cmap, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", cmap))
return self.send_request(2, buf, EndCookie, is_checked=is_checked)
def Send(self, data_type, event, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI64x", data_type))
buf.write(event.pack() if hasattr(event, "pack") else Event.synthetic(*event).pack())
return self.send_request(3, buf, SendCookie, is_checked=is_checked)
def SelectInput(self, event_mask, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", event_mask))
return self.send_request(4, buf, SelectInputCookie, is_checked=is_checked)
xcffib._add_ext(key, xevieExtension, _events, _errors)
|