# Xlib.ext.xinput -- XInput extension module
#
#    Copyright (C) 2012 Outpost Embedded, LLC
#      Forest Bond <forest.bond@rapidrollout.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
#    Free Software Foundation, Inc.,
#    59 Temple Place,
#    Suite 330,
#    Boston, MA 02111-1307 USA

'''
A very incomplete implementation of the XInput extension.
'''

import sys
import array
import struct

# Python 2/3 compatibility.
from six import integer_types

from Xlib.protocol import rq
from Xlib import X


extname = 'XInputExtension'

PropertyDeleted = 0
PropertyCreated = 1
PropertyModified = 2

NotifyNormal = 0
NotifyGrab = 1
NotifyUngrab = 2
NotifyWhileGrabbed = 3
NotifyPassiveGrab = 4
NotifyPassiveUngrab = 5

NotifyAncestor = 0
NotifyVirtual = 1
NotifyInferior = 2
NotifyNonlinear = 3
NotifyNonlinearVirtual = 4
NotifyPointer = 5
NotifyPointerRoot = 6
NotifyDetailNone = 7

GrabtypeButton = 0
GrabtypeKeycode = 1
GrabtypeEnter = 2
GrabtypeFocusIn = 3
GrabtypeTouchBegin = 4

AnyModifier = (1 << 31)
AnyButton = 0
AnyKeycode = 0

AsyncDevice = 0
SyncDevice = 1
ReplayDevice = 2
AsyncPairedDevice = 3
AsyncPair = 4
SyncPair = 5

SlaveSwitch = 1
DeviceChange = 2

MasterAdded = (1 << 0)
MasterRemoved = (1 << 1)
SlaveAdded = (1 << 2)
SlaveRemoved = (1 << 3)
SlaveAttached = (1 << 4)
SlaveDetached = (1 << 5)
DeviceEnabled = (1 << 6)
DeviceDisabled = (1 << 7)

AddMaster = 1
RemoveMaster = 2
AttachSlave = 3
DetachSlave = 4

AttachToMaster = 1
Floating = 2

ModeRelative = 0
ModeAbsolute = 1

MasterPointer = 1
MasterKeyboard = 2
SlavePointer = 3
SlaveKeyboard = 4
FloatingSlave = 5

KeyClass = 0
ButtonClass = 1
ValuatorClass = 2
ScrollClass = 3
TouchClass = 8

KeyRepeat = (1 << 16)

AllDevices = 0
AllMasterDevices = 1

DeviceChanged = 1
KeyPress = 2
KeyRelease = 3
ButtonPress = 4
ButtonRelease = 5
Motion = 6
Enter = 7
Leave = 8
FocusIn = 9
FocusOut = 10
HierarchyChanged = 11
PropertyEvent = 12
RawKeyPress = 13
RawKeyRelease = 14
RawButtonPress = 15
RawButtonRelease = 16
RawMotion = 17

DeviceChangedMask = (1 << DeviceChanged)
KeyPressMask = (1 << KeyPress)
KeyReleaseMask = (1 << KeyRelease)
ButtonPressMask = (1 << ButtonPress)
ButtonReleaseMask = (1 << ButtonRelease)
MotionMask = (1 << Motion)
EnterMask = (1 << Enter)
LeaveMask = (1 << Leave)
FocusInMask = (1 << FocusIn)
FocusOutMask = (1 << FocusOut)
HierarchyChangedMask = (1 << HierarchyChanged)
PropertyEventMask = (1 << PropertyEvent)
RawKeyPressMask = (1 << RawKeyPress)
RawKeyReleaseMask = (1 << RawKeyRelease)
RawButtonPressMask = (1 << RawButtonPress)
RawButtonReleaseMask = (1 << RawButtonRelease)
RawMotionMask = (1 << RawMotion)

GrabModeSync = 0
GrabModeAsync = 1
GrabModeTouch = 2

DEVICEID = rq.Card16
DEVICE = rq.Card16
DEVICEUSE = rq.Card8

class FP1616(rq.Int32):

    def check_value(self, value):
        return int(value * 65536.0)

    def parse_value(self, value, display):
        return float(value) / float(1 << 16)

class FP3232(rq.ValueField):
    structcode = 'lL'
    structvalues = 2

    def check_value(self, value):
        return value

    def parse_value(self, value, display):
        integral, frac = value
        ret = float(integral)
        # optimised math.ldexp(float(frac), -32)
        ret += float(frac) * (1.0 / (1 << 32))
        return ret

class XIQueryVersion(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(47),
        rq.RequestLength(),
        rq.Card16('major_version'),
        rq.Card16('minor_version'),
        )
    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Pad(1),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Card16('major_version'),
        rq.Card16('minor_version'),
        rq.Pad(20),
        )


def query_version(self):
    return XIQueryVersion(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        major_version=2,
        minor_version=0,
        )

class Mask(rq.List):

    def __init__(self, name):
        rq.List.__init__(self, name, rq.Card32, pad=0)

    def pack_value(self, val):

        mask_seq = array.array(rq.struct_to_array_codes['L'])

        if isinstance(val, integer_types):
            # We need to build a "binary mask" that (as far as I can tell) is
            # encoded in native byte order from end to end.  The simple case is
            # with a single unsigned 32-bit value, for which we construct an
            # array with just one item.  For values too big to fit inside 4
            # bytes we build a longer array, being careful to maintain native
            # byte order across the entire set of values.
            if sys.byteorder == 'little':
                def fun(val):
                    mask_seq.insert(0, val)
            elif sys.byteorder == 'big':
                fun = mask_seq.append
            else:
                raise AssertionError(sys.byteorder)
            while val:
                fun(val & 0xFFFFFFFF)
                val = val >> 32
        else:
            mask_seq.extend(val)

        return mask_seq.tostring(), len(mask_seq), None

EventMask = rq.Struct(
    DEVICE('deviceid'),
    rq.LengthOf('mask', 2),
    Mask('mask'),
)


class XISelectEvents(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(46),
        rq.RequestLength(),
        rq.Window('window'),
        rq.LengthOf('masks', 2),
        rq.Pad(2),
        rq.List('masks', EventMask),
    )

def select_events(self, event_masks):
    '''
    select_events(event_masks)

    event_masks:
      Sequence of (deviceid, mask) pairs, where deviceid is a numerical device
      ID, or AllDevices or AllMasterDevices, and mask is either an unsigned
      integer or sequence of 32 bits unsigned values
    '''
    return XISelectEvents(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        window=self,
        masks=event_masks,
    )

AnyInfo = rq.Struct(
    rq.Card16('type'),
    rq.Card16('length'),
    rq.Card16('sourceid'),
    rq.Pad(2),
)

class ButtonMask(object):

    def __init__(self, value, length):
        self._value = value
        self._length = length

    def __len__(self):
        return self._length

    def __getitem__(self, key):
        return self._value & (1 << key)

    def __str__(self):
        return repr(self)

    def __repr__(self):
        return '0b{value:0{width}b}'.format(value=self._value,
                                            width=self._length)

class ButtonState(rq.ValueField):

    structcode = None

    def __init__(self, name):
        rq.ValueField.__init__(self, name)

    def parse_binary_value(self, data, display, length, fmt):
        # Mask: bitfield of <length> button states.
        mask_len = 4 * ((((length + 7) >> 3) + 3) >> 2)
        mask_data = data[:mask_len]
        mask_value = 0
        for byte in reversed(struct.unpack('={0:d}B'.format(mask_len), mask_data)):
            mask_value <<= 8
            mask_value |= byte
        data = data[mask_len:]
        assert (mask_value & 1) == 0
        return ButtonMask(mask_value >> 1, length), data

ButtonInfo = rq.Struct(
    rq.Card16('type'),
    rq.Card16('length'),
    rq.Card16('sourceid'),
    rq.LengthOf(('state', 'labels'), 2),
    ButtonState('state'),
    rq.List('labels', rq.Card32),
)

KeyInfo = rq.Struct(
    rq.Card16('type'),
    rq.Card16('length'),
    rq.Card16('sourceid'),
    rq.LengthOf('keycodes', 2),
    rq.List('keycodes', rq.Card32),
)

ValuatorInfo = rq.Struct(
    rq.Card16('type'),
    rq.Card16('length'),
    rq.Card16('sourceid'),
    rq.Card16('number'),
    rq.Card32('label'),
    FP3232('min'),
    FP3232('max'),
    FP3232('value'),
    rq.Card32('resolution'),
    rq.Card8('mode'),
    rq.Pad(3),
)

ScrollInfo = rq.Struct(
    rq.Card16('type'),
    rq.Card16('length'),
    rq.Card16('sourceid'),
    rq.Card16('number'),
    rq.Card16('scroll_type'),
    rq.Pad(2),
    rq.Card32('flags'),
    FP3232('increment'),
)

TouchInfo = rq.Struct(
    rq.Card16('type'),
    rq.Card16('length'),
    rq.Card16('sourceid'),
    rq.Card8('mode'),
    rq.Card8('num_touches'),
)

INFO_CLASSES = {
    KeyClass: KeyInfo,
    ButtonClass: ButtonInfo,
    ValuatorClass: ValuatorInfo,
    ScrollClass: ScrollInfo,
    TouchClass: TouchInfo,
}

class ClassInfoClass(object):

    structcode = None

    def parse_binary(self, data, display):
        class_type, length = struct.unpack('=HH', data[:4])
        class_struct = INFO_CLASSES.get(class_type, AnyInfo)
        class_data, _ = class_struct.parse_binary(data, display)
        data = data[length * 4:]
        return class_data, data

ClassInfo = ClassInfoClass()

DeviceInfo = rq.Struct(
    DEVICEID('deviceid'),
    rq.Card16('use'),
    rq.Card16('attachment'),
    rq.LengthOf('classes', 2),
    rq.LengthOf('name', 2),
    rq.Bool('enabled'),
    rq.Pad(1),
    rq.String8('name', 4),
    rq.List('classes', ClassInfo),
)

class XIQueryDevice(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(48),
        rq.RequestLength(),
        DEVICEID('deviceid'),
        rq.Pad(2),
    )

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Pad(1),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.LengthOf('devices', 2),
        rq.Pad(22),
        rq.List('devices', DeviceInfo),
        )

def query_device(self, deviceid):
    return XIQueryDevice(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        deviceid=deviceid,
        )

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),
        )

def grab_device(self, deviceid, time, grab_mode, paired_device_mode, owner_events, event_mask):
    return XIGrabDevice(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        deviceid=deviceid,
        grab_window=self,
        time=time,
        cursor=X.NONE,
        grab_mode=grab_mode,
        paired_device_mode=paired_device_mode,
        owner_events=owner_events,
        mask=event_mask,
        )

class XIUngrabDevice(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(52),
        rq.RequestLength(),
        rq.Card32('time'),
        DEVICEID('deviceid'),
        rq.Pad(2),
    )

def ungrab_device(self, deviceid, time):
    return XIUngrabDevice(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        time=time,
        deviceid=deviceid,
    )

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),
        )

def passive_grab_device(self, deviceid, time, detail,
                        grab_type, grab_mode, paired_device_mode,
                        owner_events, event_mask, modifiers):
    return XIPassiveGrabDevice(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        deviceid=deviceid,
        grab_window=self,
        time=time,
        cursor=X.NONE,
        detail=detail,
        grab_type=grab_type,
        grab_mode=grab_mode,
        paired_device_mode=paired_device_mode,
        owner_events=owner_events,
        mask=event_mask,
        modifiers=modifiers,
        )

def grab_keycode(self, deviceid, time, keycode,
                 grab_mode, paired_device_mode,
                 owner_events, event_mask, modifiers):
    return passive_grab_device(self, deviceid, time, keycode,
                               GrabtypeKeycode,
                               grab_mode, paired_device_mode,
                               owner_events, event_mask, modifiers)

class XIPassiveUngrabDevice(rq.Request):

    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(55),
        rq.RequestLength(),
        rq.Window('grab_window'),
        rq.Card32('detail'),
        DEVICEID('deviceid'),
        rq.LengthOf('modifiers', 2),
        rq.Set('grab_type', 1, (GrabtypeButton, GrabtypeKeycode,
                                GrabtypeEnter, GrabtypeFocusIn,
                                GrabtypeTouchBegin)),
        rq.Pad(3),
        rq.List('modifiers', rq.Card32),
    )

def passive_ungrab_device(self, deviceid, detail, grab_type, modifiers):
    return XIPassiveUngrabDevice(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        deviceid=deviceid,
        grab_window=self,
        detail=detail,
        grab_type=grab_type,
        modifiers=modifiers,
        )

def ungrab_keycode(self, deviceid, keycode, modifiers):
    return passive_ungrab_device(self, deviceid, keycode,
                                 GrabtypeKeycode, modifiers)

HierarchyInfo = rq.Struct(
    DEVICEID('deviceid'),
    DEVICEID('attachment'),
    DEVICEUSE('type'),
    rq.Bool('enabled'),
    rq.Pad(2),
    rq.Card32('flags'),
)


HierarchyEventData = rq.Struct(
    DEVICEID('deviceid'),
    rq.Card32('time'),
    rq.Card32('flags'),
    rq.LengthOf('info', 2),
    rq.Pad(10),
    rq.List('info', HierarchyInfo),
)

ModifierInfo = rq.Struct(
    rq.Card32('base_mods'),
    rq.Card32('latched_mods'),
    rq.Card32('locked_mods'),
    rq.Card32('effective_mods'),
)

GroupInfo = rq.Struct(
    rq.Card8('base_group'),
    rq.Card8('latched_group'),
    rq.Card8('locked_group'),
    rq.Card8('effective_group'),
)

DeviceEventData = rq.Struct(
    DEVICEID('deviceid'),
    rq.Card32('time'),
    rq.Card32('detail'),
    rq.Window('root'),
    rq.Window('event'),
    rq.Window('child'),
    FP1616('root_x'),
    FP1616('root_y'),
    FP1616('event_x'),
    FP1616('event_y'),
    rq.LengthOf('buttons', 2),
    rq.Card16('valulators_len'),
    DEVICEID('sourceid'),
    rq.Pad(2),
    rq.Card32('flags'),
    rq.Object('mods', ModifierInfo),
    rq.Object('groups', GroupInfo),
    ButtonState('buttons'),
)

DeviceChangedEventData = rq.Struct(
    DEVICEID('deviceid'),
    rq.Card32('time'),
    rq.LengthOf('classes', 2),
    DEVICEID('sourceid'),
    rq.Card8('reason'),
    rq.Pad(11),
    rq.List('classes', ClassInfo),
)

def init(disp, info):
    disp.extension_add_method('display', 'xinput_query_version', query_version)
    disp.extension_add_method('window', 'xinput_select_events', select_events)
    disp.extension_add_method('display', 'xinput_query_device', query_device)
    disp.extension_add_method('window', 'xinput_grab_device', grab_device)
    disp.extension_add_method('display', 'xinput_ungrab_device', ungrab_device)
    disp.extension_add_method('window', 'xinput_grab_keycode', grab_keycode)
    disp.extension_add_method('window', 'xinput_ungrab_keycode', ungrab_keycode)
    if hasattr(disp,"ge_add_event_data"):
        for device_event in (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion):
            disp.ge_add_event_data(info.major_opcode, device_event, DeviceEventData)
        disp.ge_add_event_data(info.major_opcode, DeviceChanged, DeviceEventData)
        disp.ge_add_event_data(info.major_opcode, HierarchyChanged, HierarchyEventData)

[((5964, 5986), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""mask"""', '(2)'], {}), "('mask', 2)\n", (5975, 5986), False, 'from Xlib.protocol import rq\n'), ((6813, 6830), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""type"""'], {}), "('type')\n", (6822, 6830), False, 'from Xlib.protocol import rq\n'), ((6837, 6856), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""length"""'], {}), "('length')\n", (6846, 6856), False, 'from Xlib.protocol import rq\n'), ((6863, 6884), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sourceid"""'], {}), "('sourceid')\n", (6872, 6884), False, 'from Xlib.protocol import rq\n'), ((6891, 6900), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (6897, 6900), False, 'from Xlib.protocol import rq\n'), ((8058, 8075), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""type"""'], {}), "('type')\n", (8067, 8075), False, 'from Xlib.protocol import rq\n'), ((8082, 8101), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""length"""'], {}), "('length')\n", (8091, 8101), False, 'from Xlib.protocol import rq\n'), ((8108, 8129), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sourceid"""'], {}), "('sourceid')\n", (8117, 8129), False, 'from Xlib.protocol import rq\n'), ((8136, 8171), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (["('state', 'labels')", '(2)'], {}), "(('state', 'labels'), 2)\n", (8147, 8171), False, 'from Xlib.protocol import rq\n'), ((8205, 8233), 'Xlib.protocol.rq.List', 'rq.List', (['"""labels"""', 'rq.Card32'], {}), "('labels', rq.Card32)\n", (8212, 8233), False, 'from Xlib.protocol import rq\n'), ((8267, 8284), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""type"""'], {}), "('type')\n", (8276, 8284), False, 'from Xlib.protocol import rq\n'), ((8291, 8310), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""length"""'], {}), "('length')\n", (8300, 8310), False, 'from Xlib.protocol import rq\n'), ((8317, 8338), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sourceid"""'], {}), "('sourceid')\n", (8326, 8338), False, 'from Xlib.protocol import rq\n'), ((8345, 8371), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""keycodes"""', '(2)'], {}), "('keycodes', 2)\n", (8356, 8371), False, 'from Xlib.protocol import rq\n'), ((8378, 8408), 'Xlib.protocol.rq.List', 'rq.List', (['"""keycodes"""', 'rq.Card32'], {}), "('keycodes', rq.Card32)\n", (8385, 8408), False, 'from Xlib.protocol import rq\n'), ((8447, 8464), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""type"""'], {}), "('type')\n", (8456, 8464), False, 'from Xlib.protocol import rq\n'), ((8471, 8490), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""length"""'], {}), "('length')\n", (8480, 8490), False, 'from Xlib.protocol import rq\n'), ((8497, 8518), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sourceid"""'], {}), "('sourceid')\n", (8506, 8518), False, 'from Xlib.protocol import rq\n'), ((8525, 8544), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""number"""'], {}), "('number')\n", (8534, 8544), False, 'from Xlib.protocol import rq\n'), ((8551, 8569), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""label"""'], {}), "('label')\n", (8560, 8569), False, 'from Xlib.protocol import rq\n'), ((8638, 8661), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""resolution"""'], {}), "('resolution')\n", (8647, 8661), False, 'from Xlib.protocol import rq\n'), ((8668, 8684), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""mode"""'], {}), "('mode')\n", (8676, 8684), False, 'from Xlib.protocol import rq\n'), ((8691, 8700), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(3)'], {}), '(3)\n', (8697, 8700), False, 'from Xlib.protocol import rq\n'), ((8737, 8754), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""type"""'], {}), "('type')\n", (8746, 8754), False, 'from Xlib.protocol import rq\n'), ((8761, 8780), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""length"""'], {}), "('length')\n", (8770, 8780), False, 'from Xlib.protocol import rq\n'), ((8787, 8808), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sourceid"""'], {}), "('sourceid')\n", (8796, 8808), False, 'from Xlib.protocol import rq\n'), ((8815, 8834), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""number"""'], {}), "('number')\n", (8824, 8834), False, 'from Xlib.protocol import rq\n'), ((8841, 8865), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""scroll_type"""'], {}), "('scroll_type')\n", (8850, 8865), False, 'from Xlib.protocol import rq\n'), ((8872, 8881), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (8878, 8881), False, 'from Xlib.protocol import rq\n'), ((8888, 8906), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""flags"""'], {}), "('flags')\n", (8897, 8906), False, 'from Xlib.protocol import rq\n'), ((8968, 8985), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""type"""'], {}), "('type')\n", (8977, 8985), False, 'from Xlib.protocol import rq\n'), ((8992, 9011), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""length"""'], {}), "('length')\n", (9001, 9011), False, 'from Xlib.protocol import rq\n'), ((9018, 9039), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sourceid"""'], {}), "('sourceid')\n", (9027, 9039), False, 'from Xlib.protocol import rq\n'), ((9046, 9062), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""mode"""'], {}), "('mode')\n", (9054, 9062), False, 'from Xlib.protocol import rq\n'), ((9069, 9092), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""num_touches"""'], {}), "('num_touches')\n", (9077, 9092), False, 'from Xlib.protocol import rq\n'), ((9717, 9733), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""use"""'], {}), "('use')\n", (9726, 9733), False, 'from Xlib.protocol import rq\n'), ((9740, 9763), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""attachment"""'], {}), "('attachment')\n", (9749, 9763), False, 'from Xlib.protocol import rq\n'), ((9770, 9795), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""classes"""', '(2)'], {}), "('classes', 2)\n", (9781, 9795), False, 'from Xlib.protocol import rq\n'), ((9802, 9824), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""name"""', '(2)'], {}), "('name', 2)\n", (9813, 9824), False, 'from Xlib.protocol import rq\n'), ((9831, 9849), 'Xlib.protocol.rq.Bool', 'rq.Bool', (['"""enabled"""'], {}), "('enabled')\n", (9838, 9849), False, 'from Xlib.protocol import rq\n'), ((9856, 9865), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(1)'], {}), '(1)\n', (9862, 9865), False, 'from Xlib.protocol import rq\n'), ((9872, 9893), 'Xlib.protocol.rq.String8', 'rq.String8', (['"""name"""', '(4)'], {}), "('name', 4)\n", (9882, 9893), False, 'from Xlib.protocol import rq\n'), ((9900, 9929), 'Xlib.protocol.rq.List', 'rq.List', (['"""classes"""', 'ClassInfo'], {}), "('classes', ClassInfo)\n", (9907, 9929), False, 'from Xlib.protocol import rq\n'), ((15527, 15545), 'Xlib.protocol.rq.Bool', 'rq.Bool', (['"""enabled"""'], {}), "('enabled')\n", (15534, 15545), False, 'from Xlib.protocol import rq\n'), ((15552, 15561), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (15558, 15561), False, 'from Xlib.protocol import rq\n'), ((15568, 15586), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""flags"""'], {}), "('flags')\n", (15577, 15586), False, 'from Xlib.protocol import rq\n'), ((15660, 15677), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""time"""'], {}), "('time')\n", (15669, 15677), False, 'from Xlib.protocol import rq\n'), ((15684, 15702), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""flags"""'], {}), "('flags')\n", (15693, 15702), False, 'from Xlib.protocol import rq\n'), ((15709, 15731), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""info"""', '(2)'], {}), "('info', 2)\n", (15720, 15731), False, 'from Xlib.protocol import rq\n'), ((15738, 15748), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(10)'], {}), '(10)\n', (15744, 15748), False, 'from Xlib.protocol import rq\n'), ((15755, 15785), 'Xlib.protocol.rq.List', 'rq.List', (['"""info"""', 'HierarchyInfo'], {}), "('info', HierarchyInfo)\n", (15762, 15785), False, 'from Xlib.protocol import rq\n'), ((15824, 15846), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""base_mods"""'], {}), "('base_mods')\n", (15833, 15846), False, 'from Xlib.protocol import rq\n'), ((15853, 15878), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""latched_mods"""'], {}), "('latched_mods')\n", (15862, 15878), False, 'from Xlib.protocol import rq\n'), ((15885, 15909), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""locked_mods"""'], {}), "('locked_mods')\n", (15894, 15909), False, 'from Xlib.protocol import rq\n'), ((15916, 15943), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""effective_mods"""'], {}), "('effective_mods')\n", (15925, 15943), False, 'from Xlib.protocol import rq\n'), ((15979, 16001), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""base_group"""'], {}), "('base_group')\n", (15987, 16001), False, 'from Xlib.protocol import rq\n'), ((16008, 16033), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""latched_group"""'], {}), "('latched_group')\n", (16016, 16033), False, 'from Xlib.protocol import rq\n'), ((16040, 16064), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""locked_group"""'], {}), "('locked_group')\n", (16048, 16064), False, 'from Xlib.protocol import rq\n'), ((16071, 16098), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""effective_group"""'], {}), "('effective_group')\n", (16079, 16098), False, 'from Xlib.protocol import rq\n'), ((16167, 16184), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""time"""'], {}), "('time')\n", (16176, 16184), False, 'from Xlib.protocol import rq\n'), ((16191, 16210), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""detail"""'], {}), "('detail')\n", (16200, 16210), False, 'from Xlib.protocol import rq\n'), ((16217, 16234), 'Xlib.protocol.rq.Window', 'rq.Window', (['"""root"""'], {}), "('root')\n", (16226, 16234), False, 'from Xlib.protocol import rq\n'), ((16241, 16259), 'Xlib.protocol.rq.Window', 'rq.Window', (['"""event"""'], {}), "('event')\n", (16250, 16259), False, 'from Xlib.protocol import rq\n'), ((16266, 16284), 'Xlib.protocol.rq.Window', 'rq.Window', (['"""child"""'], {}), "('child')\n", (16275, 16284), False, 'from Xlib.protocol import rq\n'), ((16385, 16410), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""buttons"""', '(2)'], {}), "('buttons', 2)\n", (16396, 16410), False, 'from Xlib.protocol import rq\n'), ((16417, 16444), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""valulators_len"""'], {}), "('valulators_len')\n", (16426, 16444), False, 'from Xlib.protocol import rq\n'), ((16478, 16487), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (16484, 16487), False, 'from Xlib.protocol import rq\n'), ((16494, 16512), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""flags"""'], {}), "('flags')\n", (16503, 16512), False, 'from Xlib.protocol import rq\n'), ((16519, 16550), 'Xlib.protocol.rq.Object', 'rq.Object', (['"""mods"""', 'ModifierInfo'], {}), "('mods', ModifierInfo)\n", (16528, 16550), False, 'from Xlib.protocol import rq\n'), ((16557, 16587), 'Xlib.protocol.rq.Object', 'rq.Object', (['"""groups"""', 'GroupInfo'], {}), "('groups', GroupInfo)\n", (16566, 16587), False, 'from Xlib.protocol import rq\n'), ((16692, 16709), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""time"""'], {}), "('time')\n", (16701, 16709), False, 'from Xlib.protocol import rq\n'), ((16716, 16741), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""classes"""', '(2)'], {}), "('classes', 2)\n", (16727, 16741), False, 'from Xlib.protocol import rq\n'), ((16775, 16793), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""reason"""'], {}), "('reason')\n", (16783, 16793), False, 'from Xlib.protocol import rq\n'), ((16800, 16810), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(11)'], {}), '(11)\n', (16806, 16810), False, 'from Xlib.protocol import rq\n'), ((16817, 16846), 'Xlib.protocol.rq.List', 'rq.List', (['"""classes"""', 'ClassInfo'], {}), "('classes', ClassInfo)\n", (16824, 16846), False, 'from Xlib.protocol import rq\n'), ((4110, 4128), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""opcode"""'], {}), "('opcode')\n", (4118, 4128), False, 'from Xlib.protocol import rq\n'), ((4139, 4152), 'Xlib.protocol.rq.Opcode', 'rq.Opcode', (['(47)'], {}), '(47)\n', (4148, 4152), False, 'from Xlib.protocol import rq\n'), ((4163, 4181), 'Xlib.protocol.rq.RequestLength', 'rq.RequestLength', ([], {}), '()\n', (4179, 4181), False, 'from Xlib.protocol import rq\n'), ((4192, 4218), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""major_version"""'], {}), "('major_version')\n", (4201, 4218), False, 'from Xlib.protocol import rq\n'), ((4229, 4255), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""minor_version"""'], {}), "('minor_version')\n", (4238, 4255), False, 'from Xlib.protocol import rq\n'), ((4302, 4316), 'Xlib.protocol.rq.ReplyCode', 'rq.ReplyCode', ([], {}), '()\n', (4314, 4316), False, 'from Xlib.protocol import rq\n'), ((4327, 4336), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(1)'], {}), '(1)\n', (4333, 4336), False, 'from Xlib.protocol import rq\n'), ((4347, 4375), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sequence_number"""'], {}), "('sequence_number')\n", (4356, 4375), False, 'from Xlib.protocol import rq\n'), ((4386, 4402), 'Xlib.protocol.rq.ReplyLength', 'rq.ReplyLength', ([], {}), '()\n', (4400, 4402), False, 'from Xlib.protocol import rq\n'), ((4413, 4439), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""major_version"""'], {}), "('major_version')\n", (4422, 4439), False, 'from Xlib.protocol import rq\n'), ((4450, 4476), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""minor_version"""'], {}), "('minor_version')\n", (4459, 4476), False, 'from Xlib.protocol import rq\n'), ((4487, 4497), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(20)'], {}), '(20)\n', (4493, 4497), False, 'from Xlib.protocol import rq\n'), ((4787, 4833), 'Xlib.protocol.rq.List.__init__', 'rq.List.__init__', (['self', 'name', 'rq.Card32'], {'pad': '(0)'}), '(self, name, rq.Card32, pad=0)\n', (4803, 4833), False, 'from Xlib.protocol import rq\n'), ((4890, 4932), 'array.array', 'array.array', (["rq.struct_to_array_codes['L']"], {}), "(rq.struct_to_array_codes['L'])\n", (4901, 4932), False, 'import array\n'), ((6085, 6103), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""opcode"""'], {}), "('opcode')\n", (6093, 6103), False, 'from Xlib.protocol import rq\n'), ((6114, 6127), 'Xlib.protocol.rq.Opcode', 'rq.Opcode', (['(46)'], {}), '(46)\n', (6123, 6127), False, 'from Xlib.protocol import rq\n'), ((6138, 6156), 'Xlib.protocol.rq.RequestLength', 'rq.RequestLength', ([], {}), '()\n', (6154, 6156), False, 'from Xlib.protocol import rq\n'), ((6167, 6186), 'Xlib.protocol.rq.Window', 'rq.Window', (['"""window"""'], {}), "('window')\n", (6176, 6186), False, 'from Xlib.protocol import rq\n'), ((6197, 6220), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""masks"""', '(2)'], {}), "('masks', 2)\n", (6208, 6220), False, 'from Xlib.protocol import rq\n'), ((6231, 6240), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (6237, 6240), False, 'from Xlib.protocol import rq\n'), ((6251, 6278), 'Xlib.protocol.rq.List', 'rq.List', (['"""masks"""', 'EventMask'], {}), "('masks', EventMask)\n", (6258, 6278), False, 'from Xlib.protocol import rq\n'), ((7480, 7514), 'Xlib.protocol.rq.ValueField.__init__', 'rq.ValueField.__init__', (['self', 'name'], {}), '(self, name)\n', (7502, 7514), False, 'from Xlib.protocol import rq\n'), ((9400, 9430), 'struct.unpack', 'struct.unpack', (['"""=HH"""', 'data[:4]'], {}), "('=HH', data[:4])\n", (9413, 9430), False, 'import struct\n'), ((10011, 10029), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""opcode"""'], {}), "('opcode')\n", (10019, 10029), False, 'from Xlib.protocol import rq\n'), ((10040, 10053), 'Xlib.protocol.rq.Opcode', 'rq.Opcode', (['(48)'], {}), '(48)\n', (10049, 10053), False, 'from Xlib.protocol import rq\n'), ((10064, 10082), 'Xlib.protocol.rq.RequestLength', 'rq.RequestLength', ([], {}), '()\n', (10080, 10082), False, 'from Xlib.protocol import rq\n'), ((10124, 10133), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (10130, 10133), False, 'from Xlib.protocol import rq\n'), ((10178, 10192), 'Xlib.protocol.rq.ReplyCode', 'rq.ReplyCode', ([], {}), '()\n', (10190, 10192), False, 'from Xlib.protocol import rq\n'), ((10203, 10212), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(1)'], {}), '(1)\n', (10209, 10212), False, 'from Xlib.protocol import rq\n'), ((10223, 10251), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sequence_number"""'], {}), "('sequence_number')\n", (10232, 10251), False, 'from Xlib.protocol import rq\n'), ((10262, 10278), 'Xlib.protocol.rq.ReplyLength', 'rq.ReplyLength', ([], {}), '()\n', (10276, 10278), False, 'from Xlib.protocol import rq\n'), ((10289, 10314), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""devices"""', '(2)'], {}), "('devices', 2)\n", (10300, 10314), False, 'from Xlib.protocol import rq\n'), ((10325, 10335), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(22)'], {}), '(22)\n', (10331, 10335), False, 'from Xlib.protocol import rq\n'), ((10346, 10376), 'Xlib.protocol.rq.List', 'rq.List', (['"""devices"""', 'DeviceInfo'], {}), "('devices', DeviceInfo)\n", (10353, 10376), False, 'from Xlib.protocol import rq\n'), ((10658, 10676), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""opcode"""'], {}), "('opcode')\n", (10666, 10676), False, 'from Xlib.protocol import rq\n'), ((10687, 10700), 'Xlib.protocol.rq.Opcode', 'rq.Opcode', (['(51)'], {}), '(51)\n', (10696, 10700), False, 'from Xlib.protocol import rq\n'), ((10711, 10729), 'Xlib.protocol.rq.RequestLength', 'rq.RequestLength', ([], {}), '()\n', (10727, 10729), False, 'from Xlib.protocol import rq\n'), ((10740, 10764), 'Xlib.protocol.rq.Window', 'rq.Window', (['"""grab_window"""'], {}), "('grab_window')\n", (10749, 10764), False, 'from Xlib.protocol import rq\n'), ((10775, 10792), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""time"""'], {}), "('time')\n", (10784, 10792), False, 'from Xlib.protocol import rq\n'), ((10803, 10833), 'Xlib.protocol.rq.Cursor', 'rq.Cursor', (['"""cursor"""', '(X.NONE,)'], {}), "('cursor', (X.NONE,))\n", (10812, 10833), False, 'from Xlib.protocol import rq\n'), ((10876, 10929), 'Xlib.protocol.rq.Set', 'rq.Set', (['"""grab_mode"""', '(1)', '(GrabModeSync, GrabModeAsync)'], {}), "('grab_mode', 1, (GrabModeSync, GrabModeAsync))\n", (10882, 10929), False, 'from Xlib.protocol import rq\n'), ((10940, 11002), 'Xlib.protocol.rq.Set', 'rq.Set', (['"""paired_device_mode"""', '(1)', '(GrabModeSync, GrabModeAsync)'], {}), "('paired_device_mode', 1, (GrabModeSync, GrabModeAsync))\n", (10946, 11002), False, 'from Xlib.protocol import rq\n'), ((11013, 11036), 'Xlib.protocol.rq.Bool', 'rq.Bool', (['"""owner_events"""'], {}), "('owner_events')\n", (11020, 11036), False, 'from Xlib.protocol import rq\n'), ((11047, 11056), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(1)'], {}), '(1)\n', (11053, 11056), False, 'from Xlib.protocol import rq\n'), ((11067, 11089), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""mask"""', '(2)'], {}), "('mask', 2)\n", (11078, 11089), False, 'from Xlib.protocol import rq\n'), ((11157, 11171), 'Xlib.protocol.rq.ReplyCode', 'rq.ReplyCode', ([], {}), '()\n', (11169, 11171), False, 'from Xlib.protocol import rq\n'), ((11182, 11191), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(1)'], {}), '(1)\n', (11188, 11191), False, 'from Xlib.protocol import rq\n'), ((11202, 11230), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sequence_number"""'], {}), "('sequence_number')\n", (11211, 11230), False, 'from Xlib.protocol import rq\n'), ((11241, 11257), 'Xlib.protocol.rq.ReplyLength', 'rq.ReplyLength', ([], {}), '()\n', (11255, 11257), False, 'from Xlib.protocol import rq\n'), ((11268, 11286), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""status"""'], {}), "('status')\n", (11276, 11286), False, 'from Xlib.protocol import rq\n'), ((11297, 11307), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(23)'], {}), '(23)\n', (11303, 11307), False, 'from Xlib.protocol import rq\n'), ((11858, 11876), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""opcode"""'], {}), "('opcode')\n", (11866, 11876), False, 'from Xlib.protocol import rq\n'), ((11887, 11900), 'Xlib.protocol.rq.Opcode', 'rq.Opcode', (['(52)'], {}), '(52)\n', (11896, 11900), False, 'from Xlib.protocol import rq\n'), ((11911, 11929), 'Xlib.protocol.rq.RequestLength', 'rq.RequestLength', ([], {}), '()\n', (11927, 11929), False, 'from Xlib.protocol import rq\n'), ((11940, 11957), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""time"""'], {}), "('time')\n", (11949, 11957), False, 'from Xlib.protocol import rq\n'), ((11999, 12008), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (12005, 12008), False, 'from Xlib.protocol import rq\n'), ((12317, 12335), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""opcode"""'], {}), "('opcode')\n", (12325, 12335), False, 'from Xlib.protocol import rq\n'), ((12346, 12359), 'Xlib.protocol.rq.Opcode', 'rq.Opcode', (['(54)'], {}), '(54)\n', (12355, 12359), False, 'from Xlib.protocol import rq\n'), ((12370, 12388), 'Xlib.protocol.rq.RequestLength', 'rq.RequestLength', ([], {}), '()\n', (12386, 12388), False, 'from Xlib.protocol import rq\n'), ((12399, 12416), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""time"""'], {}), "('time')\n", (12408, 12416), False, 'from Xlib.protocol import rq\n'), ((12427, 12451), 'Xlib.protocol.rq.Window', 'rq.Window', (['"""grab_window"""'], {}), "('grab_window')\n", (12436, 12451), False, 'from Xlib.protocol import rq\n'), ((12462, 12492), 'Xlib.protocol.rq.Cursor', 'rq.Cursor', (['"""cursor"""', '(X.NONE,)'], {}), "('cursor', (X.NONE,))\n", (12471, 12492), False, 'from Xlib.protocol import rq\n'), ((12504, 12523), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""detail"""'], {}), "('detail')\n", (12513, 12523), False, 'from Xlib.protocol import rq\n'), ((12565, 12592), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""modifiers"""', '(2)'], {}), "('modifiers', 2)\n", (12576, 12592), False, 'from Xlib.protocol import rq\n'), ((12603, 12625), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""mask"""', '(2)'], {}), "('mask', 2)\n", (12614, 12625), False, 'from Xlib.protocol import rq\n'), ((12636, 12749), 'Xlib.protocol.rq.Set', 'rq.Set', (['"""grab_type"""', '(1)', '(GrabtypeButton, GrabtypeKeycode, GrabtypeEnter, GrabtypeFocusIn,\n    GrabtypeTouchBegin)'], {}), "('grab_type', 1, (GrabtypeButton, GrabtypeKeycode, GrabtypeEnter,\n    GrabtypeFocusIn, GrabtypeTouchBegin))\n", (12642, 12749), False, 'from Xlib.protocol import rq\n'), ((12789, 12842), 'Xlib.protocol.rq.Set', 'rq.Set', (['"""grab_mode"""', '(1)', '(GrabModeSync, GrabModeAsync)'], {}), "('grab_mode', 1, (GrabModeSync, GrabModeAsync))\n", (12795, 12842), False, 'from Xlib.protocol import rq\n'), ((12853, 12915), 'Xlib.protocol.rq.Set', 'rq.Set', (['"""paired_device_mode"""', '(1)', '(GrabModeSync, GrabModeAsync)'], {}), "('paired_device_mode', 1, (GrabModeSync, GrabModeAsync))\n", (12859, 12915), False, 'from Xlib.protocol import rq\n'), ((12926, 12949), 'Xlib.protocol.rq.Bool', 'rq.Bool', (['"""owner_events"""'], {}), "('owner_events')\n", (12933, 12949), False, 'from Xlib.protocol import rq\n'), ((12960, 12969), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(2)'], {}), '(2)\n', (12966, 12969), False, 'from Xlib.protocol import rq\n'), ((13003, 13034), 'Xlib.protocol.rq.List', 'rq.List', (['"""modifiers"""', 'rq.Card32'], {}), "('modifiers', rq.Card32)\n", (13010, 13034), False, 'from Xlib.protocol import rq\n'), ((13079, 13093), 'Xlib.protocol.rq.ReplyCode', 'rq.ReplyCode', ([], {}), '()\n', (13091, 13093), False, 'from Xlib.protocol import rq\n'), ((13104, 13113), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(1)'], {}), '(1)\n', (13110, 13113), False, 'from Xlib.protocol import rq\n'), ((13124, 13152), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""sequence_number"""'], {}), "('sequence_number')\n", (13133, 13152), False, 'from Xlib.protocol import rq\n'), ((13163, 13179), 'Xlib.protocol.rq.ReplyLength', 'rq.ReplyLength', ([], {}), '()\n', (13177, 13179), False, 'from Xlib.protocol import rq\n'), ((13190, 13217), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""modifiers"""', '(2)'], {}), "('modifiers', 2)\n", (13201, 13217), False, 'from Xlib.protocol import rq\n'), ((13228, 13238), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(22)'], {}), '(22)\n', (13234, 13238), False, 'from Xlib.protocol import rq\n'), ((13249, 13280), 'Xlib.protocol.rq.List', 'rq.List', (['"""modifiers"""', 'rq.Card32'], {}), "('modifiers', rq.Card32)\n", (13256, 13280), False, 'from Xlib.protocol import rq\n'), ((14419, 14437), 'Xlib.protocol.rq.Card8', 'rq.Card8', (['"""opcode"""'], {}), "('opcode')\n", (14427, 14437), False, 'from Xlib.protocol import rq\n'), ((14448, 14461), 'Xlib.protocol.rq.Opcode', 'rq.Opcode', (['(55)'], {}), '(55)\n', (14457, 14461), False, 'from Xlib.protocol import rq\n'), ((14472, 14490), 'Xlib.protocol.rq.RequestLength', 'rq.RequestLength', ([], {}), '()\n', (14488, 14490), False, 'from Xlib.protocol import rq\n'), ((14501, 14525), 'Xlib.protocol.rq.Window', 'rq.Window', (['"""grab_window"""'], {}), "('grab_window')\n", (14510, 14525), False, 'from Xlib.protocol import rq\n'), ((14536, 14555), 'Xlib.protocol.rq.Card32', 'rq.Card32', (['"""detail"""'], {}), "('detail')\n", (14545, 14555), False, 'from Xlib.protocol import rq\n'), ((14597, 14624), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""modifiers"""', '(2)'], {}), "('modifiers', 2)\n", (14608, 14624), False, 'from Xlib.protocol import rq\n'), ((14635, 14748), 'Xlib.protocol.rq.Set', 'rq.Set', (['"""grab_type"""', '(1)', '(GrabtypeButton, GrabtypeKeycode, GrabtypeEnter, GrabtypeFocusIn,\n    GrabtypeTouchBegin)'], {}), "('grab_type', 1, (GrabtypeButton, GrabtypeKeycode, GrabtypeEnter,\n    GrabtypeFocusIn, GrabtypeTouchBegin))\n", (14641, 14748), False, 'from Xlib.protocol import rq\n'), ((14821, 14830), 'Xlib.protocol.rq.Pad', 'rq.Pad', (['(3)'], {}), '(3)\n', (14827, 14830), False, 'from Xlib.protocol import rq\n'), ((14841, 14872), 'Xlib.protocol.rq.List', 'rq.List', (['"""modifiers"""', 'rq.Card32'], {}), "('modifiers', rq.Card32)\n", (14848, 14872), False, 'from Xlib.protocol import rq\n')]