From 81bd6b26c32646a88eefc53904493145249446e1 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Sun, 13 Aug 2000 17:07:26 +0000 Subject: [PATCH] some focus follows mouse stuff svn path=/trunk/kdebase/kwin/; revision=60885 --- client.cpp | 7 +++++-- main.cpp | 4 ++-- workspace.cpp | 15 +++++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/client.cpp b/client.cpp index f2788796d9..9fbf831a9f 100644 --- a/client.cpp +++ b/client.cpp @@ -195,7 +195,8 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name) XSelectInput( qt_xdisplay(), w, FocusChangeMask | - PropertyChangeMask + PropertyChangeMask | + EnterWindowMask | LeaveWindowMask ); // install a passive grab to catch mouse button events @@ -1702,6 +1703,7 @@ bool Client::x11Event( XEvent * e) workspace()->requestFocus( this ); return TRUE; } + if ( e->type == LeaveNotify && e->xcrossing.mode == NotifyNormal ) { if ( !buttonDown ) setCursor( arrowCursor ); @@ -1709,12 +1711,13 @@ bool Client::x11Event( XEvent * e) if ( lostMouse ) { delete autoRaiseTimer; autoRaiseTimer = 0; - } + } if ( options->focusPolicy == Options::FocusStrictlyUnderMouse ) if ( isActive() && lostMouse ) workspace()->requestFocus( 0 ) ; return TRUE; } + return FALSE; } diff --git a/main.cpp b/main.cpp index 591682f0f8..247643c628 100644 --- a/main.cpp +++ b/main.cpp @@ -45,8 +45,8 @@ static DCOPClient * client = 0; static void crashHandler(int) { KCrash::setCrashHandler(0); // Exit on next crash. - delete client; client = 0; // Unregister with dcop. - system("kwin&"); // Try to restart + client->detach(); // Unregister with dcop. +// system("kwin&"); // Try to restart } int x11ErrorHandler(Display *d, XErrorEvent *e){ diff --git a/workspace.cpp b/workspace.cpp index 7acb122665..904f7e348d 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -470,6 +470,12 @@ bool Workspace::workspaceEvent( XEvent * e ) } break; case EnterNotify: + qDebug("EnterNotify"); + { + QWidget* w = QWidget::find( e->xcrossing.window ); + if (w ) + qDebug("w = %s", w->className() ); + } if ( !QWhatsThis::inWhatsThisMode() ) break; { @@ -479,6 +485,7 @@ bool Workspace::workspaceEvent( XEvent * e ) } break; case LeaveNotify: + qDebug("LeaveNotify"); if ( !QWhatsThis::inWhatsThisMode() ) break; c = findClientWidthId( e->xcrossing.window ); @@ -1626,7 +1633,7 @@ void Workspace::raiseClient( Client* c ) propagateClients( TRUE ); - + if ( tab_box->isVisible() ) tab_box->raise(); } @@ -2073,13 +2080,13 @@ void Workspace::slotWindowLower() */ void Workspace::slotMouseEmulation() { - + if ( mouse_emulation ) { XUngrabKeyboard(qt_xdisplay(), kwin_time); mouse_emulation = FALSE; return; - } - + } + if ( XGrabKeyboard(qt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync,