Bug 108603

Summary: Taskbar buttons produce strange effects under high CPU load
Product: [Unmaintained] kicker Reporter: Thomas McGuire <mcguire>
Component: taskbarappletAssignee: Aaron J. Seigo <aseigo>
Status: RESOLVED FIXED    
Severity: normal CC: g111, sephiron, techniq35
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot

Description Thomas McGuire 2005-07-05 20:54:10 UTC
Version:            (using KDE Devel)
OS:                Linux

When the taskbar's appearance is set to "For Transparency", the CPU load is high, for example by running make in the background and there are a few windows open, the taskbar buttons produce strange effects when the mouse is moved over them.
The cause seems to be the high CPU load, the taskbar button focus/unfocus events are queued up fast but can not be processed in time. The "Elegant" appearance seems to handle this fine.
Comment 1 Aaron J. Seigo 2005-07-06 19:32:34 UTC
can you please describe these "strange effects", or even screenshot them for me?

the reason for the slow downs, btw, will be the ShadowEngine. it's not the most efficient piece of code out there =/

do you see the problem when quickly skating the mouse back and forth over the buttons (something people don't usually do unless checking for bugs ;) or when just passing the mouse over the taskbar casually? if just casual use causes this, perhaps i could add in some code to compress out/in events so they aren't needlessly triggered.

this may be a good idea in any case .. heh.
Comment 2 Thomas McGuire 2005-07-07 07:42:48 UTC
On Wednesday 06 July 2005 19:32, Aaron J.Seigo wrote:
>can you please describe these "strange effects", or even screenshot them for 

me?
I'll try to attach a screenshot.

> do you see the problem when quickly skating the mouse back and forth over
> the buttons (something people don't usually do unless checking for bugs ;)
> or when just passing the mouse over the taskbar casually? if just casual
> use causes this, perhaps i could add in some code to compress out/in events
> so they aren't needlessly triggered.

Under high CPU load, I see this effect even when passing the mouse over the 
taskbar casually, the effect is very visible then (I was not checking for 
bugs or something like this).
Under low CPU load, I have to skate the mouse back and forth quickly to see 
the effect.
Comment 3 Thomas McGuire 2005-07-07 07:46:37 UTC
Created attachment 11700 [details]
Screenshot

This screenshot shows that 3 taskbar buttons are activated, although only one
should be at any time.
What the screenshot of course can not show is the massive amount of flicker
while moving the mouse.
Comment 4 Aaron J. Seigo 2005-10-28 05:00:56 UTC
side note: kshadowengine, which produces the halo'd text, sucks. it's very, very inneficient
Comment 5 Aaron J. Seigo 2005-12-01 18:14:55 UTC
*** Bug 115955 has been marked as a duplicate of this bug. ***
Comment 6 Aaron J. Seigo 2005-12-12 17:56:52 UTC
*** Bug 118166 has been marked as a duplicate of this bug. ***
Comment 7 Andreas Kling 2006-08-17 19:12:57 UTC
*** Bug 132546 has been marked as a duplicate of this bug. ***
Comment 8 Andreas Kling 2006-08-20 00:01:46 UTC
SVN commit 574691 by kling:

Don't create a huge pixmap for every shadow we draw.
Makes the "for transparency" taskbar style a *whole* lot faster.

BUG: 108603


 M  +1 -1      taskbar.cpp  


--- branches/KDE/3.5/kdebase/kicker/taskbar/taskbar.cpp #574690:574691
@@ -1134,7 +1134,7 @@
 
     // get a transparent pixmap
     QPainter pixPainter;
-    QPixmap textPixmap(width(), height());
+    QPixmap textPixmap(tr.size());
 
     textPixmap.fill(QColor(0,0,0));
     textPixmap.setMask(textPixmap.createHeuristicMask(true));
Comment 9 Andreas Kling 2006-08-20 00:21:05 UTC
SVN commit 574698 by kling:

Okay, I was a bit eager with the last commit, we have to modify the surroundings
a bit to make this work perfectly.

CCBUG: 108603


 M  +4 -5      taskbar.cpp  
 M  +1 -2      taskbar.h  
 M  +2 -2      taskcontainer.cpp  


--- branches/KDE/3.5/kdebase/kicker/taskbar/taskbar.cpp #574697:574698
@@ -1114,8 +1114,7 @@
 }
 
 // taken from mtaskbar, by Sebastian Wolff
-void TaskBar::drawShadowText(QPainter  &p, QRect tr, int tf, const QString & str,
-                             int len, QRect * brect, QTextParag ** internal)
+void TaskBar::drawShadowText(QPainter &p, const QRect &tr, int tf, const QString &str, const QSize &size)
 {
     // get the color of the shadow: white for dark text, black for bright text
     QPen textPen = p.pen();
@@ -1134,7 +1133,7 @@
 
     // get a transparent pixmap
     QPainter pixPainter;
-    QPixmap textPixmap(tr.size());
+    QPixmap textPixmap(size);
 
     textPixmap.fill(QColor(0,0,0));
     textPixmap.setMask(textPixmap.createHeuristicMask(true));
@@ -1143,7 +1142,7 @@
     pixPainter.begin(&textPixmap);
     pixPainter.setPen(white);
     pixPainter.setFont(p.font()); // get the font from the root painter
-    pixPainter.drawText( tr, tf, str, len, brect, internal );
+    pixPainter.drawText(tr, tf, str);
     pixPainter.end();
 
     if (!m_textShadowEngine)
@@ -1161,7 +1160,7 @@
 
     // return
     p.drawImage(0, 0, img);
-    p.drawText(tr, tf, str, len, brect, internal);
+    p.drawText(tr, tf, str);
 }
 
 QImage* TaskBar::blendGradient(const QSize& size)
--- branches/KDE/3.5/kdebase/kicker/taskbar/taskbar.h #574697:574698
@@ -61,8 +61,7 @@
     bool sortByDesktop() const { return m_sortByDesktop; }
     bool showAllWindows() const { return m_showAllWindows; }
 
-    void drawShadowText(QPainter  &p, QRect tr, int tf, const QString & str,
-                        int len = -1, QRect* brect = 0, QTextParag** internal = 0);
+    void drawShadowText(QPainter &p, const QRect &tr, int tf, const QString &str, const QSize &size);
 
     QImage* blendGradient(const QSize& size);
 
--- branches/KDE/3.5/kdebase/kicker/taskbar/taskcontainer.cpp #574697:574698
@@ -688,7 +688,7 @@
 
             if (halo)
             {
-                taskBar->drawShadowText(tp, tr, textFlags, text);
+                taskBar->drawShadowText(tp, tr, textFlags, text, size());
             }
             else
             {
@@ -708,7 +708,7 @@
 
             if (halo)
             {
-                taskBar->drawShadowText(*p, tr, textFlags, text);
+                taskBar->drawShadowText(*p, tr, textFlags, text, size());
             }
             else
             {