[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [PATCH] KPassivePopup Xinerama Quirks
From: mETz <mETz81 () web ! de>
Date: 2005-05-08 20:53:14
Message-ID: 200505082253.15028.mETz81 () web ! de
[Download RAW message or body]
Moin,
as KPassivePopup still has the bad habit of either displaying "somewhere" on
screen and not near its target or partly outside the screen I hacked a bit on
it. Results are attached.
Behaviour changes:
- fetch desktop-rect for topleft of target rect, the calculated middle of the
passivepopup base-position can already be on another desktop than the
target-rect (result would be passivepopup displayed on a different desktop)
- align bottom popup-border to top border of target-rect in case the popup
would run out of the bottom desktop-border
- align right popup-border to left border of target-rect in case we would run
out of the right desktop-border
I'm not sure if all of this is wanted so I didn't commit it right away.
Bye, Stefan aka mETz
["kpassivepopup-xinerama-fixes.patch" (text/x-diff)]
Index: kpassivepopup.cpp
===================================================================
--- kpassivepopup.cpp (Revision 411299)
+++ kpassivepopup.cpp (Arbeitskopie)
@@ -20,7 +20,7 @@
#include "config.h"
#ifdef Q_WS_X11
-#include <netwm.h>
+#include <netwm.h>
#endif
#include "kpassivepopup.h"
@@ -214,7 +214,7 @@
if ( target.isNull() ) { // bogus value, use the exact position
NETRect dummy;
ni.kdeGeometry( dummy, r );
- target.setRect( r.pos.x, r.pos.y,
+ target.setRect( r.pos.x, r.pos.y,
r.size.width, r.size.height);
}
}
@@ -233,25 +233,25 @@
int w = width();
int h = height();
- QRect r = KGlobalSettings::desktopGeometry(QPoint(x+w/2,y+h/2));
+ QRect r = KGlobalSettings::desktopGeometry(pos);
- if ( x < ( r.width() / 2 ) )
- x = x + target.width();
- else
- x = x - w;
+ if ( x < ( r.width() / 2 ) ) // align left popup-border to right side of target-rect
+ x = x + target.width();
+ else // align right popup-border to left side of target-rect
+ x = x - w;
// It's apparently trying to go off screen, so display it ALL at the bottom.
- if ( (y + h) > r.height() )
- y = r.height() - h;
+ if ( (y + h) > r.height() ) // align bottom popup-border to top of target-rect
+ y = pos.y() - h; // r.height() - h;
- if ( (x + w) > r.width() )
- x = r.width() - w;
+ if ( (x + w) > r.width() ) // align right popup-border to left side of target-rect
+ x = pos.x() - w; //r.width() - w;
- if ( y < 0 )
- y = 0;
+ if ( y < r.y() )
+ y = r.y();
- if ( x < 0 )
- x = 0;
+ if ( x < r.x() )
+ x = r.x();
move( x, y );
}
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic