[kdebase-workspace] Panel autohide fix

Jaroslav Reznik jreznik at fedoraproject.org
Wed Mar 30 10:56:32 UTC 2011


commit 718181c36d2be2f9234374bb2c9e0027234fda0b
Author: Jaroslav Reznik <jreznik at redhat.com>
Date:   Wed Mar 30 12:56:25 2011 +0200

    Panel autohide fix

 ...ase-workspace-4.6.1-kde#258012-hide-panel.patch |  199 ++++++++++++++++++++
 kdebase-workspace.spec                             |    9 +-
 2 files changed, 207 insertions(+), 1 deletions(-)
---
diff --git a/kdebase-workspace-4.6.1-kde#258012-hide-panel.patch b/kdebase-workspace-4.6.1-kde#258012-hide-panel.patch
new file mode 100644
index 0000000..446a0d1
--- /dev/null
+++ b/kdebase-workspace-4.6.1-kde#258012-hide-panel.patch
@@ -0,0 +1,199 @@
+diff -burN kdebase-workspace-4.6.1/plasma/desktop/shell/CMakeLists.txt kdebase-workspace-4.6.1.patch/plasma/desktop/shell/CMakeLists.txt
+--- kdebase-workspace-4.6.1/plasma/desktop/shell/CMakeLists.txt	2011-02-25 22:54:49.000000000 +0100
++++ kdebase-workspace-4.6.1.patch/plasma/desktop/shell/CMakeLists.txt	2011-03-19 16:53:56.057824481 +0100
+@@ -50,7 +50,7 @@
+ 
+ kde4_add_kdeinit_executable(plasma-desktop ${plasma_SRCS})
+ 
+-target_link_libraries(kdeinit_plasma-desktop ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KTEXTEDITOR_LIBS} ${QT_QTSCRIPT_LIBRARY} kworkspace plasmagenericshell)
++target_link_libraries(kdeinit_plasma-desktop ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KTEXTEDITOR_LIBS} ${KDE4_KUTILS_LIBS} ${QT_QTSCRIPT_LIBRARY} kworkspace plasmagenericshell)
+ 
+ if(UNIX AND Q_WS_X11)
+     target_link_libraries(kdeinit_plasma-desktop ${X11_LIBRARIES})
+diff -burN kdebase-workspace-4.6.1/plasma/desktop/shell/panelview.cpp kdebase-workspace-4.6.1.patch/plasma/desktop/shell/panelview.cpp
+--- kdebase-workspace-4.6.1/plasma/desktop/shell/panelview.cpp	2011-02-25 23:10:02.000000000 +0100
++++ kdebase-workspace-4.6.1.patch/plasma/desktop/shell/panelview.cpp	2011-03-19 17:00:47.334184743 +0100
+@@ -30,8 +30,9 @@
+ #include <X11/extensions/shape.h>
+ #endif
+ 
+-#include <KWindowSystem>
+ #include <KDebug>
++#include <KIdleTime>
++#include <KWindowSystem>
+ 
+ #include <Plasma/Containment>
+ #include <Plasma/Corona>
+@@ -309,6 +310,7 @@
+       m_glowBar(0),
+       m_mousePollTimer(0),
+       m_strutsTimer(new QTimer(this)),
++      m_rehideAfterAutounhideTimer(new QTimer(this)),
+       m_spacer(0),
+       m_spacerIndex(-1),
+       m_shadowWindow(0),
+@@ -318,7 +320,8 @@
+       m_visibilityMode(NormalPanel),
+       m_lastHorizontal(true),
+       m_editing(false),
+-      m_triggerEntered(false)
++      m_triggerEntered(false),
++      m_respectStatus(true)
+ {
+     // KWin setup
+     KWindowSystem::setOnAllDesktops(winId(), true);
+@@ -328,6 +331,12 @@
+     m_strutsTimer->setSingleShot(true);
+     connect(m_strutsTimer, SIGNAL(timeout()), this, SLOT(updateStruts()));
+ 
++    // this timer controls checks to re-hide a panel after it's been unhidden
++    // for the user because, e.g., something is demanding attention
++    m_rehideAfterAutounhideTimer->setSingleShot(true);
++    m_rehideAfterAutounhideTimer->setInterval(AUTOUNHIDE_CHECK_DELAY);
++    connect(m_rehideAfterAutounhideTimer, SIGNAL(timeout()), this, SLOT(checkAutounhide()));
++
+     // Graphics view setup
+     setFrameStyle(QFrame::NoFrame);
+     //setAutoFillBackground(true);
+@@ -399,7 +408,7 @@
+         disconnect(oldContainment);
+     }
+ 
+-    connect(containment, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(setStatus(Plasma::ItemStatus)));
++    connect(containment, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(statusUpdated(Plasma::ItemStatus)));
+     connect(containment, SIGNAL(destroyed(QObject*)), this, SLOT(panelDeleted()));
+     connect(containment, SIGNAL(toolBoxToggled()), this, SLOT(togglePanelController()));
+     connect(containment, SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), this, SLOT(appletAdded(Plasma::Applet *)));
+@@ -438,6 +447,11 @@
+ 
+     updateStruts();
+     checkShadow();
++
++    // if we are an autohiding panel, then see if the status mandates we do something about it
++    if (m_visibilityMode != NormalPanel && m_visibilityMode != WindowsGoBelow) {
++        checkUnhide(containment->status());
++    }
+ }
+ 
+ void PanelView::themeChanged()
+@@ -1396,7 +1410,7 @@
+     }
+ }
+ 
+-void PanelView::setStatus(Plasma::ItemStatus newStatus)
++void PanelView::statusUpdated(Plasma::ItemStatus newStatus)
+ {
+     if (newStatus == Plasma::AcceptingInputStatus) {
+         KWindowSystem::forceActiveWindow(winId());
+@@ -1405,14 +1419,50 @@
+ 
+ void PanelView::checkUnhide(Plasma::ItemStatus newStatus)
+ {
+-    //kDebug() << "================= got a new status: " << newStatus << Plasma::ActiveStatus;
++    //kDebug() << "================= got a status: " << newStatus << Plasma::ActiveStatus;
++    m_respectStatus = true;
++
+     if (newStatus > Plasma::ActiveStatus) {
+         unhide();
++        if (newStatus == Plasma::NeedsAttentionStatus) {
++            //kDebug() << "starting the timer!";
++            // start our rehide timer, so that the panel doesn't stay up and stuck forever and a day
++            m_rehideAfterAutounhideTimer->start();
++        }
+     } else {
++        //kDebug() << "new status, just autohiding";
+         startAutoHide();
+     }
+ }
+ 
++void PanelView::checkAutounhide()
++{
++    //kDebug() << "***************************" << KIdleTime::instance()->idleTime();
++    if (KIdleTime::instance()->idleTime() >= AUTOUNHIDE_CHECK_DELAY) {
++        // the user is idle .. let's not hige the panel on them quite yet, but rather given them a
++        // chance to see this thing!
++        connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), this, SLOT(checkAutounhide()),
++                Qt::UniqueConnection);
++        KIdleTime::instance()->catchNextResumeEvent();
++        //kDebug() << "exit 1 ***************************";
++        return;
++    }
++
++    m_respectStatus = false;
++    //kDebug() << "in to check ... who's resonsible?" << sender() << KIdleTime::instance();
++    if (sender() == KIdleTime::instance()) {
++        //kDebug() << "doing a 2s wait";
++        QTimer::singleShot(2000, this, SLOT(startAutoHide()));
++    } else {
++        //kDebug() << "just starting autohide!";
++        startAutoHide();
++    }
++
++    // this line must come after the check on sender() as it *clears* that value!
++    disconnect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), this, SLOT(checkAutounhide()));
++    //kDebug() << "exit 0 ***************************";
++}
++
+ void PanelView::unhide()
+ {
+     unhide(true);
+@@ -1425,10 +1475,16 @@
+ 
+ void PanelView::startAutoHide()
+ {
+-    //TODO: is 5s too long? not long enough?
+-    if (m_editing || (containment() && containment()->status() > Plasma::ActiveStatus) ||
+-        geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) ||
+-        hasPopup()) {
++	 if (m_editing || (m_respectStatus && (containment() && containment()->status() > Plasma::ActiveStatus))) {
++		if (m_mousePollTimer) {
++			m_mousePollTimer->stop();
++			disconnect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(startAutoHide()));
++		}
++		return;
++	}
++	m_rehideAfterAutounhideTimer->stop();
++
++	if (geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) || hasPopup()) {
+         if (!m_mousePollTimer) {
+             leaveEvent(0);
+         }
+diff -burN kdebase-workspace-4.6.1/plasma/desktop/shell/panelview.h kdebase-workspace-4.6.1.patch/plasma/desktop/shell/panelview.h
+--- kdebase-workspace-4.6.1/plasma/desktop/shell/panelview.h	2011-02-25 22:54:49.000000000 +0100
++++ kdebase-workspace-4.6.1.patch/plasma/desktop/shell/panelview.h	2011-03-19 16:53:56.064491239 +0100
+@@ -141,7 +141,7 @@
+     /**
+      * Decides whether give focus to the panel
+      */
+-    void setStatus(Plasma::ItemStatus newStatus);
++    void statusUpdated(Plasma::ItemStatus newStatus);
+ 
+     /**
+      * Pinches the min/max sizes of the containment to the current screen resolution
+@@ -240,6 +240,7 @@
+     void overlayMoved(PanelAppletOverlay *overlay);
+     void panelDeleted();
+     void startAutoHide();
++    void checkAutounhide();
+ 
+     /**
+      * update the appearance of the unhide hinter
+@@ -269,6 +270,7 @@
+     GlowBar *m_glowBar;
+     QTimer *m_mousePollTimer;
+     QTimer *m_strutsTimer;
++    QTimer *m_rehideAfterAutounhideTimer;
+     QTimeLine *m_timeLine;
+     QGraphicsWidget *m_spacer;
+     int m_spacerIndex;
+@@ -290,7 +292,10 @@
+ 
+     bool m_editing : 1;
+     bool m_triggerEntered : 1;
++    bool m_respectStatus : 1;
++
+     static const int STRUTSTIMERDELAY = 200;
++    static const int AUTOUNHIDE_CHECK_DELAY = 3000;
+ };
+ 
+ #endif
diff --git a/kdebase-workspace.spec b/kdebase-workspace.spec
index cdfca98..c3ac630 100644
--- a/kdebase-workspace.spec
+++ b/kdebase-workspace.spec
@@ -8,7 +8,7 @@ Version: 4.6.1
 # for .0 releases we have to use '00' as '0' is treated as null by cmake, dont' forget to update
 %define kde4workspace_version 4.6.1
 
-Release: 5%{?dist}
+Release: 6%{?dist}
 
 License: GPLv2
 Group:   User Interface/Desktops
@@ -70,6 +70,9 @@ Patch50: kdebase-workspace-4.3.3-kde#171685.patch
 Patch100: kdebase-workspace-4.6.1-solid_nm_emit.patch 
 # https://projects.kde.org/projects/kde/kdebase/kde-workspace/repository/revisions/c3b28d90cf2c5f9efb57bdc764361c6a596f1749
 Patch101: kdebase-workspace-4.6.1-notification_resizing.patch
+# 690450: Autohide panel gets visible on taskbar changes and does not hide itself (kde#258012)
+# https://projects.kde.org/projects/kde/kdebase/kde-workspace/repository/revisions/f506210c74ab65c8bb1d6de3b2332d374c7cbfcc
+Patch102: kdebase-workspace-4.6.1-kde#258012-hide-panel.patch
 
 ## Fedora specific patches
 # HALsectomy
@@ -314,6 +317,7 @@ Requires: akonadi
 # 4.6 patches
 %patch100 -p1 -b .solid_nm_emit
 %patch101 -p1 -b .notification_resizing
+%patch102 -p1 -b .kde#258012-hide-panel
 
 # trunk patches
 
@@ -736,6 +740,9 @@ fi
 
 
 %changelog
+* Wed Mar 30 2011 Jaroslav Reznik <jreznik at redhat.com> 4.6.1-6
+- Autohide panel gets visible and does not hide itself (#690450)
+
 * Thu Mar 24 2011 Dan Williams <dcbw at redhat.com> 4.6.1-5
 - Rebuild with NM 0.9 compat patches
 


More information about the scm-commits mailing list