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

List:       kde-devel
Subject:    Patch for kwm (urgent)
From:       Matthias Ettrich <ettrich () troll ! no>
Date:       1999-07-01 13:17:22
[Download RAW message or body]

Hi,

I got some mail and even read in some newsgroups that some people "complain"
about kwm's placement system.

Problem: when a window or a user specifies a geometry outside the visible
screen area (for example under the taskbar or under the panel), kwm replaced it
according to the user's placement policy.

I considered this a pretty fancy behaviour, unfortunately, most of the users
didn't understand it but claimed that kwm ignores placement completely :-(

The patch below (which I want to commit to the KDE_1_1_BRANCH) will fix this
problem. A window with any placement hint (uspos or ppos) will just be moved
into the visible area. So you can still do things like

       xclock -geom -1-1

to get a clock in the bottom/right corner of screen.

The patch also fixes the problem when a maximized netscape is restarted.
Netscape restores the size correctly but uses a strange topleft position. kwm
used to obey this setting. With the patch, however, the window is moved
correctly to where it belongs.


Please have a look at it and test it. 

Matthias





Index: manager.C
===================================================================
RCS file: /home/kde/kdebase/kwm/manager.C,v
retrieving revision 1.159.2.7
diff -u -r1.159.2.7 manager.C
--- manager.C	1999/05/24 16:50:50	1.159.2.7
+++ manager.C	1999/07/01 13:11:48
@@ -1966,8 +1966,22 @@
 
       if (c->geometry.x() < maxRect.x() || c->geometry.right() > maxRect.right()
 	  || c->geometry.y() < maxRect.y() || c->geometry.bottom() > maxRect.bottom() ) {
-	  // the settings are bogus, do customized placement again.
-	  doPlacement(c);
+	  
+	  // the settings are bogus, move the window to fit in the visible area
+	  if ( c->geometry.x() < maxRect.x() )
+	      c->geometry.moveTopLeft( 
+		 QPoint( maxRect.x(), c->geometry.y() ) );
+	  if ( c->geometry.y() < maxRect.y() )
+	      c->geometry.moveTopLeft( 
+	                 QPoint( c->geometry.x(), maxRect.y() ) );
+	  if ( c->geometry.right() > maxRect.right() 
+	       && c->geometry.width() <= maxRect.width() )
+	      c->geometry.moveBottomRight( 
+	                 QPoint( maxRect.right(), c->geometry.bottom() ) );
+	  if ( c->geometry.bottom() > maxRect.bottom() 
+	       && c->geometry.height() <= maxRect.height() )
+	      c->geometry.moveBottomRight( 
+	                 QPoint( c->geometry.right(), maxRect.bottom() ) );
 	  didPlacement = TRUE;
       }
   }

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

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