aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xf86vidmode/xf86vidmode.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/xf86vidmode/xf86vidmode.go')
-rw-r--r--nexgb/xf86vidmode/xf86vidmode.go2376
1 files changed, 1188 insertions, 1188 deletions
diff --git a/nexgb/xf86vidmode/xf86vidmode.go b/nexgb/xf86vidmode/xf86vidmode.go
index 7665cbf..17c3f3c 100644
--- a/nexgb/xf86vidmode/xf86vidmode.go
+++ b/nexgb/xf86vidmode/xf86vidmode.go
@@ -2,7 +2,7 @@
package xf86vidmode
/*
- This file was generated by xf86vidmode.xml on Jun 5 2012 12:11:59am EDT.
+ This file was generated by xf86vidmode.xml on Aug 11 2013 8:39:44pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -40,193 +40,6 @@ func init() {
xgb.NewExtErrorFuncs["XFree86-VidModeExtension"] = make(map[int]xgb.NewErrorFun)
}
-// Skipping definition for base type 'Int16'
-
-// Skipping definition for base type 'Int32'
-
-// 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'
-
-// Skipping definition for base type 'Float'
-
-// Skipping definition for base type 'Card8'
-
-const (
- ModeFlagPositiveHsync = 1
- ModeFlagNegativeHsync = 2
- ModeFlagPositiveVsync = 4
- ModeFlagNegativeVsync = 8
- ModeFlagInterlace = 16
- ModeFlagCompositeSync = 32
- ModeFlagPositiveCsync = 64
- ModeFlagNegativeCsync = 128
- ModeFlagHSkew = 256
- ModeFlagBroadcast = 512
- ModeFlagPixmux = 1024
- ModeFlagDoubleClock = 2048
- ModeFlagHalfClock = 4096
-)
-
-const (
- ClockFlagProgramable = 1
-)
-
-const (
- PermissionRead = 1
- PermissionWrite = 2
-)
-
-type Syncrange uint32
-
-type Dotclock uint32
-
-type ModeInfo struct {
- Dotclock Dotclock
- Hdisplay uint16
- Hsyncstart uint16
- Hsyncend uint16
- Htotal uint16
- Hskew uint32
- Vdisplay uint16
- Vsyncstart uint16
- Vsyncend uint16
- Vtotal uint16
- // padding: 4 bytes
- Flags uint32
- // padding: 12 bytes
- Privsize uint32
-}
-
-// ModeInfoRead reads a byte slice into a ModeInfo value.
-func ModeInfoRead(buf []byte, v *ModeInfo) int {
- b := 0
-
- v.Dotclock = Dotclock(xgb.Get32(buf[b:]))
- b += 4
-
- v.Hdisplay = xgb.Get16(buf[b:])
- b += 2
-
- v.Hsyncstart = xgb.Get16(buf[b:])
- b += 2
-
- v.Hsyncend = xgb.Get16(buf[b:])
- b += 2
-
- v.Htotal = xgb.Get16(buf[b:])
- b += 2
-
- v.Hskew = xgb.Get32(buf[b:])
- b += 4
-
- v.Vdisplay = xgb.Get16(buf[b:])
- b += 2
-
- v.Vsyncstart = xgb.Get16(buf[b:])
- b += 2
-
- v.Vsyncend = xgb.Get16(buf[b:])
- b += 2
-
- v.Vtotal = xgb.Get16(buf[b:])
- b += 2
-
- b += 4 // padding
-
- v.Flags = xgb.Get32(buf[b:])
- b += 4
-
- b += 12 // padding
-
- v.Privsize = xgb.Get32(buf[b:])
- b += 4
-
- return b
-}
-
-// ModeInfoReadList reads a byte slice into a list of ModeInfo values.
-func ModeInfoReadList(buf []byte, dest []ModeInfo) int {
- b := 0
- for i := 0; i < len(dest); i++ {
- dest[i] = ModeInfo{}
- b += ModeInfoRead(buf[b:], &dest[i])
- }
- return xgb.Pad(b)
-}
-
-// Bytes writes a ModeInfo value to a byte slice.
-func (v ModeInfo) Bytes() []byte {
- buf := make([]byte, 48)
- b := 0
-
- xgb.Put32(buf[b:], uint32(v.Dotclock))
- b += 4
-
- xgb.Put16(buf[b:], v.Hdisplay)
- b += 2
-
- xgb.Put16(buf[b:], v.Hsyncstart)
- b += 2
-
- xgb.Put16(buf[b:], v.Hsyncend)
- b += 2
-
- xgb.Put16(buf[b:], v.Htotal)
- b += 2
-
- xgb.Put32(buf[b:], v.Hskew)
- b += 4
-
- xgb.Put16(buf[b:], v.Vdisplay)
- b += 2
-
- xgb.Put16(buf[b:], v.Vsyncstart)
- b += 2
-
- xgb.Put16(buf[b:], v.Vsyncend)
- b += 2
-
- xgb.Put16(buf[b:], v.Vtotal)
- b += 2
-
- b += 4 // padding
-
- xgb.Put32(buf[b:], v.Flags)
- b += 4
-
- b += 12 // padding
-
- xgb.Put32(buf[b:], v.Privsize)
- b += 4
-
- return buf
-}
-
-// ModeInfoListBytes writes a list of ModeInfo values to a byte slice.
-func ModeInfoListBytes(buf []byte, list []ModeInfo) int {
- b := 0
- var structBytes []byte
- for _, item := range list {
- structBytes = item.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
- return b
-}
-
// BadBadClock is the error number for a BadBadClock.
const BadBadClock = 0
@@ -365,18 +178,18 @@ func init() {
xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][2] = BadVTimingsErrorNew
}
-// BadModeUnsuitable is the error number for a BadModeUnsuitable.
-const BadModeUnsuitable = 3
+// BadClientNotLocal is the error number for a BadClientNotLocal.
+const BadClientNotLocal = 5
-type ModeUnsuitableError struct {
+type ClientNotLocalError struct {
Sequence uint16
NiceName string
}
-// ModeUnsuitableErrorNew constructs a ModeUnsuitableError value that implements xgb.Error from a byte slice.
-func ModeUnsuitableErrorNew(buf []byte) xgb.Error {
- v := ModeUnsuitableError{}
- v.NiceName = "ModeUnsuitable"
+// ClientNotLocalErrorNew constructs a ClientNotLocalError value that implements xgb.Error from a byte slice.
+func ClientNotLocalErrorNew(buf []byte) xgb.Error {
+ v := ClientNotLocalError{}
+ v.NiceName = "ClientNotLocal"
b := 1 // skip error determinant
b += 1 // don't read error number
@@ -387,30 +200,36 @@ func ModeUnsuitableErrorNew(buf []byte) xgb.Error {
return v
}
-// SequenceId returns the sequence id attached to the BadModeUnsuitable error.
+// SequenceId returns the sequence id attached to the BadClientNotLocal error.
// This is mostly used internally.
-func (err ModeUnsuitableError) SequenceId() uint16 {
+func (err ClientNotLocalError) SequenceId() uint16 {
return err.Sequence
}
-// BadId returns the 'BadValue' number if one exists for the BadModeUnsuitable error. If no bad value exists, 0 is returned.
-func (err ModeUnsuitableError) BadId() uint32 {
+// BadId returns the 'BadValue' number if one exists for the BadClientNotLocal error. If no bad value exists, 0 is returned.
+func (err ClientNotLocalError) BadId() uint32 {
return 0
}
-// Error returns a rudimentary string representation of the BadModeUnsuitable error.
+// Error returns a rudimentary string representation of the BadClientNotLocal error.
-func (err ModeUnsuitableError) Error() string {
+func (err ClientNotLocalError) Error() string {
fieldVals := make([]string, 0, 0)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadModeUnsuitable {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+ return "BadClientNotLocal {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
- xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][3] = ModeUnsuitableErrorNew
+ xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][5] = ClientNotLocalErrorNew
}
+const (
+ ClockFlagProgramable = 1
+)
+
+type Dotclock uint32
+
// BadExtensionDisabled is the error number for a BadExtensionDisabled.
const BadExtensionDisabled = 4
@@ -457,18 +276,168 @@ func init() {
xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][4] = ExtensionDisabledErrorNew
}
-// BadClientNotLocal is the error number for a BadClientNotLocal.
-const BadClientNotLocal = 5
+const (
+ ModeFlagPositiveHsync = 1
+ ModeFlagNegativeHsync = 2
+ ModeFlagPositiveVsync = 4
+ ModeFlagNegativeVsync = 8
+ ModeFlagInterlace = 16
+ ModeFlagCompositeSync = 32
+ ModeFlagPositiveCsync = 64
+ ModeFlagNegativeCsync = 128
+ ModeFlagHSkew = 256
+ ModeFlagBroadcast = 512
+ ModeFlagPixmux = 1024
+ ModeFlagDoubleClock = 2048
+ ModeFlagHalfClock = 4096
+)
-type ClientNotLocalError struct {
+type ModeInfo struct {
+ Dotclock Dotclock
+ Hdisplay uint16
+ Hsyncstart uint16
+ Hsyncend uint16
+ Htotal uint16
+ Hskew uint32
+ Vdisplay uint16
+ Vsyncstart uint16
+ Vsyncend uint16
+ Vtotal uint16
+ // padding: 4 bytes
+ Flags uint32
+ // padding: 12 bytes
+ Privsize uint32
+}
+
+// ModeInfoRead reads a byte slice into a ModeInfo value.
+func ModeInfoRead(buf []byte, v *ModeInfo) int {
+ b := 0
+
+ v.Dotclock = Dotclock(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Hdisplay = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Hsyncstart = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Hsyncend = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Htotal = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Hskew = xgb.Get32(buf[b:])
+ b += 4
+
+ v.Vdisplay = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Vsyncstart = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Vsyncend = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Vtotal = xgb.Get16(buf[b:])
+ b += 2
+
+ b += 4 // padding
+
+ v.Flags = xgb.Get32(buf[b:])
+ b += 4
+
+ b += 12 // padding
+
+ v.Privsize = xgb.Get32(buf[b:])
+ b += 4
+
+ return b
+}
+
+// ModeInfoReadList reads a byte slice into a list of ModeInfo values.
+func ModeInfoReadList(buf []byte, dest []ModeInfo) int {
+ b := 0
+ for i := 0; i < len(dest); i++ {
+ dest[i] = ModeInfo{}
+ b += ModeInfoRead(buf[b:], &dest[i])
+ }
+ return xgb.Pad(b)
+}
+
+// Bytes writes a ModeInfo value to a byte slice.
+func (v ModeInfo) Bytes() []byte {
+ buf := make([]byte, 48)
+ b := 0
+
+ xgb.Put32(buf[b:], uint32(v.Dotclock))
+ b += 4
+
+ xgb.Put16(buf[b:], v.Hdisplay)
+ b += 2
+
+ xgb.Put16(buf[b:], v.Hsyncstart)
+ b += 2
+
+ xgb.Put16(buf[b:], v.Hsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], v.Htotal)
+ b += 2
+
+ xgb.Put32(buf[b:], v.Hskew)
+ b += 4
+
+ xgb.Put16(buf[b:], v.Vdisplay)
+ b += 2
+
+ xgb.Put16(buf[b:], v.Vsyncstart)
+ b += 2
+
+ xgb.Put16(buf[b:], v.Vsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], v.Vtotal)
+ b += 2
+
+ b += 4 // padding
+
+ xgb.Put32(buf[b:], v.Flags)
+ b += 4
+
+ b += 12 // padding
+
+ xgb.Put32(buf[b:], v.Privsize)
+ b += 4
+
+ return buf
+}
+
+// ModeInfoListBytes writes a list of ModeInfo values to a byte slice.
+func ModeInfoListBytes(buf []byte, list []ModeInfo) int {
+ b := 0
+ var structBytes []byte
+ for _, item := range list {
+ structBytes = item.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+ return b
+}
+
+// BadModeUnsuitable is the error number for a BadModeUnsuitable.
+const BadModeUnsuitable = 3
+
+type ModeUnsuitableError struct {
Sequence uint16
NiceName string
}
-// ClientNotLocalErrorNew constructs a ClientNotLocalError value that implements xgb.Error from a byte slice.
-func ClientNotLocalErrorNew(buf []byte) xgb.Error {
- v := ClientNotLocalError{}
- v.NiceName = "ClientNotLocal"
+// ModeUnsuitableErrorNew constructs a ModeUnsuitableError value that implements xgb.Error from a byte slice.
+func ModeUnsuitableErrorNew(buf []byte) xgb.Error {
+ v := ModeUnsuitableError{}
+ v.NiceName = "ModeUnsuitable"
b := 1 // skip error determinant
b += 1 // don't read error number
@@ -479,30 +448,37 @@ func ClientNotLocalErrorNew(buf []byte) xgb.Error {
return v
}
-// SequenceId returns the sequence id attached to the BadClientNotLocal error.
+// SequenceId returns the sequence id attached to the BadModeUnsuitable error.
// This is mostly used internally.
-func (err ClientNotLocalError) SequenceId() uint16 {
+func (err ModeUnsuitableError) SequenceId() uint16 {
return err.Sequence
}
-// BadId returns the 'BadValue' number if one exists for the BadClientNotLocal error. If no bad value exists, 0 is returned.
-func (err ClientNotLocalError) BadId() uint32 {
+// BadId returns the 'BadValue' number if one exists for the BadModeUnsuitable error. If no bad value exists, 0 is returned.
+func (err ModeUnsuitableError) BadId() uint32 {
return 0
}
-// Error returns a rudimentary string representation of the BadClientNotLocal error.
+// Error returns a rudimentary string representation of the BadModeUnsuitable error.
-func (err ClientNotLocalError) Error() string {
+func (err ModeUnsuitableError) Error() string {
fieldVals := make([]string, 0, 0)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadClientNotLocal {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+ return "BadModeUnsuitable {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
- xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][5] = ClientNotLocalErrorNew
+ xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][3] = ModeUnsuitableErrorNew
}
+const (
+ PermissionRead = 1
+ PermissionWrite = 2
+)
+
+type Syncrange uint32
+
// BadZoomLocked is the error number for a BadZoomLocked.
const BadZoomLocked = 6
@@ -549,284 +525,209 @@ func init() {
xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][6] = ZoomLockedErrorNew
}
-// QueryVersionCookie is a cookie used only for QueryVersion requests.
-type QueryVersionCookie struct {
- *xgb.Cookie
-}
-
-// QueryVersion sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
-func QueryVersion(c *xgb.Conn) QueryVersionCookie {
- if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(queryVersionRequest(c), cookie)
- return QueryVersionCookie{cookie}
-}
-
-// QueryVersionUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie {
- if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, true)
- c.NewRequest(queryVersionRequest(c), cookie)
- return QueryVersionCookie{cookie}
-}
-
-// QueryVersionReply represents the data returned from a QueryVersion request.
-type QueryVersionReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- MajorVersion uint16
- MinorVersion uint16
-}
-
-// Reply blocks and returns the reply data for a QueryVersion request.
-func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return queryVersionReply(buf), nil
-}
-
-// queryVersionReply reads a byte slice into a QueryVersionReply value.
-func queryVersionReply(buf []byte) *QueryVersionReply {
- v := new(QueryVersionReply)
- b := 1 // skip reply determinant
+// Skipping definition for base type 'Bool'
- b += 1 // padding
+// Skipping definition for base type 'Byte'
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
+// Skipping definition for base type 'Card8'
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
- b += 4
+// Skipping definition for base type 'Char'
- v.MajorVersion = xgb.Get16(buf[b:])
- b += 2
+// Skipping definition for base type 'Void'
- v.MinorVersion = xgb.Get16(buf[b:])
- b += 2
+// Skipping definition for base type 'Double'
- return v
-}
+// Skipping definition for base type 'Float'
-// Write request to wire for QueryVersion
-// queryVersionRequest writes a QueryVersion request to a byte slice.
-func queryVersionRequest(c *xgb.Conn) []byte {
- size := 4
- b := 0
- buf := make([]byte, size)
+// Skipping definition for base type 'Int16'
- buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
- b += 1
+// Skipping definition for base type 'Int32'
- buf[b] = 0 // request opcode
- b += 1
+// Skipping definition for base type 'Int8'
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
- b += 2
+// Skipping definition for base type 'Card16'
- return buf
-}
+// Skipping definition for base type 'Card32'
-// GetModeLineCookie is a cookie used only for GetModeLine requests.
-type GetModeLineCookie struct {
+// AddModeLineCookie is a cookie used only for AddModeLine requests.
+type AddModeLineCookie struct {
*xgb.Cookie
}
-// GetModeLine sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetModeLineCookie.Reply()
-func GetModeLine(c *xgb.Conn, Screen uint16) GetModeLineCookie {
+// AddModeLine sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func AddModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'AddModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, true)
- c.NewRequest(getModeLineRequest(c, Screen), cookie)
- return GetModeLineCookie{cookie}
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(addModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, AfterDotclock, AfterHdisplay, AfterHsyncstart, AfterHsyncend, AfterHtotal, AfterHskew, AfterVdisplay, AfterVsyncstart, AfterVsyncend, AfterVtotal, AfterFlags, Private), cookie)
+ return AddModeLineCookie{cookie}
}
-// GetModeLineUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetModeLineUnchecked(c *xgb.Conn, Screen uint16) GetModeLineCookie {
+// AddModeLineChecked sends a checked request.
+// If an error occurs, it can be retrieved using AddModeLineCookie.Check()
+func AddModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'AddModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(getModeLineRequest(c, Screen), cookie)
- return GetModeLineCookie{cookie}
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(addModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, AfterDotclock, AfterHdisplay, AfterHsyncstart, AfterHsyncend, AfterHtotal, AfterHskew, AfterVdisplay, AfterVsyncstart, AfterVsyncend, AfterVtotal, AfterFlags, Private), cookie)
+ return AddModeLineCookie{cookie}
}
-// GetModeLineReply represents the data returned from a GetModeLine request.
-type GetModeLineReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Dotclock Dotclock
- Hdisplay uint16
- Hsyncstart uint16
- Hsyncend uint16
- Htotal uint16
- Hskew uint16
- Vdisplay uint16
- Vsyncstart uint16
- Vsyncend uint16
- Vtotal uint16
- // padding: 2 bytes
- Flags uint32
- // padding: 12 bytes
- Privsize uint32
- Private []byte // size: xgb.Pad((int(Privsize) * 1))
+// 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.
+func (cook AddModeLineCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Reply blocks and returns the reply data for a GetModeLine request.
-func (cook GetModeLineCookie) Reply() (*GetModeLineReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return getModeLineReply(buf), nil
-}
+// Write request to wire for AddModeLine
+// addModeLineRequest writes a AddModeLine request to a byte slice.
+func addModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) []byte {
+ size := xgb.Pad((92 + xgb.Pad((int(Privsize) * 1))))
+ b := 0
+ buf := make([]byte, size)
-// getModeLineReply reads a byte slice into a GetModeLineReply value.
-func getModeLineReply(buf []byte) *GetModeLineReply {
- v := new(GetModeLineReply)
- b := 1 // skip reply determinant
+ buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ b += 1
- b += 1 // padding
+ buf[b] = 7 // request opcode
+ b += 1
- v.Sequence = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
+ xgb.Put32(buf[b:], Screen)
b += 4
- v.Dotclock = Dotclock(xgb.Get32(buf[b:]))
+ xgb.Put32(buf[b:], uint32(Dotclock))
b += 4
- v.Hdisplay = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Hdisplay)
b += 2
- v.Hsyncstart = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Hsyncstart)
b += 2
- v.Hsyncend = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Hsyncend)
b += 2
- v.Htotal = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Htotal)
b += 2
- v.Hskew = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Hskew)
b += 2
- v.Vdisplay = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Vdisplay)
b += 2
- v.Vsyncstart = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Vsyncstart)
b += 2
- v.Vsyncend = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Vsyncend)
b += 2
- v.Vtotal = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], Vtotal)
b += 2
b += 2 // padding
- v.Flags = xgb.Get32(buf[b:])
+ xgb.Put32(buf[b:], Flags)
b += 4
b += 12 // padding
- v.Privsize = xgb.Get32(buf[b:])
+ xgb.Put32(buf[b:], Privsize)
b += 4
- v.Private = make([]byte, v.Privsize)
- copy(v.Private[:v.Privsize], buf[b:])
- b += xgb.Pad(int(v.Privsize))
+ xgb.Put32(buf[b:], uint32(AfterDotclock))
+ b += 4
- return v
-}
+ xgb.Put16(buf[b:], AfterHdisplay)
+ b += 2
-// Write request to wire for GetModeLine
-// getModeLineRequest writes a GetModeLine request to a byte slice.
-func getModeLineRequest(c *xgb.Conn, Screen uint16) []byte {
- size := 8
- b := 0
- buf := make([]byte, size)
+ xgb.Put16(buf[b:], AfterHsyncstart)
+ b += 2
- buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
- b += 1
+ xgb.Put16(buf[b:], AfterHsyncend)
+ b += 2
- buf[b] = 1 // request opcode
- b += 1
+ xgb.Put16(buf[b:], AfterHtotal)
+ b += 2
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ xgb.Put16(buf[b:], AfterHskew)
b += 2
- xgb.Put16(buf[b:], Screen)
+ xgb.Put16(buf[b:], AfterVdisplay)
+ b += 2
+
+ xgb.Put16(buf[b:], AfterVsyncstart)
+ b += 2
+
+ xgb.Put16(buf[b:], AfterVsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], AfterVtotal)
b += 2
b += 2 // padding
+ xgb.Put32(buf[b:], AfterFlags)
+ b += 4
+
+ b += 12 // padding
+
+ copy(buf[b:], Private[:Privsize])
+ b += xgb.Pad(int(Privsize))
+
return buf
}
-// ModModeLineCookie is a cookie used only for ModModeLine requests.
-type ModModeLineCookie struct {
+// DeleteModeLineCookie is a cookie used only for DeleteModeLine requests.
+type DeleteModeLineCookie struct {
*xgb.Cookie
}
-// ModModeLine sends an unchecked request.
+// DeleteModeLine sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ModModeLine(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ModModeLineCookie {
+func DeleteModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'ModModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DeleteModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(modModeLineRequest(c, Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return ModModeLineCookie{cookie}
+ c.NewRequest(deleteModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return DeleteModeLineCookie{cookie}
}
-// ModModeLineChecked sends a checked request.
-// If an error occurs, it can be retrieved using ModModeLineCookie.Check()
-func ModModeLineChecked(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ModModeLineCookie {
+// DeleteModeLineChecked sends a checked request.
+// If an error occurs, it can be retrieved using DeleteModeLineCookie.Check()
+func DeleteModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'ModModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DeleteModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(modModeLineRequest(c, Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return ModModeLineCookie{cookie}
+ c.NewRequest(deleteModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return DeleteModeLineCookie{cookie}
}
// 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.
-func (cook ModModeLineCookie) Check() error {
+func (cook DeleteModeLineCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for ModModeLine
-// modModeLineRequest writes a ModModeLine request to a byte slice.
-func modModeLineRequest(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
- size := xgb.Pad((48 + xgb.Pad((int(Privsize) * 1))))
+// Write request to wire for DeleteModeLine
+// deleteModeLineRequest writes a DeleteModeLine request to a byte slice.
+func deleteModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
+ size := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 2 // request opcode
+ buf[b] = 8 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -835,6 +736,9 @@ func modModeLineRequest(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart
xgb.Put32(buf[b:], Screen)
b += 4
+ xgb.Put32(buf[b:], uint32(Dotclock))
+ b += 4
+
xgb.Put16(buf[b:], Hdisplay)
b += 2
@@ -878,42 +782,82 @@ func modModeLineRequest(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart
return buf
}
-// SwitchModeCookie is a cookie used only for SwitchMode requests.
-type SwitchModeCookie struct {
+// GetAllModeLinesCookie is a cookie used only for GetAllModeLines requests.
+type GetAllModeLinesCookie struct {
*xgb.Cookie
}
-// SwitchMode sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SwitchMode(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie {
+// GetAllModeLines sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetAllModeLinesCookie.Reply()
+func GetAllModeLines(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SwitchMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetAllModeLines' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(switchModeRequest(c, Screen, Zoom), cookie)
- return SwitchModeCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getAllModeLinesRequest(c, Screen), cookie)
+ return GetAllModeLinesCookie{cookie}
}
-// SwitchModeChecked sends a checked request.
-// If an error occurs, it can be retrieved using SwitchModeCookie.Check()
-func SwitchModeChecked(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie {
+// GetAllModeLinesUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetAllModeLinesUnchecked(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SwitchMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetAllModeLines' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(switchModeRequest(c, Screen, Zoom), cookie)
- return SwitchModeCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getAllModeLinesRequest(c, Screen), cookie)
+ return GetAllModeLinesCookie{cookie}
}
-// 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.
-func (cook SwitchModeCookie) Check() error {
- return cook.Cookie.Check()
+// GetAllModeLinesReply represents the data returned from a GetAllModeLines request.
+type GetAllModeLinesReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Modecount uint32
+ // padding: 20 bytes
+ Modeinfo []ModeInfo // size: xgb.Pad((int(Modecount) * 48))
}
-// Write request to wire for SwitchMode
-// switchModeRequest writes a SwitchMode request to a byte slice.
-func switchModeRequest(c *xgb.Conn, Screen uint16, Zoom uint16) []byte {
+// Reply blocks and returns the reply data for a GetAllModeLines request.
+func (cook GetAllModeLinesCookie) Reply() (*GetAllModeLinesReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getAllModeLinesReply(buf), nil
+}
+
+// getAllModeLinesReply reads a byte slice into a GetAllModeLinesReply value.
+func getAllModeLinesReply(buf []byte) *GetAllModeLinesReply {
+ v := new(GetAllModeLinesReply)
+ 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.Modecount = xgb.Get32(buf[b:])
+ b += 4
+
+ b += 20 // padding
+
+ v.Modeinfo = make([]ModeInfo, v.Modecount)
+ b += ModeInfoReadList(buf[b:], v.Modeinfo)
+
+ return v
+}
+
+// Write request to wire for GetAllModeLines
+// getAllModeLinesRequest writes a GetAllModeLines request to a byte slice.
+func getAllModeLinesRequest(c *xgb.Conn, Screen uint16) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -921,7 +865,7 @@ func switchModeRequest(c *xgb.Conn, Screen uint16, Zoom uint16) []byte {
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 3 // request opcode
+ buf[b] = 6 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -930,58 +874,52 @@ func switchModeRequest(c *xgb.Conn, Screen uint16, Zoom uint16) []byte {
xgb.Put16(buf[b:], Screen)
b += 2
- xgb.Put16(buf[b:], Zoom)
- b += 2
+ b += 2 // padding
return buf
}
-// GetMonitorCookie is a cookie used only for GetMonitor requests.
-type GetMonitorCookie struct {
+// GetDotClocksCookie is a cookie used only for GetDotClocks requests.
+type GetDotClocksCookie struct {
*xgb.Cookie
}
-// GetMonitor sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetMonitorCookie.Reply()
-func GetMonitor(c *xgb.Conn, Screen uint16) GetMonitorCookie {
+// GetDotClocks sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetDotClocksCookie.Reply()
+func GetDotClocks(c *xgb.Conn, Screen uint16) GetDotClocksCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetMonitor' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetDotClocks' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getMonitorRequest(c, Screen), cookie)
- return GetMonitorCookie{cookie}
+ c.NewRequest(getDotClocksRequest(c, Screen), cookie)
+ return GetDotClocksCookie{cookie}
}
-// GetMonitorUnchecked sends an unchecked request.
+// GetDotClocksUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetMonitorUnchecked(c *xgb.Conn, Screen uint16) GetMonitorCookie {
+func GetDotClocksUnchecked(c *xgb.Conn, Screen uint16) GetDotClocksCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetMonitor' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetDotClocks' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getMonitorRequest(c, Screen), cookie)
- return GetMonitorCookie{cookie}
+ c.NewRequest(getDotClocksRequest(c, Screen), cookie)
+ return GetDotClocksCookie{cookie}
}
-// GetMonitorReply represents the data returned from a GetMonitor request.
-type GetMonitorReply struct {
+// GetDotClocksReply represents the data returned from a GetDotClocks request.
+type GetDotClocksReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- VendorLength byte
- ModelLength byte
- NumHsync byte
- NumVsync byte
- // padding: 20 bytes
- Hsync []Syncrange // size: xgb.Pad((int(NumHsync) * 4))
- Vsync []Syncrange // size: xgb.Pad((int(NumVsync) * 4))
- Vendor string // size: xgb.Pad((int(VendorLength) * 1))
- AlignmentPad []byte // size: xgb.Pad(((((int(VendorLength) + 3) & -4) - int(VendorLength)) * 1))
- Model string // size: xgb.Pad((int(ModelLength) * 1))
+ Flags uint32
+ Clocks uint32
+ Maxclocks uint32
+ // padding: 12 bytes
+ Clock []uint32 // size: xgb.Pad((((1 - (int(Flags) & 1)) * int(Clocks)) * 4))
}
-// Reply blocks and returns the reply data for a GetMonitor request.
-func (cook GetMonitorCookie) Reply() (*GetMonitorReply, error) {
+// Reply blocks and returns the reply data for a GetDotClocks request.
+func (cook GetDotClocksCookie) Reply() (*GetDotClocksReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -989,12 +927,12 @@ func (cook GetMonitorCookie) Reply() (*GetMonitorReply, error) {
if buf == nil {
return nil, nil
}
- return getMonitorReply(buf), nil
+ return getDotClocksReply(buf), nil
}
-// getMonitorReply reads a byte slice into a GetMonitorReply value.
-func getMonitorReply(buf []byte) *GetMonitorReply {
- v := new(GetMonitorReply)
+// getDotClocksReply reads a byte slice into a GetDotClocksReply value.
+func getDotClocksReply(buf []byte) *GetDotClocksReply {
+ v := new(GetDotClocksReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1005,58 +943,30 @@ func getMonitorReply(buf []byte) *GetMonitorReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.VendorLength = buf[b]
- b += 1
-
- v.ModelLength = buf[b]
- b += 1
-
- v.NumHsync = buf[b]
- b += 1
+ v.Flags = xgb.Get32(buf[b:])
+ b += 4
- v.NumVsync = buf[b]
- b += 1
+ v.Clocks = xgb.Get32(buf[b:])
+ b += 4
- b += 20 // padding
+ v.Maxclocks = xgb.Get32(buf[b:])
+ b += 4
- v.Hsync = make([]Syncrange, v.NumHsync)
- for i := 0; i < int(v.NumHsync); i++ {
- v.Hsync[i] = Syncrange(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
+ b += 12 // padding
- v.Vsync = make([]Syncrange, v.NumVsync)
- for i := 0; i < int(v.NumVsync); i++ {
- v.Vsync[i] = Syncrange(xgb.Get32(buf[b:]))
+ v.Clock = make([]uint32, ((1 - (int(v.Flags) & 1)) * int(v.Clocks)))
+ for i := 0; i < int(((1 - (int(v.Flags) & 1)) * int(v.Clocks))); i++ {
+ v.Clock[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
- {
- byteString := make([]byte, v.VendorLength)
- copy(byteString[:v.VendorLength], buf[b:])
- v.Vendor = string(byteString)
- b += xgb.Pad(int(v.VendorLength))
- }
-
- v.AlignmentPad = make([]byte, (((int(v.VendorLength) + 3) & -4) - int(v.VendorLength)))
- copy(v.AlignmentPad[:(((int(v.VendorLength)+3)&-4)-int(v.VendorLength))], buf[b:])
- b += xgb.Pad(int((((int(v.VendorLength) + 3) & -4) - int(v.VendorLength))))
-
- {
- byteString := make([]byte, v.ModelLength)
- copy(byteString[:v.ModelLength], buf[b:])
- v.Model = string(byteString)
- b += xgb.Pad(int(v.ModelLength))
- }
-
return v
}
-// Write request to wire for GetMonitor
-// getMonitorRequest writes a GetMonitor request to a byte slice.
-func getMonitorRequest(c *xgb.Conn, Screen uint16) []byte {
+// Write request to wire for GetDotClocks
+// getDotClocksRequest writes a GetDotClocks request to a byte slice.
+func getDotClocksRequest(c *xgb.Conn, Screen uint16) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1064,7 +974,7 @@ func getMonitorRequest(c *xgb.Conn, Screen uint16) []byte {
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 4 // request opcode
+ buf[b] = 13 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1078,50 +988,94 @@ func getMonitorRequest(c *xgb.Conn, Screen uint16) []byte {
return buf
}
-// LockModeSwitchCookie is a cookie used only for LockModeSwitch requests.
-type LockModeSwitchCookie struct {
+// GetGammaCookie is a cookie used only for GetGamma requests.
+type GetGammaCookie struct {
*xgb.Cookie
}
-// LockModeSwitch sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func LockModeSwitch(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie {
+// GetGamma sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetGammaCookie.Reply()
+func GetGamma(c *xgb.Conn, Screen uint16) GetGammaCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'LockModeSwitch' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(lockModeSwitchRequest(c, Screen, Lock), cookie)
- return LockModeSwitchCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getGammaRequest(c, Screen), cookie)
+ return GetGammaCookie{cookie}
}
-// LockModeSwitchChecked sends a checked request.
-// If an error occurs, it can be retrieved using LockModeSwitchCookie.Check()
-func LockModeSwitchChecked(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie {
+// GetGammaUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetGammaUnchecked(c *xgb.Conn, Screen uint16) GetGammaCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'LockModeSwitch' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(lockModeSwitchRequest(c, Screen, Lock), cookie)
- return LockModeSwitchCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getGammaRequest(c, Screen), cookie)
+ return GetGammaCookie{cookie}
}
-// 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.
-func (cook LockModeSwitchCookie) Check() error {
- return cook.Cookie.Check()
+// GetGammaReply represents the data returned from a GetGamma request.
+type GetGammaReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Red uint32
+ Green uint32
+ Blue uint32
+ // padding: 12 bytes
}
-// Write request to wire for LockModeSwitch
-// lockModeSwitchRequest writes a LockModeSwitch request to a byte slice.
-func lockModeSwitchRequest(c *xgb.Conn, Screen uint16, Lock uint16) []byte {
- size := 8
+// Reply blocks and returns the reply data for a GetGamma request.
+func (cook GetGammaCookie) Reply() (*GetGammaReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getGammaReply(buf), nil
+}
+
+// getGammaReply reads a byte slice into a GetGammaReply value.
+func getGammaReply(buf []byte) *GetGammaReply {
+ v := new(GetGammaReply)
+ 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.Red = xgb.Get32(buf[b:])
+ b += 4
+
+ v.Green = xgb.Get32(buf[b:])
+ b += 4
+
+ v.Blue = xgb.Get32(buf[b:])
+ b += 4
+
+ b += 12 // padding
+
+ return v
+}
+
+// Write request to wire for GetGamma
+// getGammaRequest writes a GetGamma request to a byte slice.
+func getGammaRequest(c *xgb.Conn, Screen uint16) []byte {
+ size := 32
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 5 // request opcode
+ buf[b] = 16 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1130,51 +1084,52 @@ func lockModeSwitchRequest(c *xgb.Conn, Screen uint16, Lock uint16) []byte {
xgb.Put16(buf[b:], Screen)
b += 2
- xgb.Put16(buf[b:], Lock)
- b += 2
+ b += 26 // padding
return buf
}
-// GetAllModeLinesCookie is a cookie used only for GetAllModeLines requests.
-type GetAllModeLinesCookie struct {
+// GetGammaRampCookie is a cookie used only for GetGammaRamp requests.
+type GetGammaRampCookie struct {
*xgb.Cookie
}
-// GetAllModeLines sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetAllModeLinesCookie.Reply()
-func GetAllModeLines(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie {
+// GetGammaRamp sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetGammaRampCookie.Reply()
+func GetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetAllModeLines' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getAllModeLinesRequest(c, Screen), cookie)
- return GetAllModeLinesCookie{cookie}
+ c.NewRequest(getGammaRampRequest(c, Screen, Size), cookie)
+ return GetGammaRampCookie{cookie}
}
-// GetAllModeLinesUnchecked sends an unchecked request.
+// GetGammaRampUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetAllModeLinesUnchecked(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie {
+func GetGammaRampUnchecked(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetAllModeLines' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getAllModeLinesRequest(c, Screen), cookie)
- return GetAllModeLinesCookie{cookie}
+ c.NewRequest(getGammaRampRequest(c, Screen, Size), cookie)
+ return GetGammaRampCookie{cookie}
}
-// GetAllModeLinesReply represents the data returned from a GetAllModeLines request.
-type GetAllModeLinesReply struct {
+// GetGammaRampReply represents the data returned from a GetGammaRamp request.
+type GetGammaRampReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Modecount uint32
- // padding: 20 bytes
- Modeinfo []ModeInfo // size: xgb.Pad((int(Modecount) * 48))
+ Size uint16
+ // padding: 22 bytes
+ Red []uint16 // size: xgb.Pad((((int(Size) + 1) & -2) * 2))
+ Green []uint16 // size: xgb.Pad((((int(Size) + 1) & -2) * 2))
+ Blue []uint16 // size: xgb.Pad((((int(Size) + 1) & -2) * 2))
}
-// Reply blocks and returns the reply data for a GetAllModeLines request.
-func (cook GetAllModeLinesCookie) Reply() (*GetAllModeLinesReply, error) {
+// Reply blocks and returns the reply data for a GetGammaRamp request.
+func (cook GetGammaRampCookie) Reply() (*GetGammaRampReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1182,12 +1137,12 @@ func (cook GetAllModeLinesCookie) Reply() (*GetAllModeLinesReply, error) {
if buf == nil {
return nil, nil
}
- return getAllModeLinesReply(buf), nil
+ return getGammaRampReply(buf), nil
}
-// getAllModeLinesReply reads a byte slice into a GetAllModeLinesReply value.
-func getAllModeLinesReply(buf []byte) *GetAllModeLinesReply {
- v := new(GetAllModeLinesReply)
+// getGammaRampReply reads a byte slice into a GetGammaRampReply value.
+func getGammaRampReply(buf []byte) *GetGammaRampReply {
+ v := new(GetGammaRampReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1198,20 +1153,38 @@ func getAllModeLinesReply(buf []byte) *GetAllModeLinesReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Modecount = xgb.Get32(buf[b:])
- b += 4
+ v.Size = xgb.Get16(buf[b:])
+ b += 2
- b += 20 // padding
+ b += 22 // padding
- v.Modeinfo = make([]ModeInfo, v.Modecount)
- b += ModeInfoReadList(buf[b:], v.Modeinfo)
+ v.Red = make([]uint16, ((int(v.Size) + 1) & -2))
+ for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ {
+ v.Red[i] = xgb.Get16(buf[b:])
+ b += 2
+ }
+ b = xgb.Pad(b)
+
+ v.Green = make([]uint16, ((int(v.Size) + 1) & -2))
+ for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ {
+ v.Green[i] = xgb.Get16(buf[b:])
+ b += 2
+ }
+ b = xgb.Pad(b)
+
+ v.Blue = make([]uint16, ((int(v.Size) + 1) & -2))
+ for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ {
+ v.Blue[i] = xgb.Get16(buf[b:])
+ b += 2
+ }
+ b = xgb.Pad(b)
return v
}
-// Write request to wire for GetAllModeLines
-// getAllModeLinesRequest writes a GetAllModeLines request to a byte slice.
-func getAllModeLinesRequest(c *xgb.Conn, Screen uint16) []byte {
+// Write request to wire for GetGammaRamp
+// getGammaRampRequest writes a GetGammaRamp request to a byte slice.
+func getGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1219,7 +1192,7 @@ func getAllModeLinesRequest(c *xgb.Conn, Screen uint16) []byte {
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 6 // request opcode
+ buf[b] = 17 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1228,282 +1201,296 @@ func getAllModeLinesRequest(c *xgb.Conn, Screen uint16) []byte {
xgb.Put16(buf[b:], Screen)
b += 2
- b += 2 // padding
+ xgb.Put16(buf[b:], Size)
+ b += 2
return buf
}
-// AddModeLineCookie is a cookie used only for AddModeLine requests.
-type AddModeLineCookie struct {
+// GetGammaRampSizeCookie is a cookie used only for GetGammaRampSize requests.
+type GetGammaRampSizeCookie struct {
*xgb.Cookie
}
-// AddModeLine sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func AddModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie {
+// GetGammaRampSize sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetGammaRampSizeCookie.Reply()
+func GetGammaRampSize(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'AddModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetGammaRampSize' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(addModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, AfterDotclock, AfterHdisplay, AfterHsyncstart, AfterHsyncend, AfterHtotal, AfterHskew, AfterVdisplay, AfterVsyncstart, AfterVsyncend, AfterVtotal, AfterFlags, Private), cookie)
- return AddModeLineCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getGammaRampSizeRequest(c, Screen), cookie)
+ return GetGammaRampSizeCookie{cookie}
}
-// AddModeLineChecked sends a checked request.
-// If an error occurs, it can be retrieved using AddModeLineCookie.Check()
-func AddModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie {
+// GetGammaRampSizeUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetGammaRampSizeUnchecked(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'AddModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetGammaRampSize' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(addModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, AfterDotclock, AfterHdisplay, AfterHsyncstart, AfterHsyncend, AfterHtotal, AfterHskew, AfterVdisplay, AfterVsyncstart, AfterVsyncend, AfterVtotal, AfterFlags, Private), cookie)
- return AddModeLineCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getGammaRampSizeRequest(c, Screen), cookie)
+ return GetGammaRampSizeCookie{cookie}
}
-// 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.
-func (cook AddModeLineCookie) Check() error {
- return cook.Cookie.Check()
+// GetGammaRampSizeReply represents the data returned from a GetGammaRampSize request.
+type GetGammaRampSizeReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Size uint16
+ // padding: 22 bytes
}
-// Write request to wire for AddModeLine
-// addModeLineRequest writes a AddModeLine request to a byte slice.
-func addModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) []byte {
- size := xgb.Pad((92 + xgb.Pad((int(Privsize) * 1))))
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
- 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:], Screen)
- b += 4
-
- xgb.Put32(buf[b:], uint32(Dotclock))
- b += 4
-
- xgb.Put16(buf[b:], Hdisplay)
- b += 2
-
- xgb.Put16(buf[b:], Hsyncstart)
- b += 2
-
- xgb.Put16(buf[b:], Hsyncend)
- b += 2
-
- xgb.Put16(buf[b:], Htotal)
- b += 2
-
- xgb.Put16(buf[b:], Hskew)
- b += 2
-
- xgb.Put16(buf[b:], Vdisplay)
- b += 2
+// Reply blocks and returns the reply data for a GetGammaRampSize request.
+func (cook GetGammaRampSizeCookie) Reply() (*GetGammaRampSizeReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getGammaRampSizeReply(buf), nil
+}
- xgb.Put16(buf[b:], Vsyncstart)
- b += 2
+// getGammaRampSizeReply reads a byte slice into a GetGammaRampSizeReply value.
+func getGammaRampSizeReply(buf []byte) *GetGammaRampSizeReply {
+ v := new(GetGammaRampSizeReply)
+ b := 1 // skip reply determinant
- xgb.Put16(buf[b:], Vsyncend)
- b += 2
+ b += 1 // padding
- xgb.Put16(buf[b:], Vtotal)
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- b += 2 // padding
-
- xgb.Put32(buf[b:], Flags)
- b += 4
-
- b += 12 // padding
-
- xgb.Put32(buf[b:], Privsize)
- b += 4
-
- xgb.Put32(buf[b:], uint32(AfterDotclock))
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- xgb.Put16(buf[b:], AfterHdisplay)
- b += 2
-
- xgb.Put16(buf[b:], AfterHsyncstart)
+ v.Size = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], AfterHsyncend)
- b += 2
+ b += 22 // padding
- xgb.Put16(buf[b:], AfterHtotal)
- b += 2
+ return v
+}
- xgb.Put16(buf[b:], AfterHskew)
- b += 2
+// Write request to wire for GetGammaRampSize
+// getGammaRampSizeRequest writes a GetGammaRampSize request to a byte slice.
+func getGammaRampSizeRequest(c *xgb.Conn, Screen uint16) []byte {
+ size := 8
+ b := 0
+ buf := make([]byte, size)
- xgb.Put16(buf[b:], AfterVdisplay)
- b += 2
+ buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ b += 1
- xgb.Put16(buf[b:], AfterVsyncstart)
- b += 2
+ buf[b] = 19 // request opcode
+ b += 1
- xgb.Put16(buf[b:], AfterVsyncend)
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put16(buf[b:], AfterVtotal)
+ xgb.Put16(buf[b:], Screen)
b += 2
b += 2 // padding
- xgb.Put32(buf[b:], AfterFlags)
- b += 4
-
- b += 12 // padding
-
- copy(buf[b:], Private[:Privsize])
- b += xgb.Pad(int(Privsize))
-
return buf
}
-// DeleteModeLineCookie is a cookie used only for DeleteModeLine requests.
-type DeleteModeLineCookie struct {
+// GetModeLineCookie is a cookie used only for GetModeLine requests.
+type GetModeLineCookie struct {
*xgb.Cookie
}
-// DeleteModeLine sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func DeleteModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie {
+// GetModeLine sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetModeLineCookie.Reply()
+func GetModeLine(c *xgb.Conn, Screen uint16) GetModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'DeleteModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(deleteModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return DeleteModeLineCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getModeLineRequest(c, Screen), cookie)
+ return GetModeLineCookie{cookie}
}
-// DeleteModeLineChecked sends a checked request.
-// If an error occurs, it can be retrieved using DeleteModeLineCookie.Check()
-func DeleteModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie {
+// GetModeLineUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetModeLineUnchecked(c *xgb.Conn, Screen uint16) GetModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'DeleteModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(deleteModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return DeleteModeLineCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getModeLineRequest(c, Screen), cookie)
+ return GetModeLineCookie{cookie}
}
-// 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.
-func (cook DeleteModeLineCookie) Check() error {
- return cook.Cookie.Check()
+// GetModeLineReply represents the data returned from a GetModeLine request.
+type GetModeLineReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Dotclock Dotclock
+ Hdisplay uint16
+ Hsyncstart uint16
+ Hsyncend uint16
+ Htotal uint16
+ Hskew uint16
+ Vdisplay uint16
+ Vsyncstart uint16
+ Vsyncend uint16
+ Vtotal uint16
+ // padding: 2 bytes
+ Flags uint32
+ // padding: 12 bytes
+ Privsize uint32
+ Private []byte // size: xgb.Pad((int(Privsize) * 1))
}
-// Write request to wire for DeleteModeLine
-// deleteModeLineRequest writes a DeleteModeLine request to a byte slice.
-func deleteModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
- size := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1))))
- b := 0
- buf := make([]byte, size)
+// Reply blocks and returns the reply data for a GetModeLine request.
+func (cook GetModeLineCookie) Reply() (*GetModeLineReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getModeLineReply(buf), nil
+}
- buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
- b += 1
+// getModeLineReply reads a byte slice into a GetModeLineReply value.
+func getModeLineReply(buf []byte) *GetModeLineReply {
+ v := new(GetModeLineReply)
+ b := 1 // skip reply determinant
- buf[b] = 8 // request opcode
- b += 1
+ b += 1 // padding
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- xgb.Put32(buf[b:], Screen)
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- xgb.Put32(buf[b:], uint32(Dotclock))
+ v.Dotclock = Dotclock(xgb.Get32(buf[b:]))
b += 4
- xgb.Put16(buf[b:], Hdisplay)
+ v.Hdisplay = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Hsyncstart)
+ v.Hsyncstart = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Hsyncend)
+ v.Hsyncend = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Htotal)
+ v.Htotal = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Hskew)
+ v.Hskew = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Vdisplay)
+ v.Vdisplay = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Vsyncstart)
+ v.Vsyncstart = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Vsyncend)
+ v.Vsyncend = xgb.Get16(buf[b:])
b += 2
- xgb.Put16(buf[b:], Vtotal)
+ v.Vtotal = xgb.Get16(buf[b:])
b += 2
b += 2 // padding
- xgb.Put32(buf[b:], Flags)
+ v.Flags = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
- xgb.Put32(buf[b:], Privsize)
+ v.Privsize = xgb.Get32(buf[b:])
b += 4
- copy(buf[b:], Private[:Privsize])
- b += xgb.Pad(int(Privsize))
+ v.Private = make([]byte, v.Privsize)
+ copy(v.Private[:v.Privsize], buf[b:])
+ b += xgb.Pad(int(v.Privsize))
+
+ return v
+}
+
+// Write request to wire for GetModeLine
+// getModeLineRequest writes a GetModeLine request to a byte slice.
+func getModeLineRequest(c *xgb.Conn, Screen uint16) []byte {
+ size := 8
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ 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:], Screen)
+ b += 2
+
+ b += 2 // padding
return buf
}
-// ValidateModeLineCookie is a cookie used only for ValidateModeLine requests.
-type ValidateModeLineCookie struct {
+// GetMonitorCookie is a cookie used only for GetMonitor requests.
+type GetMonitorCookie struct {
*xgb.Cookie
}
-// ValidateModeLine sends a checked request.
-// If an error occurs, it will be returned with the reply by calling ValidateModeLineCookie.Reply()
-func ValidateModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie {
+// GetMonitor sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetMonitorCookie.Reply()
+func GetMonitor(c *xgb.Conn, Screen uint16) GetMonitorCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'ValidateModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetMonitor' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(validateModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return ValidateModeLineCookie{cookie}
+ c.NewRequest(getMonitorRequest(c, Screen), cookie)
+ return GetMonitorCookie{cookie}
}
-// ValidateModeLineUnchecked sends an unchecked request.
+// GetMonitorUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ValidateModeLineUnchecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie {
+func GetMonitorUnchecked(c *xgb.Conn, Screen uint16) GetMonitorCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'ValidateModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetMonitor' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(validateModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return ValidateModeLineCookie{cookie}
+ c.NewRequest(getMonitorRequest(c, Screen), cookie)
+ return GetMonitorCookie{cookie}
}
-// ValidateModeLineReply represents the data returned from a ValidateModeLine request.
-type ValidateModeLineReply struct {
+// GetMonitorReply represents the data returned from a GetMonitor request.
+type GetMonitorReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Status uint32
+ VendorLength byte
+ ModelLength byte
+ NumHsync byte
+ NumVsync byte
// padding: 20 bytes
+ Hsync []Syncrange // size: xgb.Pad((int(NumHsync) * 4))
+ Vsync []Syncrange // size: xgb.Pad((int(NumVsync) * 4))
+ Vendor string // size: xgb.Pad((int(VendorLength) * 1))
+ AlignmentPad []byte // size: xgb.Pad(((((int(VendorLength) + 3) & -4) - int(VendorLength)) * 1))
+ Model string // size: xgb.Pad((int(ModelLength) * 1))
}
-// Reply blocks and returns the reply data for a ValidateModeLine request.
-func (cook ValidateModeLineCookie) Reply() (*ValidateModeLineReply, error) {
+// Reply blocks and returns the reply data for a GetMonitor request.
+func (cook GetMonitorCookie) Reply() (*GetMonitorReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1511,12 +1498,12 @@ func (cook ValidateModeLineCookie) Reply() (*ValidateModeLineReply, error) {
if buf == nil {
return nil, nil
}
- return validateModeLineReply(buf), nil
+ return getMonitorReply(buf), nil
}
-// validateModeLineReply reads a byte slice into a ValidateModeLineReply value.
-func validateModeLineReply(buf []byte) *ValidateModeLineReply {
- v := new(ValidateModeLineReply)
+// getMonitorReply reads a byte slice into a GetMonitorReply value.
+func getMonitorReply(buf []byte) *GetMonitorReply {
+ v := new(GetMonitorReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1527,174 +1514,169 @@ func validateModeLineReply(buf []byte) *ValidateModeLineReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Status = xgb.Get32(buf[b:])
- b += 4
-
- b += 20 // padding
-
- return v
-}
+ v.VendorLength = buf[b]
+ b += 1
-// Write request to wire for ValidateModeLine
-// validateModeLineRequest writes a ValidateModeLine request to a byte slice.
-func validateModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
- size := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1))))
- b := 0
- buf := make([]byte, size)
+ v.ModelLength = buf[b]
+ b += 1
- buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ v.NumHsync = buf[b]
b += 1
- buf[b] = 9 // request opcode
+ v.NumVsync = buf[b]
b += 1
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
- b += 2
+ b += 20 // padding
- xgb.Put32(buf[b:], Screen)
- b += 4
+ v.Hsync = make([]Syncrange, v.NumHsync)
+ for i := 0; i < int(v.NumHsync); i++ {
+ v.Hsync[i] = Syncrange(xgb.Get32(buf[b:]))
+ b += 4
+ }
+ b = xgb.Pad(b)
- xgb.Put32(buf[b:], uint32(Dotclock))
- b += 4
+ v.Vsync = make([]Syncrange, v.NumVsync)
+ for i := 0; i < int(v.NumVsync); i++ {
+ v.Vsync[i] = Syncrange(xgb.Get32(buf[b:]))
+ b += 4
+ }
+ b = xgb.Pad(b)
- xgb.Put16(buf[b:], Hdisplay)
- b += 2
+ {
+ byteString := make([]byte, v.VendorLength)
+ copy(byteString[:v.VendorLength], buf[b:])
+ v.Vendor = string(byteString)
+ b += xgb.Pad(int(v.VendorLength))
+ }
- xgb.Put16(buf[b:], Hsyncstart)
- b += 2
+ v.AlignmentPad = make([]byte, (((int(v.VendorLength) + 3) & -4) - int(v.VendorLength)))
+ copy(v.AlignmentPad[:(((int(v.VendorLength)+3)&-4)-int(v.VendorLength))], buf[b:])
+ b += xgb.Pad(int((((int(v.VendorLength) + 3) & -4) - int(v.VendorLength))))
- xgb.Put16(buf[b:], Hsyncend)
- b += 2
+ {
+ byteString := make([]byte, v.ModelLength)
+ copy(byteString[:v.ModelLength], buf[b:])
+ v.Model = string(byteString)
+ b += xgb.Pad(int(v.ModelLength))
+ }
- xgb.Put16(buf[b:], Htotal)
- b += 2
+ return v
+}
- xgb.Put16(buf[b:], Hskew)
- b += 2
+// Write request to wire for GetMonitor
+// getMonitorRequest writes a GetMonitor request to a byte slice.
+func getMonitorRequest(c *xgb.Conn, Screen uint16) []byte {
+ size := 8
+ b := 0
+ buf := make([]byte, size)
- xgb.Put16(buf[b:], Vdisplay)
- b += 2
+ buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ b += 1
- xgb.Put16(buf[b:], Vsyncstart)
- b += 2
+ buf[b] = 4 // request opcode
+ b += 1
- xgb.Put16(buf[b:], Vsyncend)
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put16(buf[b:], Vtotal)
+ xgb.Put16(buf[b:], Screen)
b += 2
b += 2 // padding
- xgb.Put32(buf[b:], Flags)
- b += 4
-
- b += 12 // padding
-
- xgb.Put32(buf[b:], Privsize)
- b += 4
-
- copy(buf[b:], Private[:Privsize])
- b += xgb.Pad(int(Privsize))
-
return buf
}
-// SwitchToModeCookie is a cookie used only for SwitchToMode requests.
-type SwitchToModeCookie struct {
+// GetPermissionsCookie is a cookie used only for GetPermissions requests.
+type GetPermissionsCookie struct {
*xgb.Cookie
}
-// SwitchToMode sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SwitchToMode(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie {
+// GetPermissions sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetPermissionsCookie.Reply()
+func GetPermissions(c *xgb.Conn, Screen uint16) GetPermissionsCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SwitchToMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPermissions' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(switchToModeRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return SwitchToModeCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getPermissionsRequest(c, Screen), cookie)
+ return GetPermissionsCookie{cookie}
}
-// SwitchToModeChecked sends a checked request.
-// If an error occurs, it can be retrieved using SwitchToModeCookie.Check()
-func SwitchToModeChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie {
+// GetPermissionsUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetPermissionsUnchecked(c *xgb.Conn, Screen uint16) GetPermissionsCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SwitchToMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPermissions' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(switchToModeRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
- return SwitchToModeCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getPermissionsRequest(c, Screen), cookie)
+ return GetPermissionsCookie{cookie}
}
-// 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.
-func (cook SwitchToModeCookie) Check() error {
- return cook.Cookie.Check()
+// GetPermissionsReply represents the data returned from a GetPermissions request.
+type GetPermissionsReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Permissions uint32
+ // padding: 20 bytes
}
-// Write request to wire for SwitchToMode
-// switchToModeRequest writes a SwitchToMode request to a byte slice.
-func switchToModeRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
- size := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1))))
- b := 0
- buf := make([]byte, size)
+// Reply blocks and returns the reply data for a GetPermissions request.
+func (cook GetPermissionsCookie) Reply() (*GetPermissionsReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getPermissionsReply(buf), nil
+}
- buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
- b += 1
+// getPermissionsReply reads a byte slice into a GetPermissionsReply value.
+func getPermissionsReply(buf []byte) *GetPermissionsReply {
+ v := new(GetPermissionsReply)
+ b := 1 // skip reply determinant
- buf[b] = 10 // request opcode
- b += 1
+ b += 1 // padding
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- xgb.Put32(buf[b:], Screen)
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- xgb.Put32(buf[b:], uint32(Dotclock))
+ v.Permissions = xgb.Get32(buf[b:])
b += 4
- xgb.Put16(buf[b:], Hdisplay)
- b += 2
-
- xgb.Put16(buf[b:], Hsyncstart)
- b += 2
-
- xgb.Put16(buf[b:], Hsyncend)
- b += 2
+ b += 20 // padding
- xgb.Put16(buf[b:], Htotal)
- b += 2
+ return v
+}
- xgb.Put16(buf[b:], Hskew)
- b += 2
+// Write request to wire for GetPermissions
+// getPermissionsRequest writes a GetPermissions request to a byte slice.
+func getPermissionsRequest(c *xgb.Conn, Screen uint16) []byte {
+ size := 8
+ b := 0
+ buf := make([]byte, size)
- xgb.Put16(buf[b:], Vdisplay)
- b += 2
+ buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ b += 1
- xgb.Put16(buf[b:], Vsyncstart)
- b += 2
+ buf[b] = 20 // request opcode
+ b += 1
- xgb.Put16(buf[b:], Vsyncend)
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put16(buf[b:], Vtotal)
+ xgb.Put16(buf[b:], Screen)
b += 2
b += 2 // padding
- xgb.Put32(buf[b:], Flags)
- b += 4
-
- b += 12 // padding
-
- xgb.Put32(buf[b:], Privsize)
- b += 4
-
- copy(buf[b:], Private[:Privsize])
- b += xgb.Pad(int(Privsize))
-
return buf
}
@@ -1795,50 +1777,50 @@ func getViewPortRequest(c *xgb.Conn, Screen uint16) []byte {
return buf
}
-// SetViewPortCookie is a cookie used only for SetViewPort requests.
-type SetViewPortCookie struct {
+// LockModeSwitchCookie is a cookie used only for LockModeSwitch requests.
+type LockModeSwitchCookie struct {
*xgb.Cookie
}
-// SetViewPort sends an unchecked request.
+// LockModeSwitch sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetViewPort(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie {
+func LockModeSwitch(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'LockModeSwitch' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(setViewPortRequest(c, Screen, X, Y), cookie)
- return SetViewPortCookie{cookie}
+ c.NewRequest(lockModeSwitchRequest(c, Screen, Lock), cookie)
+ return LockModeSwitchCookie{cookie}
}
-// SetViewPortChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetViewPortCookie.Check()
-func SetViewPortChecked(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie {
+// LockModeSwitchChecked sends a checked request.
+// If an error occurs, it can be retrieved using LockModeSwitchCookie.Check()
+func LockModeSwitchChecked(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'LockModeSwitch' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(setViewPortRequest(c, Screen, X, Y), cookie)
- return SetViewPortCookie{cookie}
+ c.NewRequest(lockModeSwitchRequest(c, Screen, Lock), cookie)
+ return LockModeSwitchCookie{cookie}
}
// 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.
-func (cook SetViewPortCookie) Check() error {
+func (cook LockModeSwitchCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for SetViewPort
-// setViewPortRequest writes a SetViewPort request to a byte slice.
-func setViewPortRequest(c *xgb.Conn, Screen uint16, X uint32, Y uint32) []byte {
- size := 16
+// Write request to wire for LockModeSwitch
+// lockModeSwitchRequest writes a LockModeSwitch request to a byte slice.
+func lockModeSwitchRequest(c *xgb.Conn, Screen uint16, Lock uint16) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 12 // request opcode
+ buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1847,58 +1829,145 @@ func setViewPortRequest(c *xgb.Conn, Screen uint16, X uint32, Y uint32) []byte {
xgb.Put16(buf[b:], Screen)
b += 2
+ xgb.Put16(buf[b:], Lock)
+ b += 2
+
+ return buf
+}
+
+// ModModeLineCookie is a cookie used only for ModModeLine requests.
+type ModModeLineCookie struct {
+ *xgb.Cookie
+}
+
+// ModModeLine sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func ModModeLine(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ModModeLineCookie {
+ if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
+ panic("Cannot issue request 'ModModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(modModeLineRequest(c, Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return ModModeLineCookie{cookie}
+}
+
+// ModModeLineChecked sends a checked request.
+// If an error occurs, it can be retrieved using ModModeLineCookie.Check()
+func ModModeLineChecked(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ModModeLineCookie {
+ if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
+ panic("Cannot issue request 'ModModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(modModeLineRequest(c, Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return ModModeLineCookie{cookie}
+}
+
+// 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.
+func (cook ModModeLineCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for ModModeLine
+// modModeLineRequest writes a ModModeLine request to a byte slice.
+func modModeLineRequest(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
+ size := xgb.Pad((48 + xgb.Pad((int(Privsize) * 1))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ 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
+
+ xgb.Put32(buf[b:], Screen)
+ b += 4
+
+ xgb.Put16(buf[b:], Hdisplay)
+ b += 2
+
+ xgb.Put16(buf[b:], Hsyncstart)
+ b += 2
+
+ xgb.Put16(buf[b:], Hsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], Htotal)
+ b += 2
+
+ xgb.Put16(buf[b:], Hskew)
+ b += 2
+
+ xgb.Put16(buf[b:], Vdisplay)
+ b += 2
+
+ xgb.Put16(buf[b:], Vsyncstart)
+ b += 2
+
+ xgb.Put16(buf[b:], Vsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], Vtotal)
+ b += 2
+
b += 2 // padding
- xgb.Put32(buf[b:], X)
+ xgb.Put32(buf[b:], Flags)
b += 4
- xgb.Put32(buf[b:], Y)
+ b += 12 // padding
+
+ xgb.Put32(buf[b:], Privsize)
b += 4
+ copy(buf[b:], Private[:Privsize])
+ b += xgb.Pad(int(Privsize))
+
return buf
}
-// GetDotClocksCookie is a cookie used only for GetDotClocks requests.
-type GetDotClocksCookie struct {
+// QueryVersionCookie is a cookie used only for QueryVersion requests.
+type QueryVersionCookie struct {
*xgb.Cookie
}
-// GetDotClocks sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetDotClocksCookie.Reply()
-func GetDotClocks(c *xgb.Conn, Screen uint16) GetDotClocksCookie {
+// QueryVersion sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
+func QueryVersion(c *xgb.Conn) QueryVersionCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetDotClocks' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getDotClocksRequest(c, Screen), cookie)
- return GetDotClocksCookie{cookie}
+ c.NewRequest(queryVersionRequest(c), cookie)
+ return QueryVersionCookie{cookie}
}
-// GetDotClocksUnchecked sends an unchecked request.
+// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetDotClocksUnchecked(c *xgb.Conn, Screen uint16) GetDotClocksCookie {
+func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetDotClocks' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getDotClocksRequest(c, Screen), cookie)
- return GetDotClocksCookie{cookie}
+ c.NewRequest(queryVersionRequest(c), cookie)
+ return QueryVersionCookie{cookie}
}
-// GetDotClocksReply represents the data returned from a GetDotClocks request.
-type GetDotClocksReply struct {
+// QueryVersionReply represents the data returned from a QueryVersion request.
+type QueryVersionReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Flags uint32
- Clocks uint32
- Maxclocks uint32
- // padding: 12 bytes
- Clock []uint32 // size: xgb.Pad((((1 - (int(Flags) & 1)) * int(Clocks)) * 4))
+ MajorVersion uint16
+ MinorVersion uint16
}
-// Reply blocks and returns the reply data for a GetDotClocks request.
-func (cook GetDotClocksCookie) Reply() (*GetDotClocksReply, error) {
+// Reply blocks and returns the reply data for a QueryVersion request.
+func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1906,12 +1975,12 @@ func (cook GetDotClocksCookie) Reply() (*GetDotClocksReply, error) {
if buf == nil {
return nil, nil
}
- return getDotClocksReply(buf), nil
+ return queryVersionReply(buf), nil
}
-// getDotClocksReply reads a byte slice into a GetDotClocksReply value.
-func getDotClocksReply(buf []byte) *GetDotClocksReply {
- v := new(GetDotClocksReply)
+// queryVersionReply reads a byte slice into a QueryVersionReply value.
+func queryVersionReply(buf []byte) *QueryVersionReply {
+ v := new(QueryVersionReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1922,48 +1991,31 @@ func getDotClocksReply(buf []byte) *GetDotClocksReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Flags = xgb.Get32(buf[b:])
- b += 4
-
- v.Clocks = xgb.Get32(buf[b:])
- b += 4
-
- v.Maxclocks = xgb.Get32(buf[b:])
- b += 4
-
- b += 12 // padding
+ v.MajorVersion = xgb.Get16(buf[b:])
+ b += 2
- v.Clock = make([]uint32, ((1 - (int(v.Flags) & 1)) * int(v.Clocks)))
- for i := 0; i < int(((1 - (int(v.Flags) & 1)) * int(v.Clocks))); i++ {
- v.Clock[i] = xgb.Get32(buf[b:])
- b += 4
- }
- b = xgb.Pad(b)
+ v.MinorVersion = xgb.Get16(buf[b:])
+ b += 2
return v
}
-// Write request to wire for GetDotClocks
-// getDotClocksRequest writes a GetDotClocks request to a byte slice.
-func getDotClocksRequest(c *xgb.Conn, Screen uint16) []byte {
- size := 8
+// Write request to wire for QueryVersion
+// queryVersionRequest writes a QueryVersion request to a byte slice.
+func queryVersionRequest(c *xgb.Conn) []byte {
+ size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 13 // request opcode
+ buf[b] = 0 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put16(buf[b:], Screen)
- b += 2
-
- b += 2 // padding
-
return buf
}
@@ -2093,94 +2145,50 @@ func setGammaRequest(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue
return buf
}
-// GetGammaCookie is a cookie used only for GetGamma requests.
-type GetGammaCookie struct {
+// SetGammaRampCookie is a cookie used only for SetGammaRamp requests.
+type SetGammaRampCookie struct {
*xgb.Cookie
}
-// GetGamma sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetGammaCookie.Reply()
-func GetGamma(c *xgb.Conn, Screen uint16) GetGammaCookie {
- if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(getGammaRequest(c, Screen), cookie)
- return GetGammaCookie{cookie}
-}
-
-// GetGammaUnchecked sends an unchecked request.
+// SetGammaRamp sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetGammaUnchecked(c *xgb.Conn, Screen uint16) GetGammaCookie {
+func SetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(getGammaRequest(c, Screen), cookie)
- return GetGammaCookie{cookie}
-}
-
-// GetGammaReply represents the data returned from a GetGamma request.
-type GetGammaReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Red uint32
- Green uint32
- Blue uint32
- // padding: 12 bytes
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setGammaRampRequest(c, Screen, Size, Red, Green, Blue), cookie)
+ return SetGammaRampCookie{cookie}
}
-// Reply blocks and returns the reply data for a GetGamma request.
-func (cook GetGammaCookie) Reply() (*GetGammaReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// SetGammaRampChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetGammaRampCookie.Check()
+func SetGammaRampChecked(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie {
+ if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
+ panic("Cannot issue request 'SetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- return getGammaReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setGammaRampRequest(c, Screen, Size, Red, Green, Blue), cookie)
+ return SetGammaRampCookie{cookie}
}
-// getGammaReply reads a byte slice into a GetGammaReply value.
-func getGammaReply(buf []byte) *GetGammaReply {
- v := new(GetGammaReply)
- 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.Red = xgb.Get32(buf[b:])
- b += 4
-
- v.Green = xgb.Get32(buf[b:])
- b += 4
-
- v.Blue = xgb.Get32(buf[b:])
- b += 4
-
- b += 12 // padding
-
- return v
+// 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.
+func (cook SetGammaRampCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for GetGamma
-// getGammaRequest writes a GetGamma request to a byte slice.
-func getGammaRequest(c *xgb.Conn, Screen uint16) []byte {
- size := 32
+// Write request to wire for SetGammaRamp
+// setGammaRampRequest writes a SetGammaRamp request to a byte slice.
+func setGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte {
+ size := xgb.Pad((((8 + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 16 // request opcode
+ buf[b] = 18 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -2189,115 +2197,74 @@ func getGammaRequest(c *xgb.Conn, Screen uint16) []byte {
xgb.Put16(buf[b:], Screen)
b += 2
- b += 26 // padding
+ xgb.Put16(buf[b:], Size)
+ b += 2
+
+ for i := 0; i < int(((int(Size) + 1) & -2)); i++ {
+ xgb.Put16(buf[b:], Red[i])
+ b += 2
+ }
+ b = xgb.Pad(b)
+
+ for i := 0; i < int(((int(Size) + 1) & -2)); i++ {
+ xgb.Put16(buf[b:], Green[i])
+ b += 2
+ }
+ b = xgb.Pad(b)
+
+ for i := 0; i < int(((int(Size) + 1) & -2)); i++ {
+ xgb.Put16(buf[b:], Blue[i])
+ b += 2
+ }
+ b = xgb.Pad(b)
return buf
}
-// GetGammaRampCookie is a cookie used only for GetGammaRamp requests.
-type GetGammaRampCookie struct {
+// SetViewPortCookie is a cookie used only for SetViewPort requests.
+type SetViewPortCookie struct {
*xgb.Cookie
}
-// GetGammaRamp sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetGammaRampCookie.Reply()
-func GetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie {
- if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(getGammaRampRequest(c, Screen, Size), cookie)
- return GetGammaRampCookie{cookie}
-}
-
-// GetGammaRampUnchecked sends an unchecked request.
+// SetViewPort sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetGammaRampUnchecked(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie {
+func SetViewPort(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(getGammaRampRequest(c, Screen, Size), cookie)
- return GetGammaRampCookie{cookie}
-}
-
-// GetGammaRampReply represents the data returned from a GetGammaRamp request.
-type GetGammaRampReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Size uint16
- // padding: 22 bytes
- Red []uint16 // size: xgb.Pad((((int(Size) + 1) & -2) * 2))
- Green []uint16 // size: xgb.Pad((((int(Size) + 1) & -2) * 2))
- Blue []uint16 // size: xgb.Pad((((int(Size) + 1) & -2) * 2))
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setViewPortRequest(c, Screen, X, Y), cookie)
+ return SetViewPortCookie{cookie}
}
-// Reply blocks and returns the reply data for a GetGammaRamp request.
-func (cook GetGammaRampCookie) Reply() (*GetGammaRampReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// SetViewPortChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetViewPortCookie.Check()
+func SetViewPortChecked(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie {
+ if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
+ panic("Cannot issue request 'SetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- return getGammaRampReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setViewPortRequest(c, Screen, X, Y), cookie)
+ return SetViewPortCookie{cookie}
}
-// getGammaRampReply reads a byte slice into a GetGammaRampReply value.
-func getGammaRampReply(buf []byte) *GetGammaRampReply {
- v := new(GetGammaRampReply)
- 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.Size = xgb.Get16(buf[b:])
- b += 2
-
- b += 22 // padding
-
- v.Red = make([]uint16, ((int(v.Size) + 1) & -2))
- for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ {
- v.Red[i] = xgb.Get16(buf[b:])
- b += 2
- }
- b = xgb.Pad(b)
-
- v.Green = make([]uint16, ((int(v.Size) + 1) & -2))
- for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ {
- v.Green[i] = xgb.Get16(buf[b:])
- b += 2
- }
- b = xgb.Pad(b)
-
- v.Blue = make([]uint16, ((int(v.Size) + 1) & -2))
- for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ {
- v.Blue[i] = xgb.Get16(buf[b:])
- b += 2
- }
- b = xgb.Pad(b)
-
- return v
+// 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.
+func (cook SetViewPortCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for GetGammaRamp
-// getGammaRampRequest writes a GetGammaRamp request to a byte slice.
-func getGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16) []byte {
- size := 8
+// Write request to wire for SetViewPort
+// setViewPortRequest writes a SetViewPort request to a byte slice.
+func setViewPortRequest(c *xgb.Conn, Screen uint16, X uint32, Y uint32) []byte {
+ size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 17 // request opcode
+ buf[b] = 12 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -2306,56 +2273,61 @@ func getGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16) []byte {
xgb.Put16(buf[b:], Screen)
b += 2
- xgb.Put16(buf[b:], Size)
- b += 2
+ b += 2 // padding
+
+ xgb.Put32(buf[b:], X)
+ b += 4
+
+ xgb.Put32(buf[b:], Y)
+ b += 4
return buf
}
-// SetGammaRampCookie is a cookie used only for SetGammaRamp requests.
-type SetGammaRampCookie struct {
+// SwitchModeCookie is a cookie used only for SwitchMode requests.
+type SwitchModeCookie struct {
*xgb.Cookie
}
-// SetGammaRamp sends an unchecked request.
+// SwitchMode sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie {
+func SwitchMode(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SwitchMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(setGammaRampRequest(c, Screen, Size, Red, Green, Blue), cookie)
- return SetGammaRampCookie{cookie}
+ c.NewRequest(switchModeRequest(c, Screen, Zoom), cookie)
+ return SwitchModeCookie{cookie}
}
-// SetGammaRampChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetGammaRampCookie.Check()
-func SetGammaRampChecked(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie {
+// SwitchModeChecked sends a checked request.
+// If an error occurs, it can be retrieved using SwitchModeCookie.Check()
+func SwitchModeChecked(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'SetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SwitchMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(setGammaRampRequest(c, Screen, Size, Red, Green, Blue), cookie)
- return SetGammaRampCookie{cookie}
+ c.NewRequest(switchModeRequest(c, Screen, Zoom), cookie)
+ return SwitchModeCookie{cookie}
}
// 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.
-func (cook SetGammaRampCookie) Check() error {
+func (cook SwitchModeCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for SetGammaRamp
-// setGammaRampRequest writes a SetGammaRamp request to a byte slice.
-func setGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte {
- size := xgb.Pad((((8 + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))))
+// Write request to wire for SwitchMode
+// switchModeRequest writes a SwitchMode request to a byte slice.
+func switchModeRequest(c *xgb.Conn, Screen uint16, Zoom uint16) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 18 // request opcode
+ buf[b] = 3 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -2364,161 +2336,148 @@ func setGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16,
xgb.Put16(buf[b:], Screen)
b += 2
- xgb.Put16(buf[b:], Size)
+ xgb.Put16(buf[b:], Zoom)
b += 2
- for i := 0; i < int(((int(Size) + 1) & -2)); i++ {
- xgb.Put16(buf[b:], Red[i])
- b += 2
- }
- b = xgb.Pad(b)
-
- for i := 0; i < int(((int(Size) + 1) & -2)); i++ {
- xgb.Put16(buf[b:], Green[i])
- b += 2
- }
- b = xgb.Pad(b)
-
- for i := 0; i < int(((int(Size) + 1) & -2)); i++ {
- xgb.Put16(buf[b:], Blue[i])
- b += 2
- }
- b = xgb.Pad(b)
-
return buf
}
-// GetGammaRampSizeCookie is a cookie used only for GetGammaRampSize requests.
-type GetGammaRampSizeCookie struct {
+// SwitchToModeCookie is a cookie used only for SwitchToMode requests.
+type SwitchToModeCookie struct {
*xgb.Cookie
}
-// GetGammaRampSize sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetGammaRampSizeCookie.Reply()
-func GetGammaRampSize(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie {
+// SwitchToMode sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SwitchToMode(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetGammaRampSize' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SwitchToMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, true)
- c.NewRequest(getGammaRampSizeRequest(c, Screen), cookie)
- return GetGammaRampSizeCookie{cookie}
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(switchToModeRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return SwitchToModeCookie{cookie}
}
-// GetGammaRampSizeUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetGammaRampSizeUnchecked(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie {
+// SwitchToModeChecked sends a checked request.
+// If an error occurs, it can be retrieved using SwitchToModeCookie.Check()
+func SwitchToModeChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetGammaRampSize' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SwitchToMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(getGammaRampSizeRequest(c, Screen), cookie)
- return GetGammaRampSizeCookie{cookie}
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(switchToModeRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return SwitchToModeCookie{cookie}
}
-// GetGammaRampSizeReply represents the data returned from a GetGammaRampSize request.
-type GetGammaRampSizeReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Size uint16
- // padding: 22 bytes
+// 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.
+func (cook SwitchToModeCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Reply blocks and returns the reply data for a GetGammaRampSize request.
-func (cook GetGammaRampSizeCookie) Reply() (*GetGammaRampSizeReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return getGammaRampSizeReply(buf), nil
-}
+// Write request to wire for SwitchToMode
+// switchToModeRequest writes a SwitchToMode request to a byte slice.
+func switchToModeRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
+ size := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1))))
+ b := 0
+ buf := make([]byte, size)
-// getGammaRampSizeReply reads a byte slice into a GetGammaRampSizeReply value.
-func getGammaRampSizeReply(buf []byte) *GetGammaRampSizeReply {
- v := new(GetGammaRampSizeReply)
- b := 1 // skip reply determinant
+ buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
+ b += 1
- b += 1 // padding
+ buf[b] = 10 // request opcode
+ b += 1
- v.Sequence = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
+ xgb.Put32(buf[b:], Screen)
b += 4
- v.Size = xgb.Get16(buf[b:])
+ xgb.Put32(buf[b:], uint32(Dotclock))
+ b += 4
+
+ xgb.Put16(buf[b:], Hdisplay)
b += 2
- b += 22 // padding
+ xgb.Put16(buf[b:], Hsyncstart)
+ b += 2
- return v
-}
+ xgb.Put16(buf[b:], Hsyncend)
+ b += 2
-// Write request to wire for GetGammaRampSize
-// getGammaRampSizeRequest writes a GetGammaRampSize request to a byte slice.
-func getGammaRampSizeRequest(c *xgb.Conn, Screen uint16) []byte {
- size := 8
- b := 0
- buf := make([]byte, size)
+ xgb.Put16(buf[b:], Htotal)
+ b += 2
- buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
- b += 1
+ xgb.Put16(buf[b:], Hskew)
+ b += 2
- buf[b] = 19 // request opcode
- b += 1
+ xgb.Put16(buf[b:], Vdisplay)
+ b += 2
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ xgb.Put16(buf[b:], Vsyncstart)
b += 2
- xgb.Put16(buf[b:], Screen)
+ xgb.Put16(buf[b:], Vsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], Vtotal)
b += 2
b += 2 // padding
+ xgb.Put32(buf[b:], Flags)
+ b += 4
+
+ b += 12 // padding
+
+ xgb.Put32(buf[b:], Privsize)
+ b += 4
+
+ copy(buf[b:], Private[:Privsize])
+ b += xgb.Pad(int(Privsize))
+
return buf
}
-// GetPermissionsCookie is a cookie used only for GetPermissions requests.
-type GetPermissionsCookie struct {
+// ValidateModeLineCookie is a cookie used only for ValidateModeLine requests.
+type ValidateModeLineCookie struct {
*xgb.Cookie
}
-// GetPermissions sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetPermissionsCookie.Reply()
-func GetPermissions(c *xgb.Conn, Screen uint16) GetPermissionsCookie {
+// ValidateModeLine sends a checked request.
+// If an error occurs, it will be returned with the reply by calling ValidateModeLineCookie.Reply()
+func ValidateModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetPermissions' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ValidateModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getPermissionsRequest(c, Screen), cookie)
- return GetPermissionsCookie{cookie}
+ c.NewRequest(validateModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return ValidateModeLineCookie{cookie}
}
-// GetPermissionsUnchecked sends an unchecked request.
+// ValidateModeLineUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetPermissionsUnchecked(c *xgb.Conn, Screen uint16) GetPermissionsCookie {
+func ValidateModeLineUnchecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie {
if _, ok := c.Extensions["XFREE86-VIDMODEEXTENSION"]; !ok {
- panic("Cannot issue request 'GetPermissions' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ValidateModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getPermissionsRequest(c, Screen), cookie)
- return GetPermissionsCookie{cookie}
+ c.NewRequest(validateModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie)
+ return ValidateModeLineCookie{cookie}
}
-// GetPermissionsReply represents the data returned from a GetPermissions request.
-type GetPermissionsReply struct {
+// ValidateModeLineReply represents the data returned from a ValidateModeLine request.
+type ValidateModeLineReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Permissions uint32
+ Status uint32
// padding: 20 bytes
}
-// Reply blocks and returns the reply data for a GetPermissions request.
-func (cook GetPermissionsCookie) Reply() (*GetPermissionsReply, error) {
+// Reply blocks and returns the reply data for a ValidateModeLine request.
+func (cook ValidateModeLineCookie) Reply() (*ValidateModeLineReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2526,12 +2485,12 @@ func (cook GetPermissionsCookie) Reply() (*GetPermissionsReply, error) {
if buf == nil {
return nil, nil
}
- return getPermissionsReply(buf), nil
+ return validateModeLineReply(buf), nil
}
-// getPermissionsReply reads a byte slice into a GetPermissionsReply value.
-func getPermissionsReply(buf []byte) *GetPermissionsReply {
- v := new(GetPermissionsReply)
+// validateModeLineReply reads a byte slice into a ValidateModeLineReply value.
+func validateModeLineReply(buf []byte) *ValidateModeLineReply {
+ v := new(ValidateModeLineReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -2542,7 +2501,7 @@ func getPermissionsReply(buf []byte) *GetPermissionsReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Permissions = xgb.Get32(buf[b:])
+ v.Status = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
@@ -2550,26 +2509,67 @@ func getPermissionsReply(buf []byte) *GetPermissionsReply {
return v
}
-// Write request to wire for GetPermissions
-// getPermissionsRequest writes a GetPermissions request to a byte slice.
-func getPermissionsRequest(c *xgb.Conn, Screen uint16) []byte {
- size := 8
+// Write request to wire for ValidateModeLine
+// validateModeLineRequest writes a ValidateModeLine request to a byte slice.
+func validateModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte {
+ size := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XFREE86-VIDMODEEXTENSION"]
b += 1
- buf[b] = 20 // request opcode
+ buf[b] = 9 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put16(buf[b:], Screen)
+ xgb.Put32(buf[b:], Screen)
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Dotclock))
+ b += 4
+
+ xgb.Put16(buf[b:], Hdisplay)
+ b += 2
+
+ xgb.Put16(buf[b:], Hsyncstart)
+ b += 2
+
+ xgb.Put16(buf[b:], Hsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], Htotal)
+ b += 2
+
+ xgb.Put16(buf[b:], Hskew)
+ b += 2
+
+ xgb.Put16(buf[b:], Vdisplay)
+ b += 2
+
+ xgb.Put16(buf[b:], Vsyncstart)
+ b += 2
+
+ xgb.Put16(buf[b:], Vsyncend)
+ b += 2
+
+ xgb.Put16(buf[b:], Vtotal)
b += 2
b += 2 // padding
+ xgb.Put32(buf[b:], Flags)
+ b += 4
+
+ b += 12 // padding
+
+ xgb.Put32(buf[b:], Privsize)
+ b += 4
+
+ copy(buf[b:], Private[:Privsize])
+ b += xgb.Pad(int(Privsize))
+
return buf
}