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

List:       kde-commits
Subject:    KDE/kdebase/kwin
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2005-06-14 15:35:46
Message-ID: 1118763346.213433.6091.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 425377 by lunakl:

Another final attempt at sorting out the shaded geometry problems.
This time at least the code should detect properly all attempts
to use shaded geometry when the normal one is needed.
BUG: 96602



 M  +1 -0      client.h  
 M  +19 -6     geometry.cpp  
 M  +1 -1      rules.cpp  


--- trunk/KDE/kdebase/kwin/client.h #425376:425377
@@ -102,6 +102,7 @@
             SizemodeMax // try not to make it larger in either direction
             };
         QSize adjustedSize( const QSize&, Sizemode mode = SizemodeAny ) const;
+        QSize adjustedSize() const;
 
         QPixmap icon() const;
         QPixmap miniIcon() const;
--- trunk/KDE/kdebase/kwin/geometry.cpp #425376:425377
@@ -1010,6 +1010,13 @@
     return sizeForClientSize( wsize, mode, false );
     }
 
+// this helper returns proper size even if the window is shaded
+// see also the comment in Client::setGeometry()
+QSize Client::adjustedSize() const
+    {
+    return sizeForClientSize( clientSize());
+    }
+
 /*!
   Calculate the appropriate frame size for the given client size \a
   wsize.
@@ -1022,6 +1029,11 @@
     {
     int w = wsize.width();
     int h = wsize.height();
+    if( w < 1 || h < 1 )
+        {
+        kdWarning() << "sizeForClientSize() with empty size!" << endl;
+        kdWarning() << kdBacktrace() << endl;
+        }
     if (w<1) w = 1;
     if (h<1) h = 1;
 
@@ -1247,7 +1259,7 @@
         xSizeHint.win_gravity = NorthWestGravity;
     if( isManaged())
         { // update to match restrictions
-        QSize new_size = adjustedSize( size());
+        QSize new_size = adjustedSize();
         if( new_size != size() && !isFullScreen())
             resizeWithChecks( new_size );
         }
@@ -1447,8 +1459,8 @@
         {
         if( h == border_top + border_bottom )
             {
-            kdDebug() << "Shaded geometry passed for size:" << endl;
-            kdDebug() << kdBacktrace() << endl;
+            kdWarning() << "Shaded geometry passed for size:" << endl;
+            kdWarning() << kdBacktrace() << endl;
             }
         }
     int newx = x();
@@ -1614,7 +1626,8 @@
     // shading. Then the frame geometry is adjusted for the shaded geometry.
     // This gets more complicated in the case the code does only something like
     // setGeometry( geometry()) - geometry() will return the shaded frame geometry.
-    // Such code is wrong and should be changed to handle the case when the window is shaded.
+    // Such code is wrong and should be changed to handle the case when the window is shaded,
+    // for example using Client::clientSize().
     if( shade_geometry_change )
         ; // nothing
     else if( isShade())
@@ -1664,7 +1677,7 @@
 
 void Client::plainResize( int w, int h, ForceGeometry_t force )
     {
-    // this code is also duplicated in Client::setGeometry()
+    // this code is also duplicated in Client::setGeometry(), and it's also commented there
     if( shade_geometry_change )
         ; // nothing
     else if( isShade())
@@ -1752,7 +1765,7 @@
             if( pending_geometry_update )
                 {
                 if( isShade())
-                    setGeometry( QRect( pos(), sizeForClientSize( clientSize())), ForceGeometrySet );
+                    setGeometry( QRect( pos(), adjustedSize()), ForceGeometrySet );
                 else
                     setGeometry( geometry(), ForceGeometrySet );
                 pending_geometry_update = false;
--- trunk/KDE/kdebase/kwin/rules.cpp #425376:425377
@@ -828,7 +828,7 @@
         workspace()->activateNextClient( this );
     // MoveResizeMode
     // Closeable
-    QSize s = adjustedSize( sizeForClientSize( clientSize())); // handle shading
+    QSize s = adjustedSize();
     if( s != size())
         resizeWithChecks( s );
     setShortcut( rules()->checkShortcut( shortcut().toString()));
[prev in list] [next in list] [prev in thread] [next in thread] 

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