aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xfixes/xfixes.go
diff options
context:
space:
mode:
authoraarzilli <alessandro.arzilli@gmail.com>2014-05-02 15:09:23 +0200
committerPřemysl Janouch <p@janouch.name>2018-09-08 16:49:22 +0200
commita548d9d0f7b889627c43b18811357fad88760b2d (patch)
tree0d4a0ad302d753638dfdb16159e03d1fb87b0872 /nexgb/xfixes/xfixes.go
parent1f8bd79abee5d96a41a934d1eb8c74e90ccbcc8f (diff)
downloadhaven-a548d9d0f7b889627c43b18811357fad88760b2d.tar.gz
haven-a548d9d0f7b889627c43b18811357fad88760b2d.tar.xz
haven-a548d9d0f7b889627c43b18811357fad88760b2d.zip
Fix Issue #21: automatic calculation of alignment padding after lists
Diffstat (limited to 'nexgb/xfixes/xfixes.go')
-rw-r--r--nexgb/xfixes/xfixes.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/nexgb/xfixes/xfixes.go b/nexgb/xfixes/xfixes.go
index 9a08c93..ef08c9a 100644
--- a/nexgb/xfixes/xfixes.go
+++ b/nexgb/xfixes/xfixes.go
@@ -489,7 +489,7 @@ func changeCursorByNameRequest(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Na
b += 2 // padding
copy(buf[b:], Name[:Nbytes])
- b += xgb.Pad(int(Nbytes))
+ b += int(Nbytes)
return buf
}
@@ -697,7 +697,6 @@ func createPointerBarrierRequest(c *xgb.Conn, Barrier Barrier, Window xproto.Win
xgb.Put16(buf[b:], Devices[i])
b += 2
}
- b = xgb.Pad(b)
return buf
}
@@ -1367,7 +1366,6 @@ func getCursorImageReply(buf []byte) *GetCursorImageReply {
v.CursorImage[i] = xgb.Get32(buf[b:])
b += 4
}
- b = xgb.Pad(b)
return v
}
@@ -1433,7 +1431,8 @@ type GetCursorImageAndNameReply struct {
CursorAtom xproto.Atom
Nbytes uint16
// padding: 2 bytes
- Name string // size: xgb.Pad((int(Nbytes) * 1))
+ Name string // size: xgb.Pad((int(Nbytes) * 1))
+ // alignment gap to multiple of 4
CursorImage []uint32 // size: xgb.Pad(((int(Width) * int(Height)) * 4))
}
@@ -1498,12 +1497,13 @@ func getCursorImageAndNameReply(buf []byte) *GetCursorImageAndNameReply {
b += int(v.Nbytes)
}
+ b = (b + 3) & ^3 // alignment gap
+
v.CursorImage = make([]uint32, (int(v.Width) * int(v.Height)))
for i := 0; i < int((int(v.Width) * int(v.Height))); i++ {
v.CursorImage[i] = xgb.Get32(buf[b:])
b += 4
}
- b = xgb.Pad(b)
return v
}
@@ -2143,7 +2143,7 @@ func setCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name
b += 2 // padding
copy(buf[b:], Name[:Nbytes])
- b += xgb.Pad(int(Nbytes))
+ b += int(Nbytes)
return buf
}