-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uiWindow unit tests and fixes for unix #261
base: master
Are you sure you want to change the base?
Conversation
4fc63dc
to
ff6c9e0
Compare
Required for uiWindow tests that may not set a child control.
Fix segfault when calling the following functions before the main loop is run: - uiWindowSetContentSize() - uiWindowSetPosition() Ensure an iterator() function is always set, by setting one in uiInit().
Fix the reported uiWindow dimensions for windows that have not been displayed yet.
Make sure uiWindowSetPosition() does not block even if no configure event was received. This commonly occurs when setting the position of a newly created window before being displayed.
Make sure uiWindowSetContentSize() does not block even if no size-allocate event was received. This commonly occurs when setting the size of a newly created window before being displayed.
Use gtk_window_get_size() on the GtkWindow instead of querying the dummy child holder widget for it's allocation size. This fixes uiWindowContentSize() not reporting the correct window size after an uiWindowSetContentSize() on a hidden window.
Remove the manual calculations around window sizes and trust that the gtk calculations for window decorations are sufficient on most systems. Fixes wrong size reporting on windows that are margined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been tested on Wayland yet?
|
||
// Run the event loop manually by default to ensure we can run uiMainStep() | ||
// internally to make asynchronous GTK calls appear synchronous. | ||
uiMainSteps(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the event loop default to "steps mode" on Darwin now as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the event loop default to "steps mode" on Darwin now as well?
I guess that would make sense for consistencies sake? On the other hand Windows has been doing it's own thing all along, which has been calling uiMainStep()
in uiMain()
.
Happy to change that, just needs to be tested very thoroughly to make sure we don't break anything. There seems to be some interaction around that and uiMenu.
👍
I will try some other DEs besides Weston. |
To add to that, this means the unit test work. By no means do Wayland systems honor |
This sadly got a lot bigger than initially anticipated but much of this code is interdependent, hence all of this at once:
FALSE
Fixes for unix:
uiWindowSetContentSize
may cause segmentation fault on Linux #252uiWindowContentSize
now usesgtk_window_get_size
andgtk_window_resize
instead of trying to do some magic calculations on the inner container. According to the docs gtk already does a best effort calculation to report the size sans window decorations. The prior, inner container size code does not work on hidden windows and margined windows anyways and does not add anything on all systems I tested (i3wm and weston) apart from code, confusion, bugs and brittleness, hence the removal.It is unclear to me if there was ever a good reason for doing these calculations. I could not find any documentation in the code or git log. All code related to window sizing is a best effort on all Unix systems anyways as the gtk3 docs state everywhere. I did not notice any regressions by removing all the window size calculations.