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

List:       kde-commits
Subject:    kdebase/kicker/applets/minipager
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2005-02-24 3:53:17
Message-ID: 20050224035317.C91AAEDBC () office ! kde ! org
[Download RAW message or body]

CVS commit by aseigo: 

prevent insane behaviour from messing up the pager.


  M +21 -13    pagerapplet.cpp   1.108


--- kdebase/kicker/applets/minipager/pagerapplet.cpp  #1.107:1.108
@@ -211,9 +211,12 @@ void KMiniPagerButton::paintEvent(QPaint
 void KMiniPagerButton::mousePressEvent( QMouseEvent * e)
 {
-    if ( e->button() == RightButton ) {
+    if (e->button() == RightButton)
+    {
         // prevent LMB down -> RMB down -> LMB up sequence
-        if ( ( e->state() & MouseButtonMask ) == NoButton )
-            emit showMenu( e->globalPos(), deskNum );
-    } else {
+        if ((e->state() & MouseButtonMask ) == NoButton)
+            emit showMenu(e->globalPos(), deskNum);
+    }
+    else
+    {
         QButton::mousePressEvent( e );
     }
@@ -222,8 +225,5 @@ void KMiniPagerButton::mousePressEvent( 
 void KMiniPagerButton::dragEnterEvent( QDragEnterEvent* e )
 {
-    // if a dragitem is held for over a pager button for two seconds,
-    // activate corresponding desktop
     dragSwitchTimer.start( 1000, TRUE );
-
     QButton::dragEnterEvent( e );
 }
@@ -243,8 +243,5 @@ void KMiniPagerButton::slotDragSwitch()
 void KMiniPagerButton::slotClicked()
 {
-//    if ( isOn() )
       emit buttonSelected( deskNum );
-//    else
-//      setOn( true );
 }
 
@@ -371,4 +368,15 @@ void KMiniPager::slotSetDesktop(int desk
         for (unsigned int i=0; i < btnList.count(); i++)
             btnList[i]->setOn(false);
+
+    if (desktop != KWin::currentDesktop())
+    {
+        // this can happen when the user clicks on a desktop,
+        // holds down the key combo to switch desktops, lets the
+        // mouse go but keeps the key combo held. the desktop will switch
+        // back to the desktop associated with the key combo and then it
+        // becomes a race condition between kwin's signal and the button's
+        // signal. usually kwin wins.
+        return;
+    }
     curDesk = desktop;
     if ( (int) btnList.count() >= curDesk )


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

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