[Kwintv] kdenonbeta/kwintv3/qtvision/clients

Andras Mantia amantia at kde.org
Fri Mar 12 15:43:24 CET 2004


CVS commit by amantia: 

Make Always On Top work as expected:
- the Always On Top option in the config. dialog says how will QtVision start
- if the user changes the Always On Top state from the window menu, that one is valid for the current instance
- if the user's setting and the setting in the configuration dialog does not match and the user enters the config. dialog and presses OK/Apply without changing the Always On Top option, the user's setting will not be changed. If the Always On Top is changed in the dialog, the new setting will become valid. Sounds complicated, but I expect this is better, than losing the Always On Top setting if the user enters the config. dialog for some other reason.

CCMAIL: kwintv at kde.org


  M +2 -13     mainwindow.cpp   1.103
  M +0 -1      mainwindow.h   1.45
  M +9 -1      qtvisionsettingswidgetimpl.cpp   1.5


--- kdenonbeta/kwintv3/qtvision/clients/mainwindow.cpp  #1.102:1.103
@@ -527,4 +527,6 @@ void MainWindow::restoreWindowSettings()
 
     _staysOnTop = _cfg->readBoolEntry("Stay on Top", false);
+    if (_staysOnTop)
+        KWin::setState(winId(), NET::StaysOnTop);
     _disableSaver = _cfg->readBoolEntry("Disable Screensaver", true);
     _screenSaverMode = _cfg->readNumEntry("Screensaver Mode", SaverVisible);
@@ -574,16 +576,4 @@ void MainWindow::keyBindings()
 }
 
-void MainWindow::checkStayOnTop()
-{
-    // Dirk: Only works correctly if I use KWin AND Qt method for me... (???)
-    if (_staysOnTop) {
-        KWin::setState(winId(), NET::StaysOnTop);
-        setWFlags(WStyle_StaysOnTop);
-    } else {
-        KWin::clearState(winId(), NET::StaysOnTop);
-        clearWFlags(WStyle_StaysOnTop);
-    }
-}
-
 void MainWindow::setSidebarVisibility(bool v)
 {
@@ -724,5 +714,4 @@ void MainWindow::setViewMode( int mode )
     _changingViewMode = false;
     emit viewModeChanged( _viewMode );
-    checkStayOnTop();
 
     // give the TV widget focus

--- kdenonbeta/kwintv3/qtvision/clients/mainwindow.h  #1.44:1.45
@@ -166,5 +166,4 @@ protected slots:
 
     void checkScreenSaver();
-    void checkStayOnTop();
 
 protected:

--- kdenonbeta/kwintv3/qtvision/clients/qtvisionsettingswidgetimpl.cpp  #1.4:1.5
@@ -18,4 +18,5 @@
 #include <kdebug.h>
 #include <klocale.h>
+#include <kwin.h>
 #include <qcombobox.h>
 #include <qcheckbox.h>
@@ -66,5 +67,13 @@ void QtVisionSettingsWidgetImpl::apply()
     _mw->_disableSaver    = _disableScreenSaver->isChecked();
     _mw->_screenSaverMode = _saverCombo->currentItem();
+    bool staysOnTop = _mw->_staysOnTop;
     _mw->_staysOnTop      = _stayOnTop->isChecked();
+    if (staysOnTop != _mw->_staysOnTop)
+    {
+      if (_mw->_staysOnTop)     
+        KWin::setState(_mw->winId(), NET::StaysOnTop);
+      else
+        KWin::clearState(_mw->winId(), NET::StaysOnTop);
+    }
 
     _mw->_viewNormalEnabled  = _enableNormal->isChecked();
@@ -81,5 +90,4 @@ void QtVisionSettingsWidgetImpl::apply()
     }
 
-    _mw->checkStayOnTop();
     _mw->checkScreenSaver();
 }




More information about the kwintv mailing list