Merge pull request #4364 from helbling/fix_4349

Prevent exiting video player from exiting fullscreen
This commit is contained in:
Jay Kamat 2018-12-29 07:54:20 -08:00 committed by GitHub
commit 4b0d1b394e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View File

@ -34,7 +34,7 @@ from qutebrowser.browser import (urlmarks, browsertab, inspector, navigate,
webelem, downloads)
from qutebrowser.keyinput import modeman, keyutils
from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils,
objreg, utils, standarddir)
objreg, utils, standarddir, debug)
from qutebrowser.utils.usertypes import KeyMode
from qutebrowser.misc import editor, guiprocess, objects
from qutebrowser.completion.models import urlmodel, miscmodels
@ -1721,4 +1721,10 @@ class CommandDispatcher:
return
window = self._tabbed_browser.widget.window()
if not window.isFullScreen():
window.state_before_fullscreen = window.windowState()
window.setWindowState(window.windowState() ^ Qt.WindowFullScreen)
log.misc.debug('state before fullscreen: {}'.format(
debug.qflags_key(Qt, window.state_before_fullscreen)))

View File

@ -32,7 +32,7 @@ from qutebrowser.commands import runners
from qutebrowser.api import cmdutils
from qutebrowser.config import config, configfiles
from qutebrowser.utils import (message, log, usertypes, qtutils, objreg, utils,
jinja)
jinja, debug)
from qutebrowser.mainwindow import messageview, prompt
from qutebrowser.completion import completionwidget, completer
from qutebrowser.keyinput import modeman
@ -137,6 +137,7 @@ class MainWindow(QWidget):
Attributes:
status: The StatusBar widget.
tabbed_browser: The TabbedBrowser widget.
state_before_fullscreen: window state before activation of fullscreen.
_downloadview: The DownloadView widget.
_vbox: The main QVBoxLayout.
_commandrunner: The main CommandRunner instance.
@ -238,6 +239,8 @@ class MainWindow(QWidget):
objreg.get("app").new_window.emit(self)
self._set_decoration(config.val.window.hide_decoration)
self.state_before_fullscreen = self.windowState()
def _init_geometry(self, geometry):
"""Initialize the window geometry or load it from disk."""
if geometry is not None:
@ -517,9 +520,13 @@ class MainWindow(QWidget):
def _on_fullscreen_requested(self, on):
if not config.val.content.windowed_fullscreen:
if on:
self.setWindowState(self.windowState() | Qt.WindowFullScreen)
self.state_before_fullscreen = self.windowState()
self.setWindowState(
Qt.WindowFullScreen | self.state_before_fullscreen)
elif self.isFullScreen():
self.setWindowState(self.windowState() & ~Qt.WindowFullScreen)
self.setWindowState(self.state_before_fullscreen)
log.misc.debug('on: {}, state before fullscreen: {}'.format(
on, debug.qflags_key(Qt, self.state_before_fullscreen)))
@cmdutils.register(instance='main-window', scope='window')
@pyqtSlot()