/usr/lib/python2.7/dist-packages/xcffib/xinerama.py is in python-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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("XINERAMA")
_events = {}
_errors = {}
from . import xproto
class ScreenInfo(xcffib.Struct):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Struct.__init__(self, unpacker)
base = unpacker.offset
self.x_org, self.y_org, self.width, self.height = unpacker.unpack("hhHH")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=hhHH", self.x_org, self.y_org, self.width, self.height))
return buf.getvalue()
fixed_size = 8
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.major, self.minor = unpacker.unpack("xx2x4xHH")
self.bufsize = unpacker.offset - base
class QueryVersionCookie(xcffib.Cookie):
reply_type = QueryVersionReply
class GetStateReply(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.window = unpacker.unpack("xB2x4xI")
self.bufsize = unpacker.offset - base
class GetStateCookie(xcffib.Cookie):
reply_type = GetStateReply
class GetScreenCountReply(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.screen_count, self.window = unpacker.unpack("xB2x4xI")
self.bufsize = unpacker.offset - base
class GetScreenCountCookie(xcffib.Cookie):
reply_type = GetScreenCountReply
class GetScreenSizeReply(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.width, self.height, self.window, self.screen = unpacker.unpack("xx2x4xIIII")
self.bufsize = unpacker.offset - base
class GetScreenSizeCookie(xcffib.Cookie):
reply_type = GetScreenSizeReply
class IsActiveReply(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, = unpacker.unpack("xx2x4xI")
self.bufsize = unpacker.offset - base
class IsActiveCookie(xcffib.Cookie):
reply_type = IsActiveReply
class QueryScreensReply(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.number, = unpacker.unpack("xx2x4xI20x")
self.screen_info = xcffib.List(unpacker, ScreenInfo, self.number)
self.bufsize = unpacker.offset - base
class QueryScreensCookie(xcffib.Cookie):
reply_type = QueryScreensReply
class xineramaExtension(xcffib.Extension):
def QueryVersion(self, major, minor, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xB2xB", major, minor))
return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked)
def GetState(self, window, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", window))
return self.send_request(1, buf, GetStateCookie, is_checked=is_checked)
def GetScreenCount(self, window, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", window))
return self.send_request(2, buf, GetScreenCountCookie, is_checked=is_checked)
def GetScreenSize(self, window, screen, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", window, screen))
return self.send_request(3, buf, GetScreenSizeCookie, is_checked=is_checked)
def IsActive(self, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2x"))
return self.send_request(4, buf, IsActiveCookie, is_checked=is_checked)
def QueryScreens(self, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2x"))
return self.send_request(5, buf, QueryScreensCookie, is_checked=is_checked)
xcffib._add_ext(key, xineramaExtension, _events, _errors)
|