From 322bccde7b79b902d641032819d301303930cf77 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Mon, 29 Nov 1999 14:19:32 +0000 Subject: [PATCH] async keyboard svn path=/trunk/kdebase/kwin/; revision=35431 --- client.cpp | 37 ++++++++++++++++++------------------- main.cpp | 4 ++-- workspace.cpp | 24 ++++++++++++------------ 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/client.cpp b/client.cpp index 6729aa9789..b5fe7f4523 100644 --- a/client.cpp +++ b/client.cpp @@ -132,11 +132,10 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name) // StructureNotifyMask ); - // install a passive grab to catch mouse button events - XGrabButton(qt_xdisplay(), AnyButton, AnyModifier, winId(), FALSE, - ButtonPressMask, GrabModeSync, GrabModeSync, - None, None ); - + // install a passive grab to catch mouse button events + XGrabButton(qt_xdisplay(), AnyButton, AnyModifier, winId(), FALSE, + ButtonPressMask, GrabModeSync, GrabModeAsync, + None, None ); } WindowWrapper::~WindowWrapper() @@ -242,18 +241,18 @@ bool WindowWrapper::x11Event( XEvent * e) case Button3: com = options->commandWindow3(); break; - default: + default: com = Options::MouseActivateAndPassClick; } } - bool replay = ( (Client*)parentWidget() )->performMouseCommand( com, + bool replay = ( (Client*)parentWidget() )->performMouseCommand( com, QPoint( e->xbutton.x_root, e->xbutton.y_root) ); - + XAllowEvents(qt_xdisplay(), replay? ReplayPointer : SyncPointer, kwin_time); return TRUE; } break; - case ButtonRelease: + case ButtonRelease: XAllowEvents(qt_xdisplay(), SyncPointer, kwin_time); break; default: @@ -430,7 +429,7 @@ void Client::fetchName() } if ( s.isEmpty() ) s = i18n("unnamed"); - + if ( s != caption() ) { setCaption( "" ); if (workspace()->hasCaption( s ) ){ @@ -692,7 +691,7 @@ bool Client::clientMessage( XClientMessageEvent& e ) workspace()->activateClient( this ); return TRUE; } - + return FALSE; } @@ -780,7 +779,7 @@ QSize Client::sizeForWindowSize( const QSize& wsize, bool ignore_height) const w = QMAX( minimumWidth(), w ); h = QMAX( minimumHeight(), h ); - + int ww = wwrap->width(); int wh = 0; if ( !wwrap->testWState( WState_ForceHide ) ) @@ -1390,7 +1389,7 @@ void Client::setShade( bool s ) if ( isActive() ) workspace()->requestFocus( this ); } - + workspace()->iconifyOrDeiconifyTransientsOf( this ); } @@ -1446,7 +1445,7 @@ void Client::getWMHints() miniicon_pix = KWM::miniIcon( win, 16, 16 ); if ( !isWithdrawn() ) iconChange(); - + input = TRUE; XWMHints *hints = XGetWMHints(qt_xdisplay(), win ); if ( hints ) { @@ -1499,7 +1498,7 @@ void Client::setMask( const QRegion & reg) /*! Returns the main client. For normal windows, this is the window itself. For transient windows, it is the parent. - + */ Client* Client::mainClient() { @@ -1511,7 +1510,7 @@ Client* Client::mainClient() saveset.append( c ); c = workspace()->findClient( c->transientFor() ); } while ( c && c->isTransient() && !saveset.contains( c ) ); - + return c?c:this; } @@ -1556,7 +1555,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo buttonDown = TRUE; moveOffset = mapFromGlobal( globalPos ); invertedMoveOffset = rect().bottomRight() - moveOffset; - grabMouse( arrowCursor ); + grabMouse( arrowCursor ); if ( options->moveMode != Options::Opaque ) XGrabServer( qt_xdisplay() ); break; @@ -1565,12 +1564,12 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo buttonDown = TRUE; moveOffset = mapFromGlobal( globalPos ); if ( moveOffset.x() < width()/2) { - if ( moveOffset.y() < height()/2) + if ( moveOffset.y() < height()/2) mode = TopLeft; else mode = BottomLeft; } else { - if ( moveOffset.y() < height()/2) + if ( moveOffset.y() < height()/2) mode = TopRight; else mode = BottomRight; diff --git a/main.cpp b/main.cpp index 6cd073f0b8..c8daae066c 100644 --- a/main.cpp +++ b/main.cpp @@ -95,7 +95,7 @@ bool Application::x11EventFilter( XEvent *e ) e->xmotion.time : e->xbutton.time; break; case KeyPress: - case KeyRelease: + case KeyRelease: kwin_time = e->xkey.time; break; case PropertyNotify: @@ -104,7 +104,7 @@ bool Application::x11EventFilter( XEvent *e ) default: break; } - + for ( WorkspaceList::Iterator it = workspaces.begin(); it != workspaces.end(); ++it) { if ( (*it)->workspaceEvent( e ) ) return TRUE; diff --git a/workspace.cpp b/workspace.cpp index 6014c50be8..08825d731b 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -687,19 +687,19 @@ void Workspace::grabKey(KeySym keysym, unsigned int mod){ XGrabKey(qt_xdisplay(), XKeysymToKeycode(qt_xdisplay(), keysym), mod, qt_xrootwin(), FALSE, - GrabModeSync, GrabModeSync); + GrabModeAsync, GrabModeSync); XGrabKey(qt_xdisplay(), XKeysymToKeycode(qt_xdisplay(), keysym), mod | LockMask, qt_xrootwin(), FALSE, - GrabModeSync, GrabModeSync); + GrabModeAsync, GrabModeSync); XGrabKey(qt_xdisplay(), XKeysymToKeycode(qt_xdisplay(), keysym), mod | NumLockMask, qt_xrootwin(), FALSE, - GrabModeSync, GrabModeSync); + GrabModeAsync, GrabModeSync); XGrabKey(qt_xdisplay(), XKeysymToKeycode(qt_xdisplay(), keysym), mod | LockMask | NumLockMask, qt_xrootwin(), FALSE, - GrabModeSync, GrabModeSync); + GrabModeAsync, GrabModeSync); } @@ -758,8 +758,8 @@ void Workspace::iconifyOrDeiconifyTransientsOf( Client* c ) { if ( c->isIconified() || c->isShade() ) { for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) { - if ( (*it)->transientFor() == c->window() - && !(*it)->isIconified() + if ( (*it)->transientFor() == c->window() + && !(*it)->isIconified() && !(*it)->isShade() ) { (*it)->setMappingState( IconicState ); (*it)->hide(); @@ -805,7 +805,7 @@ void Workspace::requestFocus( Client* c) focusToNull(); return; } - + if ( !popup || !popup->isVisible() ) popup_client = c; @@ -891,7 +891,7 @@ QPopupMenu* Workspace::clientPopup( Client* c ) void Workspace::performWindowOperation( Client* c, Options::WindowOperation op ) { if ( !c ) return; - + switch ( op ) { case Options::CloseOp: c->closeWindow(); @@ -910,7 +910,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op ) } } -void Workspace::clientPopupActivated( int id ) +void Workspace::clientPopupActivated( int id ) { if ( popup_client ) performWindowOperation( popup_client, (Options::WindowOperation) id ); @@ -1285,7 +1285,7 @@ void Workspace::setCurrentDesktop( int new_desktop ){ active_client = 0; block_focus = TRUE; - + /* optimized Desktop switching: unmapping done from back to front mapping done from front to back => less exposure events @@ -1400,7 +1400,7 @@ bool Workspace::clientMessage( XClientMessageEvent msg ) setCurrentDesktop( msg.data.l[0] ); return TRUE; } - + return FALSE; } @@ -1602,7 +1602,7 @@ void Workspace::sendToDesktop( int desk ) popup_client->setDesktop( desk ); popup_client->hide(); - + Client* old = popup_client; for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) { if ( (*it)->transientFor() == popup_client->window() ) {