From 9e6ed6ed87f2b143aa296e00b2f1e64010c9c990 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Wed, 7 May 2008 00:18:18 +0000 Subject: [PATCH] - Backport upstream patch to port kde4-window-decorator to KDE 4.1 libplasma --- compiz-0.7.2-kde41-libplasma.patch | 240 +++++++++++++++++++++++++++++ compiz.spec | 11 +- 2 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 compiz-0.7.2-kde41-libplasma.patch diff --git a/compiz-0.7.2-kde41-libplasma.patch b/compiz-0.7.2-kde41-libplasma.patch new file mode 100644 index 0000000..4e5a61c --- /dev/null +++ b/compiz-0.7.2-kde41-libplasma.patch @@ -0,0 +1,240 @@ +From: Dennis Kasprzyk +Date: Tue, 6 May 2008 20:57:17 +0000 (+0200) +Subject: Applied plasma API changes. +X-Git-Url: http://gitweb.freedesktop.org/?p=xorg/app/compiz.git;a=commitdiff;h=ea6a2ce70ed5ff1a3544fd3165e21559d4f70854 + +Applied plasma API changes. +--- + +--- a/kde/window-decorator-kde4/decorator.cpp ++++ b/kde/window-decorator-kde4/decorator.cpp +@@ -23,6 +23,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -106,6 +107,9 @@ KWD::Decorator::Decorator (Display* disp + + mActiveId = 0; + ++ KConfigGroup cfg (KSharedConfig::openConfig("plasmarc"), QString("Theme")); ++ Plasma::Theme::defaultTheme ()->setThemeName (cfg.readEntry ("name")); ++ + Atoms::init (); + + (void *) new KWinAdaptor (this); +@@ -237,9 +241,9 @@ KWD::Decorator::enableDecorations (Time + + connect (&mIdleTimer, SIGNAL (timeout ()), SLOT (processDamage ())); + +- connect (Plasma::Theme::self (), SIGNAL (changed ()), ++ connect (Plasma::Theme::defaultTheme (), SIGNAL (themeChanged ()), + SLOT (plasmaThemeChanged ())); +- ++ + // select for client messages + XSelectInput (QX11Info::display(), QX11Info::appRootWindow(), + StructureNotifyMask | PropertyChangeMask); +--- a/kde/window-decorator-kde4/switcher.cpp ++++ b/kde/window-decorator-kde4/switcher.cpp +@@ -30,7 +30,7 @@ + + #include + +-#include ++#include + #include + + #include +@@ -43,15 +43,20 @@ mId (id) + { + QPalette palette; + long prop[4]; +- QColor color = Plasma::Theme::self ()->textColor (); ++ QColor color; ++ color = Plasma::Theme::defaultTheme ()->color (Plasma::Theme::TextColor); + +- mBackground = new Plasma::Svg("widgets/background"); +- +- mBorder.left = mBackground->elementSize ("left").width (); +- mBorder.right = mBackground->elementSize ("right").width (); +- mBorder.top = mBackground->elementSize ("top").height (); +- mBorder.bottom = mBackground->elementSize ("bottom").height () + +- Plasma::Theme::self ()->fontMetrics ().height () + 10; ++ mBackground = new Plasma::PanelSvg(); ++ mBackground->setImagePath ("dialogs/background"); ++ mBackground->setEnabledBorders(Plasma::PanelSvg::AllBorders); ++ ++ kDebug() << Plasma::Theme::defaultTheme ()->themeName(); ++ kDebug () << KGlobal::mainComponent().componentName(); ++ mBorder.left = mBackground->marginSize(Plasma::LeftMargin); ++ mBorder.right = mBackground->marginSize(Plasma::RightMargin); ++ mBorder.top = mBackground->marginSize(Plasma::TopMargin); ++ mBorder.bottom = mBackground->marginSize(Plasma::BottomMargin) + ++ Plasma::Theme::defaultTheme ()->fontMetrics ().height () + 10; + + mContext.extents.left = mBorder.left; + mContext.extents.right = mBorder.right; +@@ -115,14 +120,6 @@ KWD::Switcher::updateGeometry () + updateWindowProperties (); + } + +-/* +- * This code is taken from KDE/kdebase/workspace/libs/plasma/dialog.cpp +- * +- * Copyright (C) 2007 by Alexis Ménard +- * Copyright (C) 2007 Sebastian Kuegler +- * Copyright (C) 2006 Aaron Seigo +- */ +- + void + KWD::Switcher::redrawPixmap () + { +@@ -131,92 +128,14 @@ KWD::Switcher::redrawPixmap () + const int contentWidth = mPixmap.width (); + const int contentHeight = mPixmap.height (); + +- const int topHeight = mBackground->elementSize ("top").height (); +- const int topWidth = mBackground->elementSize ("top").width (); +- const int leftWidth = mBackground->elementSize ("left").width (); +- const int leftHeight = mBackground->elementSize ("left").height (); +- const int rightHeight = mBackground->elementSize ("right").height (); +- const int rightWidth = mBackground->elementSize ("right").width (); +- const int bottomHeight = mBackground->elementSize ("bottom").height (); +- const int bottomWidth = mBackground->elementSize ("bottom").width (); +- +- const int topOffset = 0; +- const int leftOffset = 0; +- const int rightOffset = contentWidth - rightWidth; +- const int bottomOffset = contentHeight - bottomHeight; +- const int contentTop = topHeight; +- const int contentLeft = leftWidth; +- + mPixmap.fill (Qt::transparent); + + p.setCompositionMode (QPainter::CompositionMode_Source); + p.setRenderHint (QPainter::SmoothPixmapTransform); + +- mBackground->resize (contentWidth, contentHeight); +- mBackground->paint (&p, QRect (contentLeft, contentTop, contentWidth, +- contentHeight), "center"); +- mBackground->resize (); +- +- mBackground->paint (&p, QRect (leftOffset, topOffset, +- leftWidth, topHeight), "topleft"); +- mBackground->paint (&p, QRect (rightOffset, topOffset, +- rightWidth, topHeight), "topright"); +- mBackground->paint (&p, QRect (leftOffset, bottomOffset, +- leftWidth, bottomHeight), "bottomleft"); +- mBackground->paint (&p, QRect (rightOffset, bottomOffset, +- rightWidth, bottomHeight), "bottomright"); +- +- if (mBackground->elementExists ("hint-stretch-borders")) { +- mBackground->paint (&p, QRect (leftOffset, contentTop, +- leftWidth, contentHeight), "left"); +- mBackground->paint (&p, QRect (rightOffset, contentTop, +- rightWidth, contentHeight), "right"); +- mBackground->paint (&p, QRect (contentLeft, topOffset, +- contentWidth, topHeight), "top"); +- mBackground->paint (&p, QRect (contentLeft, bottomOffset, +- contentWidth, bottomHeight), "bottom"); +- } else { +- QPixmap left (leftWidth, leftHeight); +- QPixmap right (rightWidth, rightHeight); +- QPixmap top (topWidth, topHeight); +- QPixmap bottom (bottomWidth, bottomHeight); +- +- left.fill (Qt::transparent); +- { +- QPainter sidePainter (&left); +- sidePainter.setCompositionMode (QPainter::CompositionMode_Source); +- mBackground->paint (&sidePainter, QPoint (0, 0), "left"); +- } +- p.drawTiledPixmap (QRect (leftOffset, contentTop, leftWidth, +- contentHeight - topHeight - bottomHeight), left); +- +- right.fill (Qt::transparent); +- { +- QPainter sidePainter (&right); +- sidePainter.setCompositionMode (QPainter::CompositionMode_Source); +- mBackground->paint (&sidePainter, QPoint (0, 0), "right"); +- } +- p.drawTiledPixmap (QRect (rightOffset, contentTop, rightWidth, +- contentHeight - topHeight - bottomHeight), right); +- +- top.fill (Qt::transparent); +- { +- QPainter sidePainter (&top); +- sidePainter.setCompositionMode (QPainter::CompositionMode_Source); +- mBackground->paint (&sidePainter, QPoint (0, 0), "top"); +- } +- p.drawTiledPixmap (QRect (contentLeft, topOffset, contentWidth - +- rightWidth - leftWidth, topHeight), top); +- +- bottom.fill (Qt::transparent); +- { +- QPainter sidePainter (&bottom); +- sidePainter.setCompositionMode (QPainter::CompositionMode_Source); +- mBackground->paint (&sidePainter, QPoint (0, 0), "bottom"); +- } +- p.drawTiledPixmap (QRect (contentLeft, bottomOffset, contentWidth - +- rightWidth - leftWidth, bottomHeight), bottom); +- } ++ mBackground->resizePanel (QSizeF (contentWidth, contentHeight)); ++ mBackground->paintPanel (&p, QRect (0, 0, contentWidth, ++ contentHeight)); + + mBackgroundPixmap = mPixmap.copy (mBorder.left, mBorder.top, + mGeometry.width (), +@@ -230,8 +149,9 @@ KWD::Switcher::redrawPixmap () + void + KWD::Switcher::update () + { +- QFontMetrics fm = Plasma::Theme::self ()->fontMetrics (); +- QFont font (Plasma::Theme::self ()->font ()); ++ QFontMetrics fm = Plasma::Theme::defaultTheme ()->fontMetrics (); ++ QFont font (Plasma::Theme::defaultTheme ()-> ++ font (Plasma::Theme::DefaultFont)); + QString name; + QPainter p (&mPixmap); + +@@ -249,15 +169,12 @@ KWD::Switcher::update () + + p.setCompositionMode (QPainter::CompositionMode_Source); + +- mBackground->resize (mPixmap.width (), mPixmap.height ()); + mBackground->paint (&p, QRect (mBorder.left, mBorder.top + + mGeometry.height () + 5, mGeometry.width (), + fm.height ()), "center"); +- mBackground->resize (); +- + + p.setFont (font); +- p.setBrush (QBrush (Plasma::Theme::self()->backgroundColor())); ++ p.setPen (Plasma::Theme::defaultTheme ()->color(Plasma::Theme::TextColor)); + + p.drawText ((mPixmap.width () - fm.width (name)) / 2, + mBorder.top + mGeometry.height () + 5 + fm.ascent (), name); +--- a/kde/window-decorator-kde4/switcher.h ++++ b/kde/window-decorator-kde4/switcher.h +@@ -30,7 +30,7 @@ + + namespace Plasma + { +-class Svg; ++class PanelSvg; + } + + class QSpacerItem; +@@ -70,7 +70,7 @@ class Switcher + + QRect mGeometry; + +- Plasma::Svg *mBackground; ++ Plasma::PanelSvg *mBackground; + QPixmap mPixmap; + QPixmap mBackgroundPixmap; + diff --git a/compiz.spec b/compiz.spec index 026e5ef..d7b2306 100644 --- a/compiz.spec +++ b/compiz.spec @@ -14,7 +14,7 @@ URL: http://www.go-compiz.org License: X11/MIT/GPL Group: User Interface/Desktops Version: 0.7.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: OpenGL window and compositing manager BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -51,6 +51,10 @@ Source2: kde-desktop-effects-%{kde_dialogversion}.tar.bz2 # Make sure that former beryl users still have bling Obsoletes: beryl-core +# Upstream patch to port kde4-window-decorator to KDE 4.1 libplasma +# (This has been committed after 0.7.4, will probably be in 0.7.6.) +Patch0: compiz-0.7.2-kde41-libplasma.patch + # Patches that are not upstream Patch103: composite-cube-logo.patch Patch105: fedora-logo.patch @@ -116,6 +120,8 @@ and other kde integration related stuff. %setup -q -T -b2 -n kde-desktop-effects-%{kde_dialogversion} %setup -q +%patch0 -p1 -b .kde41-libplasma + %patch103 -p1 -b .composite-cube-logo %if 0%{?fedora} %patch105 -p1 -b .fedora-logo @@ -319,6 +325,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed May 07 2008 Kevin Kofler - 0.7.2-4 +- Backport upstream patch to port kde4-window-decorator to KDE 4.1 libplasma + * Thu Mar 27 2008 Adel Gadllah - 0.7.2-3 - Fix gconf plugin loop RH #438794, patch based on older one from Guillaume Seguin