summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy <jimmy@spalge.com>2021-12-31 16:29:08 +1300
committerJimmy <jimmy@spalge.com>2021-12-31 16:29:08 +1300
commit2866cae6b34237cb36f13e02787c0111373d2f10 (patch)
tree5f4cc95bea72db3af4c561355c7975f9472b04b0
parent54b817898f212042386b602b25d23f66789399df (diff)
downloadqutebrowser-2866cae6b34237cb36f13e02787c0111373d2f10.tar.gz
qutebrowser-2866cae6b34237cb36f13e02787c0111373d2f10.zip
Support fullscreen requests on Qt6
QApplication.desktop() (And the QDesktopWidget that returns) has been deprecated since 5.11, we only support Qt 5.12+ (ref #3839). The recommended alternative is to use `QGuiApplication::screenAt(QPoint)`, but that doesn't support passing a widget. Stackoverflow [points out](https://stackoverflow.com/a/53490851) that you can get to the current screen of a widget, so that's what I'm using here. Once you get the screen there is both `geometry()` and `availableGeometry()` available. The later, sometimes, excludes window manager status bars and such, which fullscreen apps should cover. This approach works on both 5.15 and 6.2, so no version checks necessary.
-rw-r--r--qutebrowser/misc/miscwidgets.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/qutebrowser/misc/miscwidgets.py b/qutebrowser/misc/miscwidgets.py
index aaf7d07de..e28fd0c01 100644
--- a/qutebrowser/misc/miscwidgets.py
+++ b/qutebrowser/misc/miscwidgets.py
@@ -309,7 +309,7 @@ class FullscreenNotification(QLabel):
if config.val.content.fullscreen.window:
geom = self.parentWidget().geometry()
else:
- geom = QApplication.desktop().screenGeometry(self)
+ geom = self.window().windowHandle().screen().geometry()
self.move((geom.width() - self.sizeHint().width()) // 2, 30)
def set_timeout(self, timeout):