diff --git a/options.cpp b/options.cpp index 479459f691..065f388885 100644 --- a/options.cpp +++ b/options.cpp @@ -184,6 +184,14 @@ void Options::reload() if ( val == "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"); if (val == "Smart") placement = Smart; else if (val == "Random") placement = Random; diff --git a/options.h b/options.h index fb57facce9..b8c1f71a84 100644 --- a/options.h +++ b/options.h @@ -107,6 +107,13 @@ public: enum AltTabStyle { KDE, CDE }; AltTabStyle altTabStyle; + /** + * Xinerama options + */ + bool xineramaEnabled; + bool xineramaPlacementEnabled; + bool xineramaMovementEnabled; + bool xineramaMaximizeEnabled; /** Number of desktop rowsd diff --git a/workspace.cpp b/workspace.cpp index 8c4272ae81..369fd75820 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -21,6 +21,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich #include #include #include +#include #include @@ -1361,7 +1362,7 @@ QPopupMenu* Workspace::clientPopup( Client* c ) 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->insertSeparator(); @@ -1460,7 +1461,7 @@ void Workspace::randomPlacement(Client* c){ static int py = 2 * step; int tx,ty; - QRect maxRect = clientArea(); + QRect maxRect = clientArea(PlacementArea); if (px < maxRect.x()) px = maxRect.x(); @@ -1514,7 +1515,7 @@ void Workspace::smartPlacement(Client* c){ int basket; //temp holder // get the maximum allowed windows space - QRect maxRect = clientArea(); + QRect maxRect = clientArea(PlacementArea); int x = maxRect.left(), y = maxRect.top(); 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 // (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 int ch = c->height(); @@ -2830,7 +2831,7 @@ QPoint Workspace::adjustClientPosition( Client* c, QPoint pos ) if (options->windowSnapZone || options->borderSnapZone ) { bool sOWO=options->snapOnlyWhenOverlapping; - QRect maxRect = clientArea(); + QRect maxRect = clientArea(MovementArea); int xmin = maxRect.left(); int xmax = maxRect.right()+1; //desk size int ymin = maxRect.top(); @@ -3617,35 +3618,29 @@ void Workspace::updateClientArea() \sa geometry() */ -QRect Workspace::clientArea() +QRect Workspace::clientArea(clientAreaOption opt) { QRect rect = QApplication::desktop()->geometry(); + KDesktopWidget *desktop = KApplication::desktop(); -#ifdef HAVE_XINERAMA - QPoint pos = QCursor::pos(); - - for (int head = 0; head < numHeads; head++) { - if ((xineramaInfo[head].x_org <= pos.x()) && - (xineramaInfo[head].x_org + xineramaInfo[head].width > pos.x()) && - (xineramaInfo[head].y_org <= pos.y()) && - (xineramaInfo[head].y_org + xineramaInfo[head].height > pos.y())) { - rect.setRect(xineramaInfo[head].x_org, - xineramaInfo[head].y_org, - xineramaInfo[head].width, - xineramaInfo[head].height); - } - + switch (opt) { + case MaximizeArea: + if (options->xineramaMaximizeEnabled) + rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos())); + break; + case PlacementArea: + if (options->xineramaPlacementEnabled) + rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos())); + break; + case MovementArea: + if (options->xineramaMovementEnabled) + rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos())); + break; } -#endif if (area.isNull()) { return rect; } -#ifdef HAVE_XINERAMA -#warning hello return area.intersect(rect); -#else - return area; -#endif } diff --git a/workspace.h b/workspace.h index f334898850..2fe8d2db42 100644 --- a/workspace.h +++ b/workspace.h @@ -113,7 +113,9 @@ public: QRect geometry() const; - QRect clientArea(); + enum clientAreaOption { PlacementArea, MovementArea, MaximizeArea }; + + QRect clientArea(clientAreaOption opt = MaximizeArea); void removeClient( Client* );