From f46cb54a31bd8c235c8f18e8daed857906d52acd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Jul 2022 14:31:58 +0530 Subject: [PATCH] Dont use an env var to force QPA to use xcb --- src/calibre/gui2/__init__.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 36ee2448cf..640fda1254 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1065,15 +1065,6 @@ 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 override_program_name: args = [override_program_name] + args[1:] if headless: @@ -1088,6 +1079,16 @@ class Application(QApplication): args.extend(['-platform', 'windows:darkmode=2']) else: args.extend(['-platform', 'windows:darkmode=1']) + if not iswindows and not ismacos and not os.environ.get('QT_QPA_PLATFORM'): + # 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. + args.extend(['-platform', 'xcb']) + self.headless = headless from calibre_extensions import progress_indicator self.pi = progress_indicator