aboutsummaryrefslogtreecommitdiff
path: root/nexgb/randr
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2013-12-28 09:33:09 -0500
committerPřemysl Janouch <p@janouch.name>2018-09-08 16:49:20 +0200
commit2dc9914b5e6b74c353771e56e90dfd2dd33e0202 (patch)
tree8b9c5a460be7a11c23d46be1887ebcaee1eb33b7 /nexgb/randr
parentf0385db3a71c33f19d27dafb2a5d158a8a875200 (diff)
downloadhaven-2dc9914b5e6b74c353771e56e90dfd2dd33e0202.tar.gz
haven-2dc9914b5e6b74c353771e56e90dfd2dd33e0202.tar.xz
haven-2dc9914b5e6b74c353771e56e90dfd2dd33e0202.zip
When writing, don't pad the length of bytes produced from inner
structs/unions. Each type should take care of its own padding. Close #14.
Diffstat (limited to 'nexgb/randr')
-rw-r--r--nexgb/randr/randr.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/nexgb/randr/randr.go b/nexgb/randr/randr.go
index 11e1230..c7df090 100644
--- a/nexgb/randr/randr.go
+++ b/nexgb/randr/randr.go
@@ -504,15 +504,6 @@ func ModeInfoListBytes(buf []byte, list []ModeInfo) int {
return xgb.Pad(b)
}
-const (
- NotifyCrtcChange = 0
- NotifyOutputChange = 1
- NotifyOutputProperty = 2
- NotifyProviderChange = 3
- NotifyProviderProperty = 4
- NotifyResourceChange = 5
-)
-
// Notify is the event number for a NotifyEvent.
const Notify = 1
@@ -556,7 +547,7 @@ func (v NotifyEvent) Bytes() []byte {
{
unionBytes := v.U.Bytes()
copy(buf[b:], unionBytes)
- b += xgb.Pad(len(unionBytes))
+ b += len(unionBytes)
}
return buf
@@ -581,6 +572,15 @@ func init() {
xgb.NewExtEventFuncs["RANDR"][1] = NotifyEventNew
}
+const (
+ NotifyCrtcChange = 0
+ NotifyOutputChange = 1
+ NotifyOutputProperty = 2
+ NotifyProviderChange = 3
+ NotifyProviderProperty = 4
+ NotifyResourceChange = 5
+)
+
// NotifyDataUnion is a represention of the NotifyDataUnion union type.
// Note that to *create* a Union, you should *never* create
// this struct directly (unless you know what you're doing).
@@ -608,7 +608,7 @@ func NotifyDataUnionCcNew(Cc CrtcChange) NotifyDataUnion {
{
structBytes := Cc.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
// Create the Union type
@@ -651,7 +651,7 @@ func NotifyDataUnionOcNew(Oc OutputChange) NotifyDataUnion {
{
structBytes := Oc.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
// Create the Union type
@@ -694,7 +694,7 @@ func NotifyDataUnionOpNew(Op OutputProperty) NotifyDataUnion {
{
structBytes := Op.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
// Create the Union type
@@ -737,7 +737,7 @@ func NotifyDataUnionPcNew(Pc ProviderChange) NotifyDataUnion {
{
structBytes := Pc.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
// Create the Union type
@@ -780,7 +780,7 @@ func NotifyDataUnionPpNew(Pp ProviderProperty) NotifyDataUnion {
{
structBytes := Pp.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
// Create the Union type
@@ -823,7 +823,7 @@ func NotifyDataUnionRcNew(Rc ResourceChange) NotifyDataUnion {
{
structBytes := Rc.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
// Create the Union type
@@ -909,7 +909,7 @@ func (v NotifyDataUnion) Bytes() []byte {
{
structBytes := v.Cc.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
return buf
}
@@ -2133,7 +2133,7 @@ func createModeRequest(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Nam
{
structBytes := ModeInfo.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
copy(buf[b:], Name[:len(Name)])
@@ -5139,7 +5139,7 @@ func setCrtcTransformRequest(c *xgb.Conn, Crtc Crtc, Transform render.Transform,
{
structBytes := Transform.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
xgb.Put16(buf[b:], FilterLen)