Xinerama support, patch by Balaji Ramani <balaji@spinnakernet.com>

svn path=/trunk/kdebase/kwin/; revision=100136
This commit is contained in:
Dirk Mueller 2001-06-03 09:04:03 +00:00
parent 1a3f866309
commit 8e8dce5e64
4 changed files with 39 additions and 27 deletions

View file

@ -184,6 +184,14 @@ void Options::reload()
if ( val == "CDE" ) if ( val == "CDE" )
altTabStyle = CDE; altTabStyle = CDE;
xineramaEnabled = config->readBoolEntry ("XineramaEnabled", FALSE ) &&
KApplication::desktop()->isVirtualDesktop();
if (xineramaEnabled) {
xineramaPlacementEnabled = config->readBoolEntry ("XineramaPlacementEnabled", FALSE);
xineramaMovementEnabled = config->readBoolEntry ("XineramaMovementEnabled", FALSE);
xineramaMaximizeEnabled = config->readBoolEntry ("XineramaMaximizeEnabled", FALSE);
}
val = config->readEntry("Placement","Smart"); val = config->readEntry("Placement","Smart");
if (val == "Smart") placement = Smart; if (val == "Smart") placement = Smart;
else if (val == "Random") placement = Random; else if (val == "Random") placement = Random;

View file

@ -107,6 +107,13 @@ public:
enum AltTabStyle { KDE, CDE }; enum AltTabStyle { KDE, CDE };
AltTabStyle altTabStyle; AltTabStyle altTabStyle;
/**
* Xinerama options
*/
bool xineramaEnabled;
bool xineramaPlacementEnabled;
bool xineramaMovementEnabled;
bool xineramaMaximizeEnabled;
/** /**
Number of desktop rowsd Number of desktop rowsd

View file

@ -21,6 +21,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <kprocess.h> #include <kprocess.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <kstartupinfo.h> #include <kstartupinfo.h>
#include <kdesktopwidget.h>
#include <netwm.h> #include <netwm.h>
@ -1361,7 +1362,7 @@ QPopupMenu* Workspace::clientPopup( Client* c )
popup->insertSeparator(); popup->insertSeparator();
popup->insertItem(SmallIconSet( "configure" ), i18n("&Configure WindowManager..."), this, SLOT( configureWM() )); popup->insertItem(SmallIconSet( "configure" ), i18n("&Configure..."), this, SLOT( configureWM() ));
popup->insertItem(i18n("&To desktop"), desk_popup ); popup->insertItem(i18n("&To desktop"), desk_popup );
popup->insertSeparator(); popup->insertSeparator();
@ -1460,7 +1461,7 @@ void Workspace::randomPlacement(Client* c){
static int py = 2 * step; static int py = 2 * step;
int tx,ty; int tx,ty;
QRect maxRect = clientArea(); QRect maxRect = clientArea(PlacementArea);
if (px < maxRect.x()) if (px < maxRect.x())
px = maxRect.x(); px = maxRect.x();
@ -1514,7 +1515,7 @@ void Workspace::smartPlacement(Client* c){
int basket; //temp holder int basket; //temp holder
// get the maximum allowed windows space // get the maximum allowed windows space
QRect maxRect = clientArea(); QRect maxRect = clientArea(PlacementArea);
int x = maxRect.left(), y = maxRect.top(); int x = maxRect.left(), y = maxRect.top();
x_optimal = x; y_optimal = y; x_optimal = x; y_optimal = y;
@ -1660,7 +1661,7 @@ void Workspace::cascadePlacement (Client* c, bool re_init) {
// get the maximum allowed windows space and desk's origin // get the maximum allowed windows space and desk's origin
// (CT 20Nov1999 - is this common to all desktops?) // (CT 20Nov1999 - is this common to all desktops?)
QRect maxRect = clientArea(); QRect maxRect = clientArea(PlacementArea);
// initialize often used vars: width and height of c; we gain speed // initialize often used vars: width and height of c; we gain speed
int ch = c->height(); int ch = c->height();
@ -2830,7 +2831,7 @@ QPoint Workspace::adjustClientPosition( Client* c, QPoint pos )
if (options->windowSnapZone || options->borderSnapZone ) if (options->windowSnapZone || options->borderSnapZone )
{ {
bool sOWO=options->snapOnlyWhenOverlapping; bool sOWO=options->snapOnlyWhenOverlapping;
QRect maxRect = clientArea(); QRect maxRect = clientArea(MovementArea);
int xmin = maxRect.left(); int xmin = maxRect.left();
int xmax = maxRect.right()+1; //desk size int xmax = maxRect.right()+1; //desk size
int ymin = maxRect.top(); int ymin = maxRect.top();
@ -3617,35 +3618,29 @@ void Workspace::updateClientArea()
\sa geometry() \sa geometry()
*/ */
QRect Workspace::clientArea() QRect Workspace::clientArea(clientAreaOption opt)
{ {
QRect rect = QApplication::desktop()->geometry(); QRect rect = QApplication::desktop()->geometry();
KDesktopWidget *desktop = KApplication::desktop();
#ifdef HAVE_XINERAMA switch (opt) {
QPoint pos = QCursor::pos(); case MaximizeArea:
if (options->xineramaMaximizeEnabled)
for (int head = 0; head < numHeads; head++) { rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos()));
if ((xineramaInfo[head].x_org <= pos.x()) && break;
(xineramaInfo[head].x_org + xineramaInfo[head].width > pos.x()) && case PlacementArea:
(xineramaInfo[head].y_org <= pos.y()) && if (options->xineramaPlacementEnabled)
(xineramaInfo[head].y_org + xineramaInfo[head].height > pos.y())) { rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos()));
rect.setRect(xineramaInfo[head].x_org, break;
xineramaInfo[head].y_org, case MovementArea:
xineramaInfo[head].width, if (options->xineramaMovementEnabled)
xineramaInfo[head].height); rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos()));
break;
} }
}
#endif
if (area.isNull()) { if (area.isNull()) {
return rect; return rect;
} }
#ifdef HAVE_XINERAMA
#warning hello
return area.intersect(rect); return area.intersect(rect);
#else
return area;
#endif
} }

View file

@ -113,7 +113,9 @@ public:
QRect geometry() const; QRect geometry() const;
QRect clientArea(); enum clientAreaOption { PlacementArea, MovementArea, MaximizeArea };
QRect clientArea(clientAreaOption opt = MaximizeArea);
void removeClient( Client* ); void removeClient( Client* );