diff options
| author | Andrew Gallant <[email protected]> | 2013-08-11 20:54:15 -0400 |
|---|---|---|
| committer | Andrew Gallant <[email protected]> | 2013-08-11 20:54:15 -0400 |
| commit | eb7c38953b074e33f86861a3da4c05623cd44fc6 (patch) | |
| tree | 0393a0a57afb536c401afb5e3587384c282ddd00 /randr/randr.go | |
| parent | 8bc7a097c3aeddc1832d47cd74a9a365ab1f86ad (diff) | |
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 'randr/randr.go')
| -rw-r--r-- | randr/randr.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/randr/randr.go b/randr/randr.go index 8891f98..9eb8dc9 100644 --- a/randr/randr.go +++ b/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 ( |
