From 9375b474bac5cf91546cd7451d7043f8307f7a26 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Thu, 3 May 2018 13:38:39 +0200 Subject: [PATCH] BrowserWindow: Track webview that initiated html fullscreen Fixes issue where it wouldn't be possible to leave fullscreen with F11 shortcut after closing webview that was in html fullscreen. BUG: 393797 FIXED-IN: 3.0.1 --- src/lib/app/browserwindow.cpp | 11 +++++------ src/lib/app/browserwindow.h | 4 ++-- src/lib/webtab/tabbedwebview.cpp | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index 706ad261d..ee9468730 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -196,7 +196,6 @@ BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, const QUrl &startUrl) , m_startTab(0) , m_startPage(0) , m_sideBarManager(new SideBarManager(this)) - , m_isHtmlFullScreen(false) , m_hideNavigationTimer(0) { setAttribute(Qt::WA_DeleteOnClose); @@ -927,7 +926,7 @@ void BrowserWindow::toggleTabsOnTop(bool enable) void BrowserWindow::toggleFullScreen() { - if (m_isHtmlFullScreen) { + if (m_htmlFullScreenView) { weView()->triggerPageAction(QWebEnginePage::ExitFullScreen); return; } @@ -939,7 +938,7 @@ void BrowserWindow::toggleFullScreen() } } -void BrowserWindow::toggleHtmlFullScreen(bool enable) +void BrowserWindow::requestHtmlFullScreen(TabbedWebView *view, bool enable) { if (enable) { setWindowState(windowState() | Qt::WindowFullScreen); @@ -950,7 +949,7 @@ void BrowserWindow::toggleHtmlFullScreen(bool enable) if (m_sideBar) m_sideBar.data()->setHidden(enable); - m_isHtmlFullScreen = enable; + m_htmlFullScreenView = enable ? view : nullptr; } void BrowserWindow::showWebInspector() @@ -1178,7 +1177,7 @@ bool BrowserWindow::fullScreenNavigationVisible() const void BrowserWindow::showNavigationWithFullScreen() { - if (m_isHtmlFullScreen) + if (m_htmlFullScreenView) return; if (m_hideNavigationTimer->isActive()) { @@ -1237,7 +1236,7 @@ bool BrowserWindow::event(QEvent *event) m_navigationContainer->show(); m_navigationToolbar->setSuperMenuVisible(!m_menuBarVisible); m_navigationToolbar->leaveFullScreen(); - m_isHtmlFullScreen = false; + m_htmlFullScreenView = nullptr; } if (m_hideNavigationTimer) { diff --git a/src/lib/app/browserwindow.h b/src/lib/app/browserwindow.h index b023a06b0..cea106192 100644 --- a/src/lib/app/browserwindow.h +++ b/src/lib/app/browserwindow.h @@ -151,7 +151,7 @@ public Q_SLOTS: void toggleTabsOnTop(bool enable); void toggleFullScreen(); - void toggleHtmlFullScreen(bool enable); + void requestHtmlFullScreen(TabbedWebView *view, bool enable); void loadActionUrl(QObject* obj = 0); void loadActionUrlInNewTab(QObject* obj = 0); @@ -233,7 +233,7 @@ private: // Remember visibility of menubar and statusbar after entering Fullscreen bool m_menuBarVisible; bool m_statusBarVisible; - bool m_isHtmlFullScreen; + QPointer m_htmlFullScreenView; QTimer* m_hideNavigationTimer; QList > m_deleteOnCloseWidgets; diff --git a/src/lib/webtab/tabbedwebview.cpp b/src/lib/webtab/tabbedwebview.cpp index 60bd40f47..ea5389bfd 100644 --- a/src/lib/webtab/tabbedwebview.cpp +++ b/src/lib/webtab/tabbedwebview.cpp @@ -172,7 +172,7 @@ void TabbedWebView::requestFullScreen(bool enable) if (!m_window) return; - m_window->toggleHtmlFullScreen(enable); + m_window->requestHtmlFullScreen(this, enable); } void TabbedWebView::setAsCurrentTab()