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

can_drop_data with embedded subwindows disabled ignores viewport content_scale_factor #86493

Closed
Koyper opened this issue Dec 24, 2023 · 6 comments · Fixed by #86511
Closed

can_drop_data with embedded subwindows disabled ignores viewport content_scale_factor #86493

Koyper opened this issue Dec 24, 2023 · 6 comments · Fixed by #86511

Comments

@Koyper
Copy link
Contributor

Koyper commented Dec 24, 2023

Tested versions

4.3dev1, 4.2rc

System information

MacOS

Issue description

With project setting embed_subwindows disabled and Viewport.content_scale_factor set to a value other than 1.0, such as when using a HiDPI display (MacOS Retina), _can_drop_data is not calculated using the vp scale factor, and returns false when it should return true. This effects all Controls, such as Tree such that it's not possible to drag and drop tree items when the Viewport is scaled.

_drop_data position is also incorrect by the same scale factor offset.

With embed subwindows ENABLED:

Screen.Recording.2023-12-24.at.2.28.32.PM.mov

with embed_subwindows DISABLED:

Screen.Recording.2023-12-24.at.2.27.24.PM.mov

Steps to reproduce

See MRP.

Minimal reproduction project (MRP)

can_drop_data_with_non_embedded_subwindows_bug.zip

@Sauermann
Copy link
Contributor

Sauermann commented Dec 25, 2023

I can confirm the problematic behavior in the following case on Windows 10:

  • embed_subwindows is disabled
  • Viewport.content_scale_factor is not 1.0

In your issue description you write:

With project setting embed_subwindows enabled

Am I correct to assume, that you mean "disabled" instead of "enabled"?

I have tested #67531 and with that PR merged, the problem doesn't happen for me on Windows. Since that PR is not going to make it into 4.3, a dedicated solution would be helpful.

@Koyper
Copy link
Contributor Author

Koyper commented Dec 25, 2023

Am I correct to assume, that you mean "disabled" instead of "enabled"?

Yes, that's what I meant - sorry. I corrected it above. The second video above demonstrates the issue.

I have tested #67531 and with that PR merged, the problem doesn't happen for me on Windows. Since that PR is not going to make it into 4.3, a dedicated solution would be helpful.

I was hoping for that PR to be merged - do you know why it won't make it into 4.3? Do you have a sense of where in #67531 the change is made that fixes this issue?

The backstory on how this issue came up: because of the blurry embedded tooltips, menus and popups that are confounding to fix per #54030, I devised a workaround using non-embedded subwindows that provides properly rendered 2x popup windows. This is done by not setting the popup content_scale_factor, but resizing the popup by 2X, and setting the transform scale of the child Control to 2X. NOTIFICATION_SORT_CHILDREN and NOTIFICATION_DRAW then resize the child control to fit the popup Viewport. This gives you perfect 2X subwindows. This could be implemented in the engine where tooltips and popup menus are being rendered and connected to the screen HiDPI.

@Sauermann
Copy link
Contributor

do you know why it won't make it into 4.3

Yes, feel free to pm me on Godot rocket chat for details - let's keep this issue about the bug itself.

Do you have a sense of where in #67531 the change is made that fixes this issue?

Yes, see the linked PR.

@zen14774
Copy link

I'm also having problems with _can_drop_data on 4.2 on Linux. I'm not doing anything with sub-windows so I'm not sure if it's the exact same thing or not but it looks pretty much the same. It seems changing content_scale_factor and resizing the window gets things misaligned, and drop data doesn't work as expected.

@Sauermann
Copy link
Contributor

@zen14774 in order to find out, if this is the same problem, you have two options:

  • you could try out Godot with the changes of the linked PR and see if your problem is solved
  • you could try to post a minimal reproduction project of your problem

@zen14774
Copy link

@Sauermann I tested the linked PR (it was easier than I expected!) and it does solve the issue, 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 a pull request may close this issue.

4 participants