[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kwin/clients/plastik
From:       Sandro Giessl <sandro () giessl ! com>
Date:       2005-01-19 15:32:06
Message-ID: 20050119153206.1AE0A1BC41 () office ! kde ! org
[Download RAW message or body]

CVS commit by giessl: 

Apply patch by Toby Dickenson (thanks a lot!):
Do not round (mask) the decoration corners if the window aligns to a screen corner.
This has two advantages:
- Fitt's Law applies for resizing windows
- Prevents accidentally hitting buttons of maximized windows behind the active window

Hasn't been tested with xinerama setups but this should work as well. Hopefully
someone can test it before KDE 3.4.

CCMAIL: toby@tarind.com
BUG: 93918


  M +51 -18    plastikclient.cpp   1.32


--- kdebase/kwin/clients/plastik/plastikclient.cpp  #1.31:1.32
@@ -24,4 +24,5 @@
 #include <kpixmap.h>
 #include <kpixmapeffect.h>
+#include <kapplication.h>
 
 #include <qbitmap.h>
@@ -33,4 +34,5 @@
 #include <qpainter.h>
 #include <qpixmap.h>
+#include <qdesktopwidget.h>
 
 #include "plastikclient.h"
@@ -154,4 +156,5 @@ void PlastikClient::paintEvent(QPaintEve
     const QColor highlightBottom = alphaBlendColors(border,
             PlastikHandler::getColor(SideHighlightBottom, active), 150);
+    const QColor filledCorner = QColor(0,0,0);
 
     QRect Rtop(topSpacer_->geometry());
@@ -193,4 +196,10 @@ void PlastikClient::paintEvent(QPaintEve
                                 Rtop.width()-2*2, Rtop.height()-2,
                                 active ? *aTitleBarTopTile : *iTitleBarTopTile );
+        // outside the region normally masked by doShape
+        painter.setPen(filledCorner);
+        painter.drawLine(Rtop.left(), Rtop.top(), Rtop.left()+1, Rtop.top() );
+        painter.drawPoint(Rtop.left(), Rtop.top()+1);
+        painter.drawLine(Rtop.right(), Rtop.top(), Rtop.right()-1, Rtop.top() );
+        painter.drawPoint(Rtop.right(), Rtop.top()+1);
     }
 
@@ -380,4 +389,8 @@ void PlastikClient::paintEvent(QPaintEve
             painter.drawPoint(Rbottom.right()-1, Rbottom.bottom()-1);
         }
+        // outside the region normally masked by doShape
+        painter.setPen(filledCorner);
+        painter.drawPoint(Rbottom.left(), Rbottom.bottom());
+        painter.drawPoint(Rbottom.right(), Rbottom.bottom());
 
         int l;
@@ -413,32 +426,52 @@ void PlastikClient::doShape()
     int r(w);
     int b(h);
+    bool tl=true,tr=true,bl=true,br=true; // is there a transparent rounded corner in top-left? etc
 
     QRegion mask(0, 0, w, h);
 
-    if(topSpacer_->geometry().height() > 0)
+    QDesktopWidget *desktop=KApplication::desktop();
+
+    // no transparent rounded corners if the spacers are zero size
+    if(topSpacer_->geometry().height() == 0)       tl = tr = false;
+    if(leftTitleSpacer_->geometry().width() == 0)  tl = false;
+    if(rightTitleSpacer_->geometry().width() == 0) tr = false;
+    if(bottomSpacer_->geometry().height() == 0)    bl = br = false;
+    
+    // no transparent rounded corners if this window corner lines up with a screen corner
+    for(int screen=desktop->numScreens()-1;screen>=0;--screen)
     {
-        // Remove top-left corner.
-        if(leftTitleSpacer_->geometry().width() > 0)
+        QRect fullscreen(desktop->screenGeometry(screen));
+        QRect wcfullscreen(widget()->mapFromGlobal(fullscreen.topLeft()),
+                           widget()->mapFromGlobal(fullscreen.bottomRight()+QPoint(1,1)));
+                        
+        if(wcfullscreen.topLeft()    ==QPoint(0,0)) tl = false;                        
+        if(wcfullscreen.topRight()   ==QPoint(w,0)) tr = false;
+        if(wcfullscreen.bottomLeft() ==QPoint(0,h)) bl = false;
+        if(wcfullscreen.bottomRight()==QPoint(w,h)) br = false;
+    }
+
+    if(tl) // remove top-left corner
         {
             mask -= QRegion(0, 0, 1, 2);
             mask -= QRegion(1, 0, 1, 1);
         }
-        // Remove top-right corner.
-        if(rightTitleSpacer_->geometry().width() > 0)
+    
+    if(tr) // remove top-right corner
         {
             mask -= QRegion(r-1, 0, 1, 2);
             mask -= QRegion(r-2, 0, 1, 1);
         }
-    }
 
-    // Remove bottom-left corner and bottom-right corner.
-    if(bottomSpacer_->geometry().height() > 0)
+    if(bl)  // remove bottom-left corner
     {
         mask -= QRegion(0, b-1, 1, 1);
+    }
+    
+    if(br) // remove bottom-right corner
+    {
         mask -= QRegion(r-1, b-1, 1, 1);
     }
 
     setMask( mask );
-//     widget()->setMask(mask);
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic