2012-05-11 02:06:22 +02:00
// Package xinput is the X client API for the XInputExtension extension.
2012-05-10 23:01:42 +02:00
package xinput
/ *
2012-05-12 05:58:52 +02:00
This file was generated by xinput . xml on May 11 2012 11 : 57 : 20 pm EDT .
2012-05-10 23:01:42 +02:00
This file is automatically generated . Edit at your peril !
* /
import (
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
)
// Init must be called before using the XInputExtension extension.
func Init ( c * xgb . Conn ) error {
reply , err := xproto . QueryExtension ( c , 15 , "XInputExtension" ) . Reply ( )
switch {
case err != nil :
return err
case ! reply . Present :
return xgb . Errorf ( "No extension named XInputExtension could be found on on the server." )
}
xgb . ExtLock . Lock ( )
c . Extensions [ "XInputExtension" ] = reply . MajorOpcode
for evNum , fun := range xgb . NewExtEventFuncs [ "XInputExtension" ] {
xgb . NewEventFuncs [ int ( reply . FirstEvent ) + evNum ] = fun
}
for errNum , fun := range xgb . NewExtErrorFuncs [ "XInputExtension" ] {
xgb . NewErrorFuncs [ int ( reply . FirstError ) + errNum ] = fun
}
xgb . ExtLock . Unlock ( )
return nil
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] = make ( map [ int ] xgb . NewEventFun )
xgb . NewExtErrorFuncs [ "XInputExtension" ] = make ( map [ int ] xgb . NewErrorFun )
}
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
// Skipping definition for base type 'Card32'
// Skipping definition for base type 'Double'
// Skipping definition for base type 'Bool'
2012-05-12 05:58:52 +02:00
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Card8'
// Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
2012-05-10 23:01:42 +02:00
const (
ValuatorModeRelative = 0
ValuatorModeAbsolute = 1
)
const (
PropagateModeAddToList = 0
PropagateModeDeleteFromList = 1
)
const (
DeviceUseIsXPointer = 0
DeviceUseIsXKeyboard = 1
DeviceUseIsXExtensionDevice = 2
DeviceUseIsXExtensionKeyboard = 3
DeviceUseIsXExtensionPointer = 4
)
const (
InputClassKey = 0
InputClassButton = 1
InputClassValuator = 2
InputClassFeedback = 3
InputClassProximity = 4
InputClassFocus = 5
InputClassOther = 6
)
const (
DeviceInputModeAsyncThisDevice = 0
DeviceInputModeSyncThisDevice = 1
DeviceInputModeReplayThisDevice = 2
DeviceInputModeAsyncOtherDevices = 3
DeviceInputModeAsyncAll = 4
DeviceInputModeSyncAll = 5
)
const (
FeedbackClassKeyboard = 0
FeedbackClassPointer = 1
FeedbackClassString = 2
FeedbackClassInteger = 3
FeedbackClassLed = 4
FeedbackClassBell = 5
)
type KeyCode byte
type EventClass uint32
type DeviceInfo struct {
DeviceType xproto . Atom
DeviceId byte
NumClassInfo byte
DeviceUse byte
// padding: 1 bytes
}
2012-05-11 05:57:34 +02:00
// DeviceInfoRead reads a byte slice into a DeviceInfo value.
2012-05-10 23:01:42 +02:00
func DeviceInfoRead ( buf [ ] byte , v * DeviceInfo ) int {
b := 0
v . DeviceType = xproto . Atom ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . DeviceId = buf [ b ]
b += 1
v . NumClassInfo = buf [ b ]
b += 1
v . DeviceUse = buf [ b ]
b += 1
b += 1 // padding
return b
}
2012-05-11 05:57:34 +02:00
// DeviceInfoReadList reads a byte slice into a list of DeviceInfo values.
2012-05-10 23:01:42 +02:00
func DeviceInfoReadList ( buf [ ] byte , dest [ ] DeviceInfo ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceInfo { }
b += DeviceInfoRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceInfo value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceInfo ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 8 )
b := 0
xgb . Put32 ( buf [ b : ] , uint32 ( v . DeviceType ) )
b += 4
buf [ b ] = v . DeviceId
b += 1
buf [ b ] = v . NumClassInfo
b += 1
buf [ b ] = v . DeviceUse
b += 1
b += 1 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceInfoListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceInfoListBytes ( buf [ ] byte , list [ ] DeviceInfo ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type InputInfo struct {
ClassId byte
Len byte
}
2012-05-11 05:57:34 +02:00
// InputInfoRead reads a byte slice into a InputInfo value.
2012-05-10 23:01:42 +02:00
func InputInfoRead ( buf [ ] byte , v * InputInfo ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
return b
}
2012-05-11 05:57:34 +02:00
// InputInfoReadList reads a byte slice into a list of InputInfo values.
2012-05-10 23:01:42 +02:00
func InputInfoReadList ( buf [ ] byte , dest [ ] InputInfo ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = InputInfo { }
b += InputInfoRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a InputInfo value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v InputInfo ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 2 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// InputInfoListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func InputInfoListBytes ( buf [ ] byte , list [ ] InputInfo ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type KeyInfo struct {
ClassId byte
Len byte
MinKeycode KeyCode
MaxKeycode KeyCode
NumKeys uint16
// padding: 2 bytes
}
2012-05-11 05:57:34 +02:00
// KeyInfoRead reads a byte slice into a KeyInfo value.
2012-05-10 23:01:42 +02:00
func KeyInfoRead ( buf [ ] byte , v * KeyInfo ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
v . MinKeycode = KeyCode ( buf [ b ] )
b += 1
v . MaxKeycode = KeyCode ( buf [ b ] )
b += 1
v . NumKeys = xgb . Get16 ( buf [ b : ] )
b += 2
b += 2 // padding
return b
}
2012-05-11 05:57:34 +02:00
// KeyInfoReadList reads a byte slice into a list of KeyInfo values.
2012-05-10 23:01:42 +02:00
func KeyInfoReadList ( buf [ ] byte , dest [ ] KeyInfo ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = KeyInfo { }
b += KeyInfoRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a KeyInfo value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v KeyInfo ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 8 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
buf [ b ] = byte ( v . MinKeycode )
b += 1
buf [ b ] = byte ( v . MaxKeycode )
b += 1
xgb . Put16 ( buf [ b : ] , v . NumKeys )
b += 2
b += 2 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// KeyInfoListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func KeyInfoListBytes ( buf [ ] byte , list [ ] KeyInfo ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type ButtonInfo struct {
ClassId byte
Len byte
NumButtons uint16
}
2012-05-11 05:57:34 +02:00
// ButtonInfoRead reads a byte slice into a ButtonInfo value.
2012-05-10 23:01:42 +02:00
func ButtonInfoRead ( buf [ ] byte , v * ButtonInfo ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
v . NumButtons = xgb . Get16 ( buf [ b : ] )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// ButtonInfoReadList reads a byte slice into a list of ButtonInfo values.
2012-05-10 23:01:42 +02:00
func ButtonInfoReadList ( buf [ ] byte , dest [ ] ButtonInfo ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = ButtonInfo { }
b += ButtonInfoRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a ButtonInfo value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v ButtonInfo ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 4 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
xgb . Put16 ( buf [ b : ] , v . NumButtons )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// ButtonInfoListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func ButtonInfoListBytes ( buf [ ] byte , list [ ] ButtonInfo ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type AxisInfo struct {
Resolution uint32
Minimum int32
Maximum int32
}
2012-05-11 05:57:34 +02:00
// AxisInfoRead reads a byte slice into a AxisInfo value.
2012-05-10 23:01:42 +02:00
func AxisInfoRead ( buf [ ] byte , v * AxisInfo ) int {
b := 0
v . Resolution = xgb . Get32 ( buf [ b : ] )
b += 4
v . Minimum = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Maximum = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// AxisInfoReadList reads a byte slice into a list of AxisInfo values.
2012-05-10 23:01:42 +02:00
func AxisInfoReadList ( buf [ ] byte , dest [ ] AxisInfo ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = AxisInfo { }
b += AxisInfoRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a AxisInfo value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v AxisInfo ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 12 )
b := 0
xgb . Put32 ( buf [ b : ] , v . Resolution )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Minimum ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Maximum ) )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// AxisInfoListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func AxisInfoListBytes ( buf [ ] byte , list [ ] AxisInfo ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type ValuatorInfo struct {
ClassId byte
Len byte
AxesLen byte
Mode byte
MotionSize uint32
Axes [ ] AxisInfo // size: xgb.Pad((int(AxesLen) * 12))
}
2012-05-11 05:57:34 +02:00
// ValuatorInfoRead reads a byte slice into a ValuatorInfo value.
2012-05-10 23:01:42 +02:00
func ValuatorInfoRead ( buf [ ] byte , v * ValuatorInfo ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
v . AxesLen = buf [ b ]
b += 1
v . Mode = buf [ b ]
b += 1
v . MotionSize = xgb . Get32 ( buf [ b : ] )
b += 4
v . Axes = make ( [ ] AxisInfo , v . AxesLen )
b += AxisInfoReadList ( buf [ b : ] , v . Axes )
return b
}
2012-05-11 05:57:34 +02:00
// ValuatorInfoReadList reads a byte slice into a list of ValuatorInfo values.
2012-05-10 23:01:42 +02:00
func ValuatorInfoReadList ( buf [ ] byte , dest [ ] ValuatorInfo ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = ValuatorInfo { }
b += ValuatorInfoRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a ValuatorInfo value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v ValuatorInfo ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , ( 8 + xgb . Pad ( ( int ( v . AxesLen ) * 12 ) ) ) )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
buf [ b ] = v . AxesLen
b += 1
buf [ b ] = v . Mode
b += 1
xgb . Put32 ( buf [ b : ] , v . MotionSize )
b += 4
b += AxisInfoListBytes ( buf [ b : ] , v . Axes )
return buf
}
2012-05-11 05:57:34 +02:00
// ValuatorInfoListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func ValuatorInfoListBytes ( buf [ ] byte , list [ ] ValuatorInfo ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// ValuatorInfoListSize computes the size (bytes) of a list of ValuatorInfo values.
2012-05-10 23:01:42 +02:00
func ValuatorInfoListSize ( list [ ] ValuatorInfo ) int {
size := 0
for _ , item := range list {
size += ( 8 + xgb . Pad ( ( int ( item . AxesLen ) * 12 ) ) )
}
return size
}
type InputClassInfo struct {
ClassId byte
EventTypeBase byte
}
2012-05-11 05:57:34 +02:00
// InputClassInfoRead reads a byte slice into a InputClassInfo value.
2012-05-10 23:01:42 +02:00
func InputClassInfoRead ( buf [ ] byte , v * InputClassInfo ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . EventTypeBase = buf [ b ]
b += 1
return b
}
2012-05-11 05:57:34 +02:00
// InputClassInfoReadList reads a byte slice into a list of InputClassInfo values.
2012-05-10 23:01:42 +02:00
func InputClassInfoReadList ( buf [ ] byte , dest [ ] InputClassInfo ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = InputClassInfo { }
b += InputClassInfoRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a InputClassInfo value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v InputClassInfo ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 2 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . EventTypeBase
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// InputClassInfoListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func InputClassInfoListBytes ( buf [ ] byte , list [ ] InputClassInfo ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceTimeCoord struct {
Time xproto . Timestamp
}
2012-05-11 05:57:34 +02:00
// DeviceTimeCoordRead reads a byte slice into a DeviceTimeCoord value.
2012-05-10 23:01:42 +02:00
func DeviceTimeCoordRead ( buf [ ] byte , v * DeviceTimeCoord ) int {
b := 0
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// DeviceTimeCoordReadList reads a byte slice into a list of DeviceTimeCoord values.
2012-05-10 23:01:42 +02:00
func DeviceTimeCoordReadList ( buf [ ] byte , dest [ ] DeviceTimeCoord ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceTimeCoord { }
b += DeviceTimeCoordRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceTimeCoord value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceTimeCoord ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 4 )
b := 0
xgb . Put32 ( buf [ b : ] , uint32 ( v . Time ) )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceTimeCoordListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceTimeCoordListBytes ( buf [ ] byte , list [ ] DeviceTimeCoord ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type FeedbackState struct {
ClassId byte
Id byte
Len uint16
}
2012-05-11 05:57:34 +02:00
// FeedbackStateRead reads a byte slice into a FeedbackState value.
2012-05-10 23:01:42 +02:00
func FeedbackStateRead ( buf [ ] byte , v * FeedbackState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// FeedbackStateReadList reads a byte slice into a list of FeedbackState values.
2012-05-10 23:01:42 +02:00
func FeedbackStateReadList ( buf [ ] byte , dest [ ] FeedbackState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = FeedbackState { }
b += FeedbackStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a FeedbackState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v FeedbackState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 4 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// FeedbackStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func FeedbackStateListBytes ( buf [ ] byte , list [ ] FeedbackState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type KbdFeedbackState struct {
ClassId byte
Id byte
Len uint16
Pitch uint16
Duration uint16
LedMask uint32
LedValues uint32
GlobalAutoRepeat bool
Click byte
Percent byte
// padding: 1 bytes
AutoRepeats [ ] byte // size: 32
}
2012-05-11 05:57:34 +02:00
// KbdFeedbackStateRead reads a byte slice into a KbdFeedbackState value.
2012-05-10 23:01:42 +02:00
func KbdFeedbackStateRead ( buf [ ] byte , v * KbdFeedbackState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Pitch = xgb . Get16 ( buf [ b : ] )
b += 2
v . Duration = xgb . Get16 ( buf [ b : ] )
b += 2
v . LedMask = xgb . Get32 ( buf [ b : ] )
b += 4
v . LedValues = xgb . Get32 ( buf [ b : ] )
b += 4
if buf [ b ] == 1 {
v . GlobalAutoRepeat = true
} else {
v . GlobalAutoRepeat = false
}
b += 1
v . Click = buf [ b ]
b += 1
v . Percent = buf [ b ]
b += 1
b += 1 // padding
v . AutoRepeats = make ( [ ] byte , 32 )
copy ( v . AutoRepeats [ : 32 ] , buf [ b : ] )
b += xgb . Pad ( int ( 32 ) )
return b
}
2012-05-11 05:57:34 +02:00
// KbdFeedbackStateReadList reads a byte slice into a list of KbdFeedbackState values.
2012-05-10 23:01:42 +02:00
func KbdFeedbackStateReadList ( buf [ ] byte , dest [ ] KbdFeedbackState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = KbdFeedbackState { }
b += KbdFeedbackStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a KbdFeedbackState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v KbdFeedbackState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 52 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put16 ( buf [ b : ] , v . Pitch )
b += 2
xgb . Put16 ( buf [ b : ] , v . Duration )
b += 2
xgb . Put32 ( buf [ b : ] , v . LedMask )
b += 4
xgb . Put32 ( buf [ b : ] , v . LedValues )
b += 4
if v . GlobalAutoRepeat {
buf [ b ] = 1
} else {
buf [ b ] = 0
}
b += 1
buf [ b ] = v . Click
b += 1
buf [ b ] = v . Percent
b += 1
b += 1 // padding
copy ( buf [ b : ] , v . AutoRepeats [ : 32 ] )
b += xgb . Pad ( int ( 32 ) )
return buf
}
2012-05-11 05:57:34 +02:00
// KbdFeedbackStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func KbdFeedbackStateListBytes ( buf [ ] byte , list [ ] KbdFeedbackState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// KbdFeedbackStateListSize computes the size (bytes) of a list of KbdFeedbackState values.
2012-05-10 23:01:42 +02:00
func KbdFeedbackStateListSize ( list [ ] KbdFeedbackState ) int {
size := 0
for _ = range list {
size += 52
}
return size
}
type PtrFeedbackState struct {
ClassId byte
Id byte
Len uint16
// padding: 2 bytes
AccelNum uint16
AccelDenom uint16
Threshold uint16
}
2012-05-11 05:57:34 +02:00
// PtrFeedbackStateRead reads a byte slice into a PtrFeedbackState value.
2012-05-10 23:01:42 +02:00
func PtrFeedbackStateRead ( buf [ ] byte , v * PtrFeedbackState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
b += 2 // padding
v . AccelNum = xgb . Get16 ( buf [ b : ] )
b += 2
v . AccelDenom = xgb . Get16 ( buf [ b : ] )
b += 2
v . Threshold = xgb . Get16 ( buf [ b : ] )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// PtrFeedbackStateReadList reads a byte slice into a list of PtrFeedbackState values.
2012-05-10 23:01:42 +02:00
func PtrFeedbackStateReadList ( buf [ ] byte , dest [ ] PtrFeedbackState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = PtrFeedbackState { }
b += PtrFeedbackStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a PtrFeedbackState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v PtrFeedbackState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 12 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
b += 2 // padding
xgb . Put16 ( buf [ b : ] , v . AccelNum )
b += 2
xgb . Put16 ( buf [ b : ] , v . AccelDenom )
b += 2
xgb . Put16 ( buf [ b : ] , v . Threshold )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// PtrFeedbackStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func PtrFeedbackStateListBytes ( buf [ ] byte , list [ ] PtrFeedbackState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type IntegerFeedbackState struct {
ClassId byte
Id byte
Len uint16
Resolution uint32
MinValue int32
MaxValue int32
}
2012-05-11 05:57:34 +02:00
// IntegerFeedbackStateRead reads a byte slice into a IntegerFeedbackState value.
2012-05-10 23:01:42 +02:00
func IntegerFeedbackStateRead ( buf [ ] byte , v * IntegerFeedbackState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Resolution = xgb . Get32 ( buf [ b : ] )
b += 4
v . MinValue = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . MaxValue = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// IntegerFeedbackStateReadList reads a byte slice into a list of IntegerFeedbackState values.
2012-05-10 23:01:42 +02:00
func IntegerFeedbackStateReadList ( buf [ ] byte , dest [ ] IntegerFeedbackState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = IntegerFeedbackState { }
b += IntegerFeedbackStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a IntegerFeedbackState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v IntegerFeedbackState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 16 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , v . Resolution )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MinValue ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MaxValue ) )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// IntegerFeedbackStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func IntegerFeedbackStateListBytes ( buf [ ] byte , list [ ] IntegerFeedbackState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type StringFeedbackState struct {
ClassId byte
Id byte
Len uint16
MaxSymbols uint16
NumKeysyms uint16
Keysyms [ ] xproto . Keysym // size: xgb.Pad((int(NumKeysyms) * 4))
}
2012-05-11 05:57:34 +02:00
// StringFeedbackStateRead reads a byte slice into a StringFeedbackState value.
2012-05-10 23:01:42 +02:00
func StringFeedbackStateRead ( buf [ ] byte , v * StringFeedbackState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . MaxSymbols = xgb . Get16 ( buf [ b : ] )
b += 2
v . NumKeysyms = xgb . Get16 ( buf [ b : ] )
b += 2
v . Keysyms = make ( [ ] xproto . Keysym , v . NumKeysyms )
for i := 0 ; i < int ( v . NumKeysyms ) ; i ++ {
v . Keysyms [ i ] = xproto . Keysym ( xgb . Get32 ( buf [ b : ] ) )
b += 4
}
b = xgb . Pad ( b )
return b
}
2012-05-11 05:57:34 +02:00
// StringFeedbackStateReadList reads a byte slice into a list of StringFeedbackState values.
2012-05-10 23:01:42 +02:00
func StringFeedbackStateReadList ( buf [ ] byte , dest [ ] StringFeedbackState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = StringFeedbackState { }
b += StringFeedbackStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a StringFeedbackState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v StringFeedbackState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , ( 8 + xgb . Pad ( ( int ( v . NumKeysyms ) * 4 ) ) ) )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put16 ( buf [ b : ] , v . MaxSymbols )
b += 2
xgb . Put16 ( buf [ b : ] , v . NumKeysyms )
b += 2
for i := 0 ; i < int ( v . NumKeysyms ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( v . Keysyms [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// StringFeedbackStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func StringFeedbackStateListBytes ( buf [ ] byte , list [ ] StringFeedbackState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// StringFeedbackStateListSize computes the size (bytes) of a list of StringFeedbackState values.
2012-05-10 23:01:42 +02:00
func StringFeedbackStateListSize ( list [ ] StringFeedbackState ) int {
size := 0
for _ , item := range list {
size += ( 8 + xgb . Pad ( ( int ( item . NumKeysyms ) * 4 ) ) )
}
return size
}
type BellFeedbackState struct {
ClassId byte
Id byte
Len uint16
Percent byte
// padding: 3 bytes
Pitch uint16
Duration uint16
}
2012-05-11 05:57:34 +02:00
// BellFeedbackStateRead reads a byte slice into a BellFeedbackState value.
2012-05-10 23:01:42 +02:00
func BellFeedbackStateRead ( buf [ ] byte , v * BellFeedbackState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Percent = buf [ b ]
b += 1
b += 3 // padding
v . Pitch = xgb . Get16 ( buf [ b : ] )
b += 2
v . Duration = xgb . Get16 ( buf [ b : ] )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// BellFeedbackStateReadList reads a byte slice into a list of BellFeedbackState values.
2012-05-10 23:01:42 +02:00
func BellFeedbackStateReadList ( buf [ ] byte , dest [ ] BellFeedbackState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = BellFeedbackState { }
b += BellFeedbackStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a BellFeedbackState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v BellFeedbackState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 12 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = v . Percent
b += 1
b += 3 // padding
xgb . Put16 ( buf [ b : ] , v . Pitch )
b += 2
xgb . Put16 ( buf [ b : ] , v . Duration )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// BellFeedbackStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func BellFeedbackStateListBytes ( buf [ ] byte , list [ ] BellFeedbackState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type LedFeedbackState struct {
ClassId byte
Id byte
Len uint16
LedMask uint32
LedValues uint32
}
2012-05-11 05:57:34 +02:00
// LedFeedbackStateRead reads a byte slice into a LedFeedbackState value.
2012-05-10 23:01:42 +02:00
func LedFeedbackStateRead ( buf [ ] byte , v * LedFeedbackState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . LedMask = xgb . Get32 ( buf [ b : ] )
b += 4
v . LedValues = xgb . Get32 ( buf [ b : ] )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// LedFeedbackStateReadList reads a byte slice into a list of LedFeedbackState values.
2012-05-10 23:01:42 +02:00
func LedFeedbackStateReadList ( buf [ ] byte , dest [ ] LedFeedbackState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = LedFeedbackState { }
b += LedFeedbackStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a LedFeedbackState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v LedFeedbackState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 12 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , v . LedMask )
b += 4
xgb . Put32 ( buf [ b : ] , v . LedValues )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// LedFeedbackStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func LedFeedbackStateListBytes ( buf [ ] byte , list [ ] LedFeedbackState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type FeedbackCtl struct {
ClassId byte
Id byte
Len uint16
}
2012-05-11 05:57:34 +02:00
// FeedbackCtlRead reads a byte slice into a FeedbackCtl value.
2012-05-10 23:01:42 +02:00
func FeedbackCtlRead ( buf [ ] byte , v * FeedbackCtl ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// FeedbackCtlReadList reads a byte slice into a list of FeedbackCtl values.
2012-05-10 23:01:42 +02:00
func FeedbackCtlReadList ( buf [ ] byte , dest [ ] FeedbackCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = FeedbackCtl { }
b += FeedbackCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a FeedbackCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v FeedbackCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 4 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// FeedbackCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func FeedbackCtlListBytes ( buf [ ] byte , list [ ] FeedbackCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type KbdFeedbackCtl struct {
ClassId byte
Id byte
Len uint16
Key KeyCode
AutoRepeatMode byte
KeyClickPercent int8
BellPercent int8
BellPitch int16
BellDuration int16
LedMask uint32
LedValues uint32
}
2012-05-11 05:57:34 +02:00
// KbdFeedbackCtlRead reads a byte slice into a KbdFeedbackCtl value.
2012-05-10 23:01:42 +02:00
func KbdFeedbackCtlRead ( buf [ ] byte , v * KbdFeedbackCtl ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Key = KeyCode ( buf [ b ] )
b += 1
v . AutoRepeatMode = buf [ b ]
b += 1
v . KeyClickPercent = int8 ( buf [ b ] )
b += 1
v . BellPercent = int8 ( buf [ b ] )
b += 1
v . BellPitch = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . BellDuration = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . LedMask = xgb . Get32 ( buf [ b : ] )
b += 4
v . LedValues = xgb . Get32 ( buf [ b : ] )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// KbdFeedbackCtlReadList reads a byte slice into a list of KbdFeedbackCtl values.
2012-05-10 23:01:42 +02:00
func KbdFeedbackCtlReadList ( buf [ ] byte , dest [ ] KbdFeedbackCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = KbdFeedbackCtl { }
b += KbdFeedbackCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a KbdFeedbackCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v KbdFeedbackCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 20 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = byte ( v . Key )
b += 1
buf [ b ] = v . AutoRepeatMode
b += 1
buf [ b ] = byte ( v . KeyClickPercent )
b += 1
buf [ b ] = byte ( v . BellPercent )
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( v . BellPitch ) )
b += 2
xgb . Put16 ( buf [ b : ] , uint16 ( v . BellDuration ) )
b += 2
xgb . Put32 ( buf [ b : ] , v . LedMask )
b += 4
xgb . Put32 ( buf [ b : ] , v . LedValues )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// KbdFeedbackCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func KbdFeedbackCtlListBytes ( buf [ ] byte , list [ ] KbdFeedbackCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type PtrFeedbackCtl struct {
ClassId byte
Id byte
Len uint16
// padding: 2 bytes
Num int16
Denom int16
Threshold int16
}
2012-05-11 05:57:34 +02:00
// PtrFeedbackCtlRead reads a byte slice into a PtrFeedbackCtl value.
2012-05-10 23:01:42 +02:00
func PtrFeedbackCtlRead ( buf [ ] byte , v * PtrFeedbackCtl ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
b += 2 // padding
v . Num = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . Denom = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . Threshold = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// PtrFeedbackCtlReadList reads a byte slice into a list of PtrFeedbackCtl values.
2012-05-10 23:01:42 +02:00
func PtrFeedbackCtlReadList ( buf [ ] byte , dest [ ] PtrFeedbackCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = PtrFeedbackCtl { }
b += PtrFeedbackCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a PtrFeedbackCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v PtrFeedbackCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 12 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
b += 2 // padding
xgb . Put16 ( buf [ b : ] , uint16 ( v . Num ) )
b += 2
xgb . Put16 ( buf [ b : ] , uint16 ( v . Denom ) )
b += 2
xgb . Put16 ( buf [ b : ] , uint16 ( v . Threshold ) )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// PtrFeedbackCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func PtrFeedbackCtlListBytes ( buf [ ] byte , list [ ] PtrFeedbackCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type IntegerFeedbackCtl struct {
ClassId byte
Id byte
Len uint16
IntToDisplay int32
}
2012-05-11 05:57:34 +02:00
// IntegerFeedbackCtlRead reads a byte slice into a IntegerFeedbackCtl value.
2012-05-10 23:01:42 +02:00
func IntegerFeedbackCtlRead ( buf [ ] byte , v * IntegerFeedbackCtl ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . IntToDisplay = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// IntegerFeedbackCtlReadList reads a byte slice into a list of IntegerFeedbackCtl values.
2012-05-10 23:01:42 +02:00
func IntegerFeedbackCtlReadList ( buf [ ] byte , dest [ ] IntegerFeedbackCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = IntegerFeedbackCtl { }
b += IntegerFeedbackCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a IntegerFeedbackCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v IntegerFeedbackCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 8 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( v . IntToDisplay ) )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// IntegerFeedbackCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func IntegerFeedbackCtlListBytes ( buf [ ] byte , list [ ] IntegerFeedbackCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type StringFeedbackCtl struct {
ClassId byte
Id byte
Len uint16
// padding: 2 bytes
NumKeysyms uint16
Keysyms [ ] xproto . Keysym // size: xgb.Pad((int(NumKeysyms) * 4))
}
2012-05-11 05:57:34 +02:00
// StringFeedbackCtlRead reads a byte slice into a StringFeedbackCtl value.
2012-05-10 23:01:42 +02:00
func StringFeedbackCtlRead ( buf [ ] byte , v * StringFeedbackCtl ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
b += 2 // padding
v . NumKeysyms = xgb . Get16 ( buf [ b : ] )
b += 2
v . Keysyms = make ( [ ] xproto . Keysym , v . NumKeysyms )
for i := 0 ; i < int ( v . NumKeysyms ) ; i ++ {
v . Keysyms [ i ] = xproto . Keysym ( xgb . Get32 ( buf [ b : ] ) )
b += 4
}
b = xgb . Pad ( b )
return b
}
2012-05-11 05:57:34 +02:00
// StringFeedbackCtlReadList reads a byte slice into a list of StringFeedbackCtl values.
2012-05-10 23:01:42 +02:00
func StringFeedbackCtlReadList ( buf [ ] byte , dest [ ] StringFeedbackCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = StringFeedbackCtl { }
b += StringFeedbackCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a StringFeedbackCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v StringFeedbackCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , ( 8 + xgb . Pad ( ( int ( v . NumKeysyms ) * 4 ) ) ) )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
b += 2 // padding
xgb . Put16 ( buf [ b : ] , v . NumKeysyms )
b += 2
for i := 0 ; i < int ( v . NumKeysyms ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( v . Keysyms [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// StringFeedbackCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func StringFeedbackCtlListBytes ( buf [ ] byte , list [ ] StringFeedbackCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// StringFeedbackCtlListSize computes the size (bytes) of a list of StringFeedbackCtl values.
2012-05-10 23:01:42 +02:00
func StringFeedbackCtlListSize ( list [ ] StringFeedbackCtl ) int {
size := 0
for _ , item := range list {
size += ( 8 + xgb . Pad ( ( int ( item . NumKeysyms ) * 4 ) ) )
}
return size
}
type BellFeedbackCtl struct {
ClassId byte
Id byte
Len uint16
Percent int8
// padding: 3 bytes
Pitch int16
Duration int16
}
2012-05-11 05:57:34 +02:00
// BellFeedbackCtlRead reads a byte slice into a BellFeedbackCtl value.
2012-05-10 23:01:42 +02:00
func BellFeedbackCtlRead ( buf [ ] byte , v * BellFeedbackCtl ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Percent = int8 ( buf [ b ] )
b += 1
b += 3 // padding
v . Pitch = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . Duration = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// BellFeedbackCtlReadList reads a byte slice into a list of BellFeedbackCtl values.
2012-05-10 23:01:42 +02:00
func BellFeedbackCtlReadList ( buf [ ] byte , dest [ ] BellFeedbackCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = BellFeedbackCtl { }
b += BellFeedbackCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a BellFeedbackCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v BellFeedbackCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 12 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = byte ( v . Percent )
b += 1
b += 3 // padding
xgb . Put16 ( buf [ b : ] , uint16 ( v . Pitch ) )
b += 2
xgb . Put16 ( buf [ b : ] , uint16 ( v . Duration ) )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// BellFeedbackCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func BellFeedbackCtlListBytes ( buf [ ] byte , list [ ] BellFeedbackCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type LedFeedbackCtl struct {
ClassId byte
Id byte
Len uint16
LedMask uint32
LedValues uint32
}
2012-05-11 05:57:34 +02:00
// LedFeedbackCtlRead reads a byte slice into a LedFeedbackCtl value.
2012-05-10 23:01:42 +02:00
func LedFeedbackCtlRead ( buf [ ] byte , v * LedFeedbackCtl ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Id = buf [ b ]
b += 1
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . LedMask = xgb . Get32 ( buf [ b : ] )
b += 4
v . LedValues = xgb . Get32 ( buf [ b : ] )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// LedFeedbackCtlReadList reads a byte slice into a list of LedFeedbackCtl values.
2012-05-10 23:01:42 +02:00
func LedFeedbackCtlReadList ( buf [ ] byte , dest [ ] LedFeedbackCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = LedFeedbackCtl { }
b += LedFeedbackCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a LedFeedbackCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v LedFeedbackCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 12 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Id
b += 1
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , v . LedMask )
b += 4
xgb . Put32 ( buf [ b : ] , v . LedValues )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// LedFeedbackCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func LedFeedbackCtlListBytes ( buf [ ] byte , list [ ] LedFeedbackCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type InputState struct {
ClassId byte
Len byte
NumItems byte
}
2012-05-11 05:57:34 +02:00
// InputStateRead reads a byte slice into a InputState value.
2012-05-10 23:01:42 +02:00
func InputStateRead ( buf [ ] byte , v * InputState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
v . NumItems = buf [ b ]
b += 1
return b
}
2012-05-11 05:57:34 +02:00
// InputStateReadList reads a byte slice into a list of InputState values.
2012-05-10 23:01:42 +02:00
func InputStateReadList ( buf [ ] byte , dest [ ] InputState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = InputState { }
b += InputStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a InputState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v InputState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 3 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
buf [ b ] = v . NumItems
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// InputStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func InputStateListBytes ( buf [ ] byte , list [ ] InputState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type KeyState struct {
ClassId byte
Len byte
NumKeys byte
// padding: 1 bytes
Keys [ ] byte // size: 32
}
2012-05-11 05:57:34 +02:00
// KeyStateRead reads a byte slice into a KeyState value.
2012-05-10 23:01:42 +02:00
func KeyStateRead ( buf [ ] byte , v * KeyState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
v . NumKeys = buf [ b ]
b += 1
b += 1 // padding
v . Keys = make ( [ ] byte , 32 )
copy ( v . Keys [ : 32 ] , buf [ b : ] )
b += xgb . Pad ( int ( 32 ) )
return b
}
2012-05-11 05:57:34 +02:00
// KeyStateReadList reads a byte slice into a list of KeyState values.
2012-05-10 23:01:42 +02:00
func KeyStateReadList ( buf [ ] byte , dest [ ] KeyState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = KeyState { }
b += KeyStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a KeyState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v KeyState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 36 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
buf [ b ] = v . NumKeys
b += 1
b += 1 // padding
copy ( buf [ b : ] , v . Keys [ : 32 ] )
b += xgb . Pad ( int ( 32 ) )
return buf
}
2012-05-11 05:57:34 +02:00
// KeyStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func KeyStateListBytes ( buf [ ] byte , list [ ] KeyState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// KeyStateListSize computes the size (bytes) of a list of KeyState values.
2012-05-10 23:01:42 +02:00
func KeyStateListSize ( list [ ] KeyState ) int {
size := 0
for _ = range list {
size += 36
}
return size
}
type ButtonState struct {
ClassId byte
Len byte
NumButtons byte
// padding: 1 bytes
Buttons [ ] byte // size: 32
}
2012-05-11 05:57:34 +02:00
// ButtonStateRead reads a byte slice into a ButtonState value.
2012-05-10 23:01:42 +02:00
func ButtonStateRead ( buf [ ] byte , v * ButtonState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
v . NumButtons = buf [ b ]
b += 1
b += 1 // padding
v . Buttons = make ( [ ] byte , 32 )
copy ( v . Buttons [ : 32 ] , buf [ b : ] )
b += xgb . Pad ( int ( 32 ) )
return b
}
2012-05-11 05:57:34 +02:00
// ButtonStateReadList reads a byte slice into a list of ButtonState values.
2012-05-10 23:01:42 +02:00
func ButtonStateReadList ( buf [ ] byte , dest [ ] ButtonState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = ButtonState { }
b += ButtonStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a ButtonState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v ButtonState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 36 )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
buf [ b ] = v . NumButtons
b += 1
b += 1 // padding
copy ( buf [ b : ] , v . Buttons [ : 32 ] )
b += xgb . Pad ( int ( 32 ) )
return buf
}
2012-05-11 05:57:34 +02:00
// ButtonStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func ButtonStateListBytes ( buf [ ] byte , list [ ] ButtonState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// ButtonStateListSize computes the size (bytes) of a list of ButtonState values.
2012-05-10 23:01:42 +02:00
func ButtonStateListSize ( list [ ] ButtonState ) int {
size := 0
for _ = range list {
size += 36
}
return size
}
type ValuatorState struct {
ClassId byte
Len byte
NumValuators byte
Mode byte
Valuators [ ] uint32 // size: xgb.Pad((int(NumValuators) * 4))
}
2012-05-11 05:57:34 +02:00
// ValuatorStateRead reads a byte slice into a ValuatorState value.
2012-05-10 23:01:42 +02:00
func ValuatorStateRead ( buf [ ] byte , v * ValuatorState ) int {
b := 0
v . ClassId = buf [ b ]
b += 1
v . Len = buf [ b ]
b += 1
v . NumValuators = buf [ b ]
b += 1
v . Mode = buf [ b ]
b += 1
v . Valuators = make ( [ ] uint32 , v . NumValuators )
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
v . Valuators [ i ] = xgb . Get32 ( buf [ b : ] )
b += 4
}
b = xgb . Pad ( b )
return b
}
2012-05-11 05:57:34 +02:00
// ValuatorStateReadList reads a byte slice into a list of ValuatorState values.
2012-05-10 23:01:42 +02:00
func ValuatorStateReadList ( buf [ ] byte , dest [ ] ValuatorState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = ValuatorState { }
b += ValuatorStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a ValuatorState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v ValuatorState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , ( 4 + xgb . Pad ( ( int ( v . NumValuators ) * 4 ) ) ) )
b := 0
buf [ b ] = v . ClassId
b += 1
buf [ b ] = v . Len
b += 1
buf [ b ] = v . NumValuators
b += 1
buf [ b ] = v . Mode
b += 1
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
xgb . Put32 ( buf [ b : ] , v . Valuators [ i ] )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// ValuatorStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func ValuatorStateListBytes ( buf [ ] byte , list [ ] ValuatorState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// ValuatorStateListSize computes the size (bytes) of a list of ValuatorState values.
2012-05-10 23:01:42 +02:00
func ValuatorStateListSize ( list [ ] ValuatorState ) int {
size := 0
for _ , item := range list {
size += ( 4 + xgb . Pad ( ( int ( item . NumValuators ) * 4 ) ) )
}
return size
}
type DeviceState struct {
ControlId uint16
Len uint16
}
2012-05-11 05:57:34 +02:00
// DeviceStateRead reads a byte slice into a DeviceState value.
2012-05-10 23:01:42 +02:00
func DeviceStateRead ( buf [ ] byte , v * DeviceState ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// DeviceStateReadList reads a byte slice into a list of DeviceState values.
2012-05-10 23:01:42 +02:00
func DeviceStateReadList ( buf [ ] byte , dest [ ] DeviceState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceState { }
b += DeviceStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 4 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceStateListBytes ( buf [ ] byte , list [ ] DeviceState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceResolutionState struct {
ControlId uint16
Len uint16
NumValuators uint32
ResolutionValues [ ] uint32 // size: xgb.Pad((int(NumValuators) * 4))
ResolutionMin [ ] uint32 // size: xgb.Pad((int(NumValuators) * 4))
ResolutionMax [ ] uint32 // size: xgb.Pad((int(NumValuators) * 4))
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionStateRead reads a byte slice into a DeviceResolutionState value.
2012-05-10 23:01:42 +02:00
func DeviceResolutionStateRead ( buf [ ] byte , v * DeviceResolutionState ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . NumValuators = xgb . Get32 ( buf [ b : ] )
b += 4
v . ResolutionValues = make ( [ ] uint32 , v . NumValuators )
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
v . ResolutionValues [ i ] = xgb . Get32 ( buf [ b : ] )
b += 4
}
b = xgb . Pad ( b )
v . ResolutionMin = make ( [ ] uint32 , v . NumValuators )
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
v . ResolutionMin [ i ] = xgb . Get32 ( buf [ b : ] )
b += 4
}
b = xgb . Pad ( b )
v . ResolutionMax = make ( [ ] uint32 , v . NumValuators )
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
v . ResolutionMax [ i ] = xgb . Get32 ( buf [ b : ] )
b += 4
}
b = xgb . Pad ( b )
return b
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionStateReadList reads a byte slice into a list of DeviceResolutionState values.
2012-05-10 23:01:42 +02:00
func DeviceResolutionStateReadList ( buf [ ] byte , dest [ ] DeviceResolutionState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceResolutionState { }
b += DeviceResolutionStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceResolutionState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceResolutionState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , ( ( ( 8 + xgb . Pad ( ( int ( v . NumValuators ) * 4 ) ) ) + xgb . Pad ( ( int ( v . NumValuators ) * 4 ) ) ) + xgb . Pad ( ( int ( v . NumValuators ) * 4 ) ) ) )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , v . NumValuators )
b += 4
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
xgb . Put32 ( buf [ b : ] , v . ResolutionValues [ i ] )
b += 4
}
b = xgb . Pad ( b )
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
xgb . Put32 ( buf [ b : ] , v . ResolutionMin [ i ] )
b += 4
}
b = xgb . Pad ( b )
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
xgb . Put32 ( buf [ b : ] , v . ResolutionMax [ i ] )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceResolutionStateListBytes ( buf [ ] byte , list [ ] DeviceResolutionState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionStateListSize computes the size (bytes) of a list of DeviceResolutionState values.
2012-05-10 23:01:42 +02:00
func DeviceResolutionStateListSize ( list [ ] DeviceResolutionState ) int {
size := 0
for _ , item := range list {
size += ( ( ( 8 + xgb . Pad ( ( int ( item . NumValuators ) * 4 ) ) ) + xgb . Pad ( ( int ( item . NumValuators ) * 4 ) ) ) + xgb . Pad ( ( int ( item . NumValuators ) * 4 ) ) )
}
return size
}
type DeviceAbsCalibState struct {
ControlId uint16
Len uint16
MinX int32
MaxX int32
MinY int32
MaxY int32
FlipX uint32
FlipY uint32
Rotation uint32
ButtonThreshold uint32
}
2012-05-11 05:57:34 +02:00
// DeviceAbsCalibStateRead reads a byte slice into a DeviceAbsCalibState value.
2012-05-10 23:01:42 +02:00
func DeviceAbsCalibStateRead ( buf [ ] byte , v * DeviceAbsCalibState ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . MinX = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . MaxX = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . MinY = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . MaxY = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . FlipX = xgb . Get32 ( buf [ b : ] )
b += 4
v . FlipY = xgb . Get32 ( buf [ b : ] )
b += 4
v . Rotation = xgb . Get32 ( buf [ b : ] )
b += 4
v . ButtonThreshold = xgb . Get32 ( buf [ b : ] )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// DeviceAbsCalibStateReadList reads a byte slice into a list of DeviceAbsCalibState values.
2012-05-10 23:01:42 +02:00
func DeviceAbsCalibStateReadList ( buf [ ] byte , dest [ ] DeviceAbsCalibState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceAbsCalibState { }
b += DeviceAbsCalibStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceAbsCalibState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceAbsCalibState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 36 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( v . MinX ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MaxX ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MinY ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MaxY ) )
b += 4
xgb . Put32 ( buf [ b : ] , v . FlipX )
b += 4
xgb . Put32 ( buf [ b : ] , v . FlipY )
b += 4
xgb . Put32 ( buf [ b : ] , v . Rotation )
b += 4
xgb . Put32 ( buf [ b : ] , v . ButtonThreshold )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceAbsCalibStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceAbsCalibStateListBytes ( buf [ ] byte , list [ ] DeviceAbsCalibState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceAbsAreaState struct {
ControlId uint16
Len uint16
OffsetX uint32
OffsetY uint32
Width uint32
Height uint32
Screen uint32
Following uint32
}
2012-05-11 05:57:34 +02:00
// DeviceAbsAreaStateRead reads a byte slice into a DeviceAbsAreaState value.
2012-05-10 23:01:42 +02:00
func DeviceAbsAreaStateRead ( buf [ ] byte , v * DeviceAbsAreaState ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . OffsetX = xgb . Get32 ( buf [ b : ] )
b += 4
v . OffsetY = xgb . Get32 ( buf [ b : ] )
b += 4
v . Width = xgb . Get32 ( buf [ b : ] )
b += 4
v . Height = xgb . Get32 ( buf [ b : ] )
b += 4
v . Screen = xgb . Get32 ( buf [ b : ] )
b += 4
v . Following = xgb . Get32 ( buf [ b : ] )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// DeviceAbsAreaStateReadList reads a byte slice into a list of DeviceAbsAreaState values.
2012-05-10 23:01:42 +02:00
func DeviceAbsAreaStateReadList ( buf [ ] byte , dest [ ] DeviceAbsAreaState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceAbsAreaState { }
b += DeviceAbsAreaStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceAbsAreaState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceAbsAreaState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 28 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , v . OffsetX )
b += 4
xgb . Put32 ( buf [ b : ] , v . OffsetY )
b += 4
xgb . Put32 ( buf [ b : ] , v . Width )
b += 4
xgb . Put32 ( buf [ b : ] , v . Height )
b += 4
xgb . Put32 ( buf [ b : ] , v . Screen )
b += 4
xgb . Put32 ( buf [ b : ] , v . Following )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceAbsAreaStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceAbsAreaStateListBytes ( buf [ ] byte , list [ ] DeviceAbsAreaState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceCoreState struct {
ControlId uint16
Len uint16
Status byte
Iscore byte
// padding: 2 bytes
}
2012-05-11 05:57:34 +02:00
// DeviceCoreStateRead reads a byte slice into a DeviceCoreState value.
2012-05-10 23:01:42 +02:00
func DeviceCoreStateRead ( buf [ ] byte , v * DeviceCoreState ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Status = buf [ b ]
b += 1
v . Iscore = buf [ b ]
b += 1
b += 2 // padding
return b
}
2012-05-11 05:57:34 +02:00
// DeviceCoreStateReadList reads a byte slice into a list of DeviceCoreState values.
2012-05-10 23:01:42 +02:00
func DeviceCoreStateReadList ( buf [ ] byte , dest [ ] DeviceCoreState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceCoreState { }
b += DeviceCoreStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceCoreState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceCoreState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 8 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = v . Status
b += 1
buf [ b ] = v . Iscore
b += 1
b += 2 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceCoreStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceCoreStateListBytes ( buf [ ] byte , list [ ] DeviceCoreState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceEnableState struct {
ControlId uint16
Len uint16
Enable byte
// padding: 3 bytes
}
2012-05-11 05:57:34 +02:00
// DeviceEnableStateRead reads a byte slice into a DeviceEnableState value.
2012-05-10 23:01:42 +02:00
func DeviceEnableStateRead ( buf [ ] byte , v * DeviceEnableState ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Enable = buf [ b ]
b += 1
b += 3 // padding
return b
}
2012-05-11 05:57:34 +02:00
// DeviceEnableStateReadList reads a byte slice into a list of DeviceEnableState values.
2012-05-10 23:01:42 +02:00
func DeviceEnableStateReadList ( buf [ ] byte , dest [ ] DeviceEnableState ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceEnableState { }
b += DeviceEnableStateRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceEnableState value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceEnableState ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 8 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = v . Enable
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceEnableStateListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceEnableStateListBytes ( buf [ ] byte , list [ ] DeviceEnableState ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceCtl struct {
ControlId uint16
Len uint16
}
2012-05-11 05:57:34 +02:00
// DeviceCtlRead reads a byte slice into a DeviceCtl value.
2012-05-10 23:01:42 +02:00
func DeviceCtlRead ( buf [ ] byte , v * DeviceCtl ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
return b
}
2012-05-11 05:57:34 +02:00
// DeviceCtlReadList reads a byte slice into a list of DeviceCtl values.
2012-05-10 23:01:42 +02:00
func DeviceCtlReadList ( buf [ ] byte , dest [ ] DeviceCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceCtl { }
b += DeviceCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 4 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceCtlListBytes ( buf [ ] byte , list [ ] DeviceCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceResolutionCtl struct {
ControlId uint16
Len uint16
FirstValuator byte
NumValuators byte
ResolutionValues [ ] uint32 // size: xgb.Pad((int(NumValuators) * 4))
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionCtlRead reads a byte slice into a DeviceResolutionCtl value.
2012-05-10 23:01:42 +02:00
func DeviceResolutionCtlRead ( buf [ ] byte , v * DeviceResolutionCtl ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . FirstValuator = buf [ b ]
b += 1
v . NumValuators = buf [ b ]
b += 1
v . ResolutionValues = make ( [ ] uint32 , v . NumValuators )
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
v . ResolutionValues [ i ] = xgb . Get32 ( buf [ b : ] )
b += 4
}
b = xgb . Pad ( b )
return b
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionCtlReadList reads a byte slice into a list of DeviceResolutionCtl values.
2012-05-10 23:01:42 +02:00
func DeviceResolutionCtlReadList ( buf [ ] byte , dest [ ] DeviceResolutionCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceResolutionCtl { }
b += DeviceResolutionCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceResolutionCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceResolutionCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , ( 6 + xgb . Pad ( ( int ( v . NumValuators ) * 4 ) ) ) )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = v . FirstValuator
b += 1
buf [ b ] = v . NumValuators
b += 1
for i := 0 ; i < int ( v . NumValuators ) ; i ++ {
xgb . Put32 ( buf [ b : ] , v . ResolutionValues [ i ] )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceResolutionCtlListBytes ( buf [ ] byte , list [ ] DeviceResolutionCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// DeviceResolutionCtlListSize computes the size (bytes) of a list of DeviceResolutionCtl values.
2012-05-10 23:01:42 +02:00
func DeviceResolutionCtlListSize ( list [ ] DeviceResolutionCtl ) int {
size := 0
for _ , item := range list {
size += ( 6 + xgb . Pad ( ( int ( item . NumValuators ) * 4 ) ) )
}
return size
}
type DeviceAbsCalibCtl struct {
ControlId uint16
Len uint16
MinX int32
MaxX int32
MinY int32
MaxY int32
FlipX uint32
FlipY uint32
Rotation uint32
ButtonThreshold uint32
}
2012-05-11 05:57:34 +02:00
// DeviceAbsCalibCtlRead reads a byte slice into a DeviceAbsCalibCtl value.
2012-05-10 23:01:42 +02:00
func DeviceAbsCalibCtlRead ( buf [ ] byte , v * DeviceAbsCalibCtl ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . MinX = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . MaxX = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . MinY = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . MaxY = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . FlipX = xgb . Get32 ( buf [ b : ] )
b += 4
v . FlipY = xgb . Get32 ( buf [ b : ] )
b += 4
v . Rotation = xgb . Get32 ( buf [ b : ] )
b += 4
v . ButtonThreshold = xgb . Get32 ( buf [ b : ] )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// DeviceAbsCalibCtlReadList reads a byte slice into a list of DeviceAbsCalibCtl values.
2012-05-10 23:01:42 +02:00
func DeviceAbsCalibCtlReadList ( buf [ ] byte , dest [ ] DeviceAbsCalibCtl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceAbsCalibCtl { }
b += DeviceAbsCalibCtlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceAbsCalibCtl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceAbsCalibCtl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 36 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( v . MinX ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MaxX ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MinY ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . MaxY ) )
b += 4
xgb . Put32 ( buf [ b : ] , v . FlipX )
b += 4
xgb . Put32 ( buf [ b : ] , v . FlipY )
b += 4
xgb . Put32 ( buf [ b : ] , v . Rotation )
b += 4
xgb . Put32 ( buf [ b : ] , v . ButtonThreshold )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceAbsCalibCtlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceAbsCalibCtlListBytes ( buf [ ] byte , list [ ] DeviceAbsCalibCtl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceAbsAreaCtrl struct {
ControlId uint16
Len uint16
OffsetX uint32
OffsetY uint32
Width int32
Height int32
Screen int32
Following uint32
}
2012-05-11 05:57:34 +02:00
// DeviceAbsAreaCtrlRead reads a byte slice into a DeviceAbsAreaCtrl value.
2012-05-10 23:01:42 +02:00
func DeviceAbsAreaCtrlRead ( buf [ ] byte , v * DeviceAbsAreaCtrl ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . OffsetX = xgb . Get32 ( buf [ b : ] )
b += 4
v . OffsetY = xgb . Get32 ( buf [ b : ] )
b += 4
v . Width = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Height = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Screen = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Following = xgb . Get32 ( buf [ b : ] )
b += 4
return b
}
2012-05-11 05:57:34 +02:00
// DeviceAbsAreaCtrlReadList reads a byte slice into a list of DeviceAbsAreaCtrl values.
2012-05-10 23:01:42 +02:00
func DeviceAbsAreaCtrlReadList ( buf [ ] byte , dest [ ] DeviceAbsAreaCtrl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceAbsAreaCtrl { }
b += DeviceAbsAreaCtrlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceAbsAreaCtrl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceAbsAreaCtrl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 28 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
xgb . Put32 ( buf [ b : ] , v . OffsetX )
b += 4
xgb . Put32 ( buf [ b : ] , v . OffsetY )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Width ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Height ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Screen ) )
b += 4
xgb . Put32 ( buf [ b : ] , v . Following )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceAbsAreaCtrlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceAbsAreaCtrlListBytes ( buf [ ] byte , list [ ] DeviceAbsAreaCtrl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceCoreCtrl struct {
ControlId uint16
Len uint16
Status byte
// padding: 3 bytes
}
2012-05-11 05:57:34 +02:00
// DeviceCoreCtrlRead reads a byte slice into a DeviceCoreCtrl value.
2012-05-10 23:01:42 +02:00
func DeviceCoreCtrlRead ( buf [ ] byte , v * DeviceCoreCtrl ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Status = buf [ b ]
b += 1
b += 3 // padding
return b
}
2012-05-11 05:57:34 +02:00
// DeviceCoreCtrlReadList reads a byte slice into a list of DeviceCoreCtrl values.
2012-05-10 23:01:42 +02:00
func DeviceCoreCtrlReadList ( buf [ ] byte , dest [ ] DeviceCoreCtrl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceCoreCtrl { }
b += DeviceCoreCtrlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceCoreCtrl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceCoreCtrl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 8 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = v . Status
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceCoreCtrlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceCoreCtrlListBytes ( buf [ ] byte , list [ ] DeviceCoreCtrl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
type DeviceEnableCtrl struct {
ControlId uint16
Len uint16
Enable byte
// padding: 3 bytes
}
2012-05-11 05:57:34 +02:00
// DeviceEnableCtrlRead reads a byte slice into a DeviceEnableCtrl value.
2012-05-10 23:01:42 +02:00
func DeviceEnableCtrlRead ( buf [ ] byte , v * DeviceEnableCtrl ) int {
b := 0
v . ControlId = xgb . Get16 ( buf [ b : ] )
b += 2
v . Len = xgb . Get16 ( buf [ b : ] )
b += 2
v . Enable = buf [ b ]
b += 1
b += 3 // padding
return b
}
2012-05-11 05:57:34 +02:00
// DeviceEnableCtrlReadList reads a byte slice into a list of DeviceEnableCtrl values.
2012-05-10 23:01:42 +02:00
func DeviceEnableCtrlReadList ( buf [ ] byte , dest [ ] DeviceEnableCtrl ) int {
b := 0
for i := 0 ; i < len ( dest ) ; i ++ {
dest [ i ] = DeviceEnableCtrl { }
b += DeviceEnableCtrlRead ( buf [ b : ] , & dest [ i ] )
}
return xgb . Pad ( b )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceEnableCtrl value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceEnableCtrl ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 8 )
b := 0
xgb . Put16 ( buf [ b : ] , v . ControlId )
b += 2
xgb . Put16 ( buf [ b : ] , v . Len )
b += 2
buf [ b ] = v . Enable
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceEnableCtrlListBytes writes a list of %s(MISSING) values to a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceEnableCtrlListBytes ( buf [ ] byte , list [ ] DeviceEnableCtrl ) int {
b := 0
var structBytes [ ] byte
for _ , item := range list {
structBytes = item . Bytes ( )
copy ( buf [ b : ] , structBytes )
b += xgb . Pad ( len ( structBytes ) )
}
return b
}
2012-05-11 05:57:34 +02:00
// DeviceValuator is the event number for a DeviceValuatorEvent.
2012-05-10 23:01:42 +02:00
const DeviceValuator = 0
type DeviceValuatorEvent struct {
Sequence uint16
DeviceId byte
DeviceState uint16
NumValuators byte
FirstValuator byte
Valuators [ ] int32 // size: 24
}
2012-05-11 05:57:34 +02:00
// DeviceValuatorEventNew constructs a DeviceValuatorEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceValuatorEventNew ( buf [ ] byte ) xgb . Event {
v := DeviceValuatorEvent { }
b := 1 // don't read event number
v . DeviceId = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . DeviceState = xgb . Get16 ( buf [ b : ] )
b += 2
v . NumValuators = buf [ b ]
b += 1
v . FirstValuator = buf [ b ]
b += 1
v . Valuators = make ( [ ] int32 , 6 )
for i := 0 ; i < int ( 6 ) ; i ++ {
v . Valuators [ i ] = int32 ( xgb . Get32 ( buf [ b : ] ) )
b += 4
}
b = xgb . Pad ( b )
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceValuatorEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceValuatorEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 0
b += 1
buf [ b ] = v . DeviceId
b += 1
b += 2 // skip sequence number
xgb . Put16 ( buf [ b : ] , v . DeviceState )
b += 2
buf [ b ] = v . NumValuators
b += 1
buf [ b ] = v . FirstValuator
b += 1
for i := 0 ; i < int ( 6 ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( v . Valuators [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceValuator event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceValuatorEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of DeviceValuatorEvent.
2012-05-10 23:01:42 +02:00
func ( v DeviceValuatorEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 5 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceState: %d" , v . DeviceState ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "NumValuators: %d" , v . NumValuators ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "FirstValuator: %d" , v . FirstValuator ) )
return "DeviceValuator {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 0 ] = DeviceValuatorEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceKeyPress is the event number for a DeviceKeyPressEvent.
2012-05-10 23:01:42 +02:00
const DeviceKeyPress = 1
type DeviceKeyPressEvent struct {
Sequence uint16
Detail byte
Time xproto . Timestamp
Root xproto . Window
Event xproto . Window
Child xproto . Window
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
SameScreen bool
DeviceId byte
}
2012-05-11 05:57:34 +02:00
// DeviceKeyPressEventNew constructs a DeviceKeyPressEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceKeyPressEventNew ( buf [ ] byte ) xgb . Event {
v := DeviceKeyPressEvent { }
b := 1 // don't read event number
v . Detail = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Root = xproto . Window ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Event = xproto . Window ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Child = xproto . Window ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . RootX = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . RootY = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . EventX = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . EventY = int16 ( xgb . Get16 ( buf [ b : ] ) )
b += 2
v . State = xgb . Get16 ( buf [ b : ] )
b += 2
if buf [ b ] == 1 {
v . SameScreen = true
} else {
v . SameScreen = false
}
b += 1
v . DeviceId = buf [ b ]
b += 1
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceKeyPressEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyPressEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 1
b += 1
buf [ b ] = v . Detail
b += 1
b += 2 // skip sequence number
xgb . Put32 ( buf [ b : ] , uint32 ( v . Time ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Root ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Event ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Child ) )
b += 4
xgb . Put16 ( buf [ b : ] , uint16 ( v . RootX ) )
b += 2
xgb . Put16 ( buf [ b : ] , uint16 ( v . RootY ) )
b += 2
xgb . Put16 ( buf [ b : ] , uint16 ( v . EventX ) )
b += 2
xgb . Put16 ( buf [ b : ] , uint16 ( v . EventY ) )
b += 2
xgb . Put16 ( buf [ b : ] , v . State )
b += 2
if v . SameScreen {
buf [ b ] = 1
} else {
buf [ b ] = 0
}
b += 1
buf [ b ] = v . DeviceId
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceKeyPress event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyPressEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of DeviceKeyPressEvent.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyPressEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 12 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Root: %d" , v . Root ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Event: %d" , v . Event ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Child: %d" , v . Child ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootX: %d" , v . RootX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootY: %d" , v . RootY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventX: %d" , v . EventX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventY: %d" , v . EventY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "State: %d" , v . State ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "SameScreen: %t" , v . SameScreen ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "DeviceKeyPress {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 1 ] = DeviceKeyPressEventNew
}
2012-05-11 05:57:34 +02:00
// FocusIn is the event number for a FocusInEvent.
2012-05-10 23:01:42 +02:00
const FocusIn = 6
type FocusInEvent struct {
Sequence uint16
Detail byte
Time xproto . Timestamp
Window xproto . Window
Mode byte
DeviceId byte
// padding: 18 bytes
}
2012-05-11 05:57:34 +02:00
// FocusInEventNew constructs a FocusInEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func FocusInEventNew ( buf [ ] byte ) xgb . Event {
v := FocusInEvent { }
b := 1 // don't read event number
v . Detail = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Window = xproto . Window ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Mode = buf [ b ]
b += 1
v . DeviceId = buf [ b ]
b += 1
b += 18 // padding
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a FocusInEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v FocusInEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 6
b += 1
buf [ b ] = v . Detail
b += 1
b += 2 // skip sequence number
xgb . Put32 ( buf [ b : ] , uint32 ( v . Time ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( v . Window ) )
b += 4
buf [ b ] = v . Mode
b += 1
buf [ b ] = v . DeviceId
b += 1
b += 18 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the FocusIn event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v FocusInEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of FocusInEvent.
2012-05-10 23:01:42 +02:00
func ( v FocusInEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 6 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Window: %d" , v . Window ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Mode: %d" , v . Mode ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "FocusIn {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 6 ] = FocusInEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceStateNotify is the event number for a DeviceStateNotifyEvent.
2012-05-10 23:01:42 +02:00
const DeviceStateNotify = 10
type DeviceStateNotifyEvent struct {
Sequence uint16
DeviceId byte
Time xproto . Timestamp
NumKeys byte
NumButtons byte
NumValuators byte
ClassesReported byte
Buttons [ ] byte // size: 4
Keys [ ] byte // size: 4
Valuators [ ] uint32 // size: 12
}
2012-05-11 05:57:34 +02:00
// DeviceStateNotifyEventNew constructs a DeviceStateNotifyEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceStateNotifyEventNew ( buf [ ] byte ) xgb . Event {
v := DeviceStateNotifyEvent { }
b := 1 // don't read event number
v . DeviceId = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . NumKeys = buf [ b ]
b += 1
v . NumButtons = buf [ b ]
b += 1
v . NumValuators = buf [ b ]
b += 1
v . ClassesReported = buf [ b ]
b += 1
v . Buttons = make ( [ ] byte , 4 )
copy ( v . Buttons [ : 4 ] , buf [ b : ] )
b += xgb . Pad ( int ( 4 ) )
v . Keys = make ( [ ] byte , 4 )
copy ( v . Keys [ : 4 ] , buf [ b : ] )
b += xgb . Pad ( int ( 4 ) )
v . Valuators = make ( [ ] uint32 , 3 )
for i := 0 ; i < int ( 3 ) ; i ++ {
v . Valuators [ i ] = xgb . Get32 ( buf [ b : ] )
b += 4
}
b = xgb . Pad ( b )
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceStateNotifyEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceStateNotifyEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 10
b += 1
buf [ b ] = v . DeviceId
b += 1
b += 2 // skip sequence number
xgb . Put32 ( buf [ b : ] , uint32 ( v . Time ) )
b += 4
buf [ b ] = v . NumKeys
b += 1
buf [ b ] = v . NumButtons
b += 1
buf [ b ] = v . NumValuators
b += 1
buf [ b ] = v . ClassesReported
b += 1
copy ( buf [ b : ] , v . Buttons [ : 4 ] )
b += xgb . Pad ( int ( 4 ) )
copy ( buf [ b : ] , v . Keys [ : 4 ] )
b += xgb . Pad ( int ( 4 ) )
for i := 0 ; i < int ( 3 ) ; i ++ {
xgb . Put32 ( buf [ b : ] , v . Valuators [ i ] )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceStateNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceStateNotifyEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of DeviceStateNotifyEvent.
2012-05-10 23:01:42 +02:00
func ( v DeviceStateNotifyEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 9 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "NumKeys: %d" , v . NumKeys ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "NumButtons: %d" , v . NumButtons ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "NumValuators: %d" , v . NumValuators ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "ClassesReported: %d" , v . ClassesReported ) )
return "DeviceStateNotify {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 10 ] = DeviceStateNotifyEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceMappingNotify is the event number for a DeviceMappingNotifyEvent.
2012-05-10 23:01:42 +02:00
const DeviceMappingNotify = 11
type DeviceMappingNotifyEvent struct {
Sequence uint16
DeviceId byte
Request byte
FirstKeycode KeyCode
Count byte
// padding: 1 bytes
Time xproto . Timestamp
// padding: 20 bytes
}
2012-05-11 05:57:34 +02:00
// DeviceMappingNotifyEventNew constructs a DeviceMappingNotifyEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceMappingNotifyEventNew ( buf [ ] byte ) xgb . Event {
v := DeviceMappingNotifyEvent { }
b := 1 // don't read event number
v . DeviceId = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Request = buf [ b ]
b += 1
v . FirstKeycode = KeyCode ( buf [ b ] )
b += 1
v . Count = buf [ b ]
b += 1
b += 1 // padding
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
b += 20 // padding
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceMappingNotifyEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceMappingNotifyEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 11
b += 1
buf [ b ] = v . DeviceId
b += 1
b += 2 // skip sequence number
buf [ b ] = v . Request
b += 1
buf [ b ] = byte ( v . FirstKeycode )
b += 1
buf [ b ] = v . Count
b += 1
b += 1 // padding
xgb . Put32 ( buf [ b : ] , uint32 ( v . Time ) )
b += 4
b += 20 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceMappingNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceMappingNotifyEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of DeviceMappingNotifyEvent.
2012-05-10 23:01:42 +02:00
func ( v DeviceMappingNotifyEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 7 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Request: %d" , v . Request ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "FirstKeycode: %d" , v . FirstKeycode ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Count: %d" , v . Count ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
return "DeviceMappingNotify {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 11 ] = DeviceMappingNotifyEventNew
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceNotify is the event number for a ChangeDeviceNotifyEvent.
2012-05-10 23:01:42 +02:00
const ChangeDeviceNotify = 12
type ChangeDeviceNotifyEvent struct {
Sequence uint16
DeviceId byte
Time xproto . Timestamp
Request byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceNotifyEventNew constructs a ChangeDeviceNotifyEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func ChangeDeviceNotifyEventNew ( buf [ ] byte ) xgb . Event {
v := ChangeDeviceNotifyEvent { }
b := 1 // don't read event number
v . DeviceId = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Request = buf [ b ]
b += 1
b += 23 // padding
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a ChangeDeviceNotifyEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v ChangeDeviceNotifyEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 12
b += 1
buf [ b ] = v . DeviceId
b += 1
b += 2 // skip sequence number
xgb . Put32 ( buf [ b : ] , uint32 ( v . Time ) )
b += 4
buf [ b ] = v . Request
b += 1
b += 23 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the ChangeDeviceNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v ChangeDeviceNotifyEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of ChangeDeviceNotifyEvent.
2012-05-10 23:01:42 +02:00
func ( v ChangeDeviceNotifyEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 4 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Request: %d" , v . Request ) )
return "ChangeDeviceNotify {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 12 ] = ChangeDeviceNotifyEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceKeyStateNotify is the event number for a DeviceKeyStateNotifyEvent.
2012-05-10 23:01:42 +02:00
const DeviceKeyStateNotify = 13
type DeviceKeyStateNotifyEvent struct {
Sequence uint16
DeviceId byte
Keys [ ] byte // size: 28
}
2012-05-11 05:57:34 +02:00
// DeviceKeyStateNotifyEventNew constructs a DeviceKeyStateNotifyEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceKeyStateNotifyEventNew ( buf [ ] byte ) xgb . Event {
v := DeviceKeyStateNotifyEvent { }
b := 1 // don't read event number
v . DeviceId = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Keys = make ( [ ] byte , 28 )
copy ( v . Keys [ : 28 ] , buf [ b : ] )
b += xgb . Pad ( int ( 28 ) )
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceKeyStateNotifyEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyStateNotifyEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 13
b += 1
buf [ b ] = v . DeviceId
b += 1
b += 2 // skip sequence number
copy ( buf [ b : ] , v . Keys [ : 28 ] )
b += xgb . Pad ( int ( 28 ) )
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceKeyStateNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyStateNotifyEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of DeviceKeyStateNotifyEvent.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyStateNotifyEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 2 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "DeviceKeyStateNotify {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 13 ] = DeviceKeyStateNotifyEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceButtonStateNotify is the event number for a DeviceButtonStateNotifyEvent.
2012-05-10 23:01:42 +02:00
const DeviceButtonStateNotify = 14
type DeviceButtonStateNotifyEvent struct {
Sequence uint16
DeviceId byte
Buttons [ ] byte // size: 28
}
2012-05-11 05:57:34 +02:00
// DeviceButtonStateNotifyEventNew constructs a DeviceButtonStateNotifyEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceButtonStateNotifyEventNew ( buf [ ] byte ) xgb . Event {
v := DeviceButtonStateNotifyEvent { }
b := 1 // don't read event number
v . DeviceId = buf [ b ]
b += 1
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Buttons = make ( [ ] byte , 28 )
copy ( v . Buttons [ : 28 ] , buf [ b : ] )
b += xgb . Pad ( int ( 28 ) )
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceButtonStateNotifyEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceButtonStateNotifyEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 14
b += 1
buf [ b ] = v . DeviceId
b += 1
b += 2 // skip sequence number
copy ( buf [ b : ] , v . Buttons [ : 28 ] )
b += xgb . Pad ( int ( 28 ) )
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceButtonStateNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceButtonStateNotifyEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of DeviceButtonStateNotifyEvent.
2012-05-10 23:01:42 +02:00
func ( v DeviceButtonStateNotifyEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 2 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "DeviceButtonStateNotify {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 14 ] = DeviceButtonStateNotifyEventNew
}
2012-05-11 05:57:34 +02:00
// DevicePresenceNotify is the event number for a DevicePresenceNotifyEvent.
2012-05-10 23:01:42 +02:00
const DevicePresenceNotify = 15
type DevicePresenceNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Time xproto . Timestamp
Devchange byte
DeviceId byte
Control uint16
// padding: 20 bytes
}
2012-05-11 05:57:34 +02:00
// DevicePresenceNotifyEventNew constructs a DevicePresenceNotifyEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DevicePresenceNotifyEventNew ( buf [ ] byte ) xgb . Event {
v := DevicePresenceNotifyEvent { }
b := 1 // don't read event number
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Devchange = buf [ b ]
b += 1
v . DeviceId = buf [ b ]
b += 1
v . Control = xgb . Get16 ( buf [ b : ] )
b += 2
b += 20 // padding
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DevicePresenceNotifyEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DevicePresenceNotifyEvent ) Bytes ( ) [ ] byte {
buf := make ( [ ] byte , 32 )
b := 0
// write event number
buf [ b ] = 15
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb . Put32 ( buf [ b : ] , uint32 ( v . Time ) )
b += 4
buf [ b ] = v . Devchange
b += 1
buf [ b ] = v . DeviceId
b += 1
xgb . Put16 ( buf [ b : ] , v . Control )
b += 2
b += 20 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DevicePresenceNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DevicePresenceNotifyEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of DevicePresenceNotifyEvent.
2012-05-10 23:01:42 +02:00
func ( v DevicePresenceNotifyEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 6 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Devchange: %d" , v . Devchange ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Control: %d" , v . Control ) )
return "DevicePresenceNotify {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 15 ] = DevicePresenceNotifyEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceKeyRelease is the event number for a DeviceKeyReleaseEvent.
2012-05-10 23:01:42 +02:00
const DeviceKeyRelease = 2
type DeviceKeyReleaseEvent DeviceKeyPressEvent
2012-05-11 05:57:34 +02:00
// DeviceKeyReleaseEventNew constructs a DeviceKeyReleaseEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceKeyReleaseEventNew ( buf [ ] byte ) xgb . Event {
return DeviceKeyReleaseEvent ( DeviceKeyPressEventNew ( buf ) . ( DeviceKeyPressEvent ) )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceKeyReleaseEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyReleaseEvent ) Bytes ( ) [ ] byte {
return DeviceKeyPressEvent ( v ) . Bytes ( )
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceKeyRelease event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceKeyReleaseEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
func ( v DeviceKeyReleaseEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 12 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Root: %d" , v . Root ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Event: %d" , v . Event ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Child: %d" , v . Child ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootX: %d" , v . RootX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootY: %d" , v . RootY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventX: %d" , v . EventX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventY: %d" , v . EventY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "State: %d" , v . State ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "SameScreen: %t" , v . SameScreen ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "DeviceKeyRelease {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 2 ] = DeviceKeyReleaseEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceButtonPress is the event number for a DeviceButtonPressEvent.
2012-05-10 23:01:42 +02:00
const DeviceButtonPress = 3
type DeviceButtonPressEvent DeviceKeyPressEvent
2012-05-11 05:57:34 +02:00
// DeviceButtonPressEventNew constructs a DeviceButtonPressEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceButtonPressEventNew ( buf [ ] byte ) xgb . Event {
return DeviceButtonPressEvent ( DeviceKeyPressEventNew ( buf ) . ( DeviceKeyPressEvent ) )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceButtonPressEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceButtonPressEvent ) Bytes ( ) [ ] byte {
return DeviceKeyPressEvent ( v ) . Bytes ( )
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceButtonPress event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceButtonPressEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
func ( v DeviceButtonPressEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 12 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Root: %d" , v . Root ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Event: %d" , v . Event ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Child: %d" , v . Child ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootX: %d" , v . RootX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootY: %d" , v . RootY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventX: %d" , v . EventX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventY: %d" , v . EventY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "State: %d" , v . State ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "SameScreen: %t" , v . SameScreen ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "DeviceButtonPress {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 3 ] = DeviceButtonPressEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceButtonRelease is the event number for a DeviceButtonReleaseEvent.
2012-05-10 23:01:42 +02:00
const DeviceButtonRelease = 4
type DeviceButtonReleaseEvent DeviceKeyPressEvent
2012-05-11 05:57:34 +02:00
// DeviceButtonReleaseEventNew constructs a DeviceButtonReleaseEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceButtonReleaseEventNew ( buf [ ] byte ) xgb . Event {
return DeviceButtonReleaseEvent ( DeviceKeyPressEventNew ( buf ) . ( DeviceKeyPressEvent ) )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceButtonReleaseEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceButtonReleaseEvent ) Bytes ( ) [ ] byte {
return DeviceKeyPressEvent ( v ) . Bytes ( )
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceButtonRelease event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceButtonReleaseEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
func ( v DeviceButtonReleaseEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 12 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Root: %d" , v . Root ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Event: %d" , v . Event ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Child: %d" , v . Child ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootX: %d" , v . RootX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootY: %d" , v . RootY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventX: %d" , v . EventX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventY: %d" , v . EventY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "State: %d" , v . State ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "SameScreen: %t" , v . SameScreen ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "DeviceButtonRelease {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 4 ] = DeviceButtonReleaseEventNew
}
2012-05-11 05:57:34 +02:00
// DeviceMotionNotify is the event number for a DeviceMotionNotifyEvent.
2012-05-10 23:01:42 +02:00
const DeviceMotionNotify = 5
type DeviceMotionNotifyEvent DeviceKeyPressEvent
2012-05-11 05:57:34 +02:00
// DeviceMotionNotifyEventNew constructs a DeviceMotionNotifyEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceMotionNotifyEventNew ( buf [ ] byte ) xgb . Event {
return DeviceMotionNotifyEvent ( DeviceKeyPressEventNew ( buf ) . ( DeviceKeyPressEvent ) )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a DeviceMotionNotifyEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v DeviceMotionNotifyEvent ) Bytes ( ) [ ] byte {
return DeviceKeyPressEvent ( v ) . Bytes ( )
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the DeviceMotionNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v DeviceMotionNotifyEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
func ( v DeviceMotionNotifyEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 12 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Root: %d" , v . Root ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Event: %d" , v . Event ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Child: %d" , v . Child ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootX: %d" , v . RootX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootY: %d" , v . RootY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventX: %d" , v . EventX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventY: %d" , v . EventY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "State: %d" , v . State ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "SameScreen: %t" , v . SameScreen ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "DeviceMotionNotify {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 5 ] = DeviceMotionNotifyEventNew
}
2012-05-11 05:57:34 +02:00
// ProximityIn is the event number for a ProximityInEvent.
2012-05-10 23:01:42 +02:00
const ProximityIn = 8
type ProximityInEvent DeviceKeyPressEvent
2012-05-11 05:57:34 +02:00
// ProximityInEventNew constructs a ProximityInEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func ProximityInEventNew ( buf [ ] byte ) xgb . Event {
return ProximityInEvent ( DeviceKeyPressEventNew ( buf ) . ( DeviceKeyPressEvent ) )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a ProximityInEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v ProximityInEvent ) Bytes ( ) [ ] byte {
return DeviceKeyPressEvent ( v ) . Bytes ( )
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the ProximityIn event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v ProximityInEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
func ( v ProximityInEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 12 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Root: %d" , v . Root ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Event: %d" , v . Event ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Child: %d" , v . Child ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootX: %d" , v . RootX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootY: %d" , v . RootY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventX: %d" , v . EventX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventY: %d" , v . EventY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "State: %d" , v . State ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "SameScreen: %t" , v . SameScreen ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "ProximityIn {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 8 ] = ProximityInEventNew
}
2012-05-11 05:57:34 +02:00
// ProximityOut is the event number for a ProximityOutEvent.
2012-05-10 23:01:42 +02:00
const ProximityOut = 9
type ProximityOutEvent DeviceKeyPressEvent
2012-05-11 05:57:34 +02:00
// ProximityOutEventNew constructs a ProximityOutEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func ProximityOutEventNew ( buf [ ] byte ) xgb . Event {
return ProximityOutEvent ( DeviceKeyPressEventNew ( buf ) . ( DeviceKeyPressEvent ) )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a ProximityOutEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v ProximityOutEvent ) Bytes ( ) [ ] byte {
return DeviceKeyPressEvent ( v ) . Bytes ( )
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the ProximityOut event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v ProximityOutEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
func ( v ProximityOutEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 12 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Root: %d" , v . Root ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Event: %d" , v . Event ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Child: %d" , v . Child ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootX: %d" , v . RootX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "RootY: %d" , v . RootY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventX: %d" , v . EventX ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "EventY: %d" , v . EventY ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "State: %d" , v . State ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "SameScreen: %t" , v . SameScreen ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "ProximityOut {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 9 ] = ProximityOutEventNew
}
2012-05-11 05:57:34 +02:00
// FocusOut is the event number for a FocusOutEvent.
2012-05-10 23:01:42 +02:00
const FocusOut = 7
type FocusOutEvent FocusInEvent
2012-05-11 05:57:34 +02:00
// FocusOutEventNew constructs a FocusOutEvent value that implements xgb.Event from a byte slice.
2012-05-10 23:01:42 +02:00
func FocusOutEventNew ( buf [ ] byte ) xgb . Event {
return FocusOutEvent ( FocusInEventNew ( buf ) . ( FocusInEvent ) )
}
2012-05-11 05:57:34 +02:00
// Bytes writes a FocusOutEvent value to a byte slice.
2012-05-10 23:01:42 +02:00
func ( v FocusOutEvent ) Bytes ( ) [ ] byte {
return FocusInEvent ( v ) . Bytes ( )
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the FocusOut event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( v FocusOutEvent ) SequenceId ( ) uint16 {
return v . Sequence
}
func ( v FocusOutEvent ) String ( ) string {
fieldVals := make ( [ ] string , 0 , 6 )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , v . Sequence ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Detail: %d" , v . Detail ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Time: %d" , v . Time ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Window: %d" , v . Window ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Mode: %d" , v . Mode ) )
fieldVals = append ( fieldVals , xgb . Sprintf ( "DeviceId: %d" , v . DeviceId ) )
return "FocusOut {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtEventFuncs [ "XInputExtension" ] [ 7 ] = FocusOutEventNew
}
2012-05-11 05:57:34 +02:00
// BadDevice is the error number for a BadDevice.
2012-05-10 23:01:42 +02:00
const BadDevice = 0
type DeviceError struct {
Sequence uint16
NiceName string
}
2012-05-11 05:57:34 +02:00
// DeviceErrorNew constructs a DeviceError value that implements xgb.Error from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceErrorNew ( buf [ ] byte ) xgb . Error {
v := DeviceError { }
v . NiceName = "Device"
b := 1 // skip error determinant
b += 1 // don't read error number
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadDevice error.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( err DeviceError ) SequenceId ( ) uint16 {
return err . Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadDevice error. If no bad value exists, 0 is returned.
2012-05-10 23:01:42 +02:00
func ( err DeviceError ) BadId ( ) uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadDevice error.
2012-05-10 23:01:42 +02:00
func ( err DeviceError ) Error ( ) string {
fieldVals := make ( [ ] string , 0 , 0 )
fieldVals = append ( fieldVals , "NiceName: " + err . NiceName )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , err . Sequence ) )
return "BadDevice {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtErrorFuncs [ "XInputExtension" ] [ 0 ] = DeviceErrorNew
}
2012-05-11 05:57:34 +02:00
// BadEvent is the error number for a BadEvent.
2012-05-10 23:01:42 +02:00
const BadEvent = 1
type EventError struct {
Sequence uint16
NiceName string
}
2012-05-11 05:57:34 +02:00
// EventErrorNew constructs a EventError value that implements xgb.Error from a byte slice.
2012-05-10 23:01:42 +02:00
func EventErrorNew ( buf [ ] byte ) xgb . Error {
v := EventError { }
v . NiceName = "Event"
b := 1 // skip error determinant
b += 1 // don't read error number
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadEvent error.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( err EventError ) SequenceId ( ) uint16 {
return err . Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadEvent error. If no bad value exists, 0 is returned.
2012-05-10 23:01:42 +02:00
func ( err EventError ) BadId ( ) uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadEvent error.
2012-05-10 23:01:42 +02:00
func ( err EventError ) Error ( ) string {
fieldVals := make ( [ ] string , 0 , 0 )
fieldVals = append ( fieldVals , "NiceName: " + err . NiceName )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , err . Sequence ) )
return "BadEvent {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtErrorFuncs [ "XInputExtension" ] [ 1 ] = EventErrorNew
}
2012-05-11 05:57:34 +02:00
// BadMode is the error number for a BadMode.
2012-05-10 23:01:42 +02:00
const BadMode = 2
type ModeError struct {
Sequence uint16
NiceName string
}
2012-05-11 05:57:34 +02:00
// ModeErrorNew constructs a ModeError value that implements xgb.Error from a byte slice.
2012-05-10 23:01:42 +02:00
func ModeErrorNew ( buf [ ] byte ) xgb . Error {
v := ModeError { }
v . NiceName = "Mode"
b := 1 // skip error determinant
b += 1 // don't read error number
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadMode error.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( err ModeError ) SequenceId ( ) uint16 {
return err . Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadMode error. If no bad value exists, 0 is returned.
2012-05-10 23:01:42 +02:00
func ( err ModeError ) BadId ( ) uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadMode error.
2012-05-10 23:01:42 +02:00
func ( err ModeError ) Error ( ) string {
fieldVals := make ( [ ] string , 0 , 0 )
fieldVals = append ( fieldVals , "NiceName: " + err . NiceName )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , err . Sequence ) )
return "BadMode {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtErrorFuncs [ "XInputExtension" ] [ 2 ] = ModeErrorNew
}
2012-05-11 05:57:34 +02:00
// BadDeviceBusy is the error number for a BadDeviceBusy.
2012-05-10 23:01:42 +02:00
const BadDeviceBusy = 3
type DeviceBusyError struct {
Sequence uint16
NiceName string
}
2012-05-11 05:57:34 +02:00
// DeviceBusyErrorNew constructs a DeviceBusyError value that implements xgb.Error from a byte slice.
2012-05-10 23:01:42 +02:00
func DeviceBusyErrorNew ( buf [ ] byte ) xgb . Error {
v := DeviceBusyError { }
v . NiceName = "DeviceBusy"
b := 1 // skip error determinant
b += 1 // don't read error number
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadDeviceBusy error.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( err DeviceBusyError ) SequenceId ( ) uint16 {
return err . Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadDeviceBusy error. If no bad value exists, 0 is returned.
2012-05-10 23:01:42 +02:00
func ( err DeviceBusyError ) BadId ( ) uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadDeviceBusy error.
2012-05-10 23:01:42 +02:00
func ( err DeviceBusyError ) Error ( ) string {
fieldVals := make ( [ ] string , 0 , 0 )
fieldVals = append ( fieldVals , "NiceName: " + err . NiceName )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , err . Sequence ) )
return "BadDeviceBusy {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtErrorFuncs [ "XInputExtension" ] [ 3 ] = DeviceBusyErrorNew
}
2012-05-11 05:57:34 +02:00
// BadClass is the error number for a BadClass.
2012-05-10 23:01:42 +02:00
const BadClass = 4
type ClassError struct {
Sequence uint16
NiceName string
}
2012-05-11 05:57:34 +02:00
// ClassErrorNew constructs a ClassError value that implements xgb.Error from a byte slice.
2012-05-10 23:01:42 +02:00
func ClassErrorNew ( buf [ ] byte ) xgb . Error {
v := ClassError { }
v . NiceName = "Class"
b := 1 // skip error determinant
b += 1 // don't read error number
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadClass error.
// This is mostly used internally.
2012-05-10 23:01:42 +02:00
func ( err ClassError ) SequenceId ( ) uint16 {
return err . Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadClass error. If no bad value exists, 0 is returned.
2012-05-10 23:01:42 +02:00
func ( err ClassError ) BadId ( ) uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadClass error.
2012-05-10 23:01:42 +02:00
func ( err ClassError ) Error ( ) string {
fieldVals := make ( [ ] string , 0 , 0 )
fieldVals = append ( fieldVals , "NiceName: " + err . NiceName )
fieldVals = append ( fieldVals , xgb . Sprintf ( "Sequence: %d" , err . Sequence ) )
return "BadClass {" + xgb . StringsJoin ( fieldVals , ", " ) + "}"
}
func init ( ) {
xgb . NewExtErrorFuncs [ "XInputExtension" ] [ 4 ] = ClassErrorNew
}
2012-05-11 05:57:34 +02:00
// GetExtensionVersionCookie is a cookie used only for GetExtensionVersion requests.
2012-05-10 23:01:42 +02:00
type GetExtensionVersionCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetExtensionVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetExtensionVersionCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetExtensionVersion ( c * xgb . Conn , NameLen uint16 , Name string ) GetExtensionVersionCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetExtensionVersion' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getExtensionVersionRequest ( c , NameLen , Name ) , cookie )
return GetExtensionVersionCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetExtensionVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetExtensionVersionUnchecked ( c * xgb . Conn , NameLen uint16 , Name string ) GetExtensionVersionCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetExtensionVersion' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getExtensionVersionRequest ( c , NameLen , Name ) , cookie )
return GetExtensionVersionCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetExtensionVersionReply represents the data returned from a GetExtensionVersion request.
2012-05-10 23:01:42 +02:00
type GetExtensionVersionReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
ServerMajor uint16
ServerMinor uint16
Present bool
// padding: 19 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetExtensionVersion request.
2012-05-10 23:01:42 +02:00
func ( cook GetExtensionVersionCookie ) Reply ( ) ( * GetExtensionVersionReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getExtensionVersionReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getExtensionVersionReply reads a byte slice into a GetExtensionVersionReply value.
2012-05-10 23:01:42 +02:00
func getExtensionVersionReply ( buf [ ] byte ) * GetExtensionVersionReply {
v := new ( GetExtensionVersionReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . ServerMajor = xgb . Get16 ( buf [ b : ] )
b += 2
v . ServerMinor = xgb . Get16 ( buf [ b : ] )
b += 2
if buf [ b ] == 1 {
v . Present = true
} else {
v . Present = false
}
b += 1
b += 19 // padding
return v
}
// Write request to wire for GetExtensionVersion
2012-05-11 05:57:34 +02:00
// getExtensionVersionRequest writes a GetExtensionVersion request to a byte slice.
2012-05-10 23:01:42 +02:00
func getExtensionVersionRequest ( c * xgb . Conn , NameLen uint16 , Name string ) [ ] byte {
size := xgb . Pad ( ( 8 + xgb . Pad ( ( int ( NameLen ) * 1 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 1 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put16 ( buf [ b : ] , NameLen )
b += 2
b += 2 // padding
copy ( buf [ b : ] , Name [ : NameLen ] )
b += xgb . Pad ( int ( NameLen ) )
return buf
}
2012-05-11 05:57:34 +02:00
// ListInputDevicesCookie is a cookie used only for ListInputDevices requests.
2012-05-10 23:01:42 +02:00
type ListInputDevicesCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// ListInputDevices sends a checked request.
// If an error occurs, it will be returned with the reply by calling ListInputDevicesCookie.Reply()
2012-05-10 23:01:42 +02:00
func ListInputDevices ( c * xgb . Conn ) ListInputDevicesCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ListInputDevices' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( listInputDevicesRequest ( c ) , cookie )
return ListInputDevicesCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ListInputDevicesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func ListInputDevicesUnchecked ( c * xgb . Conn ) ListInputDevicesCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ListInputDevices' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( listInputDevicesRequest ( c ) , cookie )
return ListInputDevicesCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ListInputDevicesReply represents the data returned from a ListInputDevices request.
2012-05-10 23:01:42 +02:00
type ListInputDevicesReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
DevicesLen byte
// padding: 23 bytes
Devices [ ] DeviceInfo // size: xgb.Pad((int(DevicesLen) * 8))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a ListInputDevices request.
2012-05-10 23:01:42 +02:00
func ( cook ListInputDevicesCookie ) Reply ( ) ( * ListInputDevicesReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return listInputDevicesReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// listInputDevicesReply reads a byte slice into a ListInputDevicesReply value.
2012-05-10 23:01:42 +02:00
func listInputDevicesReply ( buf [ ] byte ) * ListInputDevicesReply {
v := new ( ListInputDevicesReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . DevicesLen = buf [ b ]
b += 1
b += 23 // padding
v . Devices = make ( [ ] DeviceInfo , v . DevicesLen )
b += DeviceInfoReadList ( buf [ b : ] , v . Devices )
return v
}
// Write request to wire for ListInputDevices
2012-05-11 05:57:34 +02:00
// listInputDevicesRequest writes a ListInputDevices request to a byte slice.
2012-05-10 23:01:42 +02:00
func listInputDevicesRequest ( c * xgb . Conn ) [ ] byte {
size := 4
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 2 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
return buf
}
2012-05-11 05:57:34 +02:00
// OpenDeviceCookie is a cookie used only for OpenDevice requests.
2012-05-10 23:01:42 +02:00
type OpenDeviceCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// OpenDevice sends a checked request.
// If an error occurs, it will be returned with the reply by calling OpenDeviceCookie.Reply()
2012-05-10 23:01:42 +02:00
func OpenDevice ( c * xgb . Conn , DeviceId byte ) OpenDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'OpenDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( openDeviceRequest ( c , DeviceId ) , cookie )
return OpenDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// OpenDeviceUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func OpenDeviceUnchecked ( c * xgb . Conn , DeviceId byte ) OpenDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'OpenDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( openDeviceRequest ( c , DeviceId ) , cookie )
return OpenDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// OpenDeviceReply represents the data returned from a OpenDevice request.
2012-05-10 23:01:42 +02:00
type OpenDeviceReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
NumClasses byte
// padding: 23 bytes
ClassInfo [ ] InputClassInfo // size: xgb.Pad((int(NumClasses) * 2))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a OpenDevice request.
2012-05-10 23:01:42 +02:00
func ( cook OpenDeviceCookie ) Reply ( ) ( * OpenDeviceReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return openDeviceReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// openDeviceReply reads a byte slice into a OpenDeviceReply value.
2012-05-10 23:01:42 +02:00
func openDeviceReply ( buf [ ] byte ) * OpenDeviceReply {
v := new ( OpenDeviceReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . NumClasses = buf [ b ]
b += 1
b += 23 // padding
v . ClassInfo = make ( [ ] InputClassInfo , v . NumClasses )
b += InputClassInfoReadList ( buf [ b : ] , v . ClassInfo )
return v
}
// Write request to wire for OpenDevice
2012-05-11 05:57:34 +02:00
// openDeviceRequest writes a OpenDevice request to a byte slice.
2012-05-10 23:01:42 +02:00
func openDeviceRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 3 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// CloseDeviceCookie is a cookie used only for CloseDevice requests.
2012-05-10 23:01:42 +02:00
type CloseDeviceCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// CloseDevice sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func CloseDevice ( c * xgb . Conn , DeviceId byte ) CloseDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'CloseDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( closeDeviceRequest ( c , DeviceId ) , cookie )
return CloseDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// CloseDeviceChecked sends a checked request.
// If an error occurs, it can be retrieved using CloseDeviceCookie.Check()
2012-05-10 23:01:42 +02:00
func CloseDeviceChecked ( c * xgb . Conn , DeviceId byte ) CloseDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'CloseDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( closeDeviceRequest ( c , DeviceId ) , cookie )
return CloseDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook CloseDeviceCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for CloseDevice
2012-05-11 05:57:34 +02:00
// closeDeviceRequest writes a CloseDevice request to a byte slice.
2012-05-10 23:01:42 +02:00
func closeDeviceRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 4 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SetDeviceModeCookie is a cookie used only for SetDeviceMode requests.
2012-05-10 23:01:42 +02:00
type SetDeviceModeCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// SetDeviceMode sends a checked request.
// If an error occurs, it will be returned with the reply by calling SetDeviceModeCookie.Reply()
2012-05-10 23:01:42 +02:00
func SetDeviceMode ( c * xgb . Conn , DeviceId byte , Mode byte ) SetDeviceModeCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceMode' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( setDeviceModeRequest ( c , DeviceId , Mode ) , cookie )
return SetDeviceModeCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceModeUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func SetDeviceModeUnchecked ( c * xgb . Conn , DeviceId byte , Mode byte ) SetDeviceModeCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceMode' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( setDeviceModeRequest ( c , DeviceId , Mode ) , cookie )
return SetDeviceModeCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceModeReply represents the data returned from a SetDeviceMode request.
2012-05-10 23:01:42 +02:00
type SetDeviceModeReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a SetDeviceMode request.
2012-05-10 23:01:42 +02:00
func ( cook SetDeviceModeCookie ) Reply ( ) ( * SetDeviceModeReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return setDeviceModeReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// setDeviceModeReply reads a byte slice into a SetDeviceModeReply value.
2012-05-10 23:01:42 +02:00
func setDeviceModeReply ( buf [ ] byte ) * SetDeviceModeReply {
v := new ( SetDeviceModeReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for SetDeviceMode
2012-05-11 05:57:34 +02:00
// setDeviceModeRequest writes a SetDeviceMode request to a byte slice.
2012-05-10 23:01:42 +02:00
func setDeviceModeRequest ( c * xgb . Conn , DeviceId byte , Mode byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 5 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
buf [ b ] = Mode
b += 1
b += 2 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SelectExtensionEventCookie is a cookie used only for SelectExtensionEvent requests.
2012-05-10 23:01:42 +02:00
type SelectExtensionEventCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// SelectExtensionEvent sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func SelectExtensionEvent ( c * xgb . Conn , Window xproto . Window , NumClasses uint16 , Classes [ ] EventClass ) SelectExtensionEventCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SelectExtensionEvent' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( selectExtensionEventRequest ( c , Window , NumClasses , Classes ) , cookie )
return SelectExtensionEventCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SelectExtensionEventChecked sends a checked request.
// If an error occurs, it can be retrieved using SelectExtensionEventCookie.Check()
2012-05-10 23:01:42 +02:00
func SelectExtensionEventChecked ( c * xgb . Conn , Window xproto . Window , NumClasses uint16 , Classes [ ] EventClass ) SelectExtensionEventCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SelectExtensionEvent' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( selectExtensionEventRequest ( c , Window , NumClasses , Classes ) , cookie )
return SelectExtensionEventCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook SelectExtensionEventCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for SelectExtensionEvent
2012-05-11 05:57:34 +02:00
// selectExtensionEventRequest writes a SelectExtensionEvent request to a byte slice.
2012-05-10 23:01:42 +02:00
func selectExtensionEventRequest ( c * xgb . Conn , Window xproto . Window , NumClasses uint16 , Classes [ ] EventClass ) [ ] byte {
size := xgb . Pad ( ( 12 + xgb . Pad ( ( int ( NumClasses ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 6 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Window ) )
b += 4
xgb . Put16 ( buf [ b : ] , NumClasses )
b += 2
b += 2 // padding
for i := 0 ; i < int ( NumClasses ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Classes [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// GetSelectedExtensionEventsCookie is a cookie used only for GetSelectedExtensionEvents requests.
2012-05-10 23:01:42 +02:00
type GetSelectedExtensionEventsCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetSelectedExtensionEvents sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetSelectedExtensionEventsCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetSelectedExtensionEvents ( c * xgb . Conn , Window xproto . Window ) GetSelectedExtensionEventsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetSelectedExtensionEvents' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getSelectedExtensionEventsRequest ( c , Window ) , cookie )
return GetSelectedExtensionEventsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetSelectedExtensionEventsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetSelectedExtensionEventsUnchecked ( c * xgb . Conn , Window xproto . Window ) GetSelectedExtensionEventsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetSelectedExtensionEvents' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getSelectedExtensionEventsRequest ( c , Window ) , cookie )
return GetSelectedExtensionEventsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetSelectedExtensionEventsReply represents the data returned from a GetSelectedExtensionEvents request.
2012-05-10 23:01:42 +02:00
type GetSelectedExtensionEventsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
NumThisClasses uint16
NumAllClasses uint16
// padding: 20 bytes
ThisClasses [ ] EventClass // size: xgb.Pad((int(NumThisClasses) * 4))
AllClasses [ ] EventClass // size: xgb.Pad((int(NumAllClasses) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetSelectedExtensionEvents request.
2012-05-10 23:01:42 +02:00
func ( cook GetSelectedExtensionEventsCookie ) Reply ( ) ( * GetSelectedExtensionEventsReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getSelectedExtensionEventsReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getSelectedExtensionEventsReply reads a byte slice into a GetSelectedExtensionEventsReply value.
2012-05-10 23:01:42 +02:00
func getSelectedExtensionEventsReply ( buf [ ] byte ) * GetSelectedExtensionEventsReply {
v := new ( GetSelectedExtensionEventsReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . NumThisClasses = xgb . Get16 ( buf [ b : ] )
b += 2
v . NumAllClasses = xgb . Get16 ( buf [ b : ] )
b += 2
b += 20 // padding
v . ThisClasses = make ( [ ] EventClass , v . NumThisClasses )
for i := 0 ; i < int ( v . NumThisClasses ) ; i ++ {
v . ThisClasses [ i ] = EventClass ( xgb . Get32 ( buf [ b : ] ) )
b += 4
}
b = xgb . Pad ( b )
v . AllClasses = make ( [ ] EventClass , v . NumAllClasses )
for i := 0 ; i < int ( v . NumAllClasses ) ; i ++ {
v . AllClasses [ i ] = EventClass ( xgb . Get32 ( buf [ b : ] ) )
b += 4
}
b = xgb . Pad ( b )
return v
}
// Write request to wire for GetSelectedExtensionEvents
2012-05-11 05:57:34 +02:00
// getSelectedExtensionEventsRequest writes a GetSelectedExtensionEvents request to a byte slice.
2012-05-10 23:01:42 +02:00
func getSelectedExtensionEventsRequest ( c * xgb . Conn , Window xproto . Window ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 7 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Window ) )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceDontPropagateListCookie is a cookie used only for ChangeDeviceDontPropagateList requests.
2012-05-10 23:01:42 +02:00
type ChangeDeviceDontPropagateListCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceDontPropagateList sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func ChangeDeviceDontPropagateList ( c * xgb . Conn , Window xproto . Window , NumClasses uint16 , Mode byte , Classes [ ] EventClass ) ChangeDeviceDontPropagateListCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangeDeviceDontPropagateList' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( changeDeviceDontPropagateListRequest ( c , Window , NumClasses , Mode , Classes ) , cookie )
return ChangeDeviceDontPropagateListCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceDontPropagateListChecked sends a checked request.
// If an error occurs, it can be retrieved using ChangeDeviceDontPropagateListCookie.Check()
2012-05-10 23:01:42 +02:00
func ChangeDeviceDontPropagateListChecked ( c * xgb . Conn , Window xproto . Window , NumClasses uint16 , Mode byte , Classes [ ] EventClass ) ChangeDeviceDontPropagateListCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangeDeviceDontPropagateList' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( changeDeviceDontPropagateListRequest ( c , Window , NumClasses , Mode , Classes ) , cookie )
return ChangeDeviceDontPropagateListCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook ChangeDeviceDontPropagateListCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for ChangeDeviceDontPropagateList
2012-05-11 05:57:34 +02:00
// changeDeviceDontPropagateListRequest writes a ChangeDeviceDontPropagateList request to a byte slice.
2012-05-10 23:01:42 +02:00
func changeDeviceDontPropagateListRequest ( c * xgb . Conn , Window xproto . Window , NumClasses uint16 , Mode byte , Classes [ ] EventClass ) [ ] byte {
size := xgb . Pad ( ( 12 + xgb . Pad ( ( int ( NumClasses ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 8 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Window ) )
b += 4
xgb . Put16 ( buf [ b : ] , NumClasses )
b += 2
buf [ b ] = Mode
b += 1
b += 1 // padding
for i := 0 ; i < int ( NumClasses ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Classes [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// GetDeviceDontPropagateListCookie is a cookie used only for GetDeviceDontPropagateList requests.
2012-05-10 23:01:42 +02:00
type GetDeviceDontPropagateListCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetDeviceDontPropagateList sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDeviceDontPropagateListCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetDeviceDontPropagateList ( c * xgb . Conn , Window xproto . Window ) GetDeviceDontPropagateListCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceDontPropagateList' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getDeviceDontPropagateListRequest ( c , Window ) , cookie )
return GetDeviceDontPropagateListCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceDontPropagateListUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetDeviceDontPropagateListUnchecked ( c * xgb . Conn , Window xproto . Window ) GetDeviceDontPropagateListCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceDontPropagateList' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getDeviceDontPropagateListRequest ( c , Window ) , cookie )
return GetDeviceDontPropagateListCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceDontPropagateListReply represents the data returned from a GetDeviceDontPropagateList request.
2012-05-10 23:01:42 +02:00
type GetDeviceDontPropagateListReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
NumClasses uint16
// padding: 22 bytes
Classes [ ] EventClass // size: xgb.Pad((int(NumClasses) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDeviceDontPropagateList request.
2012-05-10 23:01:42 +02:00
func ( cook GetDeviceDontPropagateListCookie ) Reply ( ) ( * GetDeviceDontPropagateListReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getDeviceDontPropagateListReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getDeviceDontPropagateListReply reads a byte slice into a GetDeviceDontPropagateListReply value.
2012-05-10 23:01:42 +02:00
func getDeviceDontPropagateListReply ( buf [ ] byte ) * GetDeviceDontPropagateListReply {
v := new ( GetDeviceDontPropagateListReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . NumClasses = xgb . Get16 ( buf [ b : ] )
b += 2
b += 22 // padding
v . Classes = make ( [ ] EventClass , v . NumClasses )
for i := 0 ; i < int ( v . NumClasses ) ; i ++ {
v . Classes [ i ] = EventClass ( xgb . Get32 ( buf [ b : ] ) )
b += 4
}
b = xgb . Pad ( b )
return v
}
// Write request to wire for GetDeviceDontPropagateList
2012-05-11 05:57:34 +02:00
// getDeviceDontPropagateListRequest writes a GetDeviceDontPropagateList request to a byte slice.
2012-05-10 23:01:42 +02:00
func getDeviceDontPropagateListRequest ( c * xgb . Conn , Window xproto . Window ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 9 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Window ) )
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetDeviceMotionEventsCookie is a cookie used only for GetDeviceMotionEvents requests.
2012-05-10 23:01:42 +02:00
type GetDeviceMotionEventsCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetDeviceMotionEvents sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDeviceMotionEventsCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetDeviceMotionEvents ( c * xgb . Conn , Start xproto . Timestamp , Stop xproto . Timestamp , DeviceId byte ) GetDeviceMotionEventsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceMotionEvents' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getDeviceMotionEventsRequest ( c , Start , Stop , DeviceId ) , cookie )
return GetDeviceMotionEventsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceMotionEventsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetDeviceMotionEventsUnchecked ( c * xgb . Conn , Start xproto . Timestamp , Stop xproto . Timestamp , DeviceId byte ) GetDeviceMotionEventsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceMotionEvents' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getDeviceMotionEventsRequest ( c , Start , Stop , DeviceId ) , cookie )
return GetDeviceMotionEventsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceMotionEventsReply represents the data returned from a GetDeviceMotionEvents request.
2012-05-10 23:01:42 +02:00
type GetDeviceMotionEventsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
NumCoords uint32
NumAxes byte
DeviceMode byte
// padding: 18 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDeviceMotionEvents request.
2012-05-10 23:01:42 +02:00
func ( cook GetDeviceMotionEventsCookie ) Reply ( ) ( * GetDeviceMotionEventsReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getDeviceMotionEventsReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getDeviceMotionEventsReply reads a byte slice into a GetDeviceMotionEventsReply value.
2012-05-10 23:01:42 +02:00
func getDeviceMotionEventsReply ( buf [ ] byte ) * GetDeviceMotionEventsReply {
v := new ( GetDeviceMotionEventsReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . NumCoords = xgb . Get32 ( buf [ b : ] )
b += 4
v . NumAxes = buf [ b ]
b += 1
v . DeviceMode = buf [ b ]
b += 1
b += 18 // padding
return v
}
// Write request to wire for GetDeviceMotionEvents
2012-05-11 05:57:34 +02:00
// getDeviceMotionEventsRequest writes a GetDeviceMotionEvents request to a byte slice.
2012-05-10 23:01:42 +02:00
func getDeviceMotionEventsRequest ( c * xgb . Conn , Start xproto . Timestamp , Stop xproto . Timestamp , DeviceId byte ) [ ] byte {
size := 16
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 10 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Start ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( Stop ) )
b += 4
buf [ b ] = DeviceId
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// ChangeKeyboardDeviceCookie is a cookie used only for ChangeKeyboardDevice requests.
2012-05-10 23:01:42 +02:00
type ChangeKeyboardDeviceCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// ChangeKeyboardDevice sends a checked request.
// If an error occurs, it will be returned with the reply by calling ChangeKeyboardDeviceCookie.Reply()
2012-05-10 23:01:42 +02:00
func ChangeKeyboardDevice ( c * xgb . Conn , DeviceId byte ) ChangeKeyboardDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangeKeyboardDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( changeKeyboardDeviceRequest ( c , DeviceId ) , cookie )
return ChangeKeyboardDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ChangeKeyboardDeviceUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func ChangeKeyboardDeviceUnchecked ( c * xgb . Conn , DeviceId byte ) ChangeKeyboardDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangeKeyboardDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( changeKeyboardDeviceRequest ( c , DeviceId ) , cookie )
return ChangeKeyboardDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ChangeKeyboardDeviceReply represents the data returned from a ChangeKeyboardDevice request.
2012-05-10 23:01:42 +02:00
type ChangeKeyboardDeviceReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a ChangeKeyboardDevice request.
2012-05-10 23:01:42 +02:00
func ( cook ChangeKeyboardDeviceCookie ) Reply ( ) ( * ChangeKeyboardDeviceReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return changeKeyboardDeviceReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// changeKeyboardDeviceReply reads a byte slice into a ChangeKeyboardDeviceReply value.
2012-05-10 23:01:42 +02:00
func changeKeyboardDeviceReply ( buf [ ] byte ) * ChangeKeyboardDeviceReply {
v := new ( ChangeKeyboardDeviceReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for ChangeKeyboardDevice
2012-05-11 05:57:34 +02:00
// changeKeyboardDeviceRequest writes a ChangeKeyboardDevice request to a byte slice.
2012-05-10 23:01:42 +02:00
func changeKeyboardDeviceRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 11 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// ChangePointerDeviceCookie is a cookie used only for ChangePointerDevice requests.
2012-05-10 23:01:42 +02:00
type ChangePointerDeviceCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// ChangePointerDevice sends a checked request.
// If an error occurs, it will be returned with the reply by calling ChangePointerDeviceCookie.Reply()
2012-05-10 23:01:42 +02:00
func ChangePointerDevice ( c * xgb . Conn , XAxis byte , YAxis byte , DeviceId byte ) ChangePointerDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangePointerDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( changePointerDeviceRequest ( c , XAxis , YAxis , DeviceId ) , cookie )
return ChangePointerDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ChangePointerDeviceUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func ChangePointerDeviceUnchecked ( c * xgb . Conn , XAxis byte , YAxis byte , DeviceId byte ) ChangePointerDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangePointerDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( changePointerDeviceRequest ( c , XAxis , YAxis , DeviceId ) , cookie )
return ChangePointerDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ChangePointerDeviceReply represents the data returned from a ChangePointerDevice request.
2012-05-10 23:01:42 +02:00
type ChangePointerDeviceReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a ChangePointerDevice request.
2012-05-10 23:01:42 +02:00
func ( cook ChangePointerDeviceCookie ) Reply ( ) ( * ChangePointerDeviceReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return changePointerDeviceReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// changePointerDeviceReply reads a byte slice into a ChangePointerDeviceReply value.
2012-05-10 23:01:42 +02:00
func changePointerDeviceReply ( buf [ ] byte ) * ChangePointerDeviceReply {
v := new ( ChangePointerDeviceReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for ChangePointerDevice
2012-05-11 05:57:34 +02:00
// changePointerDeviceRequest writes a ChangePointerDevice request to a byte slice.
2012-05-10 23:01:42 +02:00
func changePointerDeviceRequest ( c * xgb . Conn , XAxis byte , YAxis byte , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 12 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = XAxis
b += 1
buf [ b ] = YAxis
b += 1
buf [ b ] = DeviceId
b += 1
b += 1 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// GrabDeviceCookie is a cookie used only for GrabDevice requests.
2012-05-10 23:01:42 +02:00
type GrabDeviceCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GrabDevice sends a checked request.
// If an error occurs, it will be returned with the reply by calling GrabDeviceCookie.Reply()
2012-05-10 23:01:42 +02:00
func GrabDevice ( c * xgb . Conn , GrabWindow xproto . Window , Time xproto . Timestamp , NumClasses uint16 , ThisDeviceMode byte , OtherDeviceMode byte , OwnerEvents bool , DeviceId byte , Classes [ ] EventClass ) GrabDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GrabDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( grabDeviceRequest ( c , GrabWindow , Time , NumClasses , ThisDeviceMode , OtherDeviceMode , OwnerEvents , DeviceId , Classes ) , cookie )
return GrabDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GrabDeviceUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GrabDeviceUnchecked ( c * xgb . Conn , GrabWindow xproto . Window , Time xproto . Timestamp , NumClasses uint16 , ThisDeviceMode byte , OtherDeviceMode byte , OwnerEvents bool , DeviceId byte , Classes [ ] EventClass ) GrabDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GrabDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( grabDeviceRequest ( c , GrabWindow , Time , NumClasses , ThisDeviceMode , OtherDeviceMode , OwnerEvents , DeviceId , Classes ) , cookie )
return GrabDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GrabDeviceReply represents the data returned from a GrabDevice request.
2012-05-10 23:01:42 +02:00
type GrabDeviceReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GrabDevice request.
2012-05-10 23:01:42 +02:00
func ( cook GrabDeviceCookie ) Reply ( ) ( * GrabDeviceReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return grabDeviceReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// grabDeviceReply reads a byte slice into a GrabDeviceReply value.
2012-05-10 23:01:42 +02:00
func grabDeviceReply ( buf [ ] byte ) * GrabDeviceReply {
v := new ( GrabDeviceReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for GrabDevice
2012-05-11 05:57:34 +02:00
// grabDeviceRequest writes a GrabDevice request to a byte slice.
2012-05-10 23:01:42 +02:00
func grabDeviceRequest ( c * xgb . Conn , GrabWindow xproto . Window , Time xproto . Timestamp , NumClasses uint16 , ThisDeviceMode byte , OtherDeviceMode byte , OwnerEvents bool , DeviceId byte , Classes [ ] EventClass ) [ ] byte {
size := xgb . Pad ( ( 20 + xgb . Pad ( ( int ( NumClasses ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 13 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( GrabWindow ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( Time ) )
b += 4
xgb . Put16 ( buf [ b : ] , NumClasses )
b += 2
buf [ b ] = ThisDeviceMode
b += 1
buf [ b ] = OtherDeviceMode
b += 1
if OwnerEvents {
buf [ b ] = 1
} else {
buf [ b ] = 0
}
b += 1
buf [ b ] = DeviceId
b += 1
b += 2 // padding
for i := 0 ; i < int ( NumClasses ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Classes [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceCookie is a cookie used only for UngrabDevice requests.
2012-05-10 23:01:42 +02:00
type UngrabDeviceCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// UngrabDevice sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func UngrabDevice ( c * xgb . Conn , Time xproto . Timestamp , DeviceId byte ) UngrabDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'UngrabDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( ungrabDeviceRequest ( c , Time , DeviceId ) , cookie )
return UngrabDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceChecked sends a checked request.
// If an error occurs, it can be retrieved using UngrabDeviceCookie.Check()
2012-05-10 23:01:42 +02:00
func UngrabDeviceChecked ( c * xgb . Conn , Time xproto . Timestamp , DeviceId byte ) UngrabDeviceCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'UngrabDevice' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( ungrabDeviceRequest ( c , Time , DeviceId ) , cookie )
return UngrabDeviceCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook UngrabDeviceCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for UngrabDevice
2012-05-11 05:57:34 +02:00
// ungrabDeviceRequest writes a UngrabDevice request to a byte slice.
2012-05-10 23:01:42 +02:00
func ungrabDeviceRequest ( c * xgb . Conn , Time xproto . Timestamp , DeviceId byte ) [ ] byte {
size := 12
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 14 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Time ) )
b += 4
buf [ b ] = DeviceId
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GrabDeviceKeyCookie is a cookie used only for GrabDeviceKey requests.
2012-05-10 23:01:42 +02:00
type GrabDeviceKeyCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GrabDeviceKey sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GrabDeviceKey ( c * xgb . Conn , GrabWindow xproto . Window , NumClasses uint16 , Modifiers uint16 , ModifierDevice byte , GrabbedDevice byte , Key byte , ThisDeviceMode byte , OtherDeviceMode byte , OwnerEvents bool , Classes [ ] EventClass ) GrabDeviceKeyCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GrabDeviceKey' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( grabDeviceKeyRequest ( c , GrabWindow , NumClasses , Modifiers , ModifierDevice , GrabbedDevice , Key , ThisDeviceMode , OtherDeviceMode , OwnerEvents , Classes ) , cookie )
return GrabDeviceKeyCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GrabDeviceKeyChecked sends a checked request.
// If an error occurs, it can be retrieved using GrabDeviceKeyCookie.Check()
2012-05-10 23:01:42 +02:00
func GrabDeviceKeyChecked ( c * xgb . Conn , GrabWindow xproto . Window , NumClasses uint16 , Modifiers uint16 , ModifierDevice byte , GrabbedDevice byte , Key byte , ThisDeviceMode byte , OtherDeviceMode byte , OwnerEvents bool , Classes [ ] EventClass ) GrabDeviceKeyCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GrabDeviceKey' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( grabDeviceKeyRequest ( c , GrabWindow , NumClasses , Modifiers , ModifierDevice , GrabbedDevice , Key , ThisDeviceMode , OtherDeviceMode , OwnerEvents , Classes ) , cookie )
return GrabDeviceKeyCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook GrabDeviceKeyCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for GrabDeviceKey
2012-05-11 05:57:34 +02:00
// grabDeviceKeyRequest writes a GrabDeviceKey request to a byte slice.
2012-05-10 23:01:42 +02:00
func grabDeviceKeyRequest ( c * xgb . Conn , GrabWindow xproto . Window , NumClasses uint16 , Modifiers uint16 , ModifierDevice byte , GrabbedDevice byte , Key byte , ThisDeviceMode byte , OtherDeviceMode byte , OwnerEvents bool , Classes [ ] EventClass ) [ ] byte {
size := xgb . Pad ( ( 20 + xgb . Pad ( ( int ( NumClasses ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 15 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( GrabWindow ) )
b += 4
xgb . Put16 ( buf [ b : ] , NumClasses )
b += 2
xgb . Put16 ( buf [ b : ] , Modifiers )
b += 2
buf [ b ] = ModifierDevice
b += 1
buf [ b ] = GrabbedDevice
b += 1
buf [ b ] = Key
b += 1
buf [ b ] = ThisDeviceMode
b += 1
buf [ b ] = OtherDeviceMode
b += 1
if OwnerEvents {
buf [ b ] = 1
} else {
buf [ b ] = 0
}
b += 1
b += 2 // padding
for i := 0 ; i < int ( NumClasses ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Classes [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceKeyCookie is a cookie used only for UngrabDeviceKey requests.
2012-05-10 23:01:42 +02:00
type UngrabDeviceKeyCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceKey sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func UngrabDeviceKey ( c * xgb . Conn , GrabWindow xproto . Window , Modifiers uint16 , ModifierDevice byte , Key byte , GrabbedDevice byte ) UngrabDeviceKeyCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'UngrabDeviceKey' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( ungrabDeviceKeyRequest ( c , GrabWindow , Modifiers , ModifierDevice , Key , GrabbedDevice ) , cookie )
return UngrabDeviceKeyCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceKeyChecked sends a checked request.
// If an error occurs, it can be retrieved using UngrabDeviceKeyCookie.Check()
2012-05-10 23:01:42 +02:00
func UngrabDeviceKeyChecked ( c * xgb . Conn , GrabWindow xproto . Window , Modifiers uint16 , ModifierDevice byte , Key byte , GrabbedDevice byte ) UngrabDeviceKeyCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'UngrabDeviceKey' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( ungrabDeviceKeyRequest ( c , GrabWindow , Modifiers , ModifierDevice , Key , GrabbedDevice ) , cookie )
return UngrabDeviceKeyCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook UngrabDeviceKeyCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for UngrabDeviceKey
2012-05-11 05:57:34 +02:00
// ungrabDeviceKeyRequest writes a UngrabDeviceKey request to a byte slice.
2012-05-10 23:01:42 +02:00
func ungrabDeviceKeyRequest ( c * xgb . Conn , GrabWindow xproto . Window , Modifiers uint16 , ModifierDevice byte , Key byte , GrabbedDevice byte ) [ ] byte {
size := 16
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 16 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( GrabWindow ) )
b += 4
xgb . Put16 ( buf [ b : ] , Modifiers )
b += 2
buf [ b ] = ModifierDevice
b += 1
buf [ b ] = Key
b += 1
buf [ b ] = GrabbedDevice
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GrabDeviceButtonCookie is a cookie used only for GrabDeviceButton requests.
2012-05-10 23:01:42 +02:00
type GrabDeviceButtonCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GrabDeviceButton sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GrabDeviceButton ( c * xgb . Conn , GrabWindow xproto . Window , GrabbedDevice byte , ModifierDevice byte , NumClasses uint16 , Modifiers uint16 , ThisDeviceMode byte , OtherDeviceMode byte , Button byte , OwnerEvents byte , Classes [ ] EventClass ) GrabDeviceButtonCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GrabDeviceButton' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( grabDeviceButtonRequest ( c , GrabWindow , GrabbedDevice , ModifierDevice , NumClasses , Modifiers , ThisDeviceMode , OtherDeviceMode , Button , OwnerEvents , Classes ) , cookie )
return GrabDeviceButtonCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GrabDeviceButtonChecked sends a checked request.
// If an error occurs, it can be retrieved using GrabDeviceButtonCookie.Check()
2012-05-10 23:01:42 +02:00
func GrabDeviceButtonChecked ( c * xgb . Conn , GrabWindow xproto . Window , GrabbedDevice byte , ModifierDevice byte , NumClasses uint16 , Modifiers uint16 , ThisDeviceMode byte , OtherDeviceMode byte , Button byte , OwnerEvents byte , Classes [ ] EventClass ) GrabDeviceButtonCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GrabDeviceButton' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( grabDeviceButtonRequest ( c , GrabWindow , GrabbedDevice , ModifierDevice , NumClasses , Modifiers , ThisDeviceMode , OtherDeviceMode , Button , OwnerEvents , Classes ) , cookie )
return GrabDeviceButtonCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook GrabDeviceButtonCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for GrabDeviceButton
2012-05-11 05:57:34 +02:00
// grabDeviceButtonRequest writes a GrabDeviceButton request to a byte slice.
2012-05-10 23:01:42 +02:00
func grabDeviceButtonRequest ( c * xgb . Conn , GrabWindow xproto . Window , GrabbedDevice byte , ModifierDevice byte , NumClasses uint16 , Modifiers uint16 , ThisDeviceMode byte , OtherDeviceMode byte , Button byte , OwnerEvents byte , Classes [ ] EventClass ) [ ] byte {
size := xgb . Pad ( ( 20 + xgb . Pad ( ( int ( NumClasses ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 17 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( GrabWindow ) )
b += 4
buf [ b ] = GrabbedDevice
b += 1
buf [ b ] = ModifierDevice
b += 1
xgb . Put16 ( buf [ b : ] , NumClasses )
b += 2
xgb . Put16 ( buf [ b : ] , Modifiers )
b += 2
buf [ b ] = ThisDeviceMode
b += 1
buf [ b ] = OtherDeviceMode
b += 1
buf [ b ] = Button
b += 1
buf [ b ] = OwnerEvents
b += 1
b += 2 // padding
for i := 0 ; i < int ( NumClasses ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Classes [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceButtonCookie is a cookie used only for UngrabDeviceButton requests.
2012-05-10 23:01:42 +02:00
type UngrabDeviceButtonCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceButton sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func UngrabDeviceButton ( c * xgb . Conn , GrabWindow xproto . Window , Modifiers uint16 , ModifierDevice byte , Button byte , GrabbedDevice byte ) UngrabDeviceButtonCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'UngrabDeviceButton' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( ungrabDeviceButtonRequest ( c , GrabWindow , Modifiers , ModifierDevice , Button , GrabbedDevice ) , cookie )
return UngrabDeviceButtonCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// UngrabDeviceButtonChecked sends a checked request.
// If an error occurs, it can be retrieved using UngrabDeviceButtonCookie.Check()
2012-05-10 23:01:42 +02:00
func UngrabDeviceButtonChecked ( c * xgb . Conn , GrabWindow xproto . Window , Modifiers uint16 , ModifierDevice byte , Button byte , GrabbedDevice byte ) UngrabDeviceButtonCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'UngrabDeviceButton' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( ungrabDeviceButtonRequest ( c , GrabWindow , Modifiers , ModifierDevice , Button , GrabbedDevice ) , cookie )
return UngrabDeviceButtonCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook UngrabDeviceButtonCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for UngrabDeviceButton
2012-05-11 05:57:34 +02:00
// ungrabDeviceButtonRequest writes a UngrabDeviceButton request to a byte slice.
2012-05-10 23:01:42 +02:00
func ungrabDeviceButtonRequest ( c * xgb . Conn , GrabWindow xproto . Window , Modifiers uint16 , ModifierDevice byte , Button byte , GrabbedDevice byte ) [ ] byte {
size := 16
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 18 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( GrabWindow ) )
b += 4
xgb . Put16 ( buf [ b : ] , Modifiers )
b += 2
buf [ b ] = ModifierDevice
b += 1
buf [ b ] = Button
b += 1
buf [ b ] = GrabbedDevice
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// AllowDeviceEventsCookie is a cookie used only for AllowDeviceEvents requests.
2012-05-10 23:01:42 +02:00
type AllowDeviceEventsCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// AllowDeviceEvents sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func AllowDeviceEvents ( c * xgb . Conn , Time xproto . Timestamp , Mode byte , DeviceId byte ) AllowDeviceEventsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'AllowDeviceEvents' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( allowDeviceEventsRequest ( c , Time , Mode , DeviceId ) , cookie )
return AllowDeviceEventsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// AllowDeviceEventsChecked sends a checked request.
// If an error occurs, it can be retrieved using AllowDeviceEventsCookie.Check()
2012-05-10 23:01:42 +02:00
func AllowDeviceEventsChecked ( c * xgb . Conn , Time xproto . Timestamp , Mode byte , DeviceId byte ) AllowDeviceEventsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'AllowDeviceEvents' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( allowDeviceEventsRequest ( c , Time , Mode , DeviceId ) , cookie )
return AllowDeviceEventsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook AllowDeviceEventsCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for AllowDeviceEvents
2012-05-11 05:57:34 +02:00
// allowDeviceEventsRequest writes a AllowDeviceEvents request to a byte slice.
2012-05-10 23:01:42 +02:00
func allowDeviceEventsRequest ( c * xgb . Conn , Time xproto . Timestamp , Mode byte , DeviceId byte ) [ ] byte {
size := 12
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 19 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Time ) )
b += 4
buf [ b ] = Mode
b += 1
buf [ b ] = DeviceId
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetDeviceFocusCookie is a cookie used only for GetDeviceFocus requests.
2012-05-10 23:01:42 +02:00
type GetDeviceFocusCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetDeviceFocus sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDeviceFocusCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetDeviceFocus ( c * xgb . Conn , DeviceId byte ) GetDeviceFocusCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceFocus' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getDeviceFocusRequest ( c , DeviceId ) , cookie )
return GetDeviceFocusCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceFocusUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetDeviceFocusUnchecked ( c * xgb . Conn , DeviceId byte ) GetDeviceFocusCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceFocus' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getDeviceFocusRequest ( c , DeviceId ) , cookie )
return GetDeviceFocusCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceFocusReply represents the data returned from a GetDeviceFocus request.
2012-05-10 23:01:42 +02:00
type GetDeviceFocusReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Focus xproto . Window
Time xproto . Timestamp
RevertTo byte
// padding: 15 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDeviceFocus request.
2012-05-10 23:01:42 +02:00
func ( cook GetDeviceFocusCookie ) Reply ( ) ( * GetDeviceFocusReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getDeviceFocusReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getDeviceFocusReply reads a byte slice into a GetDeviceFocusReply value.
2012-05-10 23:01:42 +02:00
func getDeviceFocusReply ( buf [ ] byte ) * GetDeviceFocusReply {
v := new ( GetDeviceFocusReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Focus = xproto . Window ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . Time = xproto . Timestamp ( xgb . Get32 ( buf [ b : ] ) )
b += 4
v . RevertTo = buf [ b ]
b += 1
b += 15 // padding
return v
}
// Write request to wire for GetDeviceFocus
2012-05-11 05:57:34 +02:00
// getDeviceFocusRequest writes a GetDeviceFocus request to a byte slice.
2012-05-10 23:01:42 +02:00
func getDeviceFocusRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 20 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SetDeviceFocusCookie is a cookie used only for SetDeviceFocus requests.
2012-05-10 23:01:42 +02:00
type SetDeviceFocusCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// SetDeviceFocus sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func SetDeviceFocus ( c * xgb . Conn , Focus xproto . Window , Time xproto . Timestamp , RevertTo byte , DeviceId byte ) SetDeviceFocusCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceFocus' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( setDeviceFocusRequest ( c , Focus , Time , RevertTo , DeviceId ) , cookie )
return SetDeviceFocusCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceFocusChecked sends a checked request.
// If an error occurs, it can be retrieved using SetDeviceFocusCookie.Check()
2012-05-10 23:01:42 +02:00
func SetDeviceFocusChecked ( c * xgb . Conn , Focus xproto . Window , Time xproto . Timestamp , RevertTo byte , DeviceId byte ) SetDeviceFocusCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceFocus' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( setDeviceFocusRequest ( c , Focus , Time , RevertTo , DeviceId ) , cookie )
return SetDeviceFocusCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook SetDeviceFocusCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for SetDeviceFocus
2012-05-11 05:57:34 +02:00
// setDeviceFocusRequest writes a SetDeviceFocus request to a byte slice.
2012-05-10 23:01:42 +02:00
func setDeviceFocusRequest ( c * xgb . Conn , Focus xproto . Window , Time xproto . Timestamp , RevertTo byte , DeviceId byte ) [ ] byte {
size := 16
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 21 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Focus ) )
b += 4
xgb . Put32 ( buf [ b : ] , uint32 ( Time ) )
b += 4
buf [ b ] = RevertTo
b += 1
buf [ b ] = DeviceId
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetFeedbackControlCookie is a cookie used only for GetFeedbackControl requests.
2012-05-10 23:01:42 +02:00
type GetFeedbackControlCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetFeedbackControl sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetFeedbackControlCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetFeedbackControl ( c * xgb . Conn , DeviceId byte ) GetFeedbackControlCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetFeedbackControl' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getFeedbackControlRequest ( c , DeviceId ) , cookie )
return GetFeedbackControlCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetFeedbackControlUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetFeedbackControlUnchecked ( c * xgb . Conn , DeviceId byte ) GetFeedbackControlCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetFeedbackControl' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getFeedbackControlRequest ( c , DeviceId ) , cookie )
return GetFeedbackControlCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetFeedbackControlReply represents the data returned from a GetFeedbackControl request.
2012-05-10 23:01:42 +02:00
type GetFeedbackControlReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
NumFeedback uint16
// padding: 22 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetFeedbackControl request.
2012-05-10 23:01:42 +02:00
func ( cook GetFeedbackControlCookie ) Reply ( ) ( * GetFeedbackControlReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getFeedbackControlReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getFeedbackControlReply reads a byte slice into a GetFeedbackControlReply value.
2012-05-10 23:01:42 +02:00
func getFeedbackControlReply ( buf [ ] byte ) * GetFeedbackControlReply {
v := new ( GetFeedbackControlReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . NumFeedback = xgb . Get16 ( buf [ b : ] )
b += 2
b += 22 // padding
return v
}
// Write request to wire for GetFeedbackControl
2012-05-11 05:57:34 +02:00
// getFeedbackControlRequest writes a GetFeedbackControl request to a byte slice.
2012-05-10 23:01:42 +02:00
func getFeedbackControlRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 22 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// GetDeviceKeyMappingCookie is a cookie used only for GetDeviceKeyMapping requests.
2012-05-10 23:01:42 +02:00
type GetDeviceKeyMappingCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetDeviceKeyMapping sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDeviceKeyMappingCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetDeviceKeyMapping ( c * xgb . Conn , DeviceId byte , FirstKeycode KeyCode , Count byte ) GetDeviceKeyMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceKeyMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getDeviceKeyMappingRequest ( c , DeviceId , FirstKeycode , Count ) , cookie )
return GetDeviceKeyMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceKeyMappingUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetDeviceKeyMappingUnchecked ( c * xgb . Conn , DeviceId byte , FirstKeycode KeyCode , Count byte ) GetDeviceKeyMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceKeyMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getDeviceKeyMappingRequest ( c , DeviceId , FirstKeycode , Count ) , cookie )
return GetDeviceKeyMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceKeyMappingReply represents the data returned from a GetDeviceKeyMapping request.
2012-05-10 23:01:42 +02:00
type GetDeviceKeyMappingReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
KeysymsPerKeycode byte
// padding: 23 bytes
Keysyms [ ] xproto . Keysym // size: xgb.Pad((int(Length) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDeviceKeyMapping request.
2012-05-10 23:01:42 +02:00
func ( cook GetDeviceKeyMappingCookie ) Reply ( ) ( * GetDeviceKeyMappingReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getDeviceKeyMappingReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getDeviceKeyMappingReply reads a byte slice into a GetDeviceKeyMappingReply value.
2012-05-10 23:01:42 +02:00
func getDeviceKeyMappingReply ( buf [ ] byte ) * GetDeviceKeyMappingReply {
v := new ( GetDeviceKeyMappingReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . KeysymsPerKeycode = buf [ b ]
b += 1
b += 23 // padding
v . Keysyms = make ( [ ] xproto . Keysym , v . Length )
for i := 0 ; i < int ( v . Length ) ; i ++ {
v . Keysyms [ i ] = xproto . Keysym ( xgb . Get32 ( buf [ b : ] ) )
b += 4
}
b = xgb . Pad ( b )
return v
}
// Write request to wire for GetDeviceKeyMapping
2012-05-11 05:57:34 +02:00
// getDeviceKeyMappingRequest writes a GetDeviceKeyMapping request to a byte slice.
2012-05-10 23:01:42 +02:00
func getDeviceKeyMappingRequest ( c * xgb . Conn , DeviceId byte , FirstKeycode KeyCode , Count byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 24 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
buf [ b ] = byte ( FirstKeycode )
b += 1
buf [ b ] = Count
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceKeyMappingCookie is a cookie used only for ChangeDeviceKeyMapping requests.
2012-05-10 23:01:42 +02:00
type ChangeDeviceKeyMappingCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceKeyMapping sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func ChangeDeviceKeyMapping ( c * xgb . Conn , DeviceId byte , FirstKeycode KeyCode , KeysymsPerKeycode byte , KeycodeCount byte , Keysyms [ ] xproto . Keysym ) ChangeDeviceKeyMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangeDeviceKeyMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( changeDeviceKeyMappingRequest ( c , DeviceId , FirstKeycode , KeysymsPerKeycode , KeycodeCount , Keysyms ) , cookie )
return ChangeDeviceKeyMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// ChangeDeviceKeyMappingChecked sends a checked request.
// If an error occurs, it can be retrieved using ChangeDeviceKeyMappingCookie.Check()
2012-05-10 23:01:42 +02:00
func ChangeDeviceKeyMappingChecked ( c * xgb . Conn , DeviceId byte , FirstKeycode KeyCode , KeysymsPerKeycode byte , KeycodeCount byte , Keysyms [ ] xproto . Keysym ) ChangeDeviceKeyMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'ChangeDeviceKeyMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( changeDeviceKeyMappingRequest ( c , DeviceId , FirstKeycode , KeysymsPerKeycode , KeycodeCount , Keysyms ) , cookie )
return ChangeDeviceKeyMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook ChangeDeviceKeyMappingCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for ChangeDeviceKeyMapping
2012-05-11 05:57:34 +02:00
// changeDeviceKeyMappingRequest writes a ChangeDeviceKeyMapping request to a byte slice.
2012-05-10 23:01:42 +02:00
func changeDeviceKeyMappingRequest ( c * xgb . Conn , DeviceId byte , FirstKeycode KeyCode , KeysymsPerKeycode byte , KeycodeCount byte , Keysyms [ ] xproto . Keysym ) [ ] byte {
size := xgb . Pad ( ( 8 + xgb . Pad ( ( ( int ( KeycodeCount ) * int ( KeysymsPerKeycode ) ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 25 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
buf [ b ] = byte ( FirstKeycode )
b += 1
buf [ b ] = KeysymsPerKeycode
b += 1
buf [ b ] = KeycodeCount
b += 1
for i := 0 ; i < int ( ( int ( KeycodeCount ) * int ( KeysymsPerKeycode ) ) ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Keysyms [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// GetDeviceModifierMappingCookie is a cookie used only for GetDeviceModifierMapping requests.
2012-05-10 23:01:42 +02:00
type GetDeviceModifierMappingCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetDeviceModifierMapping sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDeviceModifierMappingCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetDeviceModifierMapping ( c * xgb . Conn , DeviceId byte ) GetDeviceModifierMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceModifierMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getDeviceModifierMappingRequest ( c , DeviceId ) , cookie )
return GetDeviceModifierMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceModifierMappingUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetDeviceModifierMappingUnchecked ( c * xgb . Conn , DeviceId byte ) GetDeviceModifierMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceModifierMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getDeviceModifierMappingRequest ( c , DeviceId ) , cookie )
return GetDeviceModifierMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceModifierMappingReply represents the data returned from a GetDeviceModifierMapping request.
2012-05-10 23:01:42 +02:00
type GetDeviceModifierMappingReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
KeycodesPerModifier byte
// padding: 23 bytes
Keymaps [ ] byte // size: xgb.Pad(((int(KeycodesPerModifier) * 8) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDeviceModifierMapping request.
2012-05-10 23:01:42 +02:00
func ( cook GetDeviceModifierMappingCookie ) Reply ( ) ( * GetDeviceModifierMappingReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getDeviceModifierMappingReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getDeviceModifierMappingReply reads a byte slice into a GetDeviceModifierMappingReply value.
2012-05-10 23:01:42 +02:00
func getDeviceModifierMappingReply ( buf [ ] byte ) * GetDeviceModifierMappingReply {
v := new ( GetDeviceModifierMappingReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . KeycodesPerModifier = buf [ b ]
b += 1
b += 23 // padding
v . Keymaps = make ( [ ] byte , ( int ( v . KeycodesPerModifier ) * 8 ) )
copy ( v . Keymaps [ : ( int ( v . KeycodesPerModifier ) * 8 ) ] , buf [ b : ] )
b += xgb . Pad ( int ( ( int ( v . KeycodesPerModifier ) * 8 ) ) )
return v
}
// Write request to wire for GetDeviceModifierMapping
2012-05-11 05:57:34 +02:00
// getDeviceModifierMappingRequest writes a GetDeviceModifierMapping request to a byte slice.
2012-05-10 23:01:42 +02:00
func getDeviceModifierMappingRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 26 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SetDeviceModifierMappingCookie is a cookie used only for SetDeviceModifierMapping requests.
2012-05-10 23:01:42 +02:00
type SetDeviceModifierMappingCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// SetDeviceModifierMapping sends a checked request.
// If an error occurs, it will be returned with the reply by calling SetDeviceModifierMappingCookie.Reply()
2012-05-10 23:01:42 +02:00
func SetDeviceModifierMapping ( c * xgb . Conn , DeviceId byte , KeycodesPerModifier byte , Keymaps [ ] byte ) SetDeviceModifierMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceModifierMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( setDeviceModifierMappingRequest ( c , DeviceId , KeycodesPerModifier , Keymaps ) , cookie )
return SetDeviceModifierMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceModifierMappingUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func SetDeviceModifierMappingUnchecked ( c * xgb . Conn , DeviceId byte , KeycodesPerModifier byte , Keymaps [ ] byte ) SetDeviceModifierMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceModifierMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( setDeviceModifierMappingRequest ( c , DeviceId , KeycodesPerModifier , Keymaps ) , cookie )
return SetDeviceModifierMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceModifierMappingReply represents the data returned from a SetDeviceModifierMapping request.
2012-05-10 23:01:42 +02:00
type SetDeviceModifierMappingReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a SetDeviceModifierMapping request.
2012-05-10 23:01:42 +02:00
func ( cook SetDeviceModifierMappingCookie ) Reply ( ) ( * SetDeviceModifierMappingReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return setDeviceModifierMappingReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// setDeviceModifierMappingReply reads a byte slice into a SetDeviceModifierMappingReply value.
2012-05-10 23:01:42 +02:00
func setDeviceModifierMappingReply ( buf [ ] byte ) * SetDeviceModifierMappingReply {
v := new ( SetDeviceModifierMappingReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for SetDeviceModifierMapping
2012-05-11 05:57:34 +02:00
// setDeviceModifierMappingRequest writes a SetDeviceModifierMapping request to a byte slice.
2012-05-10 23:01:42 +02:00
func setDeviceModifierMappingRequest ( c * xgb . Conn , DeviceId byte , KeycodesPerModifier byte , Keymaps [ ] byte ) [ ] byte {
size := xgb . Pad ( ( 7 + xgb . Pad ( ( ( int ( KeycodesPerModifier ) * 8 ) * 1 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 27 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
buf [ b ] = KeycodesPerModifier
b += 1
b += 1 // padding
copy ( buf [ b : ] , Keymaps [ : ( int ( KeycodesPerModifier ) * 8 ) ] )
b += xgb . Pad ( int ( ( int ( KeycodesPerModifier ) * 8 ) ) )
return buf
}
2012-05-11 05:57:34 +02:00
// GetDeviceButtonMappingCookie is a cookie used only for GetDeviceButtonMapping requests.
2012-05-10 23:01:42 +02:00
type GetDeviceButtonMappingCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetDeviceButtonMapping sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDeviceButtonMappingCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetDeviceButtonMapping ( c * xgb . Conn , DeviceId byte ) GetDeviceButtonMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceButtonMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getDeviceButtonMappingRequest ( c , DeviceId ) , cookie )
return GetDeviceButtonMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceButtonMappingUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetDeviceButtonMappingUnchecked ( c * xgb . Conn , DeviceId byte ) GetDeviceButtonMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceButtonMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getDeviceButtonMappingRequest ( c , DeviceId ) , cookie )
return GetDeviceButtonMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceButtonMappingReply represents the data returned from a GetDeviceButtonMapping request.
2012-05-10 23:01:42 +02:00
type GetDeviceButtonMappingReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
MapSize byte
// padding: 23 bytes
Map [ ] byte // size: xgb.Pad((int(MapSize) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDeviceButtonMapping request.
2012-05-10 23:01:42 +02:00
func ( cook GetDeviceButtonMappingCookie ) Reply ( ) ( * GetDeviceButtonMappingReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getDeviceButtonMappingReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getDeviceButtonMappingReply reads a byte slice into a GetDeviceButtonMappingReply value.
2012-05-10 23:01:42 +02:00
func getDeviceButtonMappingReply ( buf [ ] byte ) * GetDeviceButtonMappingReply {
v := new ( GetDeviceButtonMappingReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . MapSize = buf [ b ]
b += 1
b += 23 // padding
v . Map = make ( [ ] byte , v . MapSize )
copy ( v . Map [ : v . MapSize ] , buf [ b : ] )
b += xgb . Pad ( int ( v . MapSize ) )
return v
}
// Write request to wire for GetDeviceButtonMapping
2012-05-11 05:57:34 +02:00
// getDeviceButtonMappingRequest writes a GetDeviceButtonMapping request to a byte slice.
2012-05-10 23:01:42 +02:00
func getDeviceButtonMappingRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 28 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SetDeviceButtonMappingCookie is a cookie used only for SetDeviceButtonMapping requests.
2012-05-10 23:01:42 +02:00
type SetDeviceButtonMappingCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// SetDeviceButtonMapping sends a checked request.
// If an error occurs, it will be returned with the reply by calling SetDeviceButtonMappingCookie.Reply()
2012-05-10 23:01:42 +02:00
func SetDeviceButtonMapping ( c * xgb . Conn , DeviceId byte , MapSize byte , Map [ ] byte ) SetDeviceButtonMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceButtonMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( setDeviceButtonMappingRequest ( c , DeviceId , MapSize , Map ) , cookie )
return SetDeviceButtonMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceButtonMappingUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func SetDeviceButtonMappingUnchecked ( c * xgb . Conn , DeviceId byte , MapSize byte , Map [ ] byte ) SetDeviceButtonMappingCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceButtonMapping' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( setDeviceButtonMappingRequest ( c , DeviceId , MapSize , Map ) , cookie )
return SetDeviceButtonMappingCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceButtonMappingReply represents the data returned from a SetDeviceButtonMapping request.
2012-05-10 23:01:42 +02:00
type SetDeviceButtonMappingReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a SetDeviceButtonMapping request.
2012-05-10 23:01:42 +02:00
func ( cook SetDeviceButtonMappingCookie ) Reply ( ) ( * SetDeviceButtonMappingReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return setDeviceButtonMappingReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// setDeviceButtonMappingReply reads a byte slice into a SetDeviceButtonMappingReply value.
2012-05-10 23:01:42 +02:00
func setDeviceButtonMappingReply ( buf [ ] byte ) * SetDeviceButtonMappingReply {
v := new ( SetDeviceButtonMappingReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for SetDeviceButtonMapping
2012-05-11 05:57:34 +02:00
// setDeviceButtonMappingRequest writes a SetDeviceButtonMapping request to a byte slice.
2012-05-10 23:01:42 +02:00
func setDeviceButtonMappingRequest ( c * xgb . Conn , DeviceId byte , MapSize byte , Map [ ] byte ) [ ] byte {
size := xgb . Pad ( ( 8 + xgb . Pad ( ( int ( MapSize ) * 1 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 29 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
buf [ b ] = MapSize
b += 1
b += 2 // padding
copy ( buf [ b : ] , Map [ : MapSize ] )
b += xgb . Pad ( int ( MapSize ) )
return buf
}
2012-05-11 05:57:34 +02:00
// QueryDeviceStateCookie is a cookie used only for QueryDeviceState requests.
2012-05-10 23:01:42 +02:00
type QueryDeviceStateCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// QueryDeviceState sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryDeviceStateCookie.Reply()
2012-05-10 23:01:42 +02:00
func QueryDeviceState ( c * xgb . Conn , DeviceId byte ) QueryDeviceStateCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'QueryDeviceState' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( queryDeviceStateRequest ( c , DeviceId ) , cookie )
return QueryDeviceStateCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// QueryDeviceStateUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func QueryDeviceStateUnchecked ( c * xgb . Conn , DeviceId byte ) QueryDeviceStateCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'QueryDeviceState' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( queryDeviceStateRequest ( c , DeviceId ) , cookie )
return QueryDeviceStateCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// QueryDeviceStateReply represents the data returned from a QueryDeviceState request.
2012-05-10 23:01:42 +02:00
type QueryDeviceStateReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
NumClasses byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a QueryDeviceState request.
2012-05-10 23:01:42 +02:00
func ( cook QueryDeviceStateCookie ) Reply ( ) ( * QueryDeviceStateReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return queryDeviceStateReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// queryDeviceStateReply reads a byte slice into a QueryDeviceStateReply value.
2012-05-10 23:01:42 +02:00
func queryDeviceStateReply ( buf [ ] byte ) * QueryDeviceStateReply {
v := new ( QueryDeviceStateReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . NumClasses = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for QueryDeviceState
2012-05-11 05:57:34 +02:00
// queryDeviceStateRequest writes a QueryDeviceState request to a byte slice.
2012-05-10 23:01:42 +02:00
func queryDeviceStateRequest ( c * xgb . Conn , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 30 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
b += 3 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SendExtensionEventCookie is a cookie used only for SendExtensionEvent requests.
2012-05-10 23:01:42 +02:00
type SendExtensionEventCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// SendExtensionEvent sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func SendExtensionEvent ( c * xgb . Conn , Destination xproto . Window , DeviceId byte , Propagate bool , NumClasses uint16 , NumEvents byte , Events string , Classes [ ] EventClass ) SendExtensionEventCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SendExtensionEvent' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( sendExtensionEventRequest ( c , Destination , DeviceId , Propagate , NumClasses , NumEvents , Events , Classes ) , cookie )
return SendExtensionEventCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SendExtensionEventChecked sends a checked request.
// If an error occurs, it can be retrieved using SendExtensionEventCookie.Check()
2012-05-10 23:01:42 +02:00
func SendExtensionEventChecked ( c * xgb . Conn , Destination xproto . Window , DeviceId byte , Propagate bool , NumClasses uint16 , NumEvents byte , Events string , Classes [ ] EventClass ) SendExtensionEventCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SendExtensionEvent' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( sendExtensionEventRequest ( c , Destination , DeviceId , Propagate , NumClasses , NumEvents , Events , Classes ) , cookie )
return SendExtensionEventCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook SendExtensionEventCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for SendExtensionEvent
2012-05-11 05:57:34 +02:00
// sendExtensionEventRequest writes a SendExtensionEvent request to a byte slice.
2012-05-10 23:01:42 +02:00
func sendExtensionEventRequest ( c * xgb . Conn , Destination xproto . Window , DeviceId byte , Propagate bool , NumClasses uint16 , NumEvents byte , Events string , Classes [ ] EventClass ) [ ] byte {
size := xgb . Pad ( ( ( 16 + xgb . Pad ( ( ( int ( NumEvents ) * 32 ) * 1 ) ) ) + xgb . Pad ( ( int ( NumClasses ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 31 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put32 ( buf [ b : ] , uint32 ( Destination ) )
b += 4
buf [ b ] = DeviceId
b += 1
if Propagate {
buf [ b ] = 1
} else {
buf [ b ] = 0
}
b += 1
xgb . Put16 ( buf [ b : ] , NumClasses )
b += 2
buf [ b ] = NumEvents
b += 1
b += 3 // padding
copy ( buf [ b : ] , Events [ : ( int ( NumEvents ) * 32 ) ] )
b += xgb . Pad ( int ( ( int ( NumEvents ) * 32 ) ) )
for i := 0 ; i < int ( NumClasses ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Classes [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// DeviceBellCookie is a cookie used only for DeviceBell requests.
2012-05-10 23:01:42 +02:00
type DeviceBellCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// DeviceBell sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func DeviceBell ( c * xgb . Conn , DeviceId byte , FeedbackId byte , FeedbackClass byte , Percent int8 ) DeviceBellCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'DeviceBell' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , false )
c . NewRequest ( deviceBellRequest ( c , DeviceId , FeedbackId , FeedbackClass , Percent ) , cookie )
return DeviceBellCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// DeviceBellChecked sends a checked request.
// If an error occurs, it can be retrieved using DeviceBellCookie.Check()
2012-05-10 23:01:42 +02:00
func DeviceBellChecked ( c * xgb . Conn , DeviceId byte , FeedbackId byte , FeedbackClass byte , Percent int8 ) DeviceBellCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'DeviceBell' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , false )
c . NewRequest ( deviceBellRequest ( c , DeviceId , FeedbackId , FeedbackClass , Percent ) , cookie )
return DeviceBellCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2012-05-10 23:01:42 +02:00
func ( cook DeviceBellCookie ) Check ( ) error {
return cook . Cookie . Check ( )
}
// Write request to wire for DeviceBell
2012-05-11 05:57:34 +02:00
// deviceBellRequest writes a DeviceBell request to a byte slice.
2012-05-10 23:01:42 +02:00
func deviceBellRequest ( c * xgb . Conn , DeviceId byte , FeedbackId byte , FeedbackClass byte , Percent int8 ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 32 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
buf [ b ] = FeedbackId
b += 1
buf [ b ] = FeedbackClass
b += 1
buf [ b ] = byte ( Percent )
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// SetDeviceValuatorsCookie is a cookie used only for SetDeviceValuators requests.
2012-05-10 23:01:42 +02:00
type SetDeviceValuatorsCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// SetDeviceValuators sends a checked request.
// If an error occurs, it will be returned with the reply by calling SetDeviceValuatorsCookie.Reply()
2012-05-10 23:01:42 +02:00
func SetDeviceValuators ( c * xgb . Conn , DeviceId byte , FirstValuator byte , NumValuators byte , Valuators [ ] int32 ) SetDeviceValuatorsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceValuators' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( setDeviceValuatorsRequest ( c , DeviceId , FirstValuator , NumValuators , Valuators ) , cookie )
return SetDeviceValuatorsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceValuatorsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func SetDeviceValuatorsUnchecked ( c * xgb . Conn , DeviceId byte , FirstValuator byte , NumValuators byte , Valuators [ ] int32 ) SetDeviceValuatorsCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'SetDeviceValuators' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( setDeviceValuatorsRequest ( c , DeviceId , FirstValuator , NumValuators , Valuators ) , cookie )
return SetDeviceValuatorsCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// SetDeviceValuatorsReply represents the data returned from a SetDeviceValuators request.
2012-05-10 23:01:42 +02:00
type SetDeviceValuatorsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a SetDeviceValuators request.
2012-05-10 23:01:42 +02:00
func ( cook SetDeviceValuatorsCookie ) Reply ( ) ( * SetDeviceValuatorsReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return setDeviceValuatorsReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// setDeviceValuatorsReply reads a byte slice into a SetDeviceValuatorsReply value.
2012-05-10 23:01:42 +02:00
func setDeviceValuatorsReply ( buf [ ] byte ) * SetDeviceValuatorsReply {
v := new ( SetDeviceValuatorsReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for SetDeviceValuators
2012-05-11 05:57:34 +02:00
// setDeviceValuatorsRequest writes a SetDeviceValuators request to a byte slice.
2012-05-10 23:01:42 +02:00
func setDeviceValuatorsRequest ( c * xgb . Conn , DeviceId byte , FirstValuator byte , NumValuators byte , Valuators [ ] int32 ) [ ] byte {
size := xgb . Pad ( ( 8 + xgb . Pad ( ( int ( NumValuators ) * 4 ) ) ) )
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 33 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
buf [ b ] = DeviceId
b += 1
buf [ b ] = FirstValuator
b += 1
buf [ b ] = NumValuators
b += 1
b += 1 // padding
for i := 0 ; i < int ( NumValuators ) ; i ++ {
xgb . Put32 ( buf [ b : ] , uint32 ( Valuators [ i ] ) )
b += 4
}
b = xgb . Pad ( b )
return buf
}
2012-05-11 05:57:34 +02:00
// GetDeviceControlCookie is a cookie used only for GetDeviceControl requests.
2012-05-10 23:01:42 +02:00
type GetDeviceControlCookie struct {
* xgb . Cookie
}
2012-05-11 05:57:34 +02:00
// GetDeviceControl sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDeviceControlCookie.Reply()
2012-05-10 23:01:42 +02:00
func GetDeviceControl ( c * xgb . Conn , ControlId uint16 , DeviceId byte ) GetDeviceControlCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceControl' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( true , true )
c . NewRequest ( getDeviceControlRequest ( c , ControlId , DeviceId ) , cookie )
return GetDeviceControlCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceControlUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2012-05-10 23:01:42 +02:00
func GetDeviceControlUnchecked ( c * xgb . Conn , ControlId uint16 , DeviceId byte ) GetDeviceControlCookie {
2012-05-12 05:58:52 +02:00
if _ , ok := c . Extensions [ "XINPUTEXTENSION" ] ; ! ok {
panic ( "Cannot issue request 'GetDeviceControl' using the uninitialized extension 'XInputExtension'. xinput.Init(connObj) must be called first." )
}
2012-05-10 23:01:42 +02:00
cookie := c . NewCookie ( false , true )
c . NewRequest ( getDeviceControlRequest ( c , ControlId , DeviceId ) , cookie )
return GetDeviceControlCookie { cookie }
}
2012-05-11 05:57:34 +02:00
// GetDeviceControlReply represents the data returned from a GetDeviceControl request.
2012-05-10 23:01:42 +02:00
type GetDeviceControlReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
2012-05-10 23:01:42 +02:00
// padding: 1 bytes
Status byte
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDeviceControl request.
2012-05-10 23:01:42 +02:00
func ( cook GetDeviceControlCookie ) Reply ( ) ( * GetDeviceControlReply , error ) {
buf , err := cook . Cookie . Reply ( )
if err != nil {
return nil , err
}
if buf == nil {
return nil , nil
}
return getDeviceControlReply ( buf ) , nil
}
2012-05-11 05:57:34 +02:00
// getDeviceControlReply reads a byte slice into a GetDeviceControlReply value.
2012-05-10 23:01:42 +02:00
func getDeviceControlReply ( buf [ ] byte ) * GetDeviceControlReply {
v := new ( GetDeviceControlReply )
b := 1 // skip reply determinant
b += 1 // padding
v . Sequence = xgb . Get16 ( buf [ b : ] )
b += 2
v . Length = xgb . Get32 ( buf [ b : ] ) // 4-byte units
b += 4
v . Status = buf [ b ]
b += 1
b += 23 // padding
return v
}
// Write request to wire for GetDeviceControl
2012-05-11 05:57:34 +02:00
// getDeviceControlRequest writes a GetDeviceControl request to a byte slice.
2012-05-10 23:01:42 +02:00
func getDeviceControlRequest ( c * xgb . Conn , ControlId uint16 , DeviceId byte ) [ ] byte {
size := 8
b := 0
buf := make ( [ ] byte , size )
buf [ b ] = c . Extensions [ "XINPUTEXTENSION" ]
b += 1
buf [ b ] = 34 // request opcode
b += 1
xgb . Put16 ( buf [ b : ] , uint16 ( size / 4 ) ) // write request size in 4-byte units
b += 2
xgb . Put16 ( buf [ b : ] , ControlId )
b += 2
buf [ b ] = DeviceId
b += 1
b += 1 // padding
return buf
}