All Samples(15216) | Call(14737) | Derive(0) | Import(479)
Return string containing values v1, v2, ... packed according to fmt.
src/p/y/pycarrara-HEAD/V0.6-alpha/Samples/midi.py pycarrara(Download)
import copy import time from cStringIO import StringIO from struct import unpack, pack from math import sqrt ##
def write_file_header(self):
# First four bytes are MIDI header
packdata = pack(">LHHH", 6,
self.midistream.format,
self.midistream.trackcount,
self.midistream.resolution)
self.output.write('MThd%s' % packdata)
def write_track_header(self, trklen):
self.output.write('MTrk%s' % pack(">L", trklen))
src/p/y/pycarrara-HEAD/V0.5-alpha/Samples/midi.py pycarrara(Download)
import copy import time from cStringIO import StringIO from struct import unpack, pack from math import sqrt ##
def write_file_header(self):
# First four bytes are MIDI header
packdata = pack(">LHHH", 6,
self.midistream.format,
self.midistream.trackcount,
self.midistream.resolution)
self.output.write('MThd%s' % packdata)
def write_track_header(self, trklen):
self.output.write('MTrk%s' % pack(">L", trklen))
src/p/y/pycarrara-HEAD/trunk/Samples/midi.py pycarrara(Download)
import copy import time from cStringIO import StringIO from struct import unpack, pack from math import sqrt ##
def write_file_header(self):
# First four bytes are MIDI header
packdata = pack(">LHHH", 6,
self.midistream.format,
self.midistream.trackcount,
self.midistream.resolution)
self.output.write('MThd%s' % packdata)
def write_track_header(self, trklen):
self.output.write('MTrk%s' % pack(">L", trklen))
src/p/y/pycarrara-HEAD/Samples/midi.py pycarrara(Download)
import copy import time from cStringIO import StringIO from struct import unpack, pack from math import sqrt ##
def write_file_header(self):
# First four bytes are MIDI header
packdata = pack(">LHHH", 6,
self.midistream.format,
self.midistream.trackcount,
self.midistream.resolution)
self.output.write('MThd%s' % packdata)
def write_track_header(self, trklen):
self.output.write('MTrk%s' % pack(">L", trklen))
src/o/o/ooxcb-1.1/ooxcb/protocol/xproto.py ooxcb(Download)
import cStringIO as StringIO
except ImportError:
import StringIO
from struct import pack, unpack, calcsize
from ooxcb.types import make_void_array
from ooxcb.util import cached_property
def get_geometry(self):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", drawable))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 14, False, True), \
GetGeometryCookie(),
GetGeometryReply)
def get_geometry_unchecked(self):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", drawable))
def get_image(self, format, x, y, width, height, plane_mask):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIhhHHI", format, drawable, x, y, width, height, plane_mask))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 73, False, True), \
GetImageCookie(),
GetImageReply)
def get_image_unchecked(self, format, x, y, width, height, plane_mask):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIhhHHI", format, drawable, x, y, width, height, plane_mask))
def query_best_size(self, _class, width, height):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHH", _class, drawable, width, height))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 97, False, True), \
QueryBestSizeCookie(),
QueryBestSizeReply)
def query_best_size_unchecked(self, _class, width, height):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHH", _class, drawable, width, height))
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxIHH", self.same_screen, get_internal(self.child), self.dst_x, self.dst_y))
class QueryBestSizeCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIHHHHHHBxxx", self.response_type, get_internal(self.drawable), self.x, self.y, self.width, self.height, self.minor_opcode, self.count, self.major_opcode))
stream.write("\0" * (32 - (stream.tell() - root)))
class ClientMessageData(ooxcb.Union):
else:
raise ooxcb.XcbException("No value set in the union!")
if stream.tell() - root < 20:
stream.write(pack("=" + "x" * (20 - (stream.tell() - root))))
class QueryExtensionReply(ooxcb.Reply):
def __init__(self, conn):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxBBBB", self.present, self.major_opcode, self.first_event, self.first_error))
class QueryTreeReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxIIHxxxxxxxxxxxxxx", get_internal(self.root), get_internal(self.parent), self.children_len))
count += 32
build_list(self.conn, stream, self.children, 'I')
class ListInstalledColormapsReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHxxxxxxxxxxxxxxxxxxxxxx", self.cmaps_len))
count += 32
build_list(self.conn, stream, self.cmaps, 'I')
class Rgb(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=HHHxx", self.red, self.green, self.blue))
class QueryTreeCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxIHBBIIBBBBIIIHxx", self.backing_store, self.visual, self._class, self.bit_gravity, self.win_gravity, self.backing_planes, self.backing_pixel, self.save_under, self.map_is_installed, self.map_state, self.override_redirect, get_internal(self.colormap), self.all_event_masks, self.your_event_mask, self.do_not_propagate_mask))
class AllocColorCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class Colormap(ooxcb.Resource):
def __init__(self, conn, xid):
ooxcb.Resource.__init__(self, conn, xid)
def free_checked(self):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
def free(self):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 79, True, False), \
ooxcb.VoidCookie())
def copy_colormap_and_free_checked(self, mid):
mid = get_internal(mid)
src_cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", mid, src_cmap))
def copy_colormap_and_free(self, mid):
mid = get_internal(mid)
src_cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", mid, src_cmap))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 80, True, False), \
ooxcb.VoidCookie())
def install_checked(self):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
def install(self):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 81, True, False), \
ooxcb.VoidCookie())
def uninstall_checked(self):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
def uninstall(self):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 82, True, False), \
ooxcb.VoidCookie())
def alloc_color(self, red, green, blue):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHHHxx", cmap, red, green, blue))
def alloc_color_unchecked(self, red, green, blue):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHHHxx", cmap, red, green, blue))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 84, False, False), \
AllocColorCookie(),
AllocColorReply)
def alloc_named_color(self, name):
name_len = len(name)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", cmap, name_len))
def alloc_named_color_unchecked(self, name):
name_len = len(name)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", cmap, name_len))
buf.write(make_array(name, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 85, False, False), \
AllocNamedColorCookie(),
AllocNamedColorReply)
def alloc_color_cells(self, contiguous, colors, planes):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHH", contiguous, cmap, colors, planes))
def alloc_color_cells_unchecked(self, contiguous, colors, planes):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHH", contiguous, cmap, colors, planes))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 86, False, False), \
AllocColorCellsCookie(),
AllocColorCellsReply)
def alloc_color_planes(self, contiguous, colors, reds, greens, blues):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHHHH", contiguous, cmap, colors, reds, greens, blues))
def alloc_color_planes_unchecked(self, contiguous, colors, reds, greens, blues):
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHHHH", contiguous, cmap, colors, reds, greens, blues))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 87, False, False), \
AllocColorPlanesCookie(),
AllocColorPlanesReply)
def free_colors_checked(self, pixels, plane_mask):
pixels_len = len(pixels)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", cmap, plane_mask))
def free_colors(self, pixels, plane_mask):
pixels_len = len(pixels)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", cmap, plane_mask))
buf.write(make_array(pixels, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 88, True, False), \
ooxcb.VoidCookie())
def store_colors_checked(self, items):
items_len = len(items)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
def store_colors(self, items):
items_len = len(items)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
for elt in items:
elt.build(buf)
def store_named_color_checked(self, flags, pixel, name):
name_len = len(name)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIHxx", flags, cmap, pixel, name_len))
buf.write(make_array(name, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 90, True, True), \
ooxcb.VoidCookie())
def store_named_color(self, flags, pixel, name):
name_len = len(name)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIHxx", flags, cmap, pixel, name_len))
def query_colors(self, pixels):
pixels_len = len(pixels)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
buf.write(make_array(pixels, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 91, False, True), \
def query_colors_unchecked(self, pixels):
pixels_len = len(pixels)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cmap))
buf.write(make_array(pixels, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 91, False, False), \
def lookup_color(self, name):
name_len = len(name)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", cmap, name_len))
buf.write(make_array(name, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 92, False, True), \
def lookup_color_unchecked(self, name):
name_len = len(name)
cmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", cmap, name_len))
buf.write(make_array(name, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 92, False, False), \
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxx", self.status))
class GrabPointerReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxx", self.status))
class NameError(ooxcb.Error):
def __init__(self, conn):
ooxcb.Error.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class BadAtom(ooxcb.ProtocolException):
pass
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class Coloritem(ooxcb.Struct):
def __init__(self, conn):
ooxcb.Struct.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=IHHHBx", self.pixel, self.red, self.green, self.blue, self.flags))
class BadAccess(ooxcb.ProtocolException):
pass
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class Setupauthenticate(ooxcb.Struct):
def __init__(self, conn):
ooxcb.Struct.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=BxxxxxH", self.status, self.length))
count += 8
build_list(self.conn, stream, self.reason, 'B')
class GetScreenSaverReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHHBBxxxxxxxxxxxxxxxxxx", self.timeout, self.interval, self.prefer_blanking, self.allow_exposures))
class LengthError(ooxcb.Error):
def __init__(self, conn):
ooxcb.Error.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class ListFontsWithInfoCookie(ooxcb.Cookie):
pass
def query(self):
font = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", font))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 47, False, True), \
QueryFontCookie(),
QueryFontReply)
def query_unchecked(self):
font = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", font))
def query_text_extents(self, string):
string_len = len(string)
font = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=x", ))
buf.write(pack("=B", (string_len & 1)))
buf.write(pack("=xxI", font))
def query_text_extents_unchecked(self, string):
string_len = len(string)
font = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=x", ))
buf.write(pack("=B", (string_len & 1)))
buf.write(pack("=xxI", font))
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIIhhHHHBx", self.response_type, get_internal(self.event), get_internal(self.window), get_internal(self.above_sibling), self.x, self.y, self.width, self.height, self.border_width, self.override_redirect))
stream.write("\0" * (32 - (stream.tell() - root)))
class Setup(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=BxHHHIIIIHHBBBBBBBBxxxx", self.status, self.protocol_major_version, self.protocol_minor_version, self.length, self.release_number, self.resource_id_base, self.resource_id_mask, self.motion_buffer_size, self.vendor_len, self.maximum_request_length, self.roots_len, self.pixmap_formats_len, self.image_byte_order, self.bitmap_format_bit_order, self.bitmap_format_scanline_unit, self.bitmap_format_scanline_pad, self.min_keycode, self.max_keycode))
count += 40
build_list(self.conn, stream, self.vendor, 'B')
build_list(self.conn, stream, self.pixmap_formats, Format)
build_list(self.conn, stream, self.roots, Screen)
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIII", self.response_type, self.time, get_internal(self.owner), get_internal(self.selection)))
stream.write("\0" * (32 - (stream.tell() - root)))
class GetSelectionOwnerCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class ListHostsReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxHxxxxxxxxxxxxxxxxxxxxxx", self.mode, self.hosts_len))
count += 32
build_list(self.conn, stream, self.hosts, Host)
class GetModifierMappingReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", self.keycodes_per_modifier))
count += 32
build_list(self.conn, stream, self.keycodes, 'B')
class GetPointerMappingReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", self.map_len))
count += 32
build_list(self.conn, stream, self.map, 'B')
class DestroyNotifyEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxII", self.response_type, get_internal(self.event), get_internal(self.window)))
stream.write("\0" * (32 - (stream.tell() - root)))
class QueryKeymapReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHHHxxI", self.red, self.green, self.blue, self.pixel))
class BadName(ooxcb.ProtocolException):
pass
def build(self, stream):
count = 0
stream.write(pack("=hhHHhh", self.x, self.y, self.width, self.height, self.angle1, self.angle2))
@classmethod
def create(cls, conn, x, y, width, height, angle1, angle2):
arc = cls(conn)
def close_checked(self):
font = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", font))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 46, True, True), \
ooxcb.VoidCookie())
def close(self):
font = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", font))
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIHHHHHxx", self.response_type, get_internal(self.window), self.x, self.y, self.width, self.height, self.count))
stream.write("\0" * (32 - (stream.tell() - root)))
class GravityNotifyEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIhh", self.response_type, get_internal(self.event), get_internal(self.window), self.x, self.y))
stream.write("\0" * (32 - (stream.tell() - root)))
class GrabKeyboardReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxx", self.status))
class ListPropertiesReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHxxxxxxxxxxxxxxxxxxxxxx", self.atoms_len))
count += 32
build_list(self.conn, stream, self.atoms, 'I')
class ListExtensionsReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", self.names_len))
count += 32
build_list(self.conn, stream, self.names, Str)
class AllocNamedColorCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class UnmapNotifyEvent(ooxcb.Event):
event_name = "on_unmap_notify"
opcode = 18
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIBxxx", self.response_type, get_internal(self.event), get_internal(self.window), self.from_configure))
stream.write("\0" * (32 - (stream.tell() - root)))
class Setupfailed(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=BBHHH", self.status, self.reason_len, self.protocol_major_version, self.protocol_minor_version, self.length))
count += 8
build_list(self.conn, stream, self.reason, 'B')
class IDChoiceError(ooxcb.Error):
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class AllocColorCellsReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHHxxxxxxxxxxxxxxxxxxxx", self.pixels_len, self.masks_len))
count += 32
build_list(self.conn, stream, self.pixels, 'I')
build_list(self.conn, stream, self.masks, 'I')
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIhhHHHH", self.response_type, self.stack_mode, get_internal(self.parent), get_internal(self.window), get_internal(self.sibling), self.x, self.y, self.width, self.height, self.border_width, self.value_mask))
stream.write("\0" * (32 - (stream.tell() - root)))
class BadImplementation(ooxcb.ProtocolException):
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class Setuprequest(ooxcb.Struct):
def __init__(self, conn):
ooxcb.Struct.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=BxHHHHxx", self.byte_order, self.protocol_major_version, self.protocol_minor_version, self.authorization_protocol_name_len, self.authorization_protocol_data_len))
count += 12
build_list(self.conn, stream, self.authorization_protocol_name, 'B')
build_list(self.conn, stream, self.authorization_protocol_data, 'B')
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=B", self.response_type))
count += 1
build_list(self.conn, stream, self.keys, 'B')
stream.write("\0" * (32 - (stream.tell() - root)))
def build(self, stream):
count = 0
stream.write(pack("=IBBHIIIxxxx", self.visual_id, self._class, self.bits_per_rgb_value, self.colormap_entries, self.red_mask, self.green_mask, self.blue_mask))
class BadFont(ooxcb.ProtocolException):
pass
def free_checked(self):
cursor = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cursor))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 95, True, True), \
ooxcb.VoidCookie())
def free(self):
cursor = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cursor))
def recolor_checked(self, fore_red, fore_green, fore_blue, back_red, back_green, back_blue):
cursor = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHHHHHH", cursor, fore_red, fore_green, fore_blue, back_red, back_green, back_blue))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 96, True, True), \
ooxcb.VoidCookie())
def recolor(self, fore_red, fore_green, fore_blue, back_red, back_green, back_blue):
cursor = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHHHHHH", cursor, fore_red, fore_green, fore_blue, back_red, back_green, back_blue))
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class AllocColorCellsCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
stream.write(pack("=hh", self.x, self.y))
class BadColormap(ooxcb.ProtocolException):
pass
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIHBx", self.response_type, get_internal(self.drawable), self.minor_opcode, self.major_opcode))
stream.write("\0" * (32 - (stream.tell() - root)))
class BadPixmap(ooxcb.ProtocolException):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxIHHHHHH", self.pixel, self.exact_red, self.exact_green, self.exact_blue, self.visual_red, self.visual_green, self.visual_blue))
class GetImageCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIIhhhhHBB", self.response_type, self.detail, self.time, get_internal(self.root), get_internal(self.event), get_internal(self.child), self.root_x, self.root_y, self.event_x, self.event_y, self.state, self.mode, self.same_screen_focus))
stream.write("\0" * (32 - (stream.tell() - root)))
class MapRequestEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxII", self.response_type, get_internal(self.parent), get_internal(self.window)))
stream.write("\0" * (32 - (stream.tell() - root)))
class QueryPointerCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class AccessError(ooxcb.Error):
def __init__(self, conn):
ooxcb.Error.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class GrabKeyboardCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIIhhhhHBx", self.response_type, self.detail, self.time, get_internal(self.root), get_internal(self.event), get_internal(self.child), self.root_x, self.root_y, self.event_x, self.event_y, self.state, self.same_screen))
stream.write("\0" * (32 - (stream.tell() - root)))
class QueryTextExtentsCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=hhHH", self.x, self.y, self.width, self.height))
@classmethod
def create(cls, conn, x, y, width, height):
rect = cls(conn)
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxIIIxxxxxxxxxxxx", self.format, get_internal(self.type), self.bytes_after, self.value_len))
count += 32
build_list(self.conn, stream, self.value, 'B')
@property
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHHHHHH", self.exact_red, self.exact_green, self.exact_blue, self.visual_red, self.visual_green, self.visual_blue))
class GetImageReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxIxxxxxxxxxxxxxxxxxxxx", self.depth, self.visual))
count += 32
build_list(self.conn, stream, self.data, 'B')
class Screen(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=IIIIIHHHHHHIBBBB", get_internal(self.root), get_internal(self.default_colormap), self.white_pixel, self.black_pixel, self.current_input_masks, self.width_in_pixels, self.height_in_pixels, self.width_in_millimeters, self.height_in_millimeters, self.min_installed_maps, self.max_installed_maps, self.root_visual, self.backing_stores, self.save_unders, self.root_depth, self.allowed_depths_len))
count += 40
build_list(self.conn, stream, self.allowed_depths, Depth)
def get_active_window(self):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIIhhBxxx", self.response_type, get_internal(self.event), get_internal(self.window), get_internal(self.parent), self.x, self.y, self.override_redirect))
stream.write("\0" * (32 - (stream.tell() - root)))
class ClientMessageEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxII", self.response_type, self.format, get_internal(self.window), get_internal(self.type)))
count += 12
self.data.build(stream)
stream.write("\0" * (32 - (stream.tell() - root)))
def build(self, stream):
count = 0
stream.write(pack("=BxH", self.family, self.address_len))
count += 4
build_list(self.conn, stream, self.address, 'B')
class Char2b(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=BB", self.byte1, self.byte2))
class InternAtomCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxx", self.name_len))
count += 8
self.min_bounds.build(stream)
count += 4
self.max_bounds.build(stream)
stream.write(pack("=xxxxHHHHBBBBhhI", self.min_char_or_byte2, self.max_char_or_byte2, self.default_char, self.properties_len, self.draw_direction, self.min_byte1, self.max_byte1, self.all_chars_exist, self.font_ascent, self.font_descent, self.replies_hint))
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxhhhhiii", self.draw_direction, self.font_ascent, self.font_descent, self.overall_ascent, self.overall_descent, self.overall_width, self.overall_left, self.overall_right))
class ButtonReleaseEvent(ooxcb.Event):
event_name = "on_button_release"
opcode = 5
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIIhhhhHBx", self.response_type, self.detail, self.time, get_internal(self.root), get_internal(self.event), get_internal(self.child), self.root_x, self.root_y, self.event_x, self.event_y, self.state, self.same_screen))
stream.write("\0" * (32 - (stream.tell() - root)))
class Charinfo(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=hhhhhH", self.left_side_bearing, self.right_side_bearing, self.character_width, self.ascent, self.descent, self.attributes))
class BadLength(ooxcb.ProtocolException):
pass
class xprotoExtension(ooxcb.Extension):
header = "xproto"
def create_window_checked(self, depth, wid, parent, x, y, width, height, border_width, _class, visual, value_mask, value_list):
wid = get_internal(wid)
parent = get_internal(parent)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIhhHHHHII", depth, wid, parent, x, y, width, height, border_width, _class, visual, value_mask))
def create_window(self, depth, wid, parent, x, y, width, height, border_width, _class, visual, value_mask, value_list):
wid = get_internal(wid)
parent = get_internal(parent)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIhhHHHHII", depth, wid, parent, x, y, width, height, border_width, _class, visual, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 1, True, False), \
ooxcb.VoidCookie())
def intern_atom(self, name, only_if_exists=False):
name_len = len(name)
buf = StringIO.StringIO()
buf.write(pack("=xBxxHxx", only_if_exists, name_len))
def intern_atom_unchecked(self, name, only_if_exists=False):
name_len = len(name)
buf = StringIO.StringIO()
buf.write(pack("=xBxxHxx", only_if_exists, name_len))
buf.write(make_array(name, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 16, False, False), \
InternAtomCookie(),
InternAtomReply)
def ungrab_pointer_checked(self, time=Time.CurrentTime):
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", time))
def ungrab_pointer(self, time=Time.CurrentTime):
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", time))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 27, True, False), \
ooxcb.VoidCookie())
def change_active_pointer_grab_checked(self, cursor, time, event_mask):
cursor = get_internal(cursor)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIHxx", cursor, time, event_mask))
def change_active_pointer_grab(self, cursor, time, event_mask):
cursor = get_internal(cursor)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIHxx", cursor, time, event_mask))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 30, True, False), \
ooxcb.VoidCookie())
def ungrab_keyboard_checked(self, time=0):
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", time))
def ungrab_keyboard(self, time=0):
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", time))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 32, True, False), \
ooxcb.VoidCookie())
def allow_events_checked(self, mode, time=0):
buf = StringIO.StringIO()
buf.write(pack("=xBxxI", mode, time))
def allow_events(self, mode, time=0):
buf = StringIO.StringIO()
buf.write(pack("=xBxxI", mode, time))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 35, True, False), \
ooxcb.VoidCookie())
def grab_server_checked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def grab_server(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 36, True, False), \
ooxcb.VoidCookie())
def ungrab_server_checked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def ungrab_server(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 37, True, False), \
ooxcb.VoidCookie())
def warp_pointer_checked(self, src_window, dst_window, src_x, src_y, src_width, src_height, dst_x, dst_y):
src_window = get_internal(src_window)
dst_window = get_internal(dst_window)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhhHHhh", src_window, dst_window, src_x, src_y, src_width, src_height, dst_x, dst_y))
def warp_pointer(self, src_window, dst_window, src_x, src_y, src_width, src_height, dst_x, dst_y):
src_window = get_internal(src_window)
dst_window = get_internal(dst_window)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhhHHhh", src_window, dst_window, src_x, src_y, src_width, src_height, dst_x, dst_y))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 41, True, False), \
ooxcb.VoidCookie())
def get_input_focus(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def get_input_focus_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 43, False, False), \
GetInputFocusCookie(),
GetInputFocusReply)
def query_keymap(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def query_keymap_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 44, False, False), \
QueryKeymapCookie(),
QueryKeymapReply)
def open_font_checked(self, fid, name):
name_len = len(name)
fid = get_internal(fid)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", fid, name_len))
def open_font(self, fid, name):
name_len = len(name)
fid = get_internal(fid)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", fid, name_len))
buf.write(make_array(name, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 45, True, False), \
ooxcb.VoidCookie())
def list_fonts(self, max_names, pattern):
pattern_len = len(pattern)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHH", max_names, pattern_len))
def list_fonts_unchecked(self, max_names, pattern):
pattern_len = len(pattern)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHH", max_names, pattern_len))
buf.write(make_array(pattern, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 49, False, False), \
ListFontsCookie(),
ListFontsReply)
def list_fonts_with_info(self, max_names, pattern):
pattern_len = len(pattern)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHH", max_names, pattern_len))
def list_fonts_with_info_unchecked(self, max_names, pattern):
pattern_len = len(pattern)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHH", max_names, pattern_len))
buf.write(make_array(pattern, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 50, False, False), \
ListFontsWithInfoCookie(),
ListFontsWithInfoReply)
def set_font_path_checked(self, path):
font_qty = len(path)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHxx", font_qty))
def set_font_path(self, path):
font_qty = len(path)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHxx", font_qty))
for item in path:
buf.write(make_array(item, "B") + "\x00")
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 51, True, False), \
ooxcb.VoidCookie())
def get_font_path(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def get_font_path_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 52, False, False), \
GetFontPathCookie(),
GetFontPathReply)
def create_pixmap_checked(self, depth, pid, drawable, width, height):
pid = get_internal(pid)
drawable = get_internal(drawable)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIHH", depth, pid, drawable, width, height))
def create_pixmap(self, depth, pid, drawable, width, height):
pid = get_internal(pid)
drawable = get_internal(drawable)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIHH", depth, pid, drawable, width, height))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 53, True, False), \
ooxcb.VoidCookie())
def create_g_c_checked(self, cid, drawable, value_mask, value_list):
cid = get_internal(cid)
drawable = get_internal(drawable)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", cid, drawable, value_mask))
def create_g_c(self, cid, drawable, value_mask, value_list):
cid = get_internal(cid)
drawable = get_internal(drawable)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", cid, drawable, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 55, True, False), \
ooxcb.VoidCookie())
def create_colormap_checked(self, alloc, mid, window, visual):
mid = get_internal(mid)
window = get_internal(window)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIII", alloc, mid, window, visual))
def create_colormap(self, alloc, mid, window, visual):
mid = get_internal(mid)
window = get_internal(window)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIII", alloc, mid, window, visual))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 78, True, False), \
ooxcb.VoidCookie())
def create_cursor_checked(self, cid, source, mask, fore_red, fore_green, fore_blue, back_red, back_green, back_blue, x, y):
cid = get_internal(cid)
source = get_internal(source)
mask = get_internal(mask)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIHHHHHHHH", cid, source, mask, fore_red, fore_green, fore_blue, back_red, back_green, back_blue, x, y))
def create_cursor(self, cid, source, mask, fore_red, fore_green, fore_blue, back_red, back_green, back_blue, x, y):
cid = get_internal(cid)
source = get_internal(source)
mask = get_internal(mask)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIHHHHHHHH", cid, source, mask, fore_red, fore_green, fore_blue, back_red, back_green, back_blue, x, y))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 93, True, False), \
def create_glyph_cursor_checked(self, cid, source_font, mask_font, source_char, mask_char, fore_red, fore_green, fore_blue, back_red, back_green, back_blue):
cid = get_internal(cid)
source_font = get_internal(source_font)
mask_font = get_internal(mask_font)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIHHHHHHHH", cid, source_font, mask_font, source_char, mask_char, fore_red, fore_green, fore_blue, back_red, back_green, back_blue))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 94, True, True), \
def create_glyph_cursor(self, cid, source_font, mask_font, source_char, mask_char, fore_red, fore_green, fore_blue, back_red, back_green, back_blue):
cid = get_internal(cid)
source_font = get_internal(source_font)
mask_font = get_internal(mask_font)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIHHHHHHHH", cid, source_font, mask_font, source_char, mask_char, fore_red, fore_green, fore_blue, back_red, back_green, back_blue))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 94, True, False), \
ooxcb.VoidCookie())
def query_extension(self, name):
name_len = len(name)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHxx", name_len))
def query_extension_unchecked(self, name):
name_len = len(name)
buf = StringIO.StringIO()
buf.write(pack("=xxxxHxx", name_len))
buf.write(make_array(name, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 98, False, False), \
QueryExtensionCookie(),
QueryExtensionReply)
def list_extensions(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def list_extensions_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 99, False, False), \
ListExtensionsCookie(),
ListExtensionsReply)
def change_keyboard_mapping_checked(self, keycode_count, first_keycode, keysyms_per_keycode, keysyms):
buf = StringIO.StringIO()
buf.write(pack("=xBxxBB", keycode_count, first_keycode, keysyms_per_keycode))
def change_keyboard_mapping(self, keycode_count, first_keycode, keysyms_per_keycode, keysyms):
buf = StringIO.StringIO()
buf.write(pack("=xBxxBB", keycode_count, first_keycode, keysyms_per_keycode))
buf.write(make_array(keysyms, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 100, True, False), \
ooxcb.VoidCookie())
def get_keyboard_mapping(self, first_keycode, count):
buf = StringIO.StringIO()
buf.write(pack("=xxxxBB", first_keycode, count))
def get_keyboard_mapping_unchecked(self, first_keycode, count):
buf = StringIO.StringIO()
buf.write(pack("=xxxxBB", first_keycode, count))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 101, False, False), \
GetKeyboardMappingCookie(),
GetKeyboardMappingReply)
value_mask |= 128
value_list.append(values["auto_repeat_mode"])
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 102, True, True), \
ooxcb.VoidCookie())
value_mask |= 128
value_list.append(values["auto_repeat_mode"])
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 102, True, False), \
ooxcb.VoidCookie())
def get_keyboard_control(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def get_keyboard_control_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 103, False, False), \
GetKeyboardControlCookie(),
GetKeyboardControlReply)
def bell_checked(self, percent=0):
buf = StringIO.StringIO()
buf.write(pack("=xbxx", percent))
def bell(self, percent=0):
buf = StringIO.StringIO()
buf.write(pack("=xbxx", percent))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 104, True, False), \
ooxcb.VoidCookie())
def change_pointer_control_checked(self, acceleration_numerator, acceleration_denominator, threshold, do_acceleration, do_threshold):
buf = StringIO.StringIO()
buf.write(pack("=xxxxhhhBB", acceleration_numerator, acceleration_denominator, threshold, do_acceleration, do_threshold))
def change_pointer_control(self, acceleration_numerator, acceleration_denominator, threshold, do_acceleration, do_threshold):
buf = StringIO.StringIO()
buf.write(pack("=xxxxhhhBB", acceleration_numerator, acceleration_denominator, threshold, do_acceleration, do_threshold))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 105, True, False), \
ooxcb.VoidCookie())
def get_pointer_control(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def get_pointer_control_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 106, False, False), \
GetPointerControlCookie(),
GetPointerControlReply)
def set_screen_saver_checked(self, timeout, interval, prefer_blanking, allow_exposures):
buf = StringIO.StringIO()
buf.write(pack("=xxxxhhBB", timeout, interval, prefer_blanking, allow_exposures))
def set_screen_saver(self, timeout, interval, prefer_blanking, allow_exposures):
buf = StringIO.StringIO()
buf.write(pack("=xxxxhhBB", timeout, interval, prefer_blanking, allow_exposures))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 107, True, False), \
ooxcb.VoidCookie())
def get_screen_saver(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def get_screen_saver_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 108, False, False), \
GetScreenSaverCookie(),
GetScreenSaverReply)
def change_hosts_checked(self, mode, family, address):
address_len = len(address)
buf = StringIO.StringIO()
buf.write(pack("=xBxxBxH", mode, family, address_len))
def change_hosts(self, mode, family, address):
address_len = len(address)
buf = StringIO.StringIO()
buf.write(pack("=xBxxBxH", mode, family, address_len))
buf.write(make_array(address, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 109, True, False), \
ooxcb.VoidCookie())
def list_hosts(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def list_hosts_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 110, False, False), \
ListHostsCookie(),
ListHostsReply)
def set_access_control_checked(self, mode):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", mode))
def set_access_control(self, mode):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", mode))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 111, True, False), \
ooxcb.VoidCookie())
def set_close_down_mode_checked(self, mode):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", mode))
def set_close_down_mode(self, mode):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", mode))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 112, True, False), \
ooxcb.VoidCookie())
def kill_client_checked(self, resource):
resource = resource.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", resource))
def kill_client(self, resource):
resource = resource.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", resource))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 113, True, False), \
ooxcb.VoidCookie())
def force_screen_saver_checked(self, mode):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", mode))
def force_screen_saver(self, mode):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", mode))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 115, True, False), \
ooxcb.VoidCookie())
def set_pointer_mapping(self, map):
map_len = len(map)
buf = StringIO.StringIO()
buf.write(pack("=xBxx", map_len))
def set_pointer_mapping_unchecked(self, map):
map_len = len(map)
buf = StringIO.StringIO()
buf.write(pack("=xBxx", map_len))
buf.write(make_array(map, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 116, False, False), \
SetPointerMappingCookie(),
SetPointerMappingReply)
def get_pointer_mapping(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def get_pointer_mapping_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 117, False, False), \
GetPointerMappingCookie(),
GetPointerMappingReply)
def set_modifier_mapping(self, keycodes_per_modifier, keycodes):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", keycodes_per_modifier))
def set_modifier_mapping_unchecked(self, keycodes_per_modifier, keycodes):
buf = StringIO.StringIO()
buf.write(pack("=xBxx", keycodes_per_modifier))
buf.write(make_array(keycodes, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 118, False, False), \
SetModifierMappingCookie(),
SetModifierMappingReply)
def get_modifier_mapping(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def get_modifier_mapping_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 119, False, False), \
GetModifierMappingCookie(),
GetModifierMappingReply)
def no_operation_checked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def no_operation(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 127, True, False), \
ooxcb.VoidCookie())
def list_all_fonts_with_info(self, max_names, pattern):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIIhhhhHBx", self.response_type, self.detail, self.time, get_internal(self.root), get_internal(self.event), get_internal(self.child), self.root_x, self.root_y, self.event_x, self.event_y, self.state, self.same_screen))
stream.write("\0" * (32 - (stream.tell() - root)))
class GetKeyboardControlReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxIBBHHxx", self.global_auto_repeat, self.led_mask, self.key_click_percent, self.bell_percent, self.bell_pitch, self.bell_duration))
count += 20
build_list(self.conn, stream, self.auto_repeats, 'B')
class GetPointerControlCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=B", self.name_len))
count += 1
build_list(self.conn, stream, self.name, 'B')
def __str__(self):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHxxIIIxxxxxxxx", self.pixels_len, self.red_mask, self.green_mask, self.blue_mask))
count += 32
build_list(self.conn, stream, self.pixels, 'I')
class CirculateNotifyEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIxxxxBxxx", self.response_type, get_internal(self.event), get_internal(self.window), self.place))
stream.write("\0" * (32 - (stream.tell() - root)))
class QueryExtensionCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxIxxxxxxxxxxxxxxxxxxxx", self.events_len))
count += 32
build_list(self.conn, stream, self.events, Timecoord)
class ListFontsReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHxxxxxxxxxxxxxxxxxxxxxx", self.names_len))
count += 32
build_list(self.conn, stream, self.names, Str)
class InternAtomReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxI", get_internal(self.atom)))
class KeyPressEvent(ooxcb.Event):
event_name = "on_key_press"
opcode = 2
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIIhhhhHBx", self.response_type, self.detail, self.time, get_internal(self.root), get_internal(self.event), get_internal(self.child), self.root_x, self.root_y, self.event_x, self.event_y, self.state, self.same_screen))
stream.write("\0" * (32 - (stream.tell() - root)))
class GetPointerControlReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHHHxxxxxxxxxxxxxxxxxx", self.acceleration_numerator, self.acceleration_denominator, self.threshold))
class GetFontPathCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIIhhhhHBB", self.response_type, self.detail, self.time, get_internal(self.root), get_internal(self.event), get_internal(self.child), self.root_x, self.root_y, self.event_x, self.event_y, self.state, self.mode, self.same_screen_focus))
stream.write("\0" * (32 - (stream.tell() - root)))
class QueryColorsCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class ListHostsCookie(ooxcb.Cookie):
pass
def free_checked(self):
pixmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", pixmap))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 54, True, True), \
ooxcb.VoidCookie())
def free(self):
pixmap = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", pixmap))
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIBxxx", self.response_type, get_internal(self.event), get_internal(self.window), self.override_redirect))
stream.write("\0" * (32 - (stream.tell() - root)))
class GetAtomNameReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHxxxxxxxxxxxxxxxxxxxxxx", self.name_len))
count += 32
build_list(self.conn, stream, self.name, 'B')
class Fontprop(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=II", get_internal(self.name), self.value))
class Window(Drawable):
def __init__(self, conn, xid):
ooxcb.Resource.__init__(self, conn, xid)
value_list.append(get_internal(values["cursor"]))
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", window, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 2, True, True), \
ooxcb.VoidCookie())
value_list.append(get_internal(values["cursor"]))
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", window, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 2, True, False), \
ooxcb.VoidCookie())
def get_attributes(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def get_attributes_unchecked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 3, False, False), \
GetWindowAttributesCookie(),
GetWindowAttributesReply)
def destroy_checked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def destroy(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 4, True, False), \
ooxcb.VoidCookie())
def destroy_subwindows_checked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def destroy_subwindows(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 5, True, False), \
ooxcb.VoidCookie())
def change_save_set_checked(self, mode):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxI", mode, window))
def change_save_set(self, mode):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxI", mode, window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 6, True, False), \
ooxcb.VoidCookie())
def reparent_checked(self, parent, x=0, y=0):
window = get_internal(self)
parent = get_internal(parent)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", window, parent, x, y))
def reparent(self, parent, x=0, y=0):
window = get_internal(self)
parent = get_internal(parent)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", window, parent, x, y))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 7, True, False), \
ooxcb.VoidCookie())
def map_checked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def map(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 8, True, False), \
ooxcb.VoidCookie())
def map_subwindows_checked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def map_subwindows(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 9, True, False), \
ooxcb.VoidCookie())
def unmap_checked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def unmap(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 10, True, False), \
ooxcb.VoidCookie())
def unmap_subwindows_checked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def unmap_subwindows(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 11, True, False), \
ooxcb.VoidCookie())
value_list.append(values["stack_mode"])
window = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxIH", window, value_mask))
buf.write(pack("=xx"))
if value_mask & ConfigWindow.X:
buf.write(pack("=i", value_list[0]))
del value_list[0]
if value_mask & ConfigWindow.Y:
buf.write(pack("=i", value_list[0]))
value_list.append(values["stack_mode"])
window = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxIH", window, value_mask))
buf.write(pack("=xx"))
if value_mask & ConfigWindow.X:
buf.write(pack("=i", value_list[0]))
del value_list[0]
if value_mask & ConfigWindow.Y:
buf.write(pack("=i", value_list[0]))
def circulate_window_checked(self, direction):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxI", direction, window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 13, True, True), \
ooxcb.VoidCookie())
def circulate_window(self, direction):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxI", direction, window))
def query_tree(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 15, False, True), \
QueryTreeCookie(),
QueryTreeReply)
def query_tree_unchecked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
if isinstance(type, basestring):
type = self.conn.atoms[type]
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIIBxxxI", mode, self.get_internal(), property.get_internal(), type.get_internal(), format, data_len))
buf.write(make_void_array(data, format))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 18, True, True), \
ooxcb.VoidCookie())
if isinstance(type, basestring):
type = self.conn.atoms[type]
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIIBxxxI", mode, self.get_internal(), property.get_internal(), type.get_internal(), format, data_len))
buf.write(make_void_array(data, format))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 18, True, False), \
ooxcb.VoidCookie())
def delete_property_checked(self, property):
if isinstance(property, basestring):
property = self.conn.atoms[property]
window = get_internal(self)
property = get_internal(property)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", window, property))
def delete_property(self, property):
if isinstance(property, basestring):
property = self.conn.atoms[property]
window = get_internal(self)
property = get_internal(property)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", window, property))
property = get_internal(property)
type = get_internal(type)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIIII", delete, window, property, type, long_offset, long_length))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 20, False, True), \
GetPropertyCookie(),
GetPropertyReply)
property = get_internal(property)
type = get_internal(type)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIIII", delete, window, property, type, long_offset, long_length))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 20, False, False), \
GetPropertyCookie(),
GetPropertyReply)
def list_properties(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def list_properties_unchecked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 21, False, False), \
ListPropertiesCookie(),
ListPropertiesReply)
def send_event_checked(self, event_mask, event, propagate=False):
destination = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", propagate, destination, event_mask))
def send_event(self, event_mask, event, propagate=False):
destination = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", propagate, destination, event_mask))
event.build(buf)
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 25, True, False), \
ooxcb.VoidCookie())
def grab_pointer(self, event_mask, owner_events=True, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async, confine_to=None, cursor=None, time=Time.CurrentTime):
grab_window = get_internal(self)
confine_to = get_internal(confine_to)
cursor = get_internal(cursor)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHBBIII", owner_events, grab_window, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time))
def grab_pointer_unchecked(self, event_mask, owner_events=True, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async, confine_to=None, cursor=None, time=Time.CurrentTime):
grab_window = get_internal(self)
confine_to = get_internal(confine_to)
cursor = get_internal(cursor)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHBBIII", owner_events, grab_window, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 26, False, False), \
def grab_button_checked(self, event_mask, button, modifiers, owner_events=True, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async, confine_to=None, cursor=None):
grab_window = get_internal(self)
confine_to = get_internal(confine_to)
cursor = get_internal(cursor)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHBBIIBxH", owner_events, grab_window, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, button, modifiers))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 28, True, True), \
def grab_button(self, event_mask, button, modifiers, owner_events=True, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async, confine_to=None, cursor=None):
grab_window = get_internal(self)
confine_to = get_internal(confine_to)
cursor = get_internal(cursor)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHBBIIBxH", owner_events, grab_window, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, button, modifiers))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 28, True, False), \
ooxcb.VoidCookie())
def ungrab_button_checked(self, button, modifiers):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHxx", button, grab_window, modifiers))
def ungrab_button(self, button, modifiers):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHxx", button, grab_window, modifiers))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 29, True, False), \
ooxcb.VoidCookie())
def grab_keyboard(self, owner_events=True, time=Time.CurrentTime, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIBBxx", owner_events, grab_window, time, pointer_mode, keyboard_mode))
def grab_keyboard_unchecked(self, owner_events=True, time=Time.CurrentTime, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIBBxx", owner_events, grab_window, time, pointer_mode, keyboard_mode))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 31, False, False), \
GrabKeyboardCookie(),
GrabKeyboardReply)
def grab_key_checked(self, key, modifiers, owner_events=True, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHBBBxxx", owner_events, grab_window, modifiers, key, pointer_mode, keyboard_mode))
def grab_key(self, key, modifiers, owner_events=True, pointer_mode=GrabMode.Async, keyboard_mode=GrabMode.Async):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHBBBxxx", owner_events, grab_window, modifiers, key, pointer_mode, keyboard_mode))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 33, True, False), \
ooxcb.VoidCookie())
def ungrab_key_checked(self, key, modifiers):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHxx", key, grab_window, modifiers))
def ungrab_key(self, key, modifiers):
grab_window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIHxx", key, grab_window, modifiers))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 34, True, False), \
ooxcb.VoidCookie())
def query_pointer(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def query_pointer_unchecked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 38, False, False), \
QueryPointerCookie(),
QueryPointerReply)
def get_motion_events(self, start, stop):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", window, start, stop))
def get_motion_events_unchecked(self, start, stop):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", window, start, stop))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 39, False, False), \
GetMotionEventsCookie(),
GetMotionEventsReply)
def translate_coordinates(self, dst_window, src_x, src_y):
src_window = get_internal(self)
dst_window = get_internal(dst_window)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", src_window, dst_window, src_x, src_y))
def translate_coordinates_unchecked(self, dst_window, src_x, src_y):
src_window = get_internal(self)
dst_window = get_internal(dst_window)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", src_window, dst_window, src_x, src_y))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 40, False, False), \
TranslateCoordinatesCookie(),
TranslateCoordinatesReply)
def set_input_focus_checked(self, revert_to=InputFocus.PointerRoot, time=Time.CurrentTime):
focus = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", revert_to, focus, time))
def set_input_focus(self, revert_to=InputFocus.PointerRoot, time=Time.CurrentTime):
focus = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", revert_to, focus, time))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 42, True, False), \
ooxcb.VoidCookie())
def clear_area_checked(self, x, y, width, height, exposures=False):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIhhHH", exposures, window, x, y, width, height))
def clear_area(self, x, y, width, height, exposures=False):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIhhHH", exposures, window, x, y, width, height))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 61, True, False), \
ooxcb.VoidCookie())
def list_installed_colormaps(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
def list_installed_colormaps_unchecked(self):
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", window))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 83, False, False), \
ListInstalledColormapsCookie(),
ListInstalledColormapsReply)
atoms_len = len(atoms_)
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHh", window, atoms_len, delta))
buf.write(make_array(atoms, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 114, True, True), \
ooxcb.VoidCookie())
atoms_len = len(atoms_)
window = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHh", window, atoms_len, delta))
buf.write(make_array(atoms, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 114, True, False), \
ooxcb.VoidCookie())
def build(self, stream):
count = 0
stream.write(pack("=Ihh", self.time, self.x, self.y))
class QueryBestSizeReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHH", self.width, self.height))
class VisibilityNotifyEvent(ooxcb.Event):
event_name = "on_visibility_notify"
opcode = 15
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIBxxx", self.response_type, get_internal(self.window), self.state))
stream.write("\0" * (32 - (stream.tell() - root)))
class FocusOutEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIBxxx", self.response_type, self.detail, get_internal(self.event), self.mode))
stream.write("\0" * (32 - (stream.tell() - root)))
class Format(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=BBBxxxxx", self.depth, self.bits_per_pixel, self.scanline_pad))
class ColormapNotifyEvent(ooxcb.Event):
event_name = "on_colormap_notify"
opcode = 32
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIBBxx", self.response_type, get_internal(self.window), get_internal(self.colormap), self.new, self.state))
stream.write("\0" * (32 - (stream.tell() - root)))
class CirculateRequestEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIxxxxBxxx", self.response_type, get_internal(self.event), get_internal(self.window), self.place))
stream.write("\0" * (32 - (stream.tell() - root)))
class QueryFontReply(ooxcb.Reply):
def build(self, stream):
count = 0
count += 8
self.min_bounds.build(stream)
count += 4
self.max_bounds.build(stream)
stream.write(pack("=xxxxHHHHBBBBhhI", self.min_char_or_byte2, self.max_char_or_byte2, self.default_char, self.properties_len, self.draw_direction, self.min_byte1, self.max_byte1, self.all_chars_exist, self.font_ascent, self.font_descent, self.char_infos_len))
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIhhHHHBx", self.response_type, get_internal(self.parent), get_internal(self.window), self.x, self.y, self.width, self.height, self.border_width, self.override_redirect))
stream.write("\0" * (32 - (stream.tell() - root)))
class ResizeRequestEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIHH", self.response_type, get_internal(self.window), self.width, self.height))
stream.write("\0" * (32 - (stream.tell() - root)))
class QueryColorsReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHxxxxxxxxxxxxxxxxxxxxxx", self.colors_len))
count += 32
build_list(self.conn, stream, self.colors, Rgb)
class MotionNotifyEvent(ooxcb.Event):
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIIIIhhhhHBx", self.response_type, self.detail, self.time, get_internal(self.root), get_internal(self.event), get_internal(self.child), self.root_x, self.root_y, self.event_x, self.event_y, self.state, self.same_screen))
stream.write("\0" * (32 - (stream.tell() - root)))
class Atom(ooxcb.Resource):
def __init__(self, conn, xid):
ooxcb.Resource.__init__(self, conn, xid)
def get_name(self):
atom = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", atom))
def get_name_unchecked(self):
atom = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", atom))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 17, False, False), \
GetAtomNameCookie(),
GetAtomNameReply)
def set_selection_owner_checked(self, owner=None, time=0):
owner = get_internal(owner)
selection = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", owner, selection, time))
def set_selection_owner(self, owner=None, time=0):
owner = get_internal(owner)
selection = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", owner, selection, time))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 22, True, False), \
ooxcb.VoidCookie())
def get_selection_owner(self):
selection = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", selection))
def get_selection_owner_unchecked(self):
selection = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", selection))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 23, False, False), \
GetSelectionOwnerCookie(),
GetSelectionOwnerReply)
def convert_selection_checked(self, requestor, target, property=None, time=0):
requestor = get_internal(requestor)
selection = get_internal(self)
target = get_internal(target)
property = get_internal(property)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIII", requestor, selection, target, property, time))
def convert_selection(self, requestor, target, property=None, time=0):
requestor = get_internal(requestor)
selection = get_internal(self)
target = get_internal(target)
property = get_internal(property)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIII", requestor, selection, target, property, time))
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxx", self.status))
class Segment(ooxcb.Struct):
def __init__(self, conn):
ooxcb.Struct.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=hhhh", self.x1, self.y1, self.x2, self.y2))
class ValueError(ooxcb.Error):
def __init__(self, conn):
ooxcb.Error.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class GetInputFocusReply(ooxcb.Reply):
def __init__(self, conn):
ooxcb.Reply.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxI", self.revert_to, get_internal(self.focus)))
class MappingNotifyEvent(ooxcb.Event):
event_name = "on_mapping_notify"
opcode = 34
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxBBBx", self.response_type, self.request, self.first_keycode, self.count))
stream.write("\0" * (32 - (stream.tell() - root)))
class GetGeometryReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxIhhHHHxx", self.depth, get_internal(self.root), self.x, self.y, self.width, self.height, self.border_width))
class SelectionRequestEvent(ooxcb.Event):
event_name = "on_selection_request"
opcode = 30
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIIIII", self.response_type, self.time, get_internal(self.owner), get_internal(self.requestor), get_internal(self.selection), get_internal(self.target), get_internal(self.property)))
stream.write("\0" * (32 - (stream.tell() - root)))
class BadWindow(ooxcb.ProtocolException):
def build(self, stream):
count = 0
stream.write(pack("=BxHxxxx", self.depth, self.visuals_len))
count += 8
build_list(self.conn, stream, self.visuals, Visualtype)
class ListExtensionsCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class FocusInEvent(ooxcb.Event):
event_name = "on_focus_in"
opcode = 9
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BBxxIBxxx", self.response_type, self.detail, get_internal(self.event), self.mode))
stream.write("\0" * (32 - (stream.tell() - root)))
class GContext(Fontable):
value_list.append(values["arc_mode"])
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", gc, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 56, True, True), \
ooxcb.VoidCookie())
value_list.append(values["arc_mode"])
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", gc, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 56, True, False), \
ooxcb.VoidCookie())
src_gc = get_internal(self)
dst_gc = get_internal(dst_gc)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", src_gc, dst_gc, value_mask))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 57, True, True), \
ooxcb.VoidCookie())
src_gc = get_internal(self)
dst_gc = get_internal(dst_gc)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIII", src_gc, dst_gc, value_mask))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 57, True, False), \
ooxcb.VoidCookie())
def set_dashes_checked(self, dash_offset, dashes):
dashes_len = len(dashes)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHH", gc, dash_offset, dashes_len))
def set_dashes(self, dash_offset, dashes):
dashes_len = len(dashes)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHH", gc, dash_offset, dashes_len))
buf.write(make_array(dashes, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 58, True, False), \
ooxcb.VoidCookie())
def set_clip_rectangles_checked(self, clip_x_origin, clip_y_origin, ordering, rectangles):
rectangles_len = len(rectangles)
gc = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xBxxIhh", ordering, gc, clip_x_origin, clip_y_origin))
def set_clip_rectangles(self, clip_x_origin, clip_y_origin, ordering, rectangles):
rectangles_len = len(rectangles)
gc = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xBxxIhh", ordering, gc, clip_x_origin, clip_y_origin))
for obj in rectangles:
obj.build(buf)
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 59, True, False), \
ooxcb.VoidCookie())
def free_checked(self):
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", gc))
def free(self):
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", gc))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 60, True, False), \
ooxcb.VoidCookie())
def copy_area_checked(self, src_drawable, dst_drawable, src_x, src_y, dst_x, dst_y, width, height):
src_drawable = get_internal(src_drawable)
dst_drawable = get_internal(dst_drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIhhhhHH", src_drawable, dst_drawable, gc, src_x, src_y, dst_x, dst_y, width, height))
def copy_area(self, src_drawable, dst_drawable, src_x, src_y, dst_x, dst_y, width, height):
src_drawable = get_internal(src_drawable)
dst_drawable = get_internal(dst_drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIhhhhHH", src_drawable, dst_drawable, gc, src_x, src_y, dst_x, dst_y, width, height))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 62, True, False), \
def copy_plane_checked(self, src_drawable, dst_drawable, src_x, src_y, dst_x, dst_y, width, height, bit_plane):
src_drawable = get_internal(src_drawable)
dst_drawable = get_internal(dst_drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIhhhhHHI", src_drawable, dst_drawable, gc, src_x, src_y, dst_x, dst_y, width, height, bit_plane))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 63, True, True), \
def copy_plane(self, src_drawable, dst_drawable, src_x, src_y, dst_x, dst_y, width, height, bit_plane):
src_drawable = get_internal(src_drawable)
dst_drawable = get_internal(dst_drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIIhhhhHHI", src_drawable, dst_drawable, gc, src_x, src_y, dst_x, dst_y, width, height, bit_plane))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 63, True, False), \
def poly_point_checked(self, drawable, points, coordinate_mode=0):
points_len = len(points)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", coordinate_mode, drawable, gc))
for elt in points:
buf.write(pack("=hh", *elt))
def poly_point(self, drawable, points, coordinate_mode=0):
points_len = len(points)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", coordinate_mode, drawable, gc))
for elt in points:
buf.write(pack("=hh", *elt))
def poly_line_checked(self, drawable, points, coordinate_mode=0):
points_len = len(points)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", coordinate_mode, drawable, gc))
for elt in points:
buf.write(pack("=hh", *elt))
def poly_line(self, drawable, points, coordinate_mode=0):
points_len = len(points)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxII", coordinate_mode, drawable, gc))
for elt in points:
buf.write(pack("=hh", *elt))
def poly_segment_checked(self, drawable, segments):
segments_len = len(segments)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", drawable, gc))
for elt in segments:
buf.write(pack("=hhhh", *elt))
def poly_segment(self, drawable, segments):
segments_len = len(segments)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", drawable, gc))
for elt in segments:
buf.write(pack("=hhhh", *elt))
def poly_rectangle_checked(self, drawable, rectangles):
gc = self.get_internal()
drawable = drawable.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", drawable, gc))
for rect in rectangles:
buf.write(pack("=hhHH", rect.x, rect.y, rect.width, rect.height))
def poly_rectangle(self, drawable, rectangles):
gc = self.get_internal()
drawable = drawable.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", drawable, gc))
for rect in rectangles:
buf.write(pack("=hhHH", rect.x, rect.y, rect.width, rect.height))
def poly_arc_checked(self, drawable, arcs):
arcs_length = len(arcs)
drawable = drawable.get_internal()
gc = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack('xxxxII', drawable, gc))
for obj in arcs:
def poly_arc(self, drawable, arcs):
arcs_length = len(arcs)
drawable = drawable.get_internal()
gc = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack('xxxxII', drawable, gc))
for obj in arcs:
def fill_poly_checked(self, drawable, points, shape=0, coordinate_mode=0):
points_len = len(points)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIBBxx", drawable, gc, shape, coordinate_mode))
for elt in points:
buf.write(pack("=hh", *elt))
def fill_poly(self, drawable, points, shape=0, coordinate_mode=0):
points_len = len(points)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIBBxx", drawable, gc, shape, coordinate_mode))
for elt in points:
buf.write(pack("=hh", *elt))
def poly_fill_rectangle_checked(self, drawable, rectangles):
gc = self.get_internal()
drawable = drawable.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", drawable, gc))
for rect in rectangles:
buf.write(pack("=hhHH", rect.x, rect.y, rect.width, rect.height))
def poly_fill_rectangle(self, drawable, rectangles):
gc = self.get_internal()
drawable = drawable.get_internal()
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", drawable, gc))
for rect in rectangles:
buf.write(pack("=hhHH", rect.x, rect.y, rect.width, rect.height))
def poly_fill_arc_checked(self, drawable, arcs):
arcs_length = len(arcs)
drawable = drawable.get_internal()
gc = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack('xxxxII', drawable, gc))
for obj in arcs:
def poly_fill_arc(self, drawable, arcs):
arcs_length = len(arcs)
drawable = drawable.get_internal()
gc = self.get_internal()
buf = StringIO.StringIO()
buf.write(pack('xxxxII', drawable, gc))
for obj in arcs:
def put_image_checked(self, drawable, format, width, height, dst_x, dst_y, depth, left_pad, data):
data_len = len(data)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIHHhhBBxx", format, drawable, gc, width, height, dst_x, dst_y, left_pad, depth))
buf.write(make_array(data, "B"))
def put_image(self, drawable, format, width, height, dst_x, dst_y, depth, left_pad, data):
data_len = len(data)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIHHhhBBxx", format, drawable, gc, width, height, dst_x, dst_y, left_pad, depth))
buf.write(make_array(data, "B"))
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", drawable, gc, x, y))
buf.write(make_array(items, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 74, True, True), \
ooxcb.VoidCookie())
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", drawable, gc, x, y))
buf.write(make_array(items, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 74, True, False), \
ooxcb.VoidCookie())
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", drawable, gc, x, y))
buf.write(make_array(items, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 75, True, True), \
ooxcb.VoidCookie())
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIhh", drawable, gc, x, y))
buf.write(make_array(items, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 75, True, False), \
ooxcb.VoidCookie())
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIhh", string_len, drawable, gc, x, y))
buf.write(make_array(string, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 76, True, True), \
ooxcb.VoidCookie())
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIhh", string_len, drawable, gc, x, y))
buf.write(make_array(string, "B"))
return self.conn.xproto.send_request(ooxcb.Request(self.conn, buf.getvalue(), 76, True, False), \
ooxcb.VoidCookie())
def image_text16_checked(self, drawable, x, y, string):
string_len = len(string)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIhh", string_len, drawable, gc, x, y))
def image_text16(self, drawable, x, y, string):
string_len = len(string)
drawable = get_internal(drawable)
gc = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xBxxIIhh", string_len, drawable, gc, x, y))
buf.write(string.encode("utf-16be"))
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class BadAlloc(ooxcb.ProtocolException):
pass
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxIIhhhhHxx", self.same_screen, get_internal(self.root), get_internal(self.child), self.root_x, self.root_y, self.win_x, self.win_y, self.mask))
class SelectionNotifyEvent(ooxcb.Event):
event_name = "on_selection_notify"
opcode = 31
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIIII", self.response_type, self.time, get_internal(self.requestor), get_internal(self.selection), get_internal(self.target), get_internal(self.property)))
stream.write("\0" * (32 - (stream.tell() - root)))
class SetModifierMappingCookie(ooxcb.Cookie):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxI", get_internal(self.owner)))
class WindowError(ooxcb.Error):
def __init__(self, conn):
ooxcb.Error.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=xxxxIHBx", self.bad_value, self.minor_opcode, self.major_opcode))
class PropertyNotifyEvent(ooxcb.Event):
event_name = "on_property_notify"
opcode = 28
def build(self, stream):
count = 0
root = stream.tell()
stream.write(pack("=BxxxIIIBxxx", self.response_type, get_internal(self.window), get_internal(self.atom), self.time, self.state))
stream.write("\0" * (32 - (stream.tell() - root)))
class GetFontPathReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxHxxxxxxxxxxxxxxxxxxxxxx", self.path_len))
count += 32
build_list(self.conn, stream, self.path, Str)
class GetKeyboardMappingReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", self.keysyms_per_keycode))
count += 32
build_list(self.conn, stream, self.keysyms, 'I')
_events = {
src/w/i/winappdbg-HEAD/trunk/examples/miscellaneous/find_alnum.py winappdbg(Download)
# $Id: find_alnum.py 670 2010-04-30 13:53:43Z qvasimodo $ from struct import pack from winappdbg import System, Process, HexDump # Iterator of alphanumeric executable addresses
address = mbi.BaseAddress
max_address = address + mbi.RegionSize
while address < max_address:
packed = pack(fmt, address)
if packed.isalnum():
yield address, packed
address = address + 1
src/o/o/ooxcb-1.1/ooxcb/protocol/render.py ooxcb(Download)
import cStringIO as StringIO
except ImportError:
import StringIO
from struct import pack, unpack, calcsize
from ooxcb.protocol.xproto import Drawable, Screen
from ooxcb.util import Mixin
def build(self, stream):
count = 0
stream.write(pack("=HHHHHHHH", self.red_shift, self.red_mask, self.green_shift, self.green_mask, self.blue_shift, self.blue_mask, self.alpha_shift, self.alpha_mask))
class ScreenMixin(Mixin):
target_class = Screen
def get_render_pictformat(self):
def build(self, stream):
count = 0
stream.write(pack("=BxHxxxx", self.depth, self.num_visuals))
count += 8
build_list(self.conn, stream, self.visuals, Pictvisual)
class PictureError(ooxcb.Error):
value_list.append(values["component_alpha"])
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", picture, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 5, True, True), \
ooxcb.VoidCookie())
value_list.append(values["component_alpha"])
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", picture, value_mask))
buf.write(make_array(value_list, "I"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 5, True, False), \
ooxcb.VoidCookie())
def set_clip_rectangles_checked(self, clip_x_origin, clip_y_origin, rectangles):
rectangles_len = len(rectangles)
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIhh", picture, clip_x_origin, clip_y_origin))
def set_clip_rectangles(self, clip_x_origin, clip_y_origin, rectangles):
rectangles_len = len(rectangles)
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIhh", picture, clip_x_origin, clip_y_origin))
for elt in rectangles:
elt.build(buf)
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 6, True, False), \
ooxcb.VoidCookie())
def free_checked(self):
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
def free(self):
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 7, True, False), \
ooxcb.VoidCookie())
def composite_checked(self, op, mask, dst, width, height, src_x=0, src_y=0, mask_x=0, mask_y=0, dst_x=0, dst_y=0):
src = get_internal(self)
mask = get_internal(mask)
dst = get_internal(dst)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhhhhhhHH", op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height))
def composite(self, op, mask, dst, width, height, src_x=0, src_y=0, mask_x=0, mask_y=0, dst_x=0, dst_y=0):
src = get_internal(self)
mask = get_internal(mask)
dst = get_internal(dst)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhhhhhhHH", op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 8, True, False), \
def trapezoids_checked(self, op, dst, traps, mask_format=None, src_x=0, src_y=0):
traps_len = len(traps)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
def trapezoids(self, op, dst, traps, mask_format=None, src_x=0, src_y=0):
traps_len = len(traps)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
def triangles_checked(self, op, dst, triangles, mask_format=None, src_x=0, src_y=0):
triangles_len = len(triangles)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
def triangles(self, op, dst, triangles, mask_format=None, src_x=0, src_y=0):
triangles_len = len(triangles)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
def tri_strip_checked(self, op, dst, points, mask_format=None, src_x=0, src_y=0):
points_len = len(points)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
for elt in points:
buf.write(pack("=ii", *elt))
def tri_strip(self, op, dst, points, mask_format=None, src_x=0, src_y=0):
points_len = len(points)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
for elt in points:
buf.write(pack("=ii", *elt))
def tri_fan_checked(self, op, dst, points, mask_format=None, src_x=0, src_y=0):
points_len = len(points)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
for elt in points:
buf.write(pack("=ii", *elt))
def tri_fan(self, op, dst, points, mask_format=None, src_x=0, src_y=0):
points_len = len(points)
src = get_internal(self)
dst = get_internal(dst)
mask_format = get_internal(mask_format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIhh", op, src, dst, mask_format, src_x, src_y))
for elt in points:
buf.write(pack("=ii", *elt))
mask_format = get_internal(mask_format)
glyphset = get_internal(glyphset)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y))
buf.write(make_array(glyphcmds, "B"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 23, True, True), \
ooxcb.VoidCookie())
mask_format = get_internal(mask_format)
glyphset = get_internal(glyphset)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y))
buf.write(make_array(glyphcmds, "B"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 23, True, False), \
ooxcb.VoidCookie())
mask_format = get_internal(mask_format)
glyphset = get_internal(glyphset)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y))
buf.write(make_array(glyphcmds, "B"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 24, True, True), \
ooxcb.VoidCookie())
mask_format = get_internal(mask_format)
glyphset = get_internal(glyphset)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y))
buf.write(make_array(glyphcmds, "B"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 24, True, False), \
ooxcb.VoidCookie())
mask_format = get_internal(mask_format)
glyphset = get_internal(glyphset)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y))
buf.write(make_array(glyphcmds, "B"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 25, True, True), \
ooxcb.VoidCookie())
mask_format = get_internal(mask_format)
glyphset = get_internal(glyphset)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y))
buf.write(make_array(glyphcmds, "B"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 25, True, False), \
ooxcb.VoidCookie())
def fill_rectangles_checked(self, op, color, rects):
rects_len = len(rects)
dst = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxI", op, dst))
def fill_rectangles(self, op, color, rects):
rects_len = len(rects)
dst = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxBxxxI", op, dst))
color.build(buf)
for elt in rects:
def set_transform_checked(self, transform):
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
transform.build(buf)
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 28, True, True), \
ooxcb.VoidCookie())
def set_transform(self, transform):
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
def set_filter_checked(self, filter, values):
filter_len = len(filter)
values_len = len(values)
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", picture, filter_len))
buf.write(make_array(filter, "B"))
def set_filter(self, filter, values):
filter_len = len(filter)
values_len = len(values)
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIHxx", picture, filter_len))
buf.write(make_array(filter, "B"))
def add_traps_checked(self, traps, x_off=0, y_off=0):
traps_len = len(traps)
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIhh", picture, x_off, y_off))
for elt in traps:
elt.build(buf)
def add_traps(self, traps, x_off=0, y_off=0):
traps_len = len(traps)
picture = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIhh", picture, x_off, y_off))
for elt in traps:
elt.build(buf)
def reference_checked(self, existing):
gsid = get_internal(self)
existing = get_internal(existing)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", gsid, existing))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 18, True, True), \
ooxcb.VoidCookie())
def reference(self, existing):
gsid = get_internal(self)
existing = get_internal(existing)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", gsid, existing))
def free_checked(self):
glyphset = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", glyphset))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 19, True, True), \
ooxcb.VoidCookie())
def free(self):
glyphset = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", glyphset))
def add_glyphs_checked(self, glyphids, glyphs, data):
glyphs_len = len(glyphs)
data_len = len(data)
glyphset = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", glyphset, glyphs_len))
buf.write(make_array(glyphids, "I"))
def add_glyphs(self, glyphids, glyphs, data):
glyphs_len = len(glyphs)
data_len = len(data)
glyphset = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", glyphset, glyphs_len))
buf.write(make_array(glyphids, "I"))
def free_glyphs_checked(self, glyphs):
glyphs_len = len(glyphs)
glyphset = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", glyphset))
buf.write(make_array(glyphs, "I"))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 22, True, True), \
ooxcb.VoidCookie())
def free_glyphs(self, glyphs):
glyphs_len = len(glyphs)
glyphset = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", glyphset))
def build(self, stream):
count = 0
stream.write(pack("=II", self.visual, get_internal(self.format)))
class Spanfix(ooxcb.Struct):
def __init__(self, conn):
ooxcb.Struct.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=iii", self.l, self.r, self.y))
class DrawableMixin(Mixin):
target_class = Drawable
def query_filters(self):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", drawable))
def query_filters_unchecked(self):
drawable = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", drawable))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 29, False, False), \
QueryFiltersCookie(),
QueryFiltersReply)
def build(self, stream):
count = 0
stream.write(pack("=II", self.num_depths, get_internal(self.fallback)))
count += 8
build_list(self.conn, stream, self.depths, Pictdepth)
class Animcursorelt(ooxcb.Struct):
def build(self, stream):
count = 0
stream.write(pack("=II", get_internal(self.cursor), self.delay))
class GlyphSet(object):
@classmethod
def create(cls, conn, format):
def query_version(self, client_major_version, client_minor_version):
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", client_major_version, client_minor_version))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 0, False, True), \
QueryVersionCookie(),
QueryVersionReply)
def query_version_unchecked(self, client_major_version, client_minor_version):
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", client_major_version, client_minor_version))
def query_pict_formats(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 1, False, True), \
QueryPictFormatsCookie(),
QueryPictFormatsReply)
def query_pict_formats_unchecked(self):
buf = StringIO.StringIO()
buf.write(pack("=xxxx", ))
def create_picture_checked(self, pid, drawable, format, value_mask, value_list):
pid = get_internal(pid)
drawable = get_internal(drawable)
format = get_internal(format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIII", pid, drawable, format, value_mask))
buf.write(make_array(value_list, "I"))
def create_picture(self, pid, drawable, format, value_mask, value_list):
pid = get_internal(pid)
drawable = get_internal(drawable)
format = get_internal(format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIII", pid, drawable, format, value_mask))
buf.write(make_array(value_list, "I"))
def create_glyph_set_checked(self, gsid, format):
gsid = get_internal(gsid)
format = get_internal(format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", gsid, format))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 17, True, True), \
ooxcb.VoidCookie())
def create_glyph_set(self, gsid, format):
gsid = get_internal(gsid)
format = get_internal(format)
buf = StringIO.StringIO()
buf.write(pack("=xxxxII", gsid, format))
def create_cursor_checked(self, cid, source, x, y):
source = get_internal(source)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIHH", cid, source, x, y))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 27, True, True), \
ooxcb.VoidCookie())
def create_cursor(self, cid, source, x, y):
source = get_internal(source)
buf = StringIO.StringIO()
buf.write(pack("=xxxxIIHH", cid, source, x, y))
def create_anim_cursor_checked(self, cid, cursors):
cursors_len = len(cursors)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cid))
for elt in cursors:
elt.build(buf)
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 31, True, True), \
ooxcb.VoidCookie())
def create_anim_cursor(self, cid, cursors):
cursors_len = len(cursors)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", cid))
def create_solid_fill_checked(self, picture, color):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
color.build(buf)
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 33, True, True), \
ooxcb.VoidCookie())
def create_solid_fill(self, picture, color):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
def create_linear_gradient_checked(self, picture, p1, p2, num_stops, stops, colors):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
for elt in p1:
buf.write(pack("=ii", *elt))
for elt in p2:
buf.write(pack("=ii", *elt))
buf.write(pack("=I", num_stops))
def create_linear_gradient(self, picture, p1, p2, num_stops, stops, colors):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
for elt in p1:
buf.write(pack("=ii", *elt))
for elt in p2:
buf.write(pack("=ii", *elt))
buf.write(pack("=I", num_stops))
def create_radial_gradient_checked(self, picture, inner, outer, inner_radius, outer_radius, num_stops, stops, colors):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
for elt in inner:
buf.write(pack("=ii", *elt))
for elt in outer:
buf.write(pack("=ii", *elt))
buf.write(pack("=iiI", inner_radius, outer_radius, num_stops))
def create_radial_gradient(self, picture, inner, outer, inner_radius, outer_radius, num_stops, stops, colors):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
for elt in inner:
buf.write(pack("=ii", *elt))
for elt in outer:
buf.write(pack("=ii", *elt))
buf.write(pack("=iiI", inner_radius, outer_radius, num_stops))
def create_conical_gradient_checked(self, picture, center, angle, num_stops, stops, colors):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
for elt in center:
buf.write(pack("=ii", *elt))
buf.write(pack("=iI", angle, num_stops))
def create_conical_gradient(self, picture, center, angle, num_stops, stops, colors):
picture = get_internal(picture)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", picture))
for elt in center:
buf.write(pack("=ii", *elt))
buf.write(pack("=iI", angle, num_stops))
def build(self, stream):
count = 0
stream.write(pack("=IBBxx", get_internal(self.id), self.type, self.depth))
count += 8
self.direct.build(stream)
stream.write(pack("=I", self.colormap))
def build(self, stream):
count = 0
stream.write(pack("=ii", self.x, self.y))
class BadPictFormat(ooxcb.ProtocolException):
pass
def build(self, stream):
count = 0
stream.write(pack("=IHHHH", self.pixel, self.red, self.green, self.blue, self.alpha))
class Cursor(object):
@classmethod
def create(cls, conn, source, x=0, y=0):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxIxxxxxxxxxxxxxxxxxxxx", self.num_values))
count += 32
build_list(self.conn, stream, self.values, Indexvalue)
class QueryFiltersReply(ooxcb.Reply):
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxIIxxxxxxxxxxxxxxxx", self.num_aliases, self.num_filters))
count += 32
build_list(self.conn, stream, self.aliases, 'H')
build_list(self.conn, stream, self.filters, STR)
def build(self, stream):
count = 0
stream.write(pack("=ii", self.top, self.bottom))
count += 8
self.left.build(stream)
self.right.build(stream)
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxIIxxxxxxxxxxxxxxxx", self.major_version, self.minor_version))
class PictOpError(ooxcb.Error):
def __init__(self, conn):
ooxcb.Error.__init__(self, conn)
def build(self, stream):
count = 0
stream.write(pack("=HHhhhh", self.width, self.height, self.x, self.y, self.x_off, self.y_off))
class QueryPictFormatsCookie(ooxcb.Cookie):
pass
def build(self, stream):
count = 0
stream.write(pack("=HHHH", self.red, self.green, self.blue, self.alpha))
@classmethod
def create(cls, conn, red, green, blue, alpha):
self = cls(conn)
def build(self, stream):
count = 0
stream.write(pack("=iiiiiiiii", self.matrix11, self.matrix12, self.matrix13, self.matrix21, self.matrix22, self.matrix23, self.matrix31, self.matrix32, self.matrix33))
class Pictformat(ooxcb.Resource):
def __init__(self, conn, xid):
ooxcb.Resource.__init__(self, conn, xid)
def query_pict_index_values(self):
format = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", format))
def query_pict_index_values_unchecked(self):
format = get_internal(self)
buf = StringIO.StringIO()
buf.write(pack("=xxxxI", format))
return self.conn.render.send_request(ooxcb.Request(self.conn, buf.getvalue(), 2, False, False), \
QueryPictIndexValuesCookie(),
QueryPictIndexValuesReply)
def build(self, stream):
count = 0
stream.write(pack("=xxxxxxxxIIIIIxxxx", self.num_formats, self.num_screens, self.num_depths, self.num_visuals, self.num_subpixel))
count += 32
build_list(self.conn, stream, self.formats, Pictforminfo)
build_list(self.conn, stream, self.screens, Pictscreen)
build_list(self.conn, stream, self.subpixels, 'I')
src/w/i/winappdbg-HEAD/examples/miscellaneous/find_alnum.py winappdbg(Download)
# $Id: find_alnum.py 670 2010-04-30 13:53:43Z qvasimodo $ from struct import pack from winappdbg import System, Process, HexDump # Iterator of alphanumeric executable addresses
address = mbi.BaseAddress
max_address = address + mbi.RegionSize
while address < max_address:
packed = pack(fmt, address)
if packed.isalnum():
yield address, packed
address = address + 1
src/w/i/winappdbg-1.4/examples/miscellaneous/find_alnum.py winappdbg(Download)
# $Id: find_alnum.py 670 2010-04-30 13:53:43Z qvasimodo $ from struct import pack from winappdbg import System, Process, HexDump # Iterator of alphanumeric executable addresses
address = mbi.BaseAddress
max_address = address + mbi.RegionSize
while address < max_address:
packed = pack(fmt, address)
if packed.isalnum():
yield address, packed
address = address + 1
src/t/a/tablib-HEAD/tablib/packages/xlwt/BIFFRecords.py tablib(Download)
# -*- coding: cp1252 -*-
from struct import pack
from UnicodeUtils import upack1, upack2
import sys
class SharedStringTable(object):
_SST_ID = 0x00FC
def get_biff_record(self):
self._sst_record = ''
self._continues = [None, None]
self._current_piece = pack('<II', 0, 0)
data = [(idx, s) for s, idx in self._str_indexes.iteritems()]
data.sort() # in index order
for idx, s in data:
if self._tally[idx] == 0:
s = u''
self._add_to_sst(s)
del data
self._new_piece()
self._continues[0] = pack('<2HII', self._SST_ID, len(self._sst_record), self._add_calls, len(self._str_indexes))
def _new_piece(self):
if self._sst_record == '':
self._sst_record = self._current_piece
else:
curr_piece_len = len(self._current_piece)
self._continues.append(pack('<2H%ds'%curr_piece_len, self._CONTINUE_ID, curr_piece_len, self._current_piece))
self._current_piece = ''
def get_rec_header(self):
return pack('<2H', self._REC_ID, len(self._rec_data))
# Not over-ridden by any child classes, never called (except by "get"; see below).
# def get_rec_data(self):
# return self._rec_data
chunk = data[pos:chunk_pos]
chunks.append(chunk)
pos = chunk_pos
continues = pack('<2H', self._REC_ID, len(chunks[0])) + chunks[0]
for chunk in chunks[1:]:
continues += pack('<2H%ds'%len(chunk), 0x003C, len(chunk), chunk)
# 0x003C -- CONTINUE record id
file_hist_flags = 0x00L
ver_can_read = 0x06L
self._rec_data = pack('<4H2I', version, rec_type, build, year, file_hist_flags, ver_can_read)
class InteraceHdrRecord(BiffRecord):
_REC_ID = 0x00E1
def __init__(self):
self._rec_data = pack('BB', 0xB0, 0x04)
def __init__(self):
self._rec_data = pack('<H', 0x00)
class WriteAccessRecord(BiffRecord):
"""
This record is part of the file protection. It contains the name of the
def __init__(self, owner):
uowner = owner[0:0x30]
uowner_len = len(uowner)
self._rec_data = pack('%ds%ds' % (uowner_len, 0x70 - uowner_len), uowner, ' '*(0x70 - uowner_len))
class DSFRecord(BiffRecord):
def __init__(self):
self._rec_data = pack('<H', 0x00)
class TabIDRecord(BiffRecord):
_REC_ID = 0x013D
def __init__(self, sheetcount):
for i in range(sheetcount):
self._rec_data += pack('<H', i+1)
def __init__(self):
self._rec_data = pack('BB', 0x0E, 0x00)
class WindowProtectRecord(BiffRecord):
"""
This record is part of the worksheet/workbook protection. It determines
whether the window configuration of this document is protected. Window
protection is not active, if this record is omitted.
"""
_REC_ID = 0x0019
def __init__(self, wndprotect):
self._rec_data = pack('<H', wndprotect)
def __init__(self, objprotect):
self._rec_data = pack('<H', objprotect)
class ScenProtectRecord(BiffRecord):
"""
This record is part of the worksheet/workbook protection. It
def __init__(self, scenprotect):
self._rec_data = pack('<H', scenprotect)
class ProtectRecord(BiffRecord):
"""
This record is part of the worksheet/workbook protection. It specifies
def __init__(self, protect):
self._rec_data = pack('<H', protect)
class PasswordRecord(BiffRecord):
"""
This record is part of the worksheet/workbook protection. It
def __init__(self, passwd = ""):
self._rec_data = pack('<H', self.passwd_hash(passwd))
class Prot4RevRecord(BiffRecord):
_REC_ID = 0x01AF
def __init__(self):
self._rec_data = pack('<H', 0x00)
def __init__(self):
self._rec_data = pack('<H', 0x00)
class BackupRecord(BiffRecord):
"""
This record contains a Boolean value determining whether Excel makes
a backup of the file while saving.
"""
_REC_ID = 0x0040
def __init__(self, backup):
self._rec_data = pack('<H', backup)
def __init__(self):
self._rec_data = pack('<H', 0x00)
class RefreshAllRecord(BiffRecord):
"""
"""
_REC_ID = 0x01B7
def __init__(self):
self._rec_data = pack('<H', 0x00)
def __init__(self):
self._rec_data = pack('<H', 0x00)
class CountryRecord(BiffRecord):
"""
This record stores two Windows country identifiers. The first
def __init__(self, ui_id, sys_settings_id):
self._rec_data = pack('<2H', ui_id, sys_settings_id)
class UseSelfsRecord(BiffRecord):
"""
This record specifies if the formulas in the workbook can use natural
def __init__(self):
self._rec_data = pack('<H', 0x01)
class EOFRecord(BiffRecord):
_REC_ID = 0x000A
def __init__(self, from1904):
if from1904:
self._rec_data = pack('<H', 1)
else:
self._rec_data = pack('<H', 0)
def __init__(self, use_real_values):
if use_real_values:
self._rec_data = pack('<H', 1)
else:
self._rec_data = pack('<H', 0)
def __init__(self):
self._rec_data = pack('<H', self.UTF_16)
class Window1Record(BiffRecord):
"""
Offset Size Contents
0 2 Horizontal position of the document window (in twips = 1/20 of a point)
def __init__(self,
hpos_twips, vpos_twips,
width_twips, height_twips,
flags,
active_sheet,
first_tab_index, selected_tabs, tab_width):
self._rec_data = pack('<9H', hpos_twips, vpos_twips,
uname = upack1(name)
uname_len = len(uname)
self._rec_data = pack('<5H4B%ds' % uname_len, height, options, colour_index, weight, escapement,
underline, family, charset, 0x00,
uname)
def __init__(self, idx, fmtstr):
ufmtstr = upack2(fmtstr)
ufmtstr_len = len(ufmtstr)
self._rec_data = pack('<H%ds' % ufmtstr_len, idx, ufmtstr)
def __init__(self, xf, xftype='cell'):
font_xf_idx, fmt_str_xf_idx, alignment, borders, pattern, protection = xf
fnt = pack('<H', font_xf_idx)
fmt = pack('<H', fmt_str_xf_idx)
if xftype == 'cell':
prt = pack('<H',
((protection.cell_locked & 0x01) << 0) |
((protection.formula_hidden & 0x01) << 1)
)
else:
prt = pack('<H', 0xFFF5)
aln = pack('B',
((alignment.wrap & 0x01) << 3) |
((alignment.vert & 0x07) << 4)
)
rot = pack('B', alignment.rota)
txt = pack('B',
((alignment.inde & 0x0F) << 0) |
((alignment.shri & 0x01) << 4) |
((alignment.merg & 0x01) << 5) |
((alignment.dire & 0x03) << 6)
)
if xftype == 'cell':
used_attr = pack('B', 0xF8)
else:
used_attr = pack('B', 0xF4)
borders.bottom_colour = 0x00
if borders.diag == borders.NO_LINE:
borders.diag_colour = 0x00
brd1 = pack('<L',
((borders.left & 0x0F) << 0 ) |
((borders.right & 0x0F) << 4 ) |
((borders.top & 0x0F) << 8 ) |
((borders.bottom & 0x0F) << 12) |
((borders.left_colour & 0x7F) << 16) |
((borders.right_colour & 0x7F) << 23) |
((borders.need_diag1 & 0x01) << 30) |
((borders.need_diag2 & 0x01) << 31)
)
brd2 = pack('<L',
((borders.diag & 0x0F) << 21) |
((pattern.pattern & 0x3F) << 26)
)
pat = pack('<H',
((pattern.pattern_fore_colour & 0x7F) << 0 ) |
((pattern.pattern_back_colour & 0x7F) << 7 )
)
def __init__(self):
self._rec_data = pack('<HBB', 0x8000, 0x00, 0xFF)
# TODO: implement user-defined styles???
class PaletteRecord(BiffRecord):
"""
def __init__(self, stream_pos, visibility, sheetname, encoding='ascii'):
usheetname = upack1(sheetname, encoding)
uusheetname_len = len(usheetname)
self._rec_data = pack('<LBB%ds' % uusheetname_len, stream_pos, visibility, 0x00, usheetname)
str_counter += 1
exsst_str_count_delta = max(8, len(str_placement)*8/0x2000) # maybe smth else?
self._rec_data = pack('<H', exsst_str_count_delta)
str_counter = 0
while str_counter < len(str_placement):
self._rec_data += pack('<IHH', extsst[str_counter][1], extsst[str_counter][0], 0)
def __init__(self, first_used_row, last_used_row, first_used_col, last_used_col):
if first_used_row > last_used_row or first_used_col > last_used_col:
# Special case: empty worksheet
first_used_row = first_used_col = 0
last_used_row = last_used_col = -1
self._rec_data = pack('<2L3H',
first_used_row, last_used_row + 1,
def __init__(self, options, first_visible_row, first_visible_col,
grid_colour, preview_magn, normal_magn, scl_magn):
self._rec_data = pack('<7HL', options,
first_visible_row, first_visible_col,
grid_colour,
0x00,
preview_magn, normal_magn,
0x00L)
if scl_magn:
self._scl_rec = pack('<4H', 0x00A0, 4, scl_magn, 100)
def __init__(self, px, py, first_row_bottom, first_col_right, active_pane):
self._rec_data = pack('<5H',
px, py,
first_row_bottom, first_col_right,
active_pane)
def __init__(self, index, first_col, last_col, height_options, options):
self._rec_data = pack('<6HL', index, first_col, last_col + 1,
height_options,
0x00, 0x00,
options)
class LabelSSTRecord(BiffRecord):
def __init__(self, row, col, xf_idx, sst_idx):
self._rec_data = pack('<3HL', row, col, xf_idx, sst_idx)
class MergedCellsRecord(BiffRecord):
"""
This record contains all merged cell ranges of the current sheet.
merged = ''
while (i >= 0) and (j < 0x403):
r1, r2, c1, c2 = merged_list[i]
merged += pack('<4H', r1, r2, c1, c2)
i -= 1
j += 1
self._rec_data += pack('<3H', self._REC_ID, len(merged) + 2, j) + \
def __init__(self, row, first_col, last_col, xf_index):
blanks_count = last_col-first_col+1
self._rec_data = pack('%dH' % blanks_count, *([xf_index]*blanks_count))
self._rec_data = pack('<2H', row, first_col) + self._rec_data + pack('<H', last_col)
class BlankRecord(BiffRecord):
def __init__(self, row, col, xf_index):
self._rec_data = pack('<3H', row, col, xf_index)
class RKRecord(BiffRecord):
"""
This record represents a cell that contains an RK value (encoded integer or
floating-point value). If a floating-point value cannot be encoded to an RK value,
a NUMBER record will be written.
"""
_REC_ID = 0x027E
def __init__(self, row, col, xf_index, rk_encoded):
self._rec_data = pack('<3Hi', row, col, xf_index, rk_encoded)
def __init__(self, row, col, xf_index, number):
self._rec_data = pack('<3Hd', row, col, xf_index, number)
class BoolErrRecord(BiffRecord):
"""
This record represents a cell that contains a boolean or error value.
"""
_REC_ID = 0x0205
def __init__(self, row, col, xf_index, number, is_error):
self._rec_data = pack('<3HBB', row, col, xf_index, number, is_error)
def __init__(self, row, col, xf_index, rpn, calc_flags=0):
self._rec_data = pack('<3HQHL', row, col, xf_index, 0xFFFF000000000003, calc_flags & 3, 0) + rpn
class GutsRecord(BiffRecord):
"""
This record contains information about the layout of outline symbols.
def __init__(self, row_gut_width, col_gut_height, row_visible_levels, col_visible_levels):
self._rec_data = pack('<4H', row_gut_width, col_gut_height, row_visible_levels, col_visible_levels)
class WSBoolRecord(BiffRecord):
"""
This record stores a 16 bit value with Boolean options for the current
sheet. From BIFF5 on the "Save external linked values" option is moved
def __init__(self, options):
self._rec_data = pack('<H', options)
class ColInfoRecord(BiffRecord):
"""
This record specifies the width for a given range of columns.
If a column does not have a corresponding COLINFO record,
def __init__(self, first_col, last_col, width, xf_index, options):
self._rec_data = pack('<6H', first_col, last_col, width, xf_index, options, 0)
class CalcModeRecord(BiffRecord):
"""
This record is part of the Calculation Settings Block.
It specifies whether to calculate formulas manually,
def __init__(self, calc_mode):
self._rec_data = pack('<h', calc_mode)
class CalcCountRecord(BiffRecord):
"""
This record is part of the Calculation Settings Block. It specifies the maximum
def __init__(self, calc_count):
self._rec_data = pack('<H', calc_count)
class RefModeRecord(BiffRecord):
"""
This record is part of the Calculation Settings Block.
It stores which method is used to show cell addresses in formulas.
def __init__(self, ref_mode):
self._rec_data = pack('<H', ref_mode)
class IterationRecord(BiffRecord):
"""
This record is part of the Calculation Settings Block.
It stores if iterations are allowed while calculating recursive formulas.
def __init__(self, iterations_on):
self._rec_data = pack('<H', iterations_on)
class DeltaRecord(BiffRecord):
"""
This record is part of the Calculation Settings Block.
It stores the maximum change of the result to exit an iteration.
def __init__(self, delta):
self._rec_data = pack('<d', delta)
class SaveRecalcRecord(BiffRecord):
"""
This record is part of the Calculation Settings Block.
It contains the “Recalculate before save” option in
def __init__(self, recalc):
self._rec_data = pack('<H', recalc)
class PrintHeadersRecord(BiffRecord):
"""
This record stores if the row and column headers
(the areas with row numbers and column letters) will be printed.
def __init__(self, print_headers):
self._rec_data = pack('<H', print_headers)
class PrintGridLinesRecord(BiffRecord):
"""
This record stores if sheet grid lines will be printed.
def __init__(self, print_grid):
self._rec_data = pack('<H', print_grid)
class GridSetRecord(BiffRecord):
"""
This record specifies if the option to print sheet grid lines
def __init__(self, print_grid_changed):
self._rec_data = pack('<H', print_grid_changed)
class DefaultRowHeightRecord(BiffRecord):
"""
This record specifies the default height and default flags
def __init__(self, options, def_height):
self._rec_data = pack('<2H', options, def_height)
class DefColWidthRecord(BiffRecord):
"""
This record specifies the default column width for columns that
def __init__(self, def_width):
self._rec_data = pack('<H', options, def_width)
class HorizontalPageBreaksRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It contains all
horizontal manual page breaks.
def __init__(self, breaks_list):
self._rec_data = pack('<H', len(breaks_list))
for r, c1, c2 in breaks_list:
self._rec_data += pack('<3H', r, c1, c2)
class VerticalPageBreaksRecord(BiffRecord):
"""
def __init__(self, breaks_list):
self._rec_data = pack('<H', len(breaks_list))
for r, c1, c2 in breaks_list:
self._rec_data += pack('<3H', r, c1, c2)
class HeaderRecord(BiffRecord):
"""
def __init__(self, is_horz_center):
self._rec_data = pack('<H', is_horz_center)
class VCenterRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It specifies if the
def __init__(self, is_vert_center):
self._rec_data = pack('<H', is_vert_center)
class LeftMarginRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It contains the left
def __init__(self, margin):
self._rec_data = pack('<d', margin)
class RightMarginRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It contains the right
def __init__(self, margin):
self._rec_data = pack('<d', margin)
class TopMarginRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It contains the top
page margin of the current worksheet.
def __init__(self, margin):
self._rec_data = pack('<d', margin)
class BottomMarginRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It contains the bottom
def __init__(self, margin):
self._rec_data = pack('<d', margin)
class SetupPageRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It stores the page
format settings of the current sheet. The pages may be scaled in
def __init__(self, paper, scaling, start_num, fit_width_to, fit_height_to,
options,
hres, vres,
header_margin, footer_margin,
num_copies):
self._rec_data = pack('<8H2dH', paper, scaling, start_num,
fit_width_to, fit_height_to, \
uname_len = len(uname)
#~ self._rec_data = pack('<HBBHHHBBBB%ds%ds' % (uname_len, len(rpn)), options, keyboard_shortcut, uname_len, len(rpn), 0x0000, sheet_index, len(menu_text), len(desc_text), len(help_text), len(status_text), uname, rpn) + menu_text + desc_text + help_text + status_text
self._rec_data = pack('<HBBHHHBBBBB%ds%ds' % (uname_len, len(rpn)), options, keyboard_shortcut, uname_len, len(rpn), 0x0000, sheet_index, 0x00, len(menu_text), len(desc_text), len(help_text), len(status_text), uname, rpn) + menu_text + desc_text + help_text + status_text
# Excel (both 2003 and 2007) don't like refs
# split over a record boundary, which is what the
chunk = self.refs[idx:idx+_maxRefPerRecord]
krefs = len(chunk)
if idx: # CONTINUE record
header = pack("<HH", 0x003C, 6 * krefs)
else: # ExternSheetRecord
header = pack("<HHH", self._REC_ID, 6 * krefs + 2, nrefs)
res.append(header)
res.extend([pack("<HHH", *r) for r in chunk])
def __init__(self, num_sheets):
self._rec_data = pack('<HBB', num_sheets, 0x01, 0x04)
class XcallSupBookRecord(SupBookRecord):
"""
Add-in function names are stored in EXTERNNAME records following this record.
def __init__(self):
self._rec_data = pack('<HBB', 1, 0x01, 0x3A)
class ExternnameRecord(BiffRecord):
"""
Record EXTERNNAME for external names and Analysis add-in functions, BIFF5-BIFF8:
def __init__(self, options=0, index=0, name=None, fmla=None):
self._rec_data = pack('<HHH', options, index, 0) + upack1(name) + fmla
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next