LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kdebase-pardus-window-list-fix.patch of Package kdebase3 (Project openSUSE:Factory)

From 7902c0c8a09abcdc0904fe352b30e352a404ebd5 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ozan=20=C3=87a=C4=9Flayan?= <ozan@pardus.org.tr>
Date: Fri, 24 Jun 2011 09:37:32 +0000
Subject: [PATCH] kicker: windowlistbutton fix

---
 kicker/kicker/buttons/windowlistbutton.cpp |   17 +++++++++++++++++
 kicker/kicker/buttons/windowlistbutton.h   |    9 +++++++++
 kicker/libkicker/panelbutton.cpp           |    8 ++++++++
 kicker/libkicker/panelbutton.h             |    1 +
 4 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/kicker/kicker/buttons/windowlistbutton.cpp b/kicker/kicker/buttons/windowlistbutton.cpp
index 8a60ca5..0e7db23 100644
--- a/kicker/kicker/buttons/windowlistbutton.cpp
+++ b/kicker/kicker/buttons/windowlistbutton.cpp
@@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include <kwindowlistmenu.h>
 #include <klocale.h>
+#include <kwinmodule.h>
 
 #include "windowlistbutton.h"
 #include "windowlistbutton.moc"
@@ -39,9 +40,25 @@ WindowListButton::WindowListButton( QWidget* parent )
     setTitle(i18n("Window List"));
     QToolTip::add(this, i18n("Window list"));
     setIcon("window_list");
+
+    m_winModule = new KWinModule();
+    
+    connect( m_winModule, SIGNAL(activeWindowChanged(WId)),
+             this, SLOT(activeWindowChanged(WId)) );
 }
 
 void WindowListButton::initPopup()
 {
     topMenu->init();
 }
+
+void WindowListButton::activeWindowChanged( WId win )
+{
+    int size = preferredIconSize();
+    QImage img (KWin::icon( win ).convertToImage());
+    img = img.smoothScale( size, size );
+
+    QPixmap pix( img );
+    setIcon( pix );
+}
+
diff --git a/kicker/kicker/buttons/windowlistbutton.h b/kicker/kicker/buttons/windowlistbutton.h
index 23dc26c..ed83f8e 100644
--- a/kicker/kicker/buttons/windowlistbutton.h
+++ b/kicker/kicker/buttons/windowlistbutton.h
@@ -25,8 +25,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define __windowlistbutton_h__
 
 #include "panelbutton.h"
+#include "kwin.h"
 
 class KWindowListMenu;
+class KWinModule;
 
 /**
  * Button that contains a windowlist menu
@@ -38,11 +40,18 @@ class WindowListButton : public PanelPopupButton
 public:
     WindowListButton( QWidget* parent );
 
+protected slots:
+    void activeWindowChanged( WId win );
+
 protected:
     virtual QString tileName() { return "WindowList"; }
     virtual void initPopup();
 
     KWindowListMenu* topMenu;
+
+private:
+    KWinModule* m_winModule;
+
 };
 
 #endif
diff --git a/kicker/libkicker/panelbutton.cpp b/kicker/libkicker/panelbutton.cpp
index bf47e09..2de4ad4 100644
--- a/kicker/libkicker/panelbutton.cpp
+++ b/kicker/libkicker/panelbutton.cpp
@@ -343,6 +343,14 @@ void PanelButton::setIcon(const QString& icon)
     emit iconChanged();
 }
 
+void PanelButton::setIcon(const QPixmap& pix)
+{
+    m_icon = pix;
+    m_iconh = pix;
+    m_iconz = pix;
+    update();
+}
+
 QString PanelButton::icon() const
 {
     return m_iconName;
diff --git a/kicker/libkicker/panelbutton.h b/kicker/libkicker/panelbutton.h
index c32cc7a..7325711 100644
--- a/kicker/libkicker/panelbutton.h
+++ b/kicker/libkicker/panelbutton.h
@@ -131,6 +131,7 @@ public:
      * @param icon the path to the button's icon
      */
     void setIcon(const QString& icon);
+    void setIcon(const QPixmap&);
 
     /**
      * @return the button's icon
-- 
1.6.1