Preserve fullscreen when exiting video fullscreen

Fixes #2778
This commit is contained in:
Jakub Klinkovský 2017-07-04 14:12:21 +02:00
parent 629038632c
commit 7eacea1057
2 changed files with 11 additions and 1 deletions

View File

@ -615,6 +615,7 @@ class WebEngineTab(browsertab.AbstractTab):
def shutdown(self):
self.shutting_down.emit()
self.action.exit_fullscreen()
if qtutils.version_check('5.8', exact=True):
# WORKAROUND for
# https://bugreports.qt.io/browse/QTBUG-58563

View File

@ -128,6 +128,8 @@ class MainWindow(QWidget):
_commandrunner: The main CommandRunner instance.
_overlays: Widgets shown as overlay for the current webpage.
_private: Whether the window is in private browsing mode.
_restore_fullscreen: Whether to restore the fullscreen after leaving
a video fullscreen.
"""
def __init__(self, *, private, geometry=None, parent=None):
@ -217,6 +219,8 @@ class MainWindow(QWidget):
objreg.get("app").new_window.emit(self)
self._restore_fullscreen = False
def _init_geometry(self, geometry):
"""Initialize the window geometry or load it from disk."""
if geometry is not None:
@ -483,9 +487,14 @@ class MainWindow(QWidget):
@pyqtSlot(bool)
def _on_fullscreen_requested(self, on):
if on:
self._restore_fullscreen = self.isFullScreen()
self.showFullScreen()
else:
elif not self._restore_fullscreen:
self.showNormal()
else:
self._restore_fullscreen = self.isFullScreen()
log.misc.debug('on: {}, restore fullscreen: {}'
.format(on, self._restore_fullscreen))
@cmdutils.register(instance='main-window', scope='window')
@pyqtSlot()