LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kwin-suse.diff of Package kdebase4-workspace (Project DISCONTINUED:openSUSE:11.2)

--- kwin/clients/ozone/oxygenclient.h.sav	2008-11-02 10:48:52.000000000 +0100
+++ kwin/clients/ozone/oxygenclient.h	2009-06-03 19:58:38.000000000 +0200
@@ -62,6 +62,7 @@ private:
     QColor titlebarTextColor(const QPalette &palette);
     bool colorCacheInvalid_;
     QColor cachedTitlebarTextColor_;
+    QImage logo;
 
 protected:
     friend class OxygenButton;
--- kwin/clients/ozone/oxygenclient.cpp.sav	2009-05-30 18:35:20.000000000 +0200
+++ kwin/clients/ozone/oxygenclient.cpp	2009-06-03 20:44:38.000000000 +0200
@@ -59,6 +59,9 @@
 #include "oxygenbutton.h"
 #include "oxygen.h"
 
+#define logourl "/usr/share/kde4/apps/kwin/titlebar_decor.png"
+#define logooffset 5
+
 namespace Ozone
 {
 namespace Oxygen
@@ -89,6 +92,7 @@ OxygenClient::OxygenClient(KDecorationBr
     , helper_(*globalHelper)
 {
     qAddPostRoutine(oxkwincleanupBefore);
+    logo.load(logourl);
 }
 
 OxygenClient::~OxygenClient()
@@ -303,7 +307,7 @@ void OxygenClient::paintEvent(QPaintEven
     const int titleWidth = frame.width() -
             titleEdgeLeft - layoutMetric(LM_TitleEdgeRight) -
             buttonsLeftWidth() - buttonsRightWidth() -
-            marginLeft - marginRight;
+            marginLeft - marginRight - logo.width() - logooffset;
 
     QPalette pal2( palette );
     if( !OxygenFactory::blendTitlebarColors()) {
@@ -319,6 +323,18 @@ void OxygenClient::paintEvent(QPaintEven
     painter.drawText(titleLeft, titleTop-1, titleWidth, titleHeight,  // -1 is to go into top resizearea
               OxygenFactory::titleAlignment() | Qt::AlignVCenter, caption());
 
+    if (isActive()) {
+        QFontMetrics fm(options()->font(isActive(), false));
+        int logopos;
+        if( OxygenFactory::titleAlignment() == Qt::AlignLeft )
+            logopos = qMin(fm.width(caption()), titleWidth);
+        else if( OxygenFactory::titleAlignment() == Qt::AlignRight )
+            logopos = titleWidth;
+        else
+            logopos = ( titleWidth + qMin(fm.width(caption()), titleWidth)) / 2;
+        painter.drawImage(titleLeft + logopos + logooffset, titleTop, logo);
+    }
+
     painter.setRenderHint(QPainter::Antialiasing);
 
     // Draw dividing line
@@ -344,7 +360,7 @@ void OxygenClient::paintEvent(QPaintEven
         }
 
         if (align & Qt::AlignLeft) {
-            int left = titleLeft + QFontMetrics(options()->font(isActive(), false)).width(caption()) + 4;
+            int left = titleLeft + QFontMetrics(options()->font(isActive(), false)).width(caption()) + 4 + logo.width() + logooffset;
             int right = titleLeft + titleWidth;
             drawScratch(&painter, palette, left, right, titleTop+6);
         }