From 4f396b03eb06f2f441615ab6c56f2c3ae43e8590 Mon Sep 17 00:00:00 2001
From: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date: Sat, 30 Jul 2011 03:22:42 +0000
Subject: Fix the "redmond" kwin client It is highly recommended that "window
 resize and move when maximized" be disabled when this client is in use

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1243970 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 kwin/clients/redmond/redmond.cpp | 20 +++++++++++++++-----
 kwin/lib/kcommondecoration.cpp   |  2 ++
 kwin/lib/kcommondecoration.h     |  3 ++-
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/kwin/clients/redmond/redmond.cpp b/kwin/clients/redmond/redmond.cpp
index b6161d9ce..fab104d8b 100644
--- a/kwin/clients/redmond/redmond.cpp
+++ b/kwin/clients/redmond/redmond.cpp
@@ -395,7 +395,7 @@ int RedmondDeco::layoutMetric(LayoutMetric lm, bool respectWindowState, const KC
 			return border ? borderWidth+2 : 2;
 
 		case LM_TitleEdgeTop:
-			return border ? borderWidth+2 : 2;
+			return border ? borderWidth+1 : 2;
 
 		case LM_TitleEdgeBottom:
 			return border ? 1 : 0;
@@ -422,6 +422,12 @@ int RedmondDeco::layoutMetric(LayoutMetric lm, bool respectWindowState, const KC
 		case LM_ExplicitButtonSpacer:
 			return 2;
 
+		case LM_ButtonMarginTop:
+			return 0;
+
+		case LM_RightButtonsMarginTop:
+			return 1;
+
 		default:
 			return KCommonDecoration::layoutMetric(lm, respectWindowState, btn);
 	}
@@ -560,8 +566,12 @@ void RedmondDeco::paintEvent( TQPaintEvent* )
 
         p2.setFont( fnt );
         p2.setPen( options()->color(KDecoration::ColorFont, isActive() ));
-		p2.drawText( r.x(), fontoffset, r.width()-3, r.height()-1,
-                     AlignLeft | AlignVCenter, caption() );
+        if (border)
+            p2.drawText( r.x()-3, fontoffset, r.width(), r.height()+1,
+                         AlignLeft | AlignVCenter, caption() );
+        else
+            p2.drawText( r.x()+1, fontoffset, r.width()-4, r.height()+1,
+                         AlignLeft | AlignVCenter, caption() );
         p2.end();
 
         p.drawPixmap( modBorderWidth, modBorderWidth, *titleBuffer );
@@ -576,7 +586,7 @@ void RedmondDeco::paintEvent( TQPaintEvent* )
        // Draw the title text.
        p.setFont( fnt );
        p.setPen(options()->color(KDecoration::ColorFont, isActive() ));
-	   p.drawText(r.x()+4, r.y()+fontoffset-2, r.width()-3, r.height()-1,
+	   p.drawText(r.x()+4, r.y()+fontoffset-2, r.width()-3, r.height()+1,
                   AlignLeft | AlignVCenter, caption() );
    }
 
@@ -616,7 +626,7 @@ void RedmondDecoFactory::readConfig() {
 	case BorderTiny:
 	case BorderNormal:
 	default:
-		borderWidth = 4;
+		borderWidth = 3;
 		if (normalTitleHeight < 16) normalTitleHeight = 16;
 		if (toolTitleHeight < 16) toolTitleHeight = 16;
 	}
diff --git a/kwin/lib/kcommondecoration.cpp b/kwin/lib/kcommondecoration.cpp
index 556e20c9e..d3d43ce12 100644
--- a/kwin/lib/kcommondecoration.cpp
+++ b/kwin/lib/kcommondecoration.cpp
@@ -97,6 +97,7 @@ int KCommonDecoration::layoutMetric(LayoutMetric lm, bool, const KCommonDecorati
             return 5;
 
         case LM_ButtonMarginTop:
+        case LM_RightButtonsMarginTop:
             return 0;
 
         case LM_ExplicitButtonSpacer:
@@ -212,6 +213,7 @@ void KCommonDecoration::updateLayout() const
     }
 
     if (m_buttonsRight.count() > 0) {
+        int y = r_y + layoutMetric(LM_TitleEdgeTop) + layoutMetric(LM_ButtonMarginTop) + layoutMetric(LM_RightButtonsMarginTop);
         const int titleEdgeRightLeft = r_x2-layoutMetric(LM_TitleEdgeRight)+1;
 
         const int buttonSpacing = layoutMetric(LM_ButtonSpacing);
diff --git a/kwin/lib/kcommondecoration.h b/kwin/lib/kcommondecoration.h
index ff720ab91..8126445ad 100644
--- a/kwin/lib/kcommondecoration.h
+++ b/kwin/lib/kcommondecoration.h
@@ -113,7 +113,8 @@ class KWIN_EXPORT KCommonDecoration : public KDecoration
             LM_ButtonHeight,
             LM_ButtonSpacing,
             LM_ExplicitButtonSpacer,
-            LM_ButtonMarginTop
+            LM_ButtonMarginTop,
+            LM_RightButtonsMarginTop
         };
 
         enum DecorationBehaviour
-- 
cgit v1.2.3

