https://kotlinlang.org logo
Title
t

tunedal

04/08/2017, 9:55 PM
So I thought I'd try XCB instead, but there seems to be some problem with structs, so that's not working either. 😫 @olonho Did you see the thing I pasted? Any hints?
o

olonho

04/09/2017, 8:30 AM
yes, we see the problem and try to fix it soon.
s

svyatoslav.scherbina

04/11/2017, 7:54 AM
We have fixed returning structs by value in master branch. Could you please try XCB again?
t

tunedal

04/11/2017, 12:10 PM
It's working now, thanks! 👍 Now I'm just having some trouble filling in the array of structs (xcb_rectangle_t) that needs to be passed to the drawing function. I can do "r = allocArray<xcb_rectangle_t>", access the struct with "r[0]", and successfully fill in the fields... but the last of the fields seems to be ignored somehow.
Where by ignored I mean that my rectangle gets a position and a width, but no height. But also something more weird: the fields are all shorts, and when I try to assign ints to them the compiler complains – but not for the last field! If I assign a String to the last field the compiler says it requires a Short, but if i assign an Int it compiles without complaints. 🤔
s

svyatoslav.scherbina

04/11/2017, 12:16 PM
Does it work correctly if you assign shorts to last fields?
t

tunedal

04/11/2017, 12:16 PM
No, the rectangle still doesn't get a height (i.e. it's drawn as a line).
Maybe there's a better way to create it? The C documentation says: xcb_rectangle_t rectangles[] = {{ 10, 50, 40, 20}, { 80, 50, 10, 40}};
s

svyatoslav.scherbina

04/11/2017, 12:28 PM
Currently there is no way better than manually filling struct fields. Of course it is still possible to hide this in a method 🙂
No, the rectangle still doesn't get a height (i.e. it's drawn as a line).
Could you please provide a sample?
t

tunedal

04/11/2017, 1:30 PM
Well.... 😅 I made a minimal sample and it worked perfectly. It turns out I had misspelled the parameter name as "heigth", so "this.height = height" was just reassigning itself to itself! My bad. (The compiler even warned me about it, but it got lost among the spurious "failed to obtain inline function declaration" warnings.)