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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/pager
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-08-28 21:16:20
Message-ID: 1219958180.216760.31012.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 854126 by aseigo:

avoid trusting the windowing environment to always be sane (*sigh* having to support \
things like people switching window managers mid-session is just so .... what's the \
word for it .. inane.) BUG:170003


 M  +11 -7     pager.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/pager/pager.cpp #854125:854126
@@ -407,8 +407,11 @@
 
 void Pager::currentDesktopChanged(int desktop)
 {
+    if (desktop < 1) {
+        return; // bogus value, don't accept it
+    }
+
     m_currentDesktop = desktop;
-
     m_dirtyDesktop = -1;
 
     if (!m_timer->isActive()) {
@@ -454,6 +457,10 @@
 
 void Pager::numberOfDesktopsChanged(int num)
 {
+    if (num < 1) {
+        return; // refuse to update to zero desktops
+    }
+
     m_dirtyDesktop = -1;
 
     m_desktopCount = num;
@@ -559,12 +566,9 @@
        if (m_kwin->numberOfViewports(0).width() * \
                m_kwin->numberOfViewports(0).height() > 1 )
        desktops = m_kwin->numberOfViewports(0).width() * \
                m_kwin->numberOfViewports(0).height();
        */
-    if (e->delta() < 0)
-    {
+    if (e->delta() < 0) {
         newDesk = m_currentDesktop % desktops + 1;
-    }
-    else
-    {
+    } else {
         newDesk = (desktops + m_currentDesktop - 2) % desktops + 1;
     }
 
@@ -882,7 +886,7 @@
     for (int i = 0; i < m_windowRects.count(); i++) {
         for (int j = 0; j < m_windowRects[i].count(); j++) {
             QRect rect = m_windowRects[i][j].second;
-            if (m_rects[m_currentDesktop-1].contains(rect)) {
+            if (!m_rects.isEmpty() && m_rects[m_currentDesktop-1].contains(rect)) {
                 if (m_activeWindows.contains(rect)) {
                     painter->setBrush(activeWindowBrushActiveDesk);
                     painter->setPen(activeWindowPen);


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

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