diff options
author | Andrew Gallant <jamslam@gmail.com> | 2013-08-11 20:54:15 -0400 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-09-08 16:49:18 +0200 |
commit | 38b293e74db6631873d5dfd74cf731eb7b76737d (patch) | |
tree | aca66c5633a1c2e823318efdd05ff5ff996f4021 /nexgb/randr/randr.go | |
parent | b06a8ca97625c1134449c3af65d9ac3fb251a613 (diff) | |
download | haven-38b293e74db6631873d5dfd74cf731eb7b76737d.tar.gz haven-38b293e74db6631873d5dfd74cf731eb7b76737d.tar.xz haven-38b293e74db6631873d5dfd74cf731eb7b76737d.zip |
Padding on a list is on the length of the list.
There was a bug where padding was being computed on each element of the
list. Close #5.
Diffstat (limited to 'nexgb/randr/randr.go')
-rw-r--r-- | nexgb/randr/randr.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/nexgb/randr/randr.go b/nexgb/randr/randr.go index 8891f98..9eb8dc9 100644 --- a/nexgb/randr/randr.go +++ b/nexgb/randr/randr.go @@ -295,9 +295,9 @@ func CrtcChangeListBytes(buf []byte, list []CrtcChange) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Mode uint32 @@ -453,11 +453,17 @@ func ModeInfoListBytes(buf []byte, list []ModeInfo) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } +const ( + NotifyCrtcChange = 0 + NotifyOutputChange = 1 + NotifyOutputProperty = 2 +) + // Notify is the event number for a NotifyEvent. const Notify = 1 @@ -526,12 +532,6 @@ func init() { xgb.NewExtEventFuncs["RANDR"][1] = NotifyEventNew } -const ( - NotifyCrtcChange = 0 - NotifyOutputChange = 1 - NotifyOutputProperty = 2 -) - // 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). @@ -809,9 +809,9 @@ func OutputChangeListBytes(buf []byte, list []OutputChange) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type OutputProperty struct { @@ -889,9 +889,9 @@ func OutputPropertyListBytes(buf []byte, list []OutputProperty) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type RefreshRates struct { @@ -950,9 +950,9 @@ func RefreshRatesListBytes(buf []byte, list []RefreshRates) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } // RefreshRatesListSize computes the size (bytes) of a list of RefreshRates values. @@ -1174,9 +1174,9 @@ func ScreenSizeListBytes(buf []byte, list []ScreenSize) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } const ( |