How would this be used? I'd like to meter what people want to do with this before I add this.
As said on the other issue, it could be useful to change the UI based on window size, hiding some controls, or reducing font size...
For example when using vim in a terminal (or gvim maybe) when the window is resized the amount of characters in each row/column is changed.
That makes sense, though with libui I was thinking that would be handled by a uiArea or (not yet present) uiTextArea and a similar uiAreaHandler.SizeChanged that doesn't exist yet
But I suppose I can add the size changed event to uiWindow too. Not sure how fullscreen would be handled in this case.
Not sure how fullscreen would be handled in this case.
You could emit SizeChanged on fullscreen mode enter/exit?
Done in the meantime. We'll see what happens with fullscreen (I'll probably suppress the event on programmatic change only and if OS X supports it emit one on change, but not a separate fullscreen event, maybe???).
Okay, new question, because Wayland and Mir throw a wrench in all of this.
What do you need window positioning for?
What do you need window sizing for?
@andlabs: why Wayland and Mir throw a wrench on this?
It's only related to set size and set position, or also to the "changed" events? (I consider the events more important than the setters)
Wayland and Mir don't allow you to do any of that, period. The compositor is the arbiter of window positions, and I can't reasonably add support for every compositor that ever will exist, since each has their own API, if even an API. You can position and size a window relative to another one in the same program, but that's about it, and even then it's iffy.
The idea is that instead of getting in the compositor's way, the protocol can be extended to support common use cases, such as saving and restoring window positions between executions.
@andlabs I don't think this is an essential feature, but a "nice to have" one.
The "change" event is more important according to me. Is this feature affected by the same difficulties?
Why don't provide this feature only on windows and macOS?
I think there is no problem with the changed event, no. I'd have to check.
Making it only on some OSs would go against the point of libui.
Making it only on some OSs would go against the point of libui.
Do you want to keep feature parity between platforms? This could greatly reduce supported features according to me...
I think there is no problem with the changed event, no. I'd have to check.
Great!
Okay, position can't be available at all. Only size.
Still waiting on #79.
Might as well close this; the feature has been implemented for a while, and finally works without bugs now.
Most helpful comment
For example when using vim in a terminal (or gvim maybe) when the window is resized the amount of characters in each row/column is changed.