Fix behaviour of windows when changing styles on Xinerama. Now they don't
magically fly to other screens. svn path=/trunk/kdebase/kwin/; revision=139300
This commit is contained in:
parent
7686ee5f9a
commit
1cde570a88
3 changed files with 23 additions and 19 deletions
|
@ -625,7 +625,7 @@ bool Client::manage( bool isMapped, bool doNotShow, bool isInitial )
|
|||
if ( session )
|
||||
geom = session->geometry;
|
||||
|
||||
QRect area = workspace()->clientArea();
|
||||
QRect area = workspace()->clientArea( geom.center() );
|
||||
|
||||
if ( geom == workspace()->geometry() && inherits( "KWinInternal::NoBorderClient" ) ) {
|
||||
if ( !stays_on_top )
|
||||
|
@ -1567,7 +1567,7 @@ void Client::mouseMoveEvent( QMouseEvent * e)
|
|||
break;
|
||||
}
|
||||
|
||||
QRect desktopArea = workspace()->clientArea();
|
||||
QRect desktopArea = workspace()->clientArea(e->globalPos());
|
||||
int marge = 5;
|
||||
|
||||
if ( isResize() && geom.size() != size() ) {
|
||||
|
@ -1880,7 +1880,7 @@ void Client::maximize( MaximizeMode m)
|
|||
if ( !isMaximizable() )
|
||||
return;
|
||||
|
||||
QRect clientArea = workspace()->clientArea();
|
||||
QRect clientArea = workspace()->clientArea(geometry().center());
|
||||
|
||||
if (isShade())
|
||||
setShade( FALSE );
|
||||
|
|
|
@ -3170,7 +3170,7 @@ QPoint Workspace::adjustClientPosition( Client* c, QPoint pos )
|
|||
if (options->windowSnapZone || options->borderSnapZone )
|
||||
{
|
||||
bool sOWO=options->snapOnlyWhenOverlapping;
|
||||
QRect maxRect = clientArea(MovementArea);
|
||||
QRect maxRect = clientArea(MovementArea, pos+c->rect().center());
|
||||
int xmin = maxRect.left();
|
||||
int xmax = maxRect.right()+1; //desk size
|
||||
int ymin = maxRect.top();
|
||||
|
@ -3970,39 +3970,41 @@ void Workspace::updateClientArea()
|
|||
|
||||
\sa geometry()
|
||||
*/
|
||||
QRect Workspace::clientArea(clientAreaOption opt)
|
||||
QRect Workspace::clientArea(clientAreaOption opt, const QPoint& p)
|
||||
{
|
||||
QRect rect = QApplication::desktop()->geometry();
|
||||
#if QT_VERSION < 300
|
||||
KDesktopWidget *desktop = KApplication::desktop();
|
||||
#else
|
||||
QDesktopWidget *desktop = KApplication::desktop();
|
||||
#endif
|
||||
|
||||
switch (opt) {
|
||||
case MaximizeArea:
|
||||
if (options->xineramaMaximizeEnabled)
|
||||
rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos()));
|
||||
rect = desktop->screenGeometry(desktop->screenNumber(p));
|
||||
break;
|
||||
case PlacementArea:
|
||||
if (options->xineramaPlacementEnabled)
|
||||
rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos()));
|
||||
rect = desktop->screenGeometry(desktop->screenNumber(p));
|
||||
break;
|
||||
case MovementArea:
|
||||
if (options->xineramaMovementEnabled)
|
||||
rect = desktop->screenGeometry(desktop->screenNumber(QCursor::pos()));
|
||||
rect = desktop->screenGeometry(desktop->screenNumber(p));
|
||||
break;
|
||||
}
|
||||
if (area.isNull()) {
|
||||
|
||||
if (area.isNull())
|
||||
return rect;
|
||||
}
|
||||
|
||||
return area.intersect(rect);
|
||||
}
|
||||
|
||||
// ### KDE3: remove me!
|
||||
QRect Workspace::clientArea()
|
||||
QRect Workspace::clientArea(const QPoint& p)
|
||||
{
|
||||
return clientArea( MaximizeArea );
|
||||
int screenNum = QApplication::desktop()->screenNumber(p);
|
||||
QRect rect = QApplication::desktop()->screenGeometry(screenNum);
|
||||
|
||||
if (area.isNull())
|
||||
return rect;
|
||||
|
||||
return area.intersect(rect);
|
||||
}
|
||||
|
||||
void Workspace::loadDesktopSettings()
|
||||
|
|
|
@ -17,6 +17,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|||
#include "options.h"
|
||||
#include "KWinInterface.h"
|
||||
#include <kshortcut.h>
|
||||
#include <qcursor.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#ifdef HAVE_XINERAMA
|
||||
|
@ -124,8 +125,9 @@ public:
|
|||
|
||||
|
||||
// default is MaximizeArea
|
||||
QRect clientArea(); // ### KDE3: remove me!
|
||||
QRect clientArea(clientAreaOption);
|
||||
QRect clientArea(clientAreaOption, const QPoint& p);
|
||||
QRect clientArea(const QPoint& p);
|
||||
inline QRect clientArea(clientAreaOption opt) { return clientArea(opt, QCursor::pos()); }
|
||||
|
||||
void removeClient( Client* );
|
||||
|
||||
|
|
Loading…
Reference in a new issue