Skip to content
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

Fix losing X11 window normal size hint properties #40922

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

opl-
Copy link
Contributor

@opl- opl- commented Jul 31, 2020

This was caused by XSetWMNormalHints being called multiple times, each time with different values. Calling the method replaces the old data completely, resulting in some of the settings being lost.

Since the method was called 3 times before the window was mapped, this resulted in the position hint being lost and the window always getting opened at a position determined by the WM.

I removed the id != MAIN_WINDOW_ID condition from _create_window, as it seemed unnecessary and didn't break anything.

if (id != MAIN_WINDOW_ID) {

This PR also happens to remove calls to XSetNormalHints replacing them with a call to XSetWMNormalHints, as the former has been superseded by the latter.

Tested on KDE/KWin. Not tested on tiling WMs. Xtrace was a useful tool (combined with a grep) to inspect the protocol traffic.


Pinging @reduz as the code author.

This was caused by `XSetWMNormalHints` being called multiple times, each time with different values. Calling the method replaces the old data completely, resulting in some of the settings being lost.

Since the method was called 3 times before the window was mapped, this resulted in the position hint being lost and the window always getting opened at a position determined by the WM.
@akien-mga
Copy link
Member

Do you know if this fixes any of the reported bugs in #37734?

CC @groud and @Riteo to test on tiling WMs.

@akien-mga
Copy link
Member

It did however reveal some issues in the X11 display server implementation that makes all the context menus and popups (probably others too) appear in the top left corner of the screen or around the main window, regardless of the requested position. I believe I have found the cause of this tonight. Will try to implement that fix and PR tomorrow.

I can't reproduce this issue myself on KDE/KWin, at least when testing with a single monitor. But in any case I tried the PR and everything seems OK, at least the X11 DisplayServer doesn't seem more buggy than it was already :P And it's a nice cleanup at any rate.

@opl-
Copy link
Contributor Author

opl- commented Jul 31, 2020

I'm on a dual screen setup (with differing resolutions) and Plasma 5.17. Not sure why it's not happening on your system, but as you mentioned it's an improvement regardless.

I don't think this fixes any bugs from that tracker directly, but for what it's worth I tested #37506 rebased onto this PR and that finally fixed the positioning issues I had with popups.

@akien-mga akien-mga merged commit be43560 into godotengine:master Jul 31, 2020
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants