/usr/lib/python3/dist-packages/xcffib/xfixes.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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | import xcffib
import struct
import six
MAJOR_VERSION = 5
MINOR_VERSION = 0
key = xcffib.ExtensionKey("XFIXES")
_events = {}
_errors = {}
from . import xproto
from . import render
from . import shape
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_version, self.minor_version = unpacker.unpack("xx2x4xII16x")
self.bufsize = unpacker.offset - base
class QueryVersionCookie(xcffib.Cookie):
reply_type = QueryVersionReply
class SaveSetMode:
Insert = 0
Delete = 1
class SaveSetTarget:
Nearest = 0
Root = 1
class SaveSetMapping:
Map = 0
Unmap = 1
class SelectionEvent:
SetSelectionOwner = 0
SelectionWindowDestroy = 1
SelectionClientClose = 2
class SelectionEventMask:
SetSelectionOwner = 1 << 0
SelectionWindowDestroy = 1 << 1
SelectionClientClose = 1 << 2
class SelectionNotifyEvent(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.subtype, self.window, self.owner, self.selection, self.timestamp, self.selection_timestamp = unpacker.unpack("xB2xIIIII8x")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=B", 0))
buf.write(struct.pack("=B2xIIIII8x", self.subtype, self.window, self.owner, self.selection, self.timestamp, self.selection_timestamp))
buf_len = len(buf.getvalue())
if buf_len < 32:
buf.write(struct.pack("x" * (32 - buf_len)))
return buf.getvalue()
@classmethod
def synthetic(cls, subtype, window, owner, selection, timestamp, selection_timestamp):
self = cls.__new__(cls)
self.subtype = subtype
self.window = window
self.owner = owner
self.selection = selection
self.timestamp = timestamp
self.selection_timestamp = selection_timestamp
return self
_events[0] = SelectionNotifyEvent
class CursorNotify:
DisplayCursor = 0
class CursorNotifyMask:
DisplayCursor = 1 << 0
class CursorNotifyEvent(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.subtype, self.window, self.cursor_serial, self.timestamp, self.name = unpacker.unpack("xB2xIIII12x")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=B", 1))
buf.write(struct.pack("=B2xIIII12x", self.subtype, self.window, self.cursor_serial, self.timestamp, self.name))
buf_len = len(buf.getvalue())
if buf_len < 32:
buf.write(struct.pack("x" * (32 - buf_len)))
return buf.getvalue()
@classmethod
def synthetic(cls, subtype, window, cursor_serial, timestamp, name):
self = cls.__new__(cls)
self.subtype = subtype
self.window = window
self.cursor_serial = cursor_serial
self.timestamp = timestamp
self.name = name
return self
_events[1] = CursorNotifyEvent
class GetCursorImageReply(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.x, self.y, self.width, self.height, self.xhot, self.yhot, self.cursor_serial = unpacker.unpack("xx2x4xhhHHHHI8x")
self.cursor_image = xcffib.List(unpacker, "I", self.width * self.height)
self.bufsize = unpacker.offset - base
class GetCursorImageCookie(xcffib.Cookie):
reply_type = GetCursorImageReply
class BadRegionError(xcffib.Error):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Error.__init__(self, unpacker)
base = unpacker.offset
unpacker.unpack("xx2x")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=B", 0))
buf.write(struct.pack("=x2x"))
return buf.getvalue()
BadBadRegion = BadRegionError
_errors[0] = BadRegionError
class Region:
_None = 0
class FetchRegionReply(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("xx2x4x")
self.extents = xproto.RECTANGLE(unpacker)
unpacker.unpack("16x")
unpacker.pad(xproto.RECTANGLE)
self.rectangles = xcffib.List(unpacker, xproto.RECTANGLE, self.length // 2)
self.bufsize = unpacker.offset - base
class FetchRegionCookie(xcffib.Cookie):
reply_type = FetchRegionReply
class GetCursorNameReply(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.atom, self.nbytes = unpacker.unpack("xx2x4xIH18x")
self.name = xcffib.List(unpacker, "c", self.nbytes)
self.bufsize = unpacker.offset - base
class GetCursorNameCookie(xcffib.Cookie):
reply_type = GetCursorNameReply
class GetCursorImageAndNameReply(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.x, self.y, self.width, self.height, self.xhot, self.yhot, self.cursor_serial, self.cursor_atom, self.nbytes = unpacker.unpack("xx2x4xhhHHHHIIH2x")
self.cursor_image = xcffib.List(unpacker, "I", self.width * self.height)
unpacker.pad("c")
self.name = xcffib.List(unpacker, "c", self.nbytes)
self.bufsize = unpacker.offset - base
class GetCursorImageAndNameCookie(xcffib.Cookie):
reply_type = GetCursorImageAndNameReply
class BarrierDirections:
PositiveX = 1 << 0
PositiveY = 1 << 1
NegativeX = 1 << 2
NegativeY = 1 << 3
class xfixesExtension(xcffib.Extension):
def QueryVersion(self, client_major_version, client_minor_version, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", client_major_version, client_minor_version))
return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked)
def ChangeSaveSet(self, mode, target, map, window, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xBBBxI", mode, target, map, window))
return self.send_request(1, buf, is_checked=is_checked)
def SelectSelectionInput(self, window, selection, event_mask, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIII", window, selection, event_mask))
return self.send_request(2, buf, is_checked=is_checked)
def SelectCursorInput(self, window, event_mask, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", window, event_mask))
return self.send_request(3, buf, is_checked=is_checked)
def GetCursorImage(self, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2x"))
return self.send_request(4, buf, GetCursorImageCookie, is_checked=is_checked)
def CreateRegion(self, region, rectangles_len, rectangles, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", region))
buf.write(xcffib.pack_list(rectangles, xproto.RECTANGLE))
return self.send_request(5, buf, is_checked=is_checked)
def CreateRegionFromBitmap(self, region, bitmap, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", region, bitmap))
return self.send_request(6, buf, is_checked=is_checked)
def CreateRegionFromWindow(self, region, window, kind, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIIB3x", region, window, kind))
return self.send_request(7, buf, is_checked=is_checked)
def CreateRegionFromGC(self, region, gc, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", region, gc))
return self.send_request(8, buf, is_checked=is_checked)
def CreateRegionFromPicture(self, region, picture, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", region, picture))
return self.send_request(9, buf, is_checked=is_checked)
def DestroyRegion(self, region, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", region))
return self.send_request(10, buf, is_checked=is_checked)
def SetRegion(self, region, rectangles_len, rectangles, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", region))
buf.write(xcffib.pack_list(rectangles, xproto.RECTANGLE))
return self.send_request(11, buf, is_checked=is_checked)
def CopyRegion(self, source, destination, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", source, destination))
return self.send_request(12, buf, is_checked=is_checked)
def UnionRegion(self, source1, source2, destination, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIII", source1, source2, destination))
return self.send_request(13, buf, is_checked=is_checked)
def IntersectRegion(self, source1, source2, destination, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIII", source1, source2, destination))
return self.send_request(14, buf, is_checked=is_checked)
def SubtractRegion(self, source1, source2, destination, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIII", source1, source2, destination))
return self.send_request(15, buf, is_checked=is_checked)
def InvertRegion(self, source, destination, bounds, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", source, destination))
buf.write(bounds.pack() if hasattr(bounds, "pack") else RECTANGLE.synthetic(*bounds).pack())
return self.send_request(16, buf, is_checked=is_checked)
def TranslateRegion(self, region, dx, dy, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIhh", region, dx, dy))
return self.send_request(17, buf, is_checked=is_checked)
def RegionExtents(self, source, destination, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", source, destination))
return self.send_request(18, buf, is_checked=is_checked)
def FetchRegion(self, region, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", region))
return self.send_request(19, buf, FetchRegionCookie, is_checked=is_checked)
def SetGCClipRegion(self, gc, region, x_origin, y_origin, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIIhh", gc, region, x_origin, y_origin))
return self.send_request(20, buf, is_checked=is_checked)
def SetWindowShapeRegion(self, dest, dest_kind, x_offset, y_offset, region, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIB3xhhI", dest, dest_kind, x_offset, y_offset, region))
return self.send_request(21, buf, is_checked=is_checked)
def SetPictureClipRegion(self, picture, region, x_origin, y_origin, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIIhh", picture, region, x_origin, y_origin))
return self.send_request(22, buf, is_checked=is_checked)
def SetCursorName(self, cursor, nbytes, name, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIH2x", cursor, nbytes))
buf.write(xcffib.pack_list(name, "c"))
return self.send_request(23, buf, is_checked=is_checked)
def GetCursorName(self, cursor, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", cursor))
return self.send_request(24, buf, GetCursorNameCookie, is_checked=is_checked)
def GetCursorImageAndName(self, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2x"))
return self.send_request(25, buf, GetCursorImageAndNameCookie, is_checked=is_checked)
def ChangeCursor(self, source, destination, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", source, destination))
return self.send_request(26, buf, is_checked=is_checked)
def ChangeCursorByName(self, src, nbytes, name, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIH2x", src, nbytes))
buf.write(xcffib.pack_list(name, "c"))
return self.send_request(27, buf, is_checked=is_checked)
def ExpandRegion(self, source, destination, left, right, top, bottom, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIIHHHH", source, destination, left, right, top, bottom))
return self.send_request(28, buf, is_checked=is_checked)
def HideCursor(self, window, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", window))
return self.send_request(29, buf, is_checked=is_checked)
def ShowCursor(self, window, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", window))
return self.send_request(30, buf, is_checked=is_checked)
def CreatePointerBarrier(self, barrier, window, x1, y1, x2, y2, directions, num_devices, devices, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIIHHHHI2xH", barrier, window, x1, y1, x2, y2, directions, num_devices))
buf.write(xcffib.pack_list(devices, "H"))
return self.send_request(31, buf, is_checked=is_checked)
def DeletePointerBarrier(self, barrier, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", barrier))
return self.send_request(32, buf, is_checked=is_checked)
xcffib._add_ext(key, xfixesExtension, _events, _errors)
|