diff options
Diffstat (limited to 'nexgb/xfixes/xfixes.go')
-rw-r--r-- | nexgb/xfixes/xfixes.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/nexgb/xfixes/xfixes.go b/nexgb/xfixes/xfixes.go index 0f9e4b0..440c3fd 100644 --- a/nexgb/xfixes/xfixes.go +++ b/nexgb/xfixes/xfixes.go @@ -1524,9 +1524,8 @@ type GetCursorImageAndNameReply struct { CursorAtom xproto.Atom Nbytes uint16 // padding: 2 bytes - Name string // size: xgb.Pad((int(Nbytes) * 1)) - // alignment gap to multiple of 4 CursorImage []uint32 // size: xgb.Pad(((int(Width) * int(Height)) * 4)) + Name string // size: xgb.Pad((int(Nbytes) * 1)) } // Reply blocks and returns the reply data for a GetCursorImageAndName request. @@ -1583,6 +1582,12 @@ func getCursorImageAndNameReply(buf []byte) *GetCursorImageAndNameReply { b += 2 // padding + 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 + } + { byteString := make([]byte, v.Nbytes) copy(byteString[:v.Nbytes], buf[b:]) @@ -1590,14 +1595,6 @@ 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 - } - return v } |