community
community copied to clipboard
WIP : Linux: Detect ScaleFactor [build wheel linux]
Needs testing before merge.
Although I did test locally, most of my tests were in side vm. Would be nice to get some testing in real hardware.
Testing was done only with kivy/examples/demo/showcase. Let's limit ourselves to this app for now. What should be tested
- Launching on a screen with Scale Factor != 1
- On Wayland
- *[ ] Gnome
- *[ ] KDE
- *[ ] Other DE
- On X11
- *[ ] Gnome
- *[ ] KDE
- *[ ] Other DE
- On Wayland
- Dragging between screens with different Scale Factor != 1
- On Wayland
- *[ ] Gnome
- *[ ] KDE
- *[ ] Other DE
- On X11
- *[ ] Gnome
- *[ ] KDE
- *[ ] Other DE
- On Wayland
Maintainer merge checklist
- [ ] Title is descriptive/clear for inclusion in release notes.
- [ ] Applied a
Component: xxxlabel. - [ ] Applied the
api-deprecationorapi-breaklabel. - [ ] Applied the
release-highlightlabel to be highlighted in release notes. - [ ] Added to the milestone version it was merged into.
- [ ] Unittests are included in PR.
- [ ] Properly documented, including
versionadded,versionchangedas needed.
I'm getting on Manjaro KDE:
[INFO ] [Logger ] Record log in /home/kuzeyron/.kivy/logs/kivy_25-01-13_4.txt
[INFO ] [Kivy ] v3.0.0.dev0
[INFO ] [Kivy ] Installed at "/home/kuzeyron/Projects/TestScale/.venv/lib/python3.12/site-packages/kivy/__init__.py"
[INFO ] [Python ] v3.12.7 (main, Oct 1 2024, 11:15:50) [GCC 14.2.1 20240910]
[INFO ] [Python ] Interpreter at "/home/kuzeyron/Projects/TestScale/.venv/bin/python"
[INFO ] [Logger ] Purge log fired. Processing...
[INFO ] [Logger ] Purge finished!
[INFO ] [Factory ] 195 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_pil (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: pil(['text_pango'] ignored)
[CRITICAL] [Window ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
x11 - ModuleNotFoundError: No module named 'kivy.core.window.window_x11'
File "/home/kuzeyron/Projects/TestScale/.venv/lib/python3.12/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
mod = importlib.__import__(name='{2}.{0}.{1}'.format(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1466, in __import__
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
[CRITICAL] [App ] Unable to get a Window, abort.
I'm getting on Manjaro KDE:
[INFO ] [Logger ] Record log in /home/kuzeyron/.kivy/logs/kivy_25-01-13_4.txt [INFO ] [Kivy ] v3.0.0.dev0 [INFO ] [Kivy ] Installed at "/home/kuzeyron/Projects/TestScale/.venv/lib/python3.12/site-packages/kivy/__init__.py" [INFO ] [Python ] v3.12.7 (main, Oct 1 2024, 11:15:50) [GCC 14.2.1 20240910] [INFO ] [Python ] Interpreter at "/home/kuzeyron/Projects/TestScale/.venv/bin/python" [INFO ] [Logger ] Purge log fired. Processing... [INFO ] [Logger ] Purge finished! [INFO ] [Factory ] 195 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_pil (img_ffpyplayer ignored) [INFO ] [Text ] Provider: pil(['text_pango'] ignored) [CRITICAL] [Window ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes x11 - ModuleNotFoundError: No module named 'kivy.core.window.window_x11' File "/home/kuzeyron/Projects/TestScale/.venv/lib/python3.12/site-packages/kivy/core/__init__.py", line 59, in core_select_lib mod = importlib.__import__(name='{2}.{0}.{1}'.format( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1466, in __import__ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked [CRITICAL] [App ] Unable to get a Window, abort.
Distro version and KDE versions, on X11 or on Wayland ?
I'm getting on Manjaro KDE:
[INFO ] [Logger ] Record log in /home/kuzeyron/.kivy/logs/kivy_25-01-13_4.txt [INFO ] [Kivy ] v3.0.0.dev0 [INFO ] [Kivy ] Installed at "/home/kuzeyron/Projects/TestScale/.venv/lib/python3.12/site-packages/kivy/__init__.py" [INFO ] [Python ] v3.12.7 (main, Oct 1 2024, 11:15:50) [GCC 14.2.1 20240910] [INFO ] [Python ] Interpreter at "/home/kuzeyron/Projects/TestScale/.venv/bin/python" [INFO ] [Logger ] Purge log fired. Processing... [INFO ] [Logger ] Purge finished! [INFO ] [Factory ] 195 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_pil (img_ffpyplayer ignored) [INFO ] [Text ] Provider: pil(['text_pango'] ignored) [CRITICAL] [Window ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes x11 - ModuleNotFoundError: No module named 'kivy.core.window.window_x11' File "/home/kuzeyron/Projects/TestScale/.venv/lib/python3.12/site-packages/kivy/core/__init__.py", line 59, in core_select_lib mod = importlib.__import__(name='{2}.{0}.{1}'.format( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1466, in __import__ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked [CRITICAL] [App ] Unable to get a Window, abort.Distro version and KDE versions, on X11 or on Wayland ?
So What's essentially happening here is it's failing to get the Details for kde Something in kivy/linux_metrics.py in function get_kde_scale_factor() is failing, would be great if you could help debug or help to reproduce the env for me to test in.
Manajaro Version ? KDE version ? I assume issue is on X11, as we do not use this function on wayland. Directly use wayland-info on it.
Hard to say. cat /etc/os-release:
NAME="Manjaro Linux"
PRETTY_NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="32;1;24;144;200"
HOME_URL="https://manjaro.org/"
DOCUMENTATION_URL="https://wiki.manjaro.org/"
SUPPORT_URL="https://forum.manjaro.org/"
BUG_REPORT_URL="https://docs.manjaro.org/reporting-bugs/"
PRIVACY_POLICY_URL="https://manjaro.org/privacy-policy/"
LOGO=manjarolinux
uname -a: Linux AMX-Think 6.12.4-1-MANJARO #1 SMP PREEMPT_DYNAMIC Mon, 09 Dec 2024 11:58:37 +0000 x86_64 GNU/Linux
Chiming in from #8666, as SDL3 has reached a pre-release (RC) status and we’re very close to the switch (once I resolve a few remaining issues and the SDL team makes the final releases).
The logic for determining the display density and scale has been modified to utilize the new APIs SDL_GetWindowPixelDensity and SDL_GetWindowDisplayScale. (See: https://github.com/libsdl-org/SDL/blob/main/docs/README-highdpi.md)
Could you kindly test the implementation and report if these caveats are still necessary (at least for the SDL3 provider)?
Hi @akshayaurora;
We applied the migration from SDL2 to SDL3, can you please check if this change is still required on the latest master and apply the changes accordingly?
Feel free to ping me when ready!
Some initial test with the SDL3 changes from master from today. (Linux Ubuntu 24.04)
- APP does not detect DPI either for current monitor or respond to any change in monitor.DPI.
So I guess these changes are still needed, did not test these changes, will do so and report back.
- Launching SDL3 app on a monitor that does not have OpenGL acceleration.... on linux results in SegFault. Don't think we had any such issues on SDL2 but it launched on the primary monitor anyways... so maybe that's a irrelevant test ?
@misl6 I will do some more tests later on and report back.
Mmm, according to https://github.com/libsdl-org/SDL/blob/main/docs/README-highdpi.md , should be handled transparently from SDL, but may be an edge case?
Addition:
- What if
SDL_VIDEO_DRIVERenviron variable is set towayland? - Seems that SDL isn't managing scaling on
x11at all.
Seems as per the docs you linked we would have to respond to SDL_GetWindowDisplayScale() I thought it would be transparently handled but ... we draw to context and handle DPI scale etc in house in kivy based on api....
I am a bit hesitant of using this as default, as Kivy does have a X11 windows manager similarly for non sdl2 widow managers it would be better to handle this directly, maybe use this SDL2 specific dpi/scale when SDL is being used...
Will experiment with this and update this pr accordingly.
tested with SDL_VIDEO_DRIVER=wayland and it only helps in the sense that the window is resized with window decorations scaled to the correct proportions, We would still need to respond to the WindowDisplayScale mentioned above to respond to and update the content ourself.