From 36c8ca97904d5bde200f588a35e53f8ba7a9ad73 Mon Sep 17 00:00:00 2001 From: Dasith Gunawardhana Date: Mon, 13 Nov 2017 21:38:02 -0500 Subject: [PATCH 1/3] added option to limit fullscreen to window only --- qutebrowser/config/configdata.yml | 6 ++++++ qutebrowser/mainwindow/mainwindow.py | 3 ++- qutebrowser/misc/miscwidgets.py | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 83f9635fe..8cf8953c3 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -259,6 +259,12 @@ content.default_encoding: The encoding must be a string describing an encoding such as _utf-8_, _iso-8859-1_, etc. +content.desktop_fullscreen: + type: Bool + default: true + desc: >- + Allow fullscreen to cover the entire desktop. + content.developer_extras: type: Bool default: false diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 57e540a53..cfe549890 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -493,7 +493,8 @@ class MainWindow(QWidget): def _on_fullscreen_requested(self, on): if on: self.state_before_fullscreen = self.windowState() - self.showFullScreen() + if config.val.content.desktop_fullscreen: + self.showFullScreen() elif self.isFullScreen(): self.setWindowState(self.state_before_fullscreen) log.misc.debug('on: {}, state before fullscreen: {}'.format( diff --git a/qutebrowser/misc/miscwidgets.py b/qutebrowser/misc/miscwidgets.py index 546cab8fb..1424ceac8 100644 --- a/qutebrowser/misc/miscwidgets.py +++ b/qutebrowser/misc/miscwidgets.py @@ -300,7 +300,10 @@ class FullscreenNotification(QLabel): self.setText("Page is now fullscreen.") self.resize(self.sizeHint()) - geom = QApplication.desktop().screenGeometry(self) + if config.val.content.desktop_fullscreen: + geom = QApplication.desktop().screenGeometry(self) + else: + geom = self.parentWidget().geometry() self.move((geom.width() - self.sizeHint().width()) / 2, 30) def set_timeout(self, timeout): From 4419e59d46e89c319c754c3c694f0d8a2f4feb5a Mon Sep 17 00:00:00 2001 From: Dasith Gunawardhana Date: Mon, 13 Nov 2017 23:25:10 -0500 Subject: [PATCH 2/3] prevent WM fullscreen from being unset when desktop_fullscreen is false --- qutebrowser/mainwindow/mainwindow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index cfe549890..37d412d5e 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -492,11 +492,13 @@ class MainWindow(QWidget): @pyqtSlot(bool) def _on_fullscreen_requested(self, on): if on: - self.state_before_fullscreen = self.windowState() + self.window_state_before_fullscreen = self.windowState() + self.config_state_before_fullscreen = config.val.content.desktop_fullscreen if config.val.content.desktop_fullscreen: self.showFullScreen() elif self.isFullScreen(): - self.setWindowState(self.state_before_fullscreen) + if config.val.content.desktop_fullscreen or self.config_state_before_fullscreen: + self.setWindowState(self.window_state_before_fullscreen) log.misc.debug('on: {}, state before fullscreen: {}'.format( on, debug.qflags_key(Qt, self.state_before_fullscreen))) From ea70a0dea1cd2b751cbf5bf776693f2283e67b9f Mon Sep 17 00:00:00 2001 From: Dasith Gunawardhana Date: Tue, 14 Nov 2017 01:41:15 -0500 Subject: [PATCH 3/3] changed setting name and reverted non-issue fix --- qutebrowser/config/configdata.yml | 6 +++--- qutebrowser/mainwindow/mainwindow.py | 12 +++++------- qutebrowser/misc/miscwidgets.py | 6 +++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 8cf8953c3..ba8c36857 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -259,11 +259,11 @@ content.default_encoding: The encoding must be a string describing an encoding such as _utf-8_, _iso-8859-1_, etc. -content.desktop_fullscreen: +content.windowed_fullscreen: type: Bool - default: true + default: false desc: >- - Allow fullscreen to cover the entire desktop. + Limit fullscreen to the browser window (does not expand to fill the screen). content.developer_extras: type: Bool diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 37d412d5e..bf95d3e6a 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -491,14 +491,12 @@ class MainWindow(QWidget): @pyqtSlot(bool) def _on_fullscreen_requested(self, on): - if on: - self.window_state_before_fullscreen = self.windowState() - self.config_state_before_fullscreen = config.val.content.desktop_fullscreen - if config.val.content.desktop_fullscreen: + if not config.val.content.windowed_fullscreen: + if on: + self.state_before_fullscreen = self.windowState() self.showFullScreen() - elif self.isFullScreen(): - if config.val.content.desktop_fullscreen or self.config_state_before_fullscreen: - self.setWindowState(self.window_state_before_fullscreen) + elif self.isFullScreen(): + self.setWindowState(self.state_before_fullscreen) log.misc.debug('on: {}, state before fullscreen: {}'.format( on, debug.qflags_key(Qt, self.state_before_fullscreen))) diff --git a/qutebrowser/misc/miscwidgets.py b/qutebrowser/misc/miscwidgets.py index 1424ceac8..f398feb4c 100644 --- a/qutebrowser/misc/miscwidgets.py +++ b/qutebrowser/misc/miscwidgets.py @@ -300,10 +300,10 @@ class FullscreenNotification(QLabel): self.setText("Page is now fullscreen.") self.resize(self.sizeHint()) - if config.val.content.desktop_fullscreen: - geom = QApplication.desktop().screenGeometry(self) - else: + if config.val.content.windowed_fullscreen: geom = self.parentWidget().geometry() + else: + geom = QApplication.desktop().screenGeometry(self) self.move((geom.width() - self.sizeHint().width()) / 2, 30) def set_timeout(self, timeout):