/usr/lib/python3/dist-packages/xcffib/screensaver.py is in python3-xcffib 0.3.6-1.
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 | import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("MIT-SCREEN-SAVER")
_events = {}
_errors = {}
from . import xproto
class Kind:
Blanked = 0
Internal = 1
External = 2
class Event:
NotifyMask = 1 << 0
CycleMask = 1 << 1
class State:
Off = 0
On = 1
Cycle = 2
Disabled = 3
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 QueryInfoReply(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.state, self.saver_window, self.ms_until_server, self.ms_since_user_input, self.event_mask, self.kind = unpacker.unpack("xB2x4xIIIIB7x")
self.bufsize = unpacker.offset - base
class QueryInfoCookie(xcffib.Cookie):
reply_type = QueryInfoReply
class NotifyEvent(xcffib.Event):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Event.__init__(self, unpacker)
base = unpacker.offset
self.state, self.time, self.root, self.window, self.kind, self.forced = unpacker.unpack("xB2xIIIBB14x")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=B", 0))
buf.write(struct.pack("=B2xIIIBB14x", self.state, self.time, self.root, self.window, self.kind, self.forced))
buf_len = len(buf.getvalue())
if buf_len < 32:
buf.write(struct.pack("x" * (32 - buf_len)))
return buf.getvalue()
_events[0] = NotifyEvent
class screensaverExtension(xcffib.Extension):
def QueryVersion(self, client_major_version, client_minor_version, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xB2xB2x", client_major_version, client_minor_version))
return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked)
def QueryInfo(self, drawable, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", drawable))
return self.send_request(1, buf, QueryInfoCookie, is_checked=is_checked)
def SelectInput(self, drawable, event_mask, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", drawable, event_mask))
return self.send_request(2, buf, is_checked=is_checked)
def SetAttributes(self, drawable, x, y, width, height, border_width, _class, depth, visual, value_mask, value_list, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIhhHHHBBI", drawable, x, y, width, height, border_width, _class, depth, visual))
buf.write(struct.pack("=I", value_mask))
buf.write(xcffib.pack_list(value_list, "I"))
return self.send_request(3, buf, is_checked=is_checked)
def UnsetAttributes(self, drawable, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", drawable))
return self.send_request(4, buf, is_checked=is_checked)
def Suspend(self, suspend, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xB2x3x", suspend))
return self.send_request(5, buf, is_checked=is_checked)
xcffib._add_ext(key, screensaverExtension, _events, _errors)
|