-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 non-embedded tooltips, popups and dialogs resizing to match Viewport content scale factors != 1.0 #86553
Fix non-embedded tooltips, popups and dialogs resizing to match Viewport content scale factors != 1.0 #86553
Conversation
97f2c0a
to
de49a2d
Compare
de49a2d
to
8f84fc7
Compare
I have a related question regarding PR best practices: I've finished modifications to the remaining classes that did not respond correctly to |
If it's the same bug in different related classes, I would suggest fixing all of them in the same PR (so they could be added to this one, expanding its scope a bit). I'd go as far as suggesting to make the changes in a single commit (so amend this PR's commit with the similar changes to other Control classes). |
So what about #86556 that would otherwise be included in this new group? Should I amend this PR with those changes and then close that PR? |
Yeah I think that would make sense. Fix all those related issues with one fell swoop. |
8f84fc7
to
69b99fa
Compare
I've amended this commit to add all the related changes required to implement proper scaling of non-embedded windows when This includes tooltips, |
scene/main/viewport.cpp
Outdated
@@ -1527,17 +1529,22 @@ void Viewport::_gui_show_tooltip() { | |||
|
|||
tooltip_owner->add_child(gui.tooltip_popup); | |||
|
|||
Window *window = gui.tooltip_popup->get_parent_visible_window(); |
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.
In the case that gui.tooltip_popup
is embedded, it is possible, that its embedder is not the parent visible window.
Can you please try:
Window *window = gui.tooltip_popup->get_parent_visible_window(); | |
Window *window = gui.tooltip_popup->get_embedder(); | |
if (window == null) { | |
window = ui.tooltip_popup->get_parent_visible_window(); | |
} |
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.
Change made - thanks!
0b38a37
to
b3a5a6d
Compare
How's the progress of this PR?The problem of blurry sub-windows is really annoying... |
I'll have to take care of the conflicts with a rebase, but other than that the PR is ready to merge, pending approvals, which I've been awaiting for a while. I've tested it for MacOS and Windows and all is working correctly for me (I've been using it continuously since the PR was posted) I should get to the rebase within a few days... |
44bead9
to
2887ae3
Compare
2887ae3
to
d5bc977
Compare
@@ -1461,6 +1461,8 @@ void Viewport::_gui_show_tooltip() { | |||
panel->set_flag(Window::FLAG_NO_FOCUS, true); | |||
panel->set_flag(Window::FLAG_POPUP, false); | |||
panel->set_flag(Window::FLAG_MOUSE_PASSTHROUGH, true); | |||
panel->set_flag(Window::FLAG_TRANSPARENT, true); | |||
// A non-embedded tooltip window will only be transparent if per_pixel_transparency is allowed in the main Viewport. |
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.
This comment should be above the flag change.
Is this related to what this PR fixes though?
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 true that the PR would work fine without this, but you could not have transparent backgrounds in the non-embedded tooltips. Should I remove this and at some point do a separate PR as a bug-fix?
My sense is that because this PR makes non-embedded tooltips workable (because you couldn't use them previously for projects on HiDPI displays), no one would have come accross this bug.
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.
This seems to have caused a regression where editor tooltips are transparent unexpectedly: #92712 (comment)
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.
A non-embedded tooltip window will only be transparent if per_pixel_transparency is allowed in the main Viewport.
It's allowed in the project settings not for a Viewport, and only affect requested surface format on window creation, but nothing prevents GPU driver from always using surface with alpha channel. And seems like Windows DisplayServer do not have any additional checks (unlike X11 and macOS) and will try to enable it regardless of project settings.
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.
I did some testing and it appears to be working correctly.
The code looks fine (aside from the style comments I left), but someone could double-check the viewport changes.
d5bc977
to
0881c81
Compare
Thanks for the comments! I've made the suggested changes, and for now left in the transparency flag fix, but can remove if recommended. |
Thanks! |
Required for fixes to #69749, #69171, and for fixes to the issues in #54030 when
embed_subwindows
is disabled.Probably fixes #44942.
Bugsquad edit: Fixes #89482.
This will not relate directly to a fix for the blurry subwindows issue, but might help with the eventual solution for that.
This fix causes the
PopupPanel
children to correctly resize to fit the popup when the containingViewport.content_scale_factor
is changed. Without this fix, the children would expand outside the popup bounds if the scale factor was greater than 1.0, or shrivel if less than 1.0.This fix is required for several separate PR's I will post, the first of which is to make tooltips scale to match the main viewport scale factor when the project
embed_subwindows
is disabled.Implementation is slightly different depending on whether the popup is embedded or not. If embedded, the popup will scale simply by changing the viewport content scale factor, if the popup is not embedded, i.e., using a floating system window, the popup content scale factor should be set to match the containing viewport's content scale factor. If this is done, the rendering will be correct (non-blurry).
The fixes below show the properly scaled tooltip that will be in a separate PR.
BEFORE FIX:
Screen.Recording.2023-12-27.at.11.17.35.AM.mov
ALSO BEFORE FIX - Note the tooltip scale stuck at 1.0
Screen.Recording.2023-12-27.at.11.19.17.AM.mov
AFTER FIX:
Screen.Recording.2023-12-27.at.11.15.44.AM.mov
Screen.Recording.2023-12-27.at.11.21.02.AM.mov