Catch all events related to clients, even if they're not e->xany.window .

svn path=/trunk/kdebase/kwin/; revision=255661
icc-effect-5.14.5
Luboš Luňák 2003-10-02 12:33:51 +00:00
parent 9d641a1ac5
commit 52b2452085
3 changed files with 49 additions and 19 deletions

View File

@ -234,6 +234,13 @@ bool Workspace::workspaceEvent( XEvent * e )
c->windowEvent( e );
return true;
}
Window special = findSpecialEventWindow( e );
if( special != None )
if( Client* c = findClient( WindowMatchPredicate( special )))
{
c->windowEvent( e );
return true;
}
switch (e->type)
{
@ -251,13 +258,6 @@ bool Workspace::workspaceEvent( XEvent * e )
case UnmapNotify:
{
// get also synthetic UnmapNotify from XWithdrawWindow(),
// xunmap.window is different from xany.window
if( Client* c = findClient( WindowMatchPredicate( e->xunmap.window )))
{
c->windowEvent( e );
return true;
}
// check for system tray windows
if ( removeSystemTrayWin( e->xunmap.window ) )
{
@ -305,6 +305,7 @@ bool Workspace::workspaceEvent( XEvent * e )
updateXTime();
// e->xmaprequest.window is different from e->xany.window
// TODO this shouldn't be necessary now
Client* c = findClient( WindowMatchPredicate( e->xmaprequest.window ));
if ( !c )
{
@ -377,9 +378,8 @@ bool Workspace::workspaceEvent( XEvent * e )
wc.sibling = None;
wc.stack_mode = Above;
value_mask = e->xconfigurerequest.value_mask | CWBorderWidth;
XConfigureWindow( qt_xdisplay(), e->xconfigurerequest.window, value_mask, & wc );
return TRUE;
XConfigureWindow( qt_xdisplay(), e->xconfigurerequest.window, value_mask, &wc );
return true;
}
break;
}
@ -395,17 +395,45 @@ bool Workspace::workspaceEvent( XEvent * e )
case FocusOut:
return true; // always eat these, they would tell Qt that KWin is the active app
default:
if ( e->type == Shape::shapeEvent() )
{
Client* c = findClient( WindowMatchPredicate( ((XShapeEvent *)e)->window ));
if ( c )
c->updateShape();
}
break;
}
return FALSE;
}
// Some events don't have the actual window which caused the event
// as e->xany.window (e.g. ConfigureRequest), but as some other
// field in the XEvent structure.
Window Workspace::findSpecialEventWindow( XEvent* e )
{
switch( e->type )
{
case CreateNotify:
return e->xcreatewindow.window;
case DestroyNotify:
return e->xdestroywindow.window;
case UnmapNotify:
return e->xunmap.window;
case MapNotify:
return e->xmap.window;
case MapRequest:
return e->xmaprequest.window;
case ReparentNotify:
return e->xreparent.window;
case ConfigureNotify:
return e->xconfigure.window;
case GravityNotify:
return e->xgravity.window;
case ConfigureRequest:
return e->xconfigurerequest.window;
case CirculateNotify:
return e->xcirculate.window;
case CirculateRequest:
return e->xcirculaterequest.window;
default:
return None;
};
}
/*!
Handles client messages sent to the workspace
*/

View File

@ -483,7 +483,7 @@ bool Client::manage( Window w, bool isMapped )
delete session;
// XUngrabServer( qt_xdisplay()); FRAME
// XUngrabServer( qt_xdisplay()); //FRAME
return true;
}

View File

@ -89,7 +89,7 @@ struct SessionInfo
};
class Workspace : public QObject, virtual public KWinInterface, public KDecorationDefines
class Workspace : public QObject, public KWinInterface, public KDecorationDefines
{
Q_OBJECT
public:
@ -98,7 +98,7 @@ class Workspace : public QObject, virtual public KWinInterface, public KDecorati
static Workspace * self() { return _self; }
virtual bool workspaceEvent( XEvent * );
bool workspaceEvent( XEvent * );
KDecoration* createDecoration( KDecorationBridge* bridge );
@ -384,6 +384,8 @@ class Workspace : public QObject, virtual public KWinInterface, public KDecorati
Client* createClient( Window w, bool is_mapped );
void addClient( Client* c, allowed_t );
Window findSpecialEventWindow( XEvent* e );
void randomPlacement(Client* c);
void smartPlacement(Client* c);
void cascadePlacement(Client* c, bool re_init = false);