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

Revert "Detect High DPI on Linux Desktop" #8184

Merged
merged 1 commit into from Mar 24, 2023

Conversation

akshayaurora
Copy link
Member

Reverts #8147

Previous way of using size difference between Window.size and Windows.get_DrwableSize is the correct way as outlined by SDL2 Documentation too.

The reason on why currently on Wayland window reports both to be the same cause apparently we are not properly using Wayland window provider.

@akshayaurora akshayaurora requested a review from misl6 March 24, 2023 08:56
@akshayaurora akshayaurora assigned akshayaurora and unassigned misl6 Mar 24, 2023
@misl6 misl6 added this to the 2.2.0 milestone Mar 24, 2023
Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@misl6 misl6 merged commit e2c8f07 into master Mar 24, 2023
85 checks passed
@misl6 misl6 deleted the revert-8147-linux_highdpi_sdl2 branch March 24, 2023 16:49
@jotoft
Copy link
Contributor

jotoft commented Apr 2, 2023

@akshayaurora can you explain in more detail what the issue with the original pull request was? The window size vs drawable area size is still the primary way of detecting the DPI in this PR.

The display DPI was just a secondary way of getting the DPI in case the primary way fails.

Without this PR there is no support at all for detecting DPI so the scaling does not work at all on Linux.

@akshayaurora
Copy link
Member Author

The problem with that pr is that it tries to work around on get_gl_size not working.

get_gl_size is supposed to give a dpi adjusted size. It only supposed to work on Linux when using wayland(SDL2 Window provider with the video driver set to wayland).

Your solution worked around the issue trying to detect display dpi directly. Which is not supposed to be accurate even according to the documentation on SDL2 itself.

Correct solution here is to figure out why the get_gl_size is reporting same as Window.size/system_size instead of dpi adjusted size.(Probably need to properly enable wayland video driver but needs a bit more investigation)

1)Figure out why get_gl_size is not working/reporting correct size. i.e If we are not accurately setting the video driver or not compiling the required wayland support then that needs to be fixed.(This would fix things for the binary wheel installations on linux).

  1. We probably need to detect env i.e Wayland/X11/FBO and then adjust scaling appropriately.

Your pr was a step in right direction just needs a bit adjustment to account for the above.

@FilipeMarch
Copy link
Contributor

FilipeMarch commented Apr 10, 2023

The dpi calculation is clearly wrong on my laptop

from kivy.app import runTouchApp
from kivy.uix.label import Label

runTouchApp(Label(text="hello world"))

This is how Hello World app should look like
image

This is how it looks like on my laptop (Arch Linux, kivy==master)
image

All my apps are completely distorted on my laptop screen 😫

This is my laptop screen config (not sure if this matters)
image

This is how kivy==master vs kivy==2.1.0 looks like on my laptop
image

Printing the DPI in kivy==master

>>> dpi: 189.02325439453125

Printing the DPI in kivy==2.1.0

>>> dpi: 96.0

Temporary workaround for me is adding this line on the end of _update_density_and_dpi method on kivy.core.window.window_sdl2.WindowSDL class on kivy==master

self.dpi = 96.0

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