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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/desktop/shell
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2010-12-15 17:45:02
Message-ID: 20101215174502.16C28AC8A8 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1206736 by aseigo:

* get rid of the delayedUnhide code -> it wasn't even being used anymore!
* correct signal/slot connection for autohiding
* don't autohide if the panel is asking for attention
* autohide when the panel is no longer asking for attention
* drop the should-we-autohide poll down to 500ms from 200s


 M  +8 -33     panelview.cpp  
 M  +0 -9      panelview.h  


--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/panelview.cpp #1206735:1206736
@@ -311,7 +311,6 @@
       m_glowBar(0),
       m_mousePollTimer(0),
       m_strutsTimer(new QTimer(this)),
-      m_delayedUnhideTimer(new QTimer(this)),
       m_spacer(0),
       m_spacerIndex(-1),
       m_shadowWindow(0),
@@ -328,10 +327,6 @@
     KWindowSystem::setType(winId(), NET::Dock);
     setWindowRole(QString("panel_%1").arg(id));
 
-    m_delayedUnhideTimer->setSingleShot(true);
-    m_delayedUnhideTimer->setInterval(200);
-    connect(m_delayedUnhideTimer, SIGNAL(timeout()), this, SLOT(delayedUnhide()));
-
     m_strutsTimer->setSingleShot(true);
     connect(m_strutsTimer, SIGNAL(timeout()), this, SLOT(updateStruts()));
 
@@ -1275,19 +1270,6 @@
     setScreen(screenId);
 }
 
-void PanelView::enterEvent(QEvent *event)
-{
-    // allow unhiding to happen again even if we were delay-unhidden
-    m_delayedUnhideTs = QTime();
-/*
-// handy for debugging :)
-    if (containment()) {
-        kDebug() << sceneRect() << containment()->geometry();
-    }
-*/
-    Plasma::View::enterEvent(event);
-}
-
 void PanelView::showWidgetExplorer()
 {
     if (!containment()) {
@@ -1437,7 +1419,6 @@
 void PanelView::unhide(bool destroyTrigger)
 {
     //kill the unhide stuff
-    m_delayedUnhideTimer->stop();
     hideHinter();
     if (destroyTrigger) {
         destroyUnhideTrigger();
@@ -1447,7 +1428,6 @@
     if (!isVisible()) {
         Plasma::WindowEffects::slideWindow(this, location());
         show();
-        KWindowSystem::setOnAllDesktops(winId(), true);
 
         if (m_shadowWindow && m_shadowWindow->isValid()) {
             Plasma::WindowEffects::slideWindow(m_shadowWindow, location());
@@ -1457,6 +1437,8 @@
         }
     }
 
+    KWindowSystem::setOnAllDesktops(winId(), true);
+
     //non-hiding panels stop here
     if (m_visibilityMode == NormalPanel || m_visibilityMode == WindowsGoBelow) {
         return;
@@ -1467,8 +1449,8 @@
         m_mousePollTimer = new QTimer(this);
     }
 
-    connect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(hideIfNotInUse()), Qt::UniqueConnection);
-    m_mousePollTimer->start(200);
+    connect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(startAutoHide()), Qt::UniqueConnection);
+    m_mousePollTimer->start(500);
 
     //avoid hide-show loops
     if (m_visibilityMode == LetWindowsCover) {
@@ -1491,16 +1473,11 @@
     //kDebug() << "================= got a new status: " << newStatus << Plasma::ActiveStatus;
     if (newStatus > Plasma::ActiveStatus) {
         unhide();
+    } else {
+        startAutoHide();
     }
 }
 
-void PanelView::delayedUnhide()
-{
-    m_delayedUnhideTs.start();
-    //kDebug() << "starting at:" << m_delayedUnhideTs << m_delayedUnhideTs.elapsed();
-    unhide(true);
-}
-
 void PanelView::unhide()
 {
     unhide(true);
@@ -1513,10 +1490,8 @@
 
 void PanelView::startAutoHide()
 {
-    //kDebug() << m_delayedUnhideTs.elapsed() << geometry().contains(QCursor::pos()) << hasPopup();
     //TODO: is 5s too long? not long enough?
-    if ((!m_delayedUnhideTs.isNull() && m_delayedUnhideTs.elapsed() < 5000) ||
-        m_editing ||
+    if (m_editing || (containment() && containment()->status() > Plasma::ActiveStatus) ||
         geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) ||
         hasPopup()) {
         if (!m_mousePollTimer) {
@@ -1560,7 +1535,7 @@
         }
 
         connect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(startAutoHide()), Qt::UniqueConnection);
-        m_mousePollTimer->start(200);
+        m_mousePollTimer->start(500);
     }
 
     if (event) {
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/panelview.h #1206735:1206736
@@ -134,12 +134,6 @@
     void unhide();
 
     /**
-     * unhides the panel if it is hidden due to a delayed acdtions, such as a status change
-     * This always destroys the unhide trigger
-     */
-    void delayedUnhide();
-
-    /**
      * Decides whether to hide or not based on the status of the containment
      */
     void checkUnhide(Plasma::ItemStatus newStatus);
@@ -217,7 +211,6 @@
     bool event(QEvent *event);
     void dragLeaveEvent(QDragLeaveEvent *event);
     void dropEvent(QDropEvent *event);
-    void enterEvent(QEvent *event);
 
 private:
     void createUnhideTrigger();
@@ -273,10 +266,8 @@
     PanelController *m_panelController;
     QSet<PanelAppletOverlay*> m_appletOverlays;
     GlowBar *m_glowBar;
-    QTime m_delayedUnhideTs;
     QTimer *m_mousePollTimer;
     QTimer *m_strutsTimer;
-    QTimer *m_delayedUnhideTimer;
     QTimeLine *m_timeLine;
     QGraphicsWidget *m_spacer;
     int m_spacerIndex;
[prev in list] [next in list] [prev in thread] [next in thread] 

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