WABA: Don't allow change of focus while resizing / moving.
This prevents a lot of stupid focus changes when you move a window around with focusFollowsMouse. (mouse moves -> focus changes -> window moves -> focus changes back) svn path=/trunk/kdebase/kwin/; revision=51574
This commit is contained in:
parent
fc5367e74d
commit
dc5bf6c01c
3 changed files with 14 additions and 0 deletions
|
@ -375,6 +375,8 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
|
||||||
Client::~Client()
|
Client::~Client()
|
||||||
{
|
{
|
||||||
releaseWindow();
|
releaseWindow();
|
||||||
|
if (workspace()->activeClient() == this)
|
||||||
|
workspace()->setEnableFocusChange(true); // Safety
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -937,6 +939,7 @@ void Client::mouseReleaseEvent( QMouseEvent * e)
|
||||||
setGeometry( geom );
|
setGeometry( geom );
|
||||||
Events::raise( isResize() ? Events::ResizeEnd : Events::MoveEnd );
|
Events::raise( isResize() ? Events::ResizeEnd : Events::MoveEnd );
|
||||||
moveResizeMode = FALSE;
|
moveResizeMode = FALSE;
|
||||||
|
workspace()->setEnableFocusChange(true);
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
releaseKeyboard();
|
releaseKeyboard();
|
||||||
}
|
}
|
||||||
|
@ -971,6 +974,7 @@ void Client::mouseMoveEvent( QMouseEvent * e)
|
||||||
QPoint p( e->pos() - moveOffset );
|
QPoint p( e->pos() - moveOffset );
|
||||||
if (p.manhattanLength() >= 6) {
|
if (p.manhattanLength() >= 6) {
|
||||||
moveResizeMode = TRUE;
|
moveResizeMode = TRUE;
|
||||||
|
workspace()->setEnableFocusChange(false);
|
||||||
Events::raise( isResize() ? Events::ResizeStart : Events::MoveStart );
|
Events::raise( isResize() ? Events::ResizeStart : Events::MoveStart );
|
||||||
grabMouse( cursor() ); // to keep the right cursor
|
grabMouse( cursor() ); // to keep the right cursor
|
||||||
if ( ( isMove() && options->moveMode != Options::Opaque )
|
if ( ( isMove() && options->moveMode != Options::Opaque )
|
||||||
|
@ -1778,6 +1782,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
|
||||||
break;
|
break;
|
||||||
mode = Center;
|
mode = Center;
|
||||||
moveResizeMode = TRUE;
|
moveResizeMode = TRUE;
|
||||||
|
workspace()->setEnableFocusChange(false);
|
||||||
buttonDown = TRUE;
|
buttonDown = TRUE;
|
||||||
moveOffset = mapFromGlobal( globalPos );
|
moveOffset = mapFromGlobal( globalPos );
|
||||||
invertedMoveOffset = rect().bottomRight() - moveOffset;
|
invertedMoveOffset = rect().bottomRight() - moveOffset;
|
||||||
|
@ -1790,6 +1795,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
|
||||||
if (!mayMove())
|
if (!mayMove())
|
||||||
break;
|
break;
|
||||||
moveResizeMode = TRUE;
|
moveResizeMode = TRUE;
|
||||||
|
workspace()->setEnableFocusChange(false);
|
||||||
buttonDown = TRUE;
|
buttonDown = TRUE;
|
||||||
moveOffset = mapFromGlobal( globalPos );
|
moveOffset = mapFromGlobal( globalPos );
|
||||||
if ( moveOffset.x() < width()/2) {
|
if ( moveOffset.x() < width()/2) {
|
||||||
|
@ -1923,6 +1929,7 @@ void Client::keyPressEvent( QKeyEvent * e )
|
||||||
XUngrabServer( qt_xdisplay() );
|
XUngrabServer( qt_xdisplay() );
|
||||||
setGeometry( geom );
|
setGeometry( geom );
|
||||||
moveResizeMode = FALSE;
|
moveResizeMode = FALSE;
|
||||||
|
workspace()->setEnableFocusChange(true);
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
releaseKeyboard();
|
releaseKeyboard();
|
||||||
buttonDown = FALSE;
|
buttonDown = FALSE;
|
||||||
|
|
|
@ -168,6 +168,7 @@ Workspace::Workspace( bool restore )
|
||||||
control_grab (false),
|
control_grab (false),
|
||||||
tab_grab (false),
|
tab_grab (false),
|
||||||
mouse_emulation (false),
|
mouse_emulation (false),
|
||||||
|
focus_change (true),
|
||||||
tab_box (0),
|
tab_box (0),
|
||||||
popup (0),
|
popup (0),
|
||||||
desk_popup (0),
|
desk_popup (0),
|
||||||
|
@ -935,6 +936,8 @@ bool Workspace::hasCaption( const QString& caption )
|
||||||
*/
|
*/
|
||||||
void Workspace::requestFocus( Client* c)
|
void Workspace::requestFocus( Client* c)
|
||||||
{
|
{
|
||||||
|
if (!focusChangeEnabled())
|
||||||
|
return;
|
||||||
//TODO will be different for non-root clients. (subclassing?)
|
//TODO will be different for non-root clients. (subclassing?)
|
||||||
if ( !c ) {
|
if ( !c ) {
|
||||||
focusToNull();
|
focusToNull();
|
||||||
|
|
|
@ -115,6 +115,9 @@ public:
|
||||||
void activateClient( Client* );
|
void activateClient( Client* );
|
||||||
void requestFocus( Client* c);
|
void requestFocus( Client* c);
|
||||||
|
|
||||||
|
void setEnableFocusChange(bool b) { focus_change = b; }
|
||||||
|
bool focusChangeEnabled() { return focus_change; }
|
||||||
|
|
||||||
void doPlacement( Client* c );
|
void doPlacement( Client* c );
|
||||||
QPoint adjustClientPosition( Client* c, QPoint pos );
|
QPoint adjustClientPosition( Client* c, QPoint pos );
|
||||||
void raiseClient( Client* c );
|
void raiseClient( Client* c );
|
||||||
|
@ -286,6 +289,7 @@ private:
|
||||||
bool control_grab;
|
bool control_grab;
|
||||||
bool tab_grab;
|
bool tab_grab;
|
||||||
bool mouse_emulation;
|
bool mouse_emulation;
|
||||||
|
bool focus_change;
|
||||||
|
|
||||||
TabBox* tab_box;
|
TabBox* tab_box;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue