Closed IoIxD closed 2 years ago
You call err = xproto.CreateWindowChecked(..., 0xffffffff, xproto.CwBackPixel | xproto.CwEventMask | xproto.CwOverrideRedirect)
, but the function is defined as func CreateWindowChecked(..., ValueMask uint32, ValueList []uint32) CreateWindowCookie
. The last parameter should be a slice ([] uint32) and the parameter before should be the masks. How did you even compile? (I see, you pasted here bad example here.)
See usage in tests or in examples or in an example I did for previous issue. The idea is, that first comes the mask (concatenating mask types) and then a slice with the same amount of values for each mask type (mask values have to be ordered by mask type number ascending). See xproto docs for available mask values (all should have counterparts in xgb).
I see in your code you give 3 mask types, but the flags slice holds only 2 values. You need the same count of slice values as there are mask types (in your case 3).
Ah, I see. Also yeah I forgot to surround the uint32 in the example with []uint32{} as I normally would.
Modifying my code to have defaultFlags return an array of flags that are as long as I want them to removes the error. Thank you!
...results in this...
It doesn't matter whether it's OverrideRedirect or CwCursor, it crashes either way at this point:
This would lead me to believe that I need to set something in the value mask in addition to adding something to the value list, but upon further research it would seem that I only even need to set the exposure mask (also,
xgb.PopCount(int(ValueMask))
returns 3). Interesting still, I tried to multiply the equation used to determine the size of buf by 2, and I still get the error. Switching Put32 to Put64 and making ValueList[i] a uint64 certainly doesn't help either. There's probably something I'm missing but if there's a bug then I'm certainly not sure what's causing it.