Try to fix #32969 by keeping the mouse grab even for active windows. People

not wanting this can disable click raise. Let's see if it breaks something.
(Related to this: kwin/client.cpp r1.309,r1.308,r1.305,r1.304,r1.303.)
TODO: the grab could be released at least as long as the window is topmost
and active

svn path=/trunk/kdebase/kwin/; revision=196998
This commit is contained in:
Luboš Luňák 2003-01-02 16:36:00 +00:00
parent 73e6f75ab7
commit a3bd5ae078
3 changed files with 10 additions and 17 deletions

View file

@ -272,7 +272,9 @@ static void ungrabButton( WId winId, int modifier )
void WindowWrapper::setActive( bool active )
{
if ( active ) {
if ( options->focusPolicy == Options::ClickToFocus || !options->clickRaise )
if ( !options->clickRaise )
// TODO but we could at least ungrab when the window is the top client
// and grab again after it's lowered
ungrabButton( winId(), None );
ungrabButton( winId(), ShiftMask );
ungrabButton( winId(), ControlMask );
@ -416,11 +418,9 @@ bool WindowWrapper::x11Event( XEvent * e)
bool bModKeyHeld = ( e->xbutton.state & KKeyNative::accelModMaskX()) == keyModX;
if ( ((Client*)parentWidget())->isActive()
&& ( options->focusPolicy != Options::ClickToFocus
&& options->clickRaise && !bModKeyHeld ) ) {
&& ( options->clickRaise && !bModKeyHeld ) ) {
if ( e->xbutton.button < 4 ) // exclude wheel
((Client*)parentWidget())->autoRaise();
ungrabButton( winId(), None );
}
Options::MouseCommand com = Options::MouseNothing;
@ -2589,15 +2589,8 @@ void Client::getWindowProtocols(){
*/
void Client::takeFocus( bool force )
{
if ( !force && ( isTopMenu() || isDock() ) ) {
if ( isDock() && !staysOnTop() && workspace()->activeClient() ) {
// the active client might get covered by a dock
// window. Re-enable ourselves passive grabs to make
// click-raise work again
workspace()->activeClient()->windowWrapper()->setActive( FALSE );
}
if ( !force && ( isTopMenu() || isDock() ) )
return; // toplevel menus and dock windows don't take focus if not forced
}
if ( input ) {
// Matthias Ettrich says to comment it so that we avoid two consecutive setActive
@ -2701,6 +2694,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
workspace()->raiseClient( this );
break;
case Options::MouseActivateAndRaise:
replay = isActive(); // for clickraise mode
workspace()->requestFocus( this );
workspace()->raiseClient( this );
break;
@ -2709,6 +2703,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
workspace()->lowerClient( this );
break;
case Options::MouseActivate:
replay = isActive(); // for clickraise mode
workspace()->requestFocus( this );
break;
case Options::MouseActivateRaiseAndPassClick:

View file

@ -291,8 +291,8 @@ void KFocusConfig::setAutoRaiseEnabled()
{
autoRaiseOn->setEnabled(false);
autoRaiseOnTog(false);
clickRaiseOn->setEnabled(false);
clickRaiseOnTog(false);
clickRaiseOn->setEnabled(true);
clickRaiseOnTog(true);
}
}

View file

@ -224,9 +224,7 @@ void Options::reload()
shadeHoverInterval = config->readNumEntry("ShadeHoverInterval", 250 );
// important: autoRaise implies ClickRaise
// ClickToFocus implies clickRaise too
clickRaise = autoRaise || ( focusPolicy == ClickToFocus )
|| config->readBoolEntry("ClickRaise", FALSE );
clickRaise = autoRaise || config->readBoolEntry("ClickRaise", true );
borderSnapZone = config->readNumEntry("BorderSnapZone", 10);
windowSnapZone = config->readNumEntry("WindowSnapZone", 10);