-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Fixes for windows in X11 tiling WMs #38727
Conversation
Note that one of your commit includes |
Oh, sorry, gonna fix it immediately! |
3a9d67c
to
8eae390
Compare
I tried removing it, only changed the latest commit, i'm going to see how to remove it later. |
8eae390
to
fbd7caf
Compare
Oh, nice ! |
I'm trying to keep this PR as minimal as possible, but there is a little change in the generic DisplayServer implementation by adding All platforms seem to have a "show window" function, but if one doesn't have it and directly shows one on creation, probably setting a window's properties after showing will work. In that case an empty implementation of |
Is this also related to godot not getting the proper window ID for the game until it's started? |
I don't think so, but i may be not fully get what you're referring to. This PR fixes some issues with screen sized popups on tiling window managers |
After some time, as I got the opportunity to work on this again, a lot of issues seem to have been fixed in one form or the other, leaving this PR usable, I tried it a bit and seems to work quite well. Still, without this PR, there are some tiling WM specific issues, so I just got to implement the other platforms and I think that this PR will be ready for review! |
Ok, so now i should have implemented |
Oh well, after some testing i found some other issues, i'm aware of them and i'm working on it. |
Relevant core for macOS: Split this part to the godot/platform/osx/display_server_osx.mm Lines 2320 to 2324 in a5fb445
and replace this line with godot/platform/osx/display_server_osx.mm Line 3758 in a5fb445
|
Thanks! I'll implement 'show_window' for MacOS with your changes ASAP! |
platform/osx/display_server_osx.mm
Outdated
return id; | ||
} | ||
|
||
void DisplayServerOSX::show_window(const WindowData &wd, uint32_t p_flags) { |
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.
It's ... show_window(WindowID p_id ...
on other platforms, probably should be the same here. And definition is missing from display_server_osx.h
.
void DisplayServerOSX::show_window(WindowID p_id, uint32_t p_flags) {
WindowData &wd = windows[p_id];
....
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.
oh yeah sorry, i messed up, i was distracted and wrote without thinking too much. I should be more careful while writing code i can't compile eheh. I'll fix it immediately!
It doesn't want to compile? This is confusing. |
It's probably still running previous build, not sure how GitHub Actions handle it, but Travis only cancels old build if it's not started. |
Well, my new commit(that i'm testing before pushing) will surely freshen it up. |
What? Github actions still believes that there's that line! Does it really not compile on MacOS or is actions messed up? |
platform/osx/display_server_osx.h
Outdated
@@ -230,6 +230,7 @@ class DisplayServerOSX : public DisplayServer { | |||
virtual Vector<int> get_window_list() const override; | |||
|
|||
virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i()) override; | |||
virtual void show_window(WindowID p_id, uint32_t p_flags) override; |
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.
You have not removed p_flags
from macOS version.
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.
oooh, that's why! Very very sorry, i was convinced that the issue was still that line!
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.
Fixing it right now!
Try squashing commits (it's necessary to do it before merging anyway), see: https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html#modifying-a-pull-request. |
3c8f758
to
70df0e7
Compare
Ok, I hope to have squashed the pr correctly. I tried it on linux and a bit on wine(yeah, it isn't the most accurate way of testing it, but it works), but I have no way of testing it on MacOS. Still, the PR should be done. Setting it as ready for review! |
70df0e7
to
2242c0d
Compare
When creating a window, Godot would first register it to the WM(show it) and then set its flags. This works fine on a floating WM, but on tiling WMs as soon as a window gets registered the WM immediately acts on the window by scaling it up and treating it as a generic window, being registered without any special flags. This commit separates the showing of the window into another function and calls it after the most important flags are set, making windows with special flags(eg. all popups) work again on tiling WMs. Fixes godotengine#37930
2242c0d
to
d670a49
Compare
Ok I've just tested the PR. Generally, this works a lot better than before, the popups and subwindows work great. The only problem I found is that, when I disable the tiling (awesomewm allows me to do so), the popup do not pop at the correct position anymore. I figured out that this position was the one chosen by my windows manager to open a new window. Edit: Note that all other subwindows are popped there too, not only popups. When tiling is activated it works correctly though. |
Do you have multiple screens? It looks a lot like the stuff that #37506 is trying to fix. |
No I have only one screen (at least active). We have to make sure this PR does not break the situation for any non-tiling WM though. If someone could test that :) |
I did a quick test before going to bed, and I can't reproduce this issue on i3. |
Ok. In any case this drastically improves the situation anywayu. It would be good if someone could test the PR on a non-tiling WM though, but on my side it looks good to merge. |
Tested on KDE Plasma / KWin with e7a56a2 + this PR, it seems to work fine. I get an error when I select a node in the Create New Node dialog, but it seems unrelated to this PR (happens without it too):
|
Thanks! |
Can confirm that this PR greatly improved usability on KDE, making both context menus and dialogs render much quicker and without visual artifacts that were visible before (the windows were displaying pixels that were below them when they were created until the first render). Thanks and good job! 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. Edit: Done, see #40922. |
This breaks popups on Stock Ubuntu (Gnome), I suggest reverting until we figure out whats going on, then try the PR again. |
Please test in stock Ubuntu, when it works attempt the PR again. |
Another problem with this PR is that simple popups (For value editors) do not get focus instantly like they normally did. Please check this too. |
I found out that with these changes, But just adding |
@Riteo After some more research, it seems |
Nice! I also got some new ideas regarding both the DisplayServer API and its X11 implementation. As of now i'm on my summer pause, but on monday I'll come back, ready to contribute to the fix to this issue and Godot in general. |
Sounds good! I've made a lot of progress so far but I'm still working on some regressions in specific cases due to my changes. The general idea is to use override_redirect for the popups so the WM doesn't interfere with them, and it has some side effects on how the focus switches between windows. I'll make sure to open a PR at least as a draft later today so you can have a look when you want to jump in. |
From PR godotengine#38727 which was reverted in godotengine#41373 because of regressions in Ubuntu with Gnome. Co-authored-by: Lorenzo Cerqua <[email protected]>
From PR godotengine#38727 which was reverted in godotengine#41373 because of regressions in Ubuntu with Gnome. Co-authored-by: Lorenzo Cerqua <[email protected]>
Fixes #37930
This PR aims to fix various window issues on the platform "linuxbsd" regarding titling WMs.
All popups seem to work intermittently, behaviour which i believe is caused by the current implementation of
_create_window()
The current way of creating windows works by mapping them before changing their properties.
This approach works on floating window based WMs but not on tiling ones, which as soon as they are mapped get resized to full screen and get cleared of most of their properties, as shown in this part of an i3 debug log:
This whole issue is all pretty messy as it seems to happen in two different processes at the same time, so the results vary a little sometimes, letting the window work by sheer luck.
By mapping the window later, we avoid all of this.
Almost everything works, but there is some stuff left to do, so i'm making this a draft PR. There are also some other issues, but they seem related to X11 in general, such as focus(#37531) and offset(#38591) related ones.
Edit: made the issue clearer