Bug 113160

Summary: Panel buttons and taskbar background render incorrectly with transperancy enabled
Product: [Unmaintained] kicker Reporter: Nick Thompson <nickthompson>
Component: generalAssignee: Aaron J. Seigo <aseigo>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: corrupt kicker backgrounds

Description Nick Thompson 2005-09-23 17:42:40 UTC
Version:           3.4.91 (using KDE 3.4.91 (beta1, >= 20050910), compiled sources)
Compiler:          gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-42)
OS:                Linux (i686) release 2.4.21-20.ELsmp

I have transparency enabled in kicker, and I see corruptions of the button backgrounds and taskbar backgrounds as shown (if I can figure out where to attach the screenshot...)

If mouse over effects are disabled, the buttons always get the corruption shown on the konsole and Konqi icon in the screenie as I mouse over them. If I have have tooltips on and wait for the tip to appear on a button, then mouse over the buttons, the corruption is removed again.

The task bar corruption appear and disappears randomly as I switch desktops.

I'll follow up with the screenie if I can't attach in the wizard...
Comment 1 Nick Thompson 2005-09-23 17:43:45 UTC
Created attachment 12672 [details]
corrupt kicker backgrounds
Comment 2 Aaron J. Seigo 2005-09-24 04:42:49 UTC
SVN commit 463429 by aseigo:

paint button backgrounds properly
BUGS:113093,113160


 M  +50 -2     kicker/core/container_button.cpp  
 M  +6 -2      libkicker/panelbutton.cpp  


--- branches/KDE/3.5/kdebase/kicker/kicker/core/container_button.cpp #463428:463429
@@ -36,6 +36,7 @@
 #include "global.h"
 #include "appletop_mnu.h"
 
+#include "containerarea.h"
 #include "panelbutton.h"
 #include "bookmarksbutton.h"
 #include "browserbutton.h"
@@ -43,6 +44,7 @@
 #include "extensionbutton.h"
 #include "kbutton.h"
 #include "kicker.h"
+#include "kickerSettings.h"
 #include "kickertip.h"
 #include "nonkdeappbutton.h"
 #include "paneldrag.h"
@@ -94,13 +96,59 @@
     return width;
 }
 
+#include <iostream>
+using namespace std;
 void ButtonContainer::setBackground()
 {
     PanelButton* b = button();
-    if (b)
+    if (!b)
     {
-        b->repaint();
+        return;
     }
+
+cout << "ButtonContainer::setBackground()" << endl;
+    b->unsetPalette();
+
+    if (!KickerSettings::transparent())
+    {
+        b->update();
+        return;
+    }
+
+    // inheritance is ButtonContainer - ScrollView - ContainerArea
+    ContainerArea* area = 0;
+    QObject* ancestor = parent();
+    while (ancestor && !area)
+    {
+        area = dynamic_cast<ContainerArea*>(ancestor);
+        ancestor = ancestor->parent();
+    }
+
+    const QPixmap* containerBG = area ? area->completeBackgroundPixmap()
+                                        : 0;
+
+    if (!containerBG || containerBG->isNull())
+    {
+cout << "\tsetting no background!" << endl;
+        b->setPaletteBackgroundPixmap(QPixmap());
+    }
+    else
+    {
+        int srcx = x();
+        int srcy = y();
+        int buttonWidth = b->width();
+        int buttonHeight = b->height();
+
+        QPixmap buttonBackground(buttonWidth, buttonHeight);
+        copyBlt(&buttonBackground, 0, 0,
+                containerBG, srcx, srcy,
+                buttonWidth, buttonHeight);
+
+        b->setPaletteBackgroundPixmap(buttonBackground);
+    cout << "\tbackground set!" << endl;
+    }
+
+    b->update();
 }
 
 void ButtonContainer::configure()
--- branches/KDE/3.5/kdebase/kicker/libkicker/panelbutton.cpp #463428:463429
@@ -502,13 +502,17 @@
 
 void PanelButton::drawButton(QPainter *p)
 {
-    // Draw the background. This is always needed, even when using tiles,
-    // because they don't have to cover the entire button.
     if (m_tileColor.isValid())
     {
         p->fillRect(rect(), m_tileColor);
         style().drawPrimitive(QStyle::PE_Panel, p, rect(), colorGroup());
     }
+    else if (paletteBackgroundPixmap())
+    {
+        // Draw the background. This is always needed, even when using tiles,
+        // because they don't have to cover the entire button.
+        p->drawPixmap(0, 0, *paletteBackgroundPixmap());
+    }
 
     const QPixmap& tile = (isDown() || isOn()) ? m_down : m_up;
     if (!tile.isNull())
Comment 3 Nick Thompson 2005-09-26 11:35:45 UTC
Panel buttons seem much less likely to suffer from the effects I attached in the previous screen shot after updating only the two files patched. But it does still happen. I'm finding it very difficult to reproduce now though. I didn't screenshot it when I got it to happen because it looks the same as before.

Also the taskbar, systray, clock and logout/lock applet backgrounds all still get turned to grey, as in my previous screen shot.

(I really wish KDE had anonymous svn+http access. Damn file walls :( )
Comment 4 Nick Thompson 2005-09-26 12:45:40 UTC
I seem to be able to reproduce it a lot easier now. If mouse over doesn't cause the issue, then clicking on one of the buttons seems to put it in a bad state. After clicking on a button, its background get corrupted as before, but mousing over further buttons, corrupts them as well now. Mouse over now seems to stay in that bad state.

Clicking a button again, puts it back into a good state, correcting the button backgrounds as I mouse over the icons.

The taskbar etc background corruptions, still seems to happen randomly as I change desktops. Sometimes it right, sometimes its wrong. Its about 50-50.
Comment 5 Aaron J. Seigo 2005-09-26 16:52:28 UTC
nick, the other bug report (113093) referenced has already been re-opened. i'm on top of this, please don't make more work for me by going around and managing bugs assigned to me. thanks.

*** This bug has been marked as a duplicate of 113093 ***