aboutsummaryrefslogtreecommitdiff
path: root/nexgb/record/record.go
diff options
context:
space:
mode:
authoraarzilli <alessandro.arzilli@gmail.com>2017-01-18 10:52:16 +0100
committerPřemysl Janouch <p@janouch.name>2018-09-08 16:49:27 +0200
commit3906399e7c2a40fbaf355de572cf50a314083f64 (patch)
treefcdcca7da60cc3c7c7e87faa5dcc4898d1671514 /nexgb/record/record.go
parent1c01d79ba14a802c603ca2e5bbd35156e3363b85 (diff)
downloadhaven-3906399e7c2a40fbaf355de572cf50a314083f64.tar.gz
haven-3906399e7c2a40fbaf355de572cf50a314083f64.tar.xz
haven-3906399e7c2a40fbaf355de572cf50a314083f64.zip
Regenerated from xcb-proto 1.12
Diffstat (limited to 'nexgb/record/record.go')
-rw-r--r--nexgb/record/record.go20
1 files changed, 6 insertions, 14 deletions
diff --git a/nexgb/record/record.go b/nexgb/record/record.go
index 5469170..1cb022b 100644
--- a/nexgb/record/record.go
+++ b/nexgb/record/record.go
@@ -554,7 +554,7 @@ func (cook CreateContextCookie) Check() error {
// Write request to wire for CreateContext
// createContextRequest writes a CreateContext request to a byte slice.
func createContextRequest(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) []byte {
- size := xgb.Pad((((20 + xgb.Pad((int(NumClientSpecs) * 4))) + 4) + xgb.Pad((int(NumRanges) * 24))))
+ size := xgb.Pad(((20 + xgb.Pad((int(NumClientSpecs) * 4))) + xgb.Pad((int(NumRanges) * 24))))
b := 0
buf := make([]byte, size)
@@ -566,7 +566,7 @@ func createContextRequest(c *xgb.Conn, Context Context, ElementHeader ElementHea
buf[b] = 1 // request opcode
b += 1
- blen := b
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Context))
@@ -588,13 +588,9 @@ func createContextRequest(c *xgb.Conn, Context Context, ElementHeader ElementHea
b += 4
}
- b = (b + 3) & ^3 // alignment gap
-
b += RangeListBytes(buf[b:], Ranges)
- b = xgb.Pad(b)
- xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
- return buf[:b]
+ return buf
}
// DisableContextCookie is a cookie used only for DisableContext requests.
@@ -1099,7 +1095,7 @@ func (cook RegisterClientsCookie) Check() error {
// Write request to wire for RegisterClients
// registerClientsRequest writes a RegisterClients request to a byte slice.
func registerClientsRequest(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) []byte {
- size := xgb.Pad((((20 + xgb.Pad((int(NumClientSpecs) * 4))) + 4) + xgb.Pad((int(NumRanges) * 24))))
+ size := xgb.Pad(((20 + xgb.Pad((int(NumClientSpecs) * 4))) + xgb.Pad((int(NumRanges) * 24))))
b := 0
buf := make([]byte, size)
@@ -1111,7 +1107,7 @@ func registerClientsRequest(c *xgb.Conn, Context Context, ElementHeader ElementH
buf[b] = 2 // request opcode
b += 1
- blen := b
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Context))
@@ -1133,13 +1129,9 @@ func registerClientsRequest(c *xgb.Conn, Context Context, ElementHeader ElementH
b += 4
}
- b = (b + 3) & ^3 // alignment gap
-
b += RangeListBytes(buf[b:], Ranges)
- b = xgb.Pad(b)
- xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
- return buf[:b]
+ return buf
}
// UnregisterClientsCookie is a cookie used only for UnregisterClients requests.