Linux: Default to using XWayland instead of native Wayland as there are various bugs with Qt+Wayland . You can set the env var QT_QPA_PLATFORM=wayland to force calibre to use Wayland.

This commit is contained in:
Kovid Goyal 2022-07-14 08:22:07 +05:30
parent 59541e36a5
commit 8e5666b306
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 0 deletions

View File

@ -49,6 +49,7 @@ Environment variables
the system theme -- beware of crashes and hangs.
* ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - causes calibre to print deprecation warnings to stdout. Useful for calibre developers.
* ``CALIBRE_NO_DEFAULT_PROGRAMS`` - prevent calibre from automatically registering the filetypes it is capable of handling with Windows.
* ``QT_QPA_PLATFORM`` - On Linux set this to ``wayland`` to force calibre to use Wayland. Note however that Qt + Wayland is extremely buggy.
* ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys
* ``http_proxy``, ``https_proxy`` - used on Linux to specify an HTTP(S) proxy

View File

@ -1059,6 +1059,16 @@ class Application(QApplication):
if set_app_uid(windows_app_uid):
self.windows_app_uid = windows_app_uid
self.file_event_hook = None
if not iswindows and not ismacos and not os.environ.get('QT_QPA_PLATFORM') and not headless:
# Various issues in Wayland make it unuseable so prevent Qt from
# using Wayland unless the user asks for it explicitly.
# In KDE right clicking on the book list causes left clicks on it
# to stop working till kwin is restarted. On GNOME there are no
# native window decorations. There have been reports of left clicks
# not working in GNOME though I cannot reproduce. So force use of
# XWayland.
os.environ['QT_QPA_PLATFORM'] = 'xcb'
if isfrozen and QT_VERSION <= 0x050700 and 'wayland' in os.environ.get('QT_QPA_PLATFORM', ''):
os.environ['QT_QPA_PLATFORM'] = 'xcb'
if override_program_name: