1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

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
This commit is contained in:
David Rosca 2018-05-03 13:38:39 +02:00
parent 7689b73daa
commit 9375b474ba
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 8 additions and 9 deletions

View File

@ -196,7 +196,6 @@ BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, const QUrl &startUrl)
, m_startTab(0) , m_startTab(0)
, m_startPage(0) , m_startPage(0)
, m_sideBarManager(new SideBarManager(this)) , m_sideBarManager(new SideBarManager(this))
, m_isHtmlFullScreen(false)
, m_hideNavigationTimer(0) , m_hideNavigationTimer(0)
{ {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
@ -927,7 +926,7 @@ void BrowserWindow::toggleTabsOnTop(bool enable)
void BrowserWindow::toggleFullScreen() void BrowserWindow::toggleFullScreen()
{ {
if (m_isHtmlFullScreen) { if (m_htmlFullScreenView) {
weView()->triggerPageAction(QWebEnginePage::ExitFullScreen); weView()->triggerPageAction(QWebEnginePage::ExitFullScreen);
return; return;
} }
@ -939,7 +938,7 @@ void BrowserWindow::toggleFullScreen()
} }
} }
void BrowserWindow::toggleHtmlFullScreen(bool enable) void BrowserWindow::requestHtmlFullScreen(TabbedWebView *view, bool enable)
{ {
if (enable) { if (enable) {
setWindowState(windowState() | Qt::WindowFullScreen); setWindowState(windowState() | Qt::WindowFullScreen);
@ -950,7 +949,7 @@ void BrowserWindow::toggleHtmlFullScreen(bool enable)
if (m_sideBar) if (m_sideBar)
m_sideBar.data()->setHidden(enable); m_sideBar.data()->setHidden(enable);
m_isHtmlFullScreen = enable; m_htmlFullScreenView = enable ? view : nullptr;
} }
void BrowserWindow::showWebInspector() void BrowserWindow::showWebInspector()
@ -1178,7 +1177,7 @@ bool BrowserWindow::fullScreenNavigationVisible() const
void BrowserWindow::showNavigationWithFullScreen() void BrowserWindow::showNavigationWithFullScreen()
{ {
if (m_isHtmlFullScreen) if (m_htmlFullScreenView)
return; return;
if (m_hideNavigationTimer->isActive()) { if (m_hideNavigationTimer->isActive()) {
@ -1237,7 +1236,7 @@ bool BrowserWindow::event(QEvent *event)
m_navigationContainer->show(); m_navigationContainer->show();
m_navigationToolbar->setSuperMenuVisible(!m_menuBarVisible); m_navigationToolbar->setSuperMenuVisible(!m_menuBarVisible);
m_navigationToolbar->leaveFullScreen(); m_navigationToolbar->leaveFullScreen();
m_isHtmlFullScreen = false; m_htmlFullScreenView = nullptr;
} }
if (m_hideNavigationTimer) { if (m_hideNavigationTimer) {

View File

@ -151,7 +151,7 @@ public Q_SLOTS:
void toggleTabsOnTop(bool enable); void toggleTabsOnTop(bool enable);
void toggleFullScreen(); void toggleFullScreen();
void toggleHtmlFullScreen(bool enable); void requestHtmlFullScreen(TabbedWebView *view, bool enable);
void loadActionUrl(QObject* obj = 0); void loadActionUrl(QObject* obj = 0);
void loadActionUrlInNewTab(QObject* obj = 0); void loadActionUrlInNewTab(QObject* obj = 0);
@ -233,7 +233,7 @@ private:
// Remember visibility of menubar and statusbar after entering Fullscreen // Remember visibility of menubar and statusbar after entering Fullscreen
bool m_menuBarVisible; bool m_menuBarVisible;
bool m_statusBarVisible; bool m_statusBarVisible;
bool m_isHtmlFullScreen; QPointer<TabbedWebView> m_htmlFullScreenView;
QTimer* m_hideNavigationTimer; QTimer* m_hideNavigationTimer;
QList<QPointer<QWidget> > m_deleteOnCloseWidgets; QList<QPointer<QWidget> > m_deleteOnCloseWidgets;

View File

@ -172,7 +172,7 @@ void TabbedWebView::requestFullScreen(bool enable)
if (!m_window) if (!m_window)
return; return;
m_window->toggleHtmlFullScreen(enable); m_window->requestHtmlFullScreen(this, enable);
} }
void TabbedWebView::setAsCurrentTab() void TabbedWebView::setAsCurrentTab()