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

List:       kde-devel
Subject:    kicker, windowlistbutton shows the active window icon
From:       Barış_Metin <baris () uludag ! org ! tr>
Date:       2005-04-14 12:30:33
Message-ID: 200504141530.35997.baris () uludag ! org ! tr
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hello,

I've started using windowlist button for a while. But windowlist button had an 
annoying behaviour for me. It doesn't show the active window's icon, which 
would be cool IMO :).

I've prepared a quick patch in my coffee break. The patch is attached.

I'm not sure if the patch is suitable for including in kicker, as I proposed a 
new function for PanelButton - setIcon(const QPixmap&).

What do you think?

regards,
-- 
Barış Metin

["kicker-kwindowlistbutton.patch" (text/x-diff)]

diff -ur kdebase-3.4.0.orig/kicker/buttons/windowlistbutton.cpp \
                kdebase-3.4.0/kicker/buttons/windowlistbutton.cpp
--- kdebase-3.4.0.orig/kicker/buttons/windowlistbutton.cpp	2005-04-14 \
                12:58:52.073205496 +0300
+++ kdebase-3.4.0/kicker/buttons/windowlistbutton.cpp	2005-04-14 15:14:39.891548832 \
+0300 @@ -25,6 +25,7 @@
 
 #include <kwindowlistmenu.h>
 #include <klocale.h>
+#include <kwinmodule.h>
 
 #include "windowlistbutton.h"
 #include "windowlistbutton.moc"
@@ -39,9 +40,24 @@
     setTitle(i18n("Window List"));
     setTip(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 -ur kdebase-3.4.0.orig/kicker/buttons/windowlistbutton.h \
                kdebase-3.4.0/kicker/buttons/windowlistbutton.h
--- kdebase-3.4.0.orig/kicker/buttons/windowlistbutton.h	2005-04-14 \
                12:58:52.073205496 +0300
+++ kdebase-3.4.0/kicker/buttons/windowlistbutton.h	2005-04-14 13:16:17.000000000 \
+0300 @@ -25,8 +25,10 @@
 #define __windowlistbutton_h__
 
 #include "panelbutton.h"
+#include "kwin.h"
 
 class KWindowListMenu;
+class KWinModule;
 
 /**
  * Button that contains a windowlist menu
@@ -38,11 +40,17 @@
 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 -ur kdebase-3.4.0.orig/kicker/share/panelbutton.cpp \
                kdebase-3.4.0/kicker/share/panelbutton.cpp
--- kdebase-3.4.0.orig/kicker/share/panelbutton.cpp	2005-04-14 12:58:54.490837960 \
                +0300
+++ kdebase-3.4.0/kicker/share/panelbutton.cpp	2005-04-14 14:56:27.540611416 +0300
@@ -152,6 +152,14 @@
     emit iconChanged();
 }
 
+void PanelButton::setIcon(const QPixmap& pix)
+{
+    m_icon = pix;
+    m_iconh = pix;
+    m_iconz = pix;
+    update();
+}
+
 QImage PanelButton::loadTile(const QString& tile,
                              const QSize& size,
                              const QString& state)
diff -ur kdebase-3.4.0.orig/kicker/share/panelbutton.h \
                kdebase-3.4.0/kicker/share/panelbutton.h
--- kdebase-3.4.0.orig/kicker/share/panelbutton.h	2005-04-14 12:58:54.490837960 +0300
+++ kdebase-3.4.0/kicker/share/panelbutton.h	2005-04-14 13:38:51.274471464 +0300
@@ -61,6 +61,7 @@
     void setDrawArrow(bool drawArrow);
 
     void setIcon(const QString&);
+    void setIcon(const QPixmap&);
     const QString& icon() const { return m_iconName; }
 
     Orientation orientation() const { return m_orientation; }


[Attachment #8 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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