SVN commit 784334 by lunakl: Backport r784333 (remove usage of QWidget::showFullScreen() etc.). BUG: 157941 M +1 -2 kdebase/apps/konqueror/src/konqmainwindow.cpp M +1 -1 kdebase/apps/konqueror/src/konqmisc.cpp M +3 -2 kdebase/apps/konsole/src/MainWindow.cpp M +8 -0 kdelibs/kdeui/actions/ktogglefullscreenaction.cpp M +14 -3 kdelibs/kdeui/actions/ktogglefullscreenaction.h M +2 -2 kdelibs/phonon/videowidget.cpp --- branches/KDE/4.0/kdebase/apps/konqueror/src/konqmainwindow.cpp #784333:784334 @@ -3266,9 +3266,9 @@ void KonqMainWindow::slotUpdateFullScreen( bool set ) { + KToggleFullScreenAction::setFullScreen( this, set ); if( set ) { - showFullScreen(); // Create toolbar button for exiting from full-screen mode // ...but only if there isn't one already... @@ -3311,7 +3311,6 @@ } else { - setWindowState( windowState() & ~Qt::WindowFullScreen ); unplugActionList( "fullscreen" ); if (m_prevMenuBarVisible) --- branches/KDE/4.0/kdebase/apps/konqueror/src/konqmisc.cpp #784333:784334 @@ -56,7 +56,7 @@ { KWindowInfo info = KWindowSystem::windowInfo( window->winId(), NET::WMDesktop ); if ( info.valid() && info.isOnCurrentDesktop() ) - window->showNormal(); + window->setWindowState( window->windowState() & ~Qt::WindowFullScreen ); } } } --- branches/KDE/4.0/kdebase/apps/konsole/src/MainWindow.cpp #784333:784334 @@ -257,10 +257,11 @@ void MainWindow::viewFullScreen(bool fullScreen) { if ( fullScreen ) - showFullScreen(); + setWindowState( windowState() | Qt::WindowFullScreen ); else - showNormal(); + setWindowState( windowState() & ~Qt::WindowFullScreen ); } + BookmarkHandler* MainWindow::bookmarkHandler() const { return _bookmarkHandler; --- branches/KDE/4.0/kdelibs/kdeui/actions/ktogglefullscreenaction.cpp #784333:784334 @@ -101,4 +101,12 @@ return false; } +void KToggleFullScreenAction::setFullScreen( QWidget* window, bool set ) +{ + if( set ) + window->setWindowState( window->windowState() | Qt::WindowFullScreen ); + else + window->setWindowState( window->windowState() & ~Qt::WindowFullScreen ); +} + #include "ktogglefullscreenaction.moc" --- branches/KDE/4.0/kdelibs/kdeui/actions/ktogglefullscreenaction.h #784333:784334 @@ -37,10 +37,14 @@ * yourself. Rely on this action's state (isChecked()) instead. * * Important: If you need to set/change the fullscreen state manually, - * use the relevant QWidget function (showFullScreen etc.), do not - * call directly the slot connected to the toggled() signal. The slot + * use KToggleFullScreenAction::setFullScreen() or a similar function, + * do not call directly the slot connected to the toggled() signal. The slot * still needs to explicitly set the window state though. - + * + * Note: Do NOT use QWidget::showFullScreen() or QWidget::showNormal(). + * They have several side-effects besides just switching the fullscreen + * state (for example, showNormal() resets all window states, not just + * fullscreen). Use the KToggleFullScreenAction::setFullScreen() helper function. */ class KDEUI_EXPORT KToggleFullScreenAction : public KToggleAction { @@ -72,6 +76,13 @@ */ void setWindow( QWidget* window ); + /** + * Helper function to set or reset the fullscreen state of a window. + * Use this function rather than showFullScreen()/showNormal() QWidget functions. + * @since 4.0.3 + */ + static void setFullScreen( QWidget* window, bool set ); + protected: bool eventFilter( QObject* object, QEvent* event ); --- branches/KDE/4.0/kdelibs/phonon/videowidget.cpp #784333:784334 @@ -108,9 +108,9 @@ } setWindowFlags(flags); if (newFullScreen) { - showFullScreen(); + setWindowState( windowState() | Qt::WindowFullScreen ); // set } else { - showNormal(); + setWindowState( windowState() & ~Qt::WindowFullScreen ); // reset } }