From 6e954a15969184a86d9eacb90e3f565d8fca1f18 Mon Sep 17 00:00:00 2001
From: Florian Bruhin
Date: Sat, 9 Jun 2018 16:50:48 +0200
Subject: [PATCH] Allow to force software rendering with wayland on Qt 5.11
Closes #2932 (hopefully for the last time)
---
doc/changelog.asciidoc | 2 ++
qutebrowser/misc/backendproblem.py | 46 ++++++++++++++++++------------
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc
index 64965e128..80758ee4e 100644
--- a/doc/changelog.asciidoc
+++ b/doc/changelog.asciidoc
@@ -40,6 +40,8 @@ Changed
- The `qt.force_software_rendering` setting changed from a boolean to taking
different values (`software-opengl`, `qt-quick` and `chromium`) for different
kinds of software rendering workarounds.
+- On Qt 5.11, using wayland with QtWebEngine is now possible when using
+ software rendering.
v1.3.2 (unreleased)
-------------------
diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py
index 80b8a710b..b2d6f71bb 100644
--- a/qutebrowser/misc/backendproblem.py
+++ b/qutebrowser/misc/backendproblem.py
@@ -213,33 +213,41 @@ def _handle_wayland():
if platform not in ['wayland', 'wayland-egl']:
return
+ has_qt511 = qtutils.version_check('5.11', compiled=False)
+ if has_qt511 and config.val.qt.force_software_rendering == 'chromium':
+ return
+
+ buttons = []
+ text = "You can work around this in one of the following ways:
"
+
if 'DISPLAY' in os.environ:
# XWayland is available, but QT_QPA_PLATFORM=wayland is set
- button = _Button("Force XWayland", 'qt.force_platform', 'xcb')
- _show_dialog(
- backend=usertypes.Backend.QtWebEngine,
- because="you're using Wayland",
- text="There are two ways to fix this:
"
- "Force Qt to use XWayland
"
+ buttons.append(_Button("Force XWayland", 'qt.force_platform', 'xcb'))
+ text += ("Force Qt to use XWayland
"
"This allows you to use the newer QtWebEngine backend "
"(based on Chromium). "
"This sets the qt.force_platform = 'xcb' option "
"(if you have a config.py file, you'll need to set "
- "this manually).
",
- buttons=[button],
- )
+ "this manually).
")
else:
- # XWayland is unavailable
- _show_dialog(
- backend=usertypes.Backend.QtWebEngine,
- because="you're using Wayland without XWayland",
- text="There are two ways to fix this:
"
- "Set up XWayland
"
- "This allows you to use the newer QtWebEngine backend "
- "(based on Chromium). "
- )
+ text.append("
Set up XWayland
"
+ "This allows you to use the newer QtWebEngine backend "
+ "(based on Chromium). ")
- raise utils.Unreachable
+ if has_qt511:
+ buttons.append(_Button("Force software rendering",
+ 'qt.force_software_rendering',
+ 'chromium'))
+ text += ("
Forcing software rendering
"
+ "This allows you to use the newer QtWebEngine backend "
+ "(based on Chromium) but could have noticeable performance "
+ "impact (depending on your hardware). This sets the "
+ "qt.force_software_rendering = 'chromium' option "
+ "(if you have a config.py file, you'll need to set "
+ "this manually).
")
+
+ _show_dialog(backend=usertypes.Backend.QtWebEngine,
+ because="you're using Wayland", text=text, buttons=buttons)
@attr.s