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

List:       kde-core-devel
Subject:    PATCH: kwin
From:       Matthias Ettrich <ettrich () trolltech ! com>
Date:       2000-10-07 22:26:27
[Download RAW message or body]


Some applications (netscape, kmail, kcontrol) store width and height between
sessions. When the user starts them again, they come up with their previous
size. That's very nice, but breaks for maximized (vertical, horizontal or full)
windows. 

This patch in kwin fixes this. Basically it's an auto detection for maximized
windows. Most certainly it obeyes a windows minimum size specifications.
To do this properly, it also calculates a reasonable restore geometry (again,
also obeying a window's constains).

Works very well for me and I'm wondering why kwin didn't do that from the
very beginning.


Index: client.cpp
===================================================================
RCS file: /home/kde/kdebase/kwin/client.cpp,v
retrieving revision 1.172
diff -u -r1.172 client.cpp
--- client.cpp  2000/10/05 22:09:49     1.172
+++ client.cpp  2000/10/07 22:12:36
@@ -624,11 +624,25 @@
        else if ( info->state() & NET::MaxHoriz )
            maximize( Client::MaximizeHorizontal );
 
-
-       if ( isMaximizable() && !isMaximized() && width() >= area.width() && height() >= area.height()
-            && ( geom.topLeft() == area.topLeft() ||
-                 geom.topLeft() == workspace()->geometry().topLeft() ) ) {
+       if ( isMaximizable() && !isMaximized()
+            && ( width() >= area.width() || height() >= area.height() ) ) {
+         // window is too large for the screen, maximize in the
+         // directions necessary and generate a suitable restore
+         // geometry.
+         QSize s = adjustedSize( QSize( width()*2/3, height()*2/3 ) );
+         if ( width() >= area.width() && height() >= area.height() ) {
            maximize( Client::MaximizeFull );
+           geom_restore.setSize( s );
+           geom_restore.moveCenter( geometry().center() );
+         } else if ( width() >= area.width() ) {
+           maximize( Client::MaximizeHorizontal );
+           geom_restore.setWidth( s.width() );
+           geom_restore.moveCenter( geometry().center() );
+         } else if ( height() >= area.height() ) {
+           maximize( Client::MaximizeVertical );
+           geom_restore.setHeight( s.height() );
+           geom_restore.moveCenter( geometry().center() );
+         }
        }
     }
                                                                                           

Matthias

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

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