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

Use SDL_WINDOWEVENT_DISPLAY_CHANGED to notice about window switching display to update _density an dpi #7982

Merged
merged 1 commit into from Feb 25, 2023

Conversation

misl6
Copy link
Member

@misl6 misl6 commented Aug 27, 2022

Maintainer merge checklist

  • Title is descriptive/clear for inclusion in release notes.
  • Applied a Component: xxx label.
  • Applied the api-deprecation or api-break label.
  • Applied the release-highlight label to be highlighted in release notes.
  • Added to the milestone version it was merged into.
  • Unittests are included in PR.
  • Properly documented, including versionadded, versionchanged as needed.

🔴 It was supposed to be "Ready to Merge", but the CI is failing. We should consider how the SDL2 dep is managed on Ubuntu and other Linux distros.

⚠️ SDL_WINDOWEVENT_DISPLAY_CHANGED has been added on SDL 2.0.18 but needs SDL 2.24.0 to work as expected on macOS, as previously was using a non-macOS compatible logic to compute the display on which the window is really attached to (#7974 bumps SDL2 to 2.24.0).

💡 Since now SDL2 seems to be aware of DPI on all platforms (including Windows), we may want to update how dpi gets computed.

  • Added missing SDL_WINDOWEVENT_* declarations for future usage.
  • Handle SDL_WINDOWEVENT_DISPLAY_CHANGED so we can notice about a window that changed the display is attached to.
  • Extract a method _update_density_and_dpi which updates _density and dpi to avoid DRY violations

Previously:
no_dpi

After:
ok_dpi

@misl6 misl6 added this to the 2.2.0 milestone Aug 27, 2022
@misl6 misl6 changed the title Use SDL_WINDOWEVENT_DISPLAY_CHANGED to notice about window switching display to update _density an dpi [WIP] Use SDL_WINDOWEVENT_DISPLAY_CHANGED to notice about window switching display to update _density an dpi Aug 27, 2022
tshirtman
tshirtman previously approved these changes Aug 28, 2022
matham
matham previously approved these changes Aug 31, 2022
@misl6 misl6 dismissed stale reviews from matham and tshirtman via 0d044a1 October 5, 2022 18:13
@misl6 misl6 force-pushed the fix/dpi-changes branch 3 times, most recently from 450687b to 04a3041 Compare October 8, 2022 08:09
@misl6 misl6 changed the title [WIP] Use SDL_WINDOWEVENT_DISPLAY_CHANGED to notice about window switching display to update _density an dpi Use SDL_WINDOWEVENT_DISPLAY_CHANGED to notice about window switching display to update _density an dpi Feb 18, 2023
…another display (which may have a different dpi value)
@FilipeMarch
Copy link
Contributor

Hello, since 2022 I would like to use my external monitor, but because of this dpi bug I can't because the screen gets completely distorted here using macOS. Please could you merge this PR? This would really really help me a lot.

@misl6 misl6 merged commit 61a52b1 into kivy:master Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants