Window follows mind^H^H^H^Hdesktop.

svn path=/trunk/kdebase/kwin/; revision=112163
This commit is contained in:
Waldo Bastian 2001-08-27 23:56:15 +00:00
parent 1fe4d5fbff
commit 83cbfe3acb
3 changed files with 39 additions and 9 deletions

View file

@ -574,7 +574,7 @@ Client::~Client()
{
releaseWindow();
if (moveResizeMode)
workspace()->setFocusChangeEnabled(true);
workspace()->setClientIsMoving(0);
delete info;
delete d;
@ -1436,7 +1436,7 @@ void Client::mouseReleaseEvent( QMouseEvent * e)
moveResizeMode = FALSE;
setGeometry( geom );
Events::raise( isResize() ? Events::ResizeEnd : Events::MoveEnd );
workspace()->setFocusChangeEnabled(true);
workspace()->setClientIsMoving(0);
releaseMouse();
releaseKeyboard();
}
@ -1485,7 +1485,7 @@ void Client::mouseMoveEvent( QMouseEvent * e)
Events::raise( Events::UnMaximize );
info->setState( 0, NET::Max );
}
workspace()->setFocusChangeEnabled(false);
workspace()->setClientIsMoving(this);
Events::raise( isResize() ? Events::ResizeStart : Events::MoveStart );
grabMouse( cursor() ); // to keep the right cursor
if ( ( isMove() && options->moveMode != Options::Opaque )
@ -2518,7 +2518,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
Events::raise( Events::UnMaximize );
info->setState( 0, NET::Max );
}
workspace()->setFocusChangeEnabled(false);
workspace()->setClientIsMoving(this);
buttonDown = TRUE;
moveOffset = mapFromGlobal( globalPos );
invertedMoveOffset = rect().bottomRight() - moveOffset;
@ -2539,7 +2539,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
Events::raise( Events::UnMaximize );
info->setState( 0, NET::Max );
}
workspace()->setFocusChangeEnabled(false);
workspace()->setClientIsMoving(this);
buttonDown = TRUE;
moveOffset = mapFromGlobal( globalPos );
int x = moveOffset.x(), y = moveOffset.y();
@ -2673,7 +2673,7 @@ void Client::keyPressEvent( QKeyEvent * e )
XUngrabServer( qt_xdisplay() );
setGeometry( geom );
moveResizeMode = FALSE;
workspace()->setFocusChangeEnabled(true);
workspace()->setClientIsMoving(0);
releaseMouse();
releaseKeyboard();
buttonDown = FALSE;

View file

@ -100,7 +100,8 @@ public:
electric_left_border(None),
electric_right_border(None),
electric_time_first(0),
electric_time_last(0)
electric_time_last(0),
movingClient(0)
{ };
~WorkspacePrivate() {};
KStartupInfo* startup;
@ -112,6 +113,7 @@ public:
WId electric_right_border;
Time electric_time_first;
Time electric_time_last;
Client *movingClient;
};
};
@ -1883,6 +1885,19 @@ void Workspace::cascadePlacement (Client* c, bool re_init) {
cci[d].pos = QPoint( xp + delta_x, yp + delta_y );
}
/*!
Marks the client as being moved around by the user.
*/
void Workspace::setClientIsMoving( Client *c )
{
// assert(!c || !d->movingClient); // Catch attempts to move a second
// window while still moving the first one.
d->movingClient = c;
if (d->movingClient)
focus_change = false;
else
focus_change = true;
}
/*!
Cascades all clients on the current desktop
@ -2340,6 +2355,11 @@ void Workspace::setCurrentDesktop( int new_desktop ){
ObscuringWindows obs_wins;
if (d->movingClient && !d->movingClient->isSticky())
{
d->movingClient->setDesktop(-1); // All desktops
}
for ( ClientList::ConstIterator it = stacking_order.begin(); it != stacking_order.end(); ++it) {
if ( (*it)->isVisible() && !(*it)->isOnDesktop( new_desktop ) ) {
obs_wins.create( *it );
@ -2356,6 +2376,11 @@ void Workspace::setCurrentDesktop( int new_desktop ){
mapList += (*it);
}
}
if (d->movingClient && !d->movingClient->isSticky())
{
d->movingClient->setDesktop(new_desktop);
}
}
current_desktop = new_desktop;
KIPC::sendMessageAll(KIPC::BackgroundChanged, current_desktop);

View file

@ -144,8 +144,13 @@ public:
void updateColormap();
void setFocusChangeEnabled(bool b) { focus_change = b; }
bool focusChangeEnabled() { return focus_change; }
void setFocusChangeEnabled(bool b) { focus_change = b; } // KDE 3.0: No longer used
bool focusChangeEnabled() { return focus_change; } // KDE 3.0: No longer used
/**
* Indicates that the client c is being moved around by the user.
*/
void setClientIsMoving( Client *c );
void doPlacement( Client* c );
QPoint adjustClientPosition( Client* c, QPoint pos );