class GetState(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(1), rq.RequestLength(), rq.Window('window'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Bool('state'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Window('window'), rq.Pad(20), )
class GetScreenCount(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(2), rq.RequestLength(), rq.Window('window'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Card8('screen_count'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Window('window'), rq.Pad(20), )
class GetOverlayWindow(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(7), rq.RequestLength(), rq.Window('window') ) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Window('overlay_window'), rq.Pad(20), )
class QueryTree(rq.ReplyRequest): _request = rq.Struct(rq.Opcode(15), rq.Pad(1), rq.RequestLength(), rq.Window('window')) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Window('root'), rq.Window('parent', (X.NONE, )), rq.LengthOf('children', 2), rq.Pad(14), rq.List('children', rq.WindowObj), )
class Combine(rq.Request): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(3), rq.RequestLength(), OP('operation'), KIND('destination_kind'), KIND('source_kind'), rq.Pad(1), rq.Window('destination_window'), rq.Int16('x_offset'), rq.Int16('y_offset'), rq.Window('source_window'), )
class GrabButton(rq.Request): _request = rq.Struct( rq.Opcode(28), rq.Bool('owner_events'), rq.RequestLength(), rq.Window('grab_window'), rq.Card16('event_mask'), rq.Set('pointer_mode', 1, (X.GrabModeSync, X.GrabModeAsync)), rq.Set('keyboard_mode', 1, (X.GrabModeSync, X.GrabModeAsync)), rq.Window('confine_to', (X.NONE,)), rq.Cursor('cursor', (X.NONE,)), rq.Card8('button'), rq.Pad(1), rq.Card16('modifiers'), )
class XIPassiveGrabDevice(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(54), rq.RequestLength(), rq.Card32('time'), rq.Window('grab_window'), rq.Cursor('cursor', (X.NONE, )), rq.Card32('detail'), DEVICEID('deviceid'), rq.LengthOf('modifiers', 2), rq.LengthOf('mask', 2), rq.Set('grab_type', 1, (GrabtypeButton, GrabtypeKeycode, GrabtypeEnter, GrabtypeFocusIn, GrabtypeTouchBegin)), rq.Set('grab_mode', 1, (GrabModeSync, GrabModeAsync)), rq.Set('paired_device_mode', 1, (GrabModeSync, GrabModeAsync)), rq.Bool('owner_events'), rq.Pad(2), Mask('mask'), rq.List('modifiers', rq.Card32), ) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.LengthOf('modifiers', 2), rq.Pad(22), rq.List('modifiers', rq.Card32), )
class XIGrabDevice(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(51), rq.RequestLength(), rq.Window('grab_window'), rq.Card32('time'), rq.Cursor('cursor', (X.NONE, )), DEVICEID('deviceid'), rq.Set('grab_mode', 1, (GrabModeSync, GrabModeAsync)), rq.Set('paired_device_mode', 1, (GrabModeSync, GrabModeAsync)), rq.Bool('owner_events'), rq.Pad(1), rq.LengthOf('mask', 2), Mask('mask'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card8('status'), rq.Pad(23), )
class QueryExtents(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(5), rq.RequestLength(), rq.Window('destination_window'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card8('bounding_shaped'), rq.Card8('clip_shaped'), rq.Pad(2), rq.Int16('bounding_shape_extents_x'), rq.Int16('bounding_shape_extents_y'), rq.Card16('bounding_shape_extents_width'), rq.Card16('bounding_shape_extents_height'), rq.Int16('clip_shape_extents_x'), rq.Int16('clip_shape_extents_y'), rq.Card16('clip_shape_extents_width'), rq.Card16('clip_shape_extents_height'), )
class FakeInput(object): _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(2), rq.RequestLength(), rq.Set('event_type', 1, (X.KeyPress, X.KeyRelease, X.ButtonPress, X.ButtonRelease, X.MotionNotify)), rq.Card8('detail'), rq.Pad(2), rq.Card32('time'), rq.Window('root', (X.NONE, )), rq.Pad(8), rq.Int16('x'), rq.Int16('y'), rq.Pad(8) ) def __init__(self, display, onerror = None, *args, **keys): self._errorhandler = onerror self._binary = self._request.to_binary(*args, **keys) self._serial = None display.send_request(self, onerror is not None) def _set_error(self, error): if self._errorhandler is not None: return call_error_handler(self._errorhandler, error, self) else: return 0
class CirculateWindow(rq.Request): _request = rq.Struct( rq.Opcode(13), rq.Set('direction', 1, (X.RaiseLowest, X.LowerHighest)), rq.RequestLength(), rq.Window('window'), )
class DestroySubWindows(rq.Request): _request = rq.Struct( rq.Opcode(5), rq.Pad(1), rq.RequestLength(), rq.Window('window') )
class ChangeSaveSet(rq.Request): _request = rq.Struct( rq.Opcode(6), rq.Set('mode', 1, (X.SetModeInsert, X.SetModeDelete)), rq.RequestLength(), rq.Window('window'), )
class MapWindow(rq.Request): _request = rq.Struct( rq.Opcode(8), rq.Pad(1), rq.RequestLength(), rq.Window('window') )
class UnmapSubwindows(rq.Request): _request = rq.Struct( rq.Opcode(11), rq.Pad(1), rq.RequestLength(), rq.Window('window') )
class CreateNotify(rq.Event): _code = X.CreateNotify _fields = rq.Struct( rq.Card8('type'), rq.Pad(1), rq.Card16('sequence_number'), rq.Window('parent'), rq.Window('window'), rq.Int16('x'), rq.Int16('y'), rq.Card16('width'), rq.Card16('height'), rq.Card16('border_width'), rq.Card8('override'), rq.Pad(9), )
class GetWindowAttributes(rq.ReplyRequest): _request = rq.Struct( rq.Opcode(3), rq.Pad(1), rq.RequestLength(), rq.Window('window') ) _reply = rq.Struct( rq.ReplyCode(), rq.Card8('backing_store'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card32('visual'), rq.Card16('win_class'), rq.Card8('bit_gravity'), rq.Card8('win_gravity'), rq.Card32('backing_bit_planes'), rq.Card32('backing_pixel'), rq.Card8('save_under'), rq.Card8('map_is_installed'), rq.Card8('map_state'), rq.Card8('override_redirect'), rq.Colormap('colormap', (X.NONE, )), rq.Card32('all_event_masks'), rq.Card32('your_event_mask'), rq.Card16('do_not_propagate_mask'), rq.Pad(2), )
class CreateWindow(rq.Request): _request = rq.Struct( rq.Opcode(1), rq.Card8('depth'), rq.RequestLength(), rq.Window('wid'), rq.Window('parent'), rq.Int16('x'), rq.Int16('y'), rq.Card16('width'), rq.Card16('height'), rq.Card16('border_width'), rq.Set('window_class', 2, (X.CopyFromParent, X.InputOutput, X.InputOnly)), rq.Card32('visual'), structs.WindowValues('attrs'), )
class ChangeWindowAttributes(rq.Request): _request = rq.Struct( rq.Opcode(2), rq.Pad(1), rq.RequestLength(), rq.Window('window'), structs.WindowValues('attrs'), )
class DeleteProperty(rq.Request): _request = rq.Struct( rq.Opcode(19), rq.Pad(1), rq.RequestLength(), rq.Window('window'), rq.Card32('property'), )
class FakeInput(rq.Request): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(2), rq.RequestLength(), rq.Set('event_type', 1, (X.KeyPress, X.KeyRelease, X.ButtonPress, X.ButtonRelease, X.MotionNotify)), rq.Card8('detail'), rq.Pad(2), rq.Card32('time'), rq.Window('root', (X.NONE, )), rq.Pad(8), rq.Int16('x'), rq.Int16('y'), rq.Pad(8))
class ConfigureRequest(rq.Event): _code = X.ConfigureRequest _fields = rq.Struct( rq.Card8('type'), rq.Card8('stack_mode'), rq.Card16('sequence_number'), rq.Window('parent'), rq.Window('window'), rq.Window('sibling', (X.NONE, )), rq.Int16('x'), rq.Int16('y'), rq.Card16('width'), rq.Card16('height'), rq.Card16('border_width'), rq.Card16('value_mask'), rq.Pad(4), )
class CreateRegionFromBorderClip(rq.Request): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(5), rq.RequestLength(), rq.Card32('region'), # FIXME: this should be a Region from XFIXES extension rq.Window('window'), )
class SetOutputPrimary(rq.Request): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(30), rq.RequestLength(), rq.Window('window'), rq.Card32('output'), )
class NameWindowPixmap(rq.Request): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(6), rq.RequestLength(), rq.Window('window'), rq.Pixmap('pixmap'), )
class ConfigureNotify(rq.Event): _code = X.ConfigureNotify _fields = rq.Struct( rq.Card8('type'), rq.Pad(1), rq.Card16('sequence_number'), rq.Window('event'), rq.Window('window'), rq.Window('above_sibling', (X.NONE, )), rq.Int16('x'), rq.Int16('y'), rq.Card16('width'), rq.Card16('height'), rq.Card16('border_width'), rq.Card8('override'), rq.Pad(5), )
class ScreenChangeNotify(rq.Event): _code = None _fields = rq.Struct( rq.Card8('type'), rq.Card8('rotation'), rq.Card16('sequence_number'), rq.Card32('timestamp'), rq.Card32('config_timestamp'), rq.Window('root'), rq.Window('window'), rq.Card16('size_id'), rq.Card16('subpixel_order'), rq.Card16('width_in_pixels'), rq.Card16('height_in_pixels'), rq.Card16('width_in_millimeters'), rq.Card16('height_in_millimeters'), )
class UngrabKey(rq.Request): _request = rq.Struct( rq.Opcode(34), rq.Card8('key'), rq.RequestLength(), rq.Window('grab_window'), rq.Card16('modifiers'), rq.Pad(2), )
class UngrabButton(rq.Request): _request = rq.Struct( rq.Opcode(29), rq.Card8('button'), rq.RequestLength(), rq.Window('grab_window'), rq.Card16('modifiers'), rq.Pad(2), )
class SetInputFocus(rq.Request): _request = rq.Struct( rq.Opcode(42), rq.Set('revert_to', 1, (X.RevertToNone, X.RevertToPointerRoot, X.RevertToParent)), rq.RequestLength(), rq.Window('focus'), rq.Card32('time'), )