From 084f5750177a5e654d40ca6fac318f60afab8ebd Mon Sep 17 00:00:00 2001 From: Alexey Shvetsov Date: Sun, 12 Apr 2009 11:38:49 +0000 Subject: add missing patches; thanks to winterheart (Portage version: 2.2_rc30/cvs/Linux x86_64) --- kde-base/plasma-workspace/ChangeLog | 6 +- .../plasma-workspace-fake-panel-transparency.patch | 219 +++++++++++++++++++++ 2 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 kde-base/plasma-workspace/files/plasma-workspace-fake-panel-transparency.patch diff --git a/kde-base/plasma-workspace/ChangeLog b/kde-base/plasma-workspace/ChangeLog index f1a0f22574ba..23f8e70da343 100644 --- a/kde-base/plasma-workspace/ChangeLog +++ b/kde-base/plasma-workspace/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for kde-base/plasma-workspace # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/kde-base/plasma-workspace/ChangeLog,v 1.17 2009/04/12 06:41:39 alexxy Exp $ +# $Header: /var/cvsroot/gentoo-x86/kde-base/plasma-workspace/ChangeLog,v 1.18 2009/04/12 11:38:48 alexxy Exp $ + + 12 Apr 2009; Alexey Shvetsov + +files/plasma-workspace-fake-panel-transparency.patch: + add missing patches; thanks to winterheart *plasma-workspace-4.2.2 (11 Apr 2009) diff --git a/kde-base/plasma-workspace/files/plasma-workspace-fake-panel-transparency.patch b/kde-base/plasma-workspace/files/plasma-workspace-fake-panel-transparency.patch new file mode 100644 index 000000000000..fe2e42b66a95 --- /dev/null +++ b/kde-base/plasma-workspace/files/plasma-workspace-fake-panel-transparency.patch @@ -0,0 +1,219 @@ +Index: plasma/containments/panel/panel.h +=================================================================== +--- plasma/containments/panel/panel.h (Revision 940781) ++++ plasma/containments/panel/panel.h (Arbeitskopie) +@@ -54,6 +54,9 @@ + protected: + void saveState(KConfigGroup &config) const; + ++ public slots: ++ void setBlendInterface(bool); ++ + private slots: + void themeUpdated(); + void backgroundChanged(); +@@ -83,6 +86,7 @@ + bool m_maskDirty; + int m_spacerIndex; + Spacer *m_spacer; ++ bool m_blendInterface; + + friend class Spacer; + }; +Index: plasma/containments/panel/panel.cpp +=================================================================== +--- plasma/containments/panel/panel.cpp (Revision 940781) ++++ plasma/containments/panel/panel.cpp (Arbeitskopie) +@@ -93,7 +93,8 @@ + m_currentSize(QSize(Kephal::ScreenUtils::screenSize(screen()).width(), 35)), + m_maskDirty(true), + m_spacerIndex(-1), +- m_spacer(0) ++ m_spacer(0), ++ m_blendInterface(false) + { + m_background = new Plasma::FrameSvg(this); + m_background->setImagePath("widgets/panel-background"); +@@ -495,6 +496,10 @@ + } + } + ++void Panel::setBlendInterface(bool blend) { ++ m_blendInterface = blend; ++} ++ + void Panel::saveState(KConfigGroup &config) const + { + config.writeEntry("minimumSize", minimumSize()); +@@ -564,8 +569,8 @@ + } + } + +- // blit the background (saves all the per-pixel-products that blending does) +- painter->setCompositionMode(QPainter::CompositionMode_Source); ++ // blit the background (saves all per-pixel-products that blending does) ++ painter->setCompositionMode(m_blendInterface ? QPainter::CompositionMode_SourceOver : QPainter::CompositionMode_Source); + painter->setRenderHint(QPainter::Antialiasing); + + m_background->paintFrame(painter, option->exposedRect); +Index: plasma/shells/desktop/desktopview.h +=================================================================== +--- plasma/shells/desktop/desktopview.h (Revision 940781) ++++ plasma/shells/desktop/desktopview.h (Arbeitskopie) +@@ -82,6 +82,7 @@ + void setContainment(Plasma::Containment *containment); + + protected: ++ void paintEvent(QPaintEvent* event); + void wheelEvent(QWheelEvent *event); + void drawBackground(QPainter *painter, const QRectF &rect); + +Index: plasma/shells/desktop/desktopview.cpp +=================================================================== +--- plasma/shells/desktop/desktopview.cpp (Revision 940781) ++++ plasma/shells/desktop/desktopview.cpp (Arbeitskopie) +@@ -42,6 +42,7 @@ + #include "dashboardview.h" + #include "plasmaapp.h" + #include "plasma-shell-desktop.h" ++#include "panelview.h" + + #ifdef Q_WS_WIN + #include "windows.h" +@@ -263,6 +264,15 @@ + } + } + ++void DesktopView::paintEvent(QPaintEvent* event) { ++ foreach(PanelView* view, PlasmaApp::self()->panelViews()) { ++ QRect intersection = view->geometry() & QRect(mapToGlobal(event->rect().topLeft()), mapToGlobal(event->rect().bottomRight())); ++ if(!intersection.isEmpty()) ++ view->undergroundChanged(QRect(view->mapFromGlobal(intersection.topLeft()), view->mapFromGlobal(intersection.bottomRight()))); ++ } ++ QGraphicsView::paintEvent(event); ++} ++ + void DesktopView::wheelEvent(QWheelEvent* event) + { + QGraphicsItem * item = scene() ? scene()->itemAt(sceneRect().topLeft() + event->pos()) : 0; +Index: plasma/shells/desktop/panelview.h +=================================================================== +--- plasma/shells/desktop/panelview.h (Revision 940781) ++++ plasma/shells/desktop/panelview.h (Arbeitskopie) +@@ -177,6 +177,11 @@ + */ + void recreateUnhideTrigger(); + ++ /** ++ * Notification that the undergound of this panel-view has changed ++ */ ++ void undergroundChanged(QRect area); ++ + protected Q_SLOTS: + void updateStruts(); + +Index: plasma/shells/desktop/panelview.cpp +=================================================================== +--- plasma/shells/desktop/panelview.cpp (Revision 940781) ++++ plasma/shells/desktop/panelview.cpp (Arbeitskopie) +@@ -44,6 +44,7 @@ + #include "plasmaapp.h" + + #include ++#include "desktopview.h" + + class GlowBar : public QWidget + { +@@ -1197,13 +1198,43 @@ + Plasma::View::leaveEvent(event); + } + +-void PanelView::drawBackground(QPainter *painter, const QRectF &rect) +-{ +- if (PlasmaApp::hasComposite()) { +- painter->setCompositionMode(QPainter::CompositionMode_Source); +- painter->fillRect(rect.toAlignedRect(), Qt::transparent); +- } else { +- Plasma::View::drawBackground(painter, rect); ++bool useDesktopTransparency = true; ++ ++void PanelView::undergroundChanged(QRect area) { ++ if(!PlasmaApp::hasComposite() && useDesktopTransparency) ++ update(area); ++} ++ ++void PanelView::drawBackground(QPainter *painter, const QRectF &_rect) ++{ ++ QRectF rect(_rect); ++ DesktopView* desktopView = PlasmaApp::self()->viewForPanel(this); ++ if(containment()) ++ QMetaObject::invokeMethod(containment(), "setBlendInterface", Q_ARG(bool, false)); ++ ++ if (PlasmaApp::hasComposite()) { ++ painter->setCompositionMode(QPainter::CompositionMode_Source); ++ painter->fillRect(rect.toAlignedRect(), Qt::transparent); ++ } else if(desktopView && useDesktopTransparency) { ++ painter->setCompositionMode(QPainter::CompositionMode_Source); ++ ++ //Map 'rect' from the panel into the desktop view ++ QRectF desktopRect = mapFromScene(rect).boundingRect(); ++ desktopRect.translate(pos().x(), pos().y()); ++ desktopRect.translate(-desktopView->pos().x(), -desktopView->pos().y()); ++ QRect grab = desktopRect.toRect(); ++ grab &= QRect(QPoint(0, 0), desktopView->size()); //Sometimes the scene-mapping maps one pixel too far outside, so restrict the area ++ ++ useDesktopTransparency = false; //Disable desktop transparency temporarily to prevent endless updating from within undergoundChanged ++ QPixmap grabbed = QPixmap::grabWidget(desktopView, grab); ++ useDesktopTransparency = true; ++ ++ painter->drawPixmap(rect, grabbed, QRectF(0, 0, grab.width(), grab.height())); ++ ++ if(containment()) //Tell the panel to blend the interface over the background, so it isn't discarded ++ QMetaObject::invokeMethod(containment(), "setBlendInterface", Q_ARG(bool, true)); ++ }else{ ++ Plasma::View::drawBackground(painter, rect); + } + } + +Index: plasma/shells/desktop/plasmaapp.h +=================================================================== +--- plasma/shells/desktop/plasmaapp.h (Revision 940781) ++++ plasma/shells/desktop/plasmaapp.h (Arbeitskopie) +@@ -80,6 +80,11 @@ + */ + QList panelViews() const; + ++ /** ++ * Returns the currently active desktop that this panel is visible on, or zero ++ */ ++ DesktopView* viewForPanel(PanelView* panel) const; ++ + static bool isPanelContainment(Plasma::Containment *containment); + + #ifdef Q_WS_X11 +Index: plasma/shells/desktop/plasmaapp.cpp +=================================================================== +--- plasma/shells/desktop/plasmaapp.cpp (Revision 940781) ++++ plasma/shells/desktop/plasmaapp.cpp (Arbeitskopie) +@@ -446,6 +446,21 @@ + } + } + ++DesktopView* PlasmaApp::viewForPanel(PanelView* panel) const { ++ ++ int currentDesktop = -1; ++ if (AppSettings::perVirtualDesktopViews()) ++ currentDesktop = KWindowSystem::currentDesktop()-1; ++ ++ ++ foreach (DesktopView *view, m_desktops) ++ if((view->desktop() == currentDesktop || currentDesktop == -1) && !(view->geometry() & panel->geometry()).isEmpty()) ++ if(!view->isHidden()) ++ return view; ++ ++ return 0; ++} ++ + DesktopView* PlasmaApp::viewForScreen(int screen, int desktop) const + { + foreach (DesktopView *view, m_desktops) { -- cgit v1.2.3-65-gdbad