[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/utils/yakuake
From:       Eike Hein <hein () kde ! org>
Date:       2009-03-30 17:23:53
Message-ID: 1238433833.312273.10053.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 946995 by hein:

Rewrite fullscreen handling, fixing bugs such as exiting fullscreen mode
on virtual desktop switch.


 M  +4 -2      ChangeLog  
 M  +44 -22    app/mainwindow.cpp  
 M  +1 -1      app/mainwindow.h  


--- trunk/extragear/utils/yakuake/ChangeLog #946994:946995
@@ -30,8 +30,10 @@
 * The auto-open-on-mouse-pointer-hitting-the-screen edge feature now checks
   the position of the mouse pointer against the actual position and width of
   the window rather than triggering on the entire screen edge. This way, the
-  screen corners are freed up e.g. for KWin Desktop Effects triggers with the
-  default Yakuake window width of 90%.
+  screen corners are freed up e.g. for KWin Desktop Effects triggers with
+  the default Yakuake window width of 90%.
+* Rewrote fullscreen handling, fixing bugs such as exiting fullscreen mode
+  on virtual desktop switch.
 
 
 Changes in 2.9.4:
--- trunk/extragear/utils/yakuake/app/mainwindow.cpp #946994:946995
@@ -72,6 +72,8 @@
     m_titleBar = new TitleBar(this);
     m_firstRunDialog = NULL;
 
+    m_togglingWindowState = false;
+
     setupActions();
     setupMenu();
 
@@ -138,19 +140,21 @@
 {
     m_actionCollection = new KActionCollection(this);
 
+    KToggleFullScreenAction* fullScreenAction = new KToggleFullScreenAction(this);
+    fullScreenAction->setWindow(this);
+    fullScreenAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
+    m_actionCollection->addAction("view-full-screen", fullScreenAction);
+    connect(fullScreenAction, SIGNAL(toggled(bool)), this, \
SLOT(setFullScreen(bool))); +
     KAction* action = KStandardAction::quit(kapp, SLOT(quit()),actionCollection());
     action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Q));
 
     action = KStandardAction::aboutApp(m_helpMenu, SLOT(aboutApplication()), \
                actionCollection());
     action = KStandardAction::aboutKDE(m_helpMenu, SLOT(aboutKDE()), \
                actionCollection());
- 
+
     action = KStandardAction::keyBindings(this, SLOT(configureKeys()), \
                actionCollection());
     action = KStandardAction::preferences(this, SLOT(configureApp()), \
actionCollection());  
-    action = KStandardAction::fullScreen(this, SLOT(updateFullScreen()), this, \
                actionCollection());
-    action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
-    connect(action, SIGNAL(toggled(bool)), this, SLOT(setFullScreen(bool)));
-
     action = KStandardAction::whatsThis(this, SLOT(whatsThis()), \
actionCollection());  
     action = actionCollection()->addAction("toggle-window-state");
@@ -383,7 +387,7 @@
     m_menu->addAction(actionCollection()->action(KStandardAction::stdName(KStandardAction::AboutKDE)));
  
     m_menu->addTitle(i18nc("@title:menu", "Quick Options"));
-    m_menu->addAction(actionCollection()->action(KStandardAction::stdName(KStandardAction::FullScreen)));
 +    m_menu->addAction(actionCollection()->action("view-full-screen"));
     m_menu->addAction(actionCollection()->action("keep-open"));
 
     m_screenMenu = new KMenu(this);
@@ -572,10 +576,22 @@
 
 void MainWindow::applyWindowGeometry()
 {
-    QAction* action =  \
                actionCollection()->action(KStandardAction::stdName(KStandardAction::FullScreen));
                
-    if (action->isChecked()) action->activate(KAction::Trigger);
+    int width, height;
 
-    setWindowGeometry(Settings::width(), Settings::height(), Settings::position());
+    QAction* action = actionCollection()->action("view-full-screen");
+
+    if (action->isChecked())
+    {
+        width = 100;
+        height = 100;
+    }
+    else
+    {
+        width = Settings::width();
+        height = Settings::height();
+    }
+
+    setWindowGeometry(width, height, Settings::position());
 }
 
 void MainWindow::setWindowGeometry(int newWidth, int newHeight, int newPosition)
@@ -731,6 +747,8 @@
 
 void MainWindow::toggleWindowState()
 {
+    m_togglingWindowState = true;
+
     if (m_animationTimer.isActive()) return;
 
     if (isVisible())
@@ -741,6 +759,13 @@
             return;
         }
 
+        QAction* action = actionCollection()->action("view-full-screen");
+        if (action->isChecked())
+        {
+            action->setChecked(false);
+            applyWindowGeometry();
+        }
+
         m_animationFrame = Settings::frames();
 
         connect(&m_animationTimer, SIGNAL(timeout()), this, SLOT(retractWindow()));
@@ -755,6 +780,8 @@
         connect(&m_animationTimer, SIGNAL(timeout()), this, SLOT(openWindow()));
         m_animationTimer.start();
     }
+
+    m_togglingWindowState = false;
 }
 
 void MainWindow::openWindow()
@@ -852,23 +879,18 @@
 
 void MainWindow::setFullScreen(bool state)
 {
-     if (state)
-        setWindowGeometry(100, 100, Settings::position());
-     else
-        applyWindowGeometry();
-}
-
-void MainWindow::updateFullScreen()
-{
-    QAction* action =  \
                actionCollection()->action(KStandardAction::stdName(KStandardAction::FullScreen));
                
-
-    if (action->isChecked())
+    if (state)
     {
+        setWindowState(windowState() | Qt::WindowFullScreen);
         setWindowGeometry(100, 100, Settings::position());
-        this->setWindowState(windowState() | Qt::WindowFullScreen);
     }
     else
+    {
         this->setWindowState(windowState() & ~Qt::WindowFullScreen);
+
+        if (!m_togglingWindowState)
+            setWindowGeometry(Settings::width(), Settings::height(), \
Settings::position()); +    }
 }
 
 int MainWindow::getScreen()
@@ -881,7 +903,7 @@
 
 QRect MainWindow::getDesktopGeometry()
 {
-    QAction* action = \
actionCollection()->action(KStandardAction::stdName(KStandardAction::FullScreen)); +  \
QAction* action = actionCollection()->action("view-full-screen");  
     if (action->isChecked()) 
         return KApplication::desktop()->screenGeometry(getScreen());
--- trunk/extragear/utils/yakuake/app/mainwindow.h #946994:946995
@@ -110,7 +110,6 @@
         void setKeepOpen(bool keepOpen);
 
         void setFullScreen(bool state);
-        void updateFullScreen();
 
         void handleSwitchToAction();
 
@@ -163,6 +162,7 @@
         QTimer m_mousePoller;
         int m_animationFrame;
         int m_animationStepSize;
+        bool m_togglingWindowState;
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic