Make it possible for Client to pass an XEvent to Workspace for handling
it (will be needed for the following MapRequest handling for save-sets). svn path=/trunk/kdebase/kwin/; revision=273669
This commit is contained in:
parent
c84b674e6a
commit
05b1897258
2 changed files with 64 additions and 47 deletions
11
client.h
11
client.h
|
@ -78,7 +78,7 @@ class Client : public QObject, public KDecorationDefines
|
|||
QPoint clientPos() const; // inside of geometry()
|
||||
QSize clientSize() const;
|
||||
|
||||
void windowEvent( XEvent* e );
|
||||
bool windowEvent( XEvent* e );
|
||||
virtual bool eventFilter( QObject* o, QEvent* e );
|
||||
|
||||
bool manage( Window w, bool isMapped );
|
||||
|
@ -297,21 +297,22 @@ class Client : public QObject, public KDecorationDefines
|
|||
void doDrawbound( const QRect& geom, bool clear );
|
||||
|
||||
// handlers for X11 events
|
||||
void mapRequestEvent( XMapRequestEvent* e );
|
||||
bool mapRequestEvent( XMapRequestEvent* e );
|
||||
void unmapNotifyEvent( XUnmapEvent*e );
|
||||
void destroyNotifyEvent( XDestroyWindowEvent*e );
|
||||
void configureRequestEvent( XConfigureRequestEvent* e );
|
||||
void propertyNotifyEvent( XPropertyEvent* e );
|
||||
void clientMessageEvent( XClientMessageEvent* e );
|
||||
bool buttonPressEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
|
||||
bool buttonReleaseEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
|
||||
bool motionNotifyEvent( Window w, int state, int x, int y, int x_root, int y_root );
|
||||
void enterNotifyEvent( XCrossingEvent* e );
|
||||
void leaveNotifyEvent( XCrossingEvent* e );
|
||||
void visibilityNotifyEvent( XVisibilityEvent* e );
|
||||
void focusInEvent( XFocusInEvent* e );
|
||||
void focusOutEvent( XFocusOutEvent* e );
|
||||
|
||||
bool buttonPressEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
|
||||
bool buttonReleaseEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
|
||||
bool motionNotifyEvent( Window w, int state, int x, int y, int x_root, int y_root );
|
||||
|
||||
void processDecorationButtonPress( int button, int state, int x, int y, int x_root, int y_root );
|
||||
|
||||
private slots:
|
||||
|
|
64
events.cpp
64
events.cpp
|
@ -228,26 +228,29 @@ bool Workspace::workspaceEvent( XEvent * e )
|
|||
|
||||
if( Client* c = findClient( WindowMatchPredicate( e->xany.window )))
|
||||
{
|
||||
c->windowEvent( e );
|
||||
if( c->windowEvent( e ))
|
||||
return true;
|
||||
}
|
||||
if( Client* c = findClient( WrapperIdMatchPredicate( e->xany.window )))
|
||||
else if( Client* c = findClient( WrapperIdMatchPredicate( e->xany.window )))
|
||||
{
|
||||
c->windowEvent( e );
|
||||
if( c->windowEvent( e ))
|
||||
return true;
|
||||
}
|
||||
if( Client* c = findClient( FrameIdMatchPredicate( e->xany.window )))
|
||||
else if( Client* c = findClient( FrameIdMatchPredicate( e->xany.window )))
|
||||
{
|
||||
c->windowEvent( e );
|
||||
if( c->windowEvent( e ))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Window special = findSpecialEventWindow( e );
|
||||
if( special != None )
|
||||
if( Client* c = findClient( WindowMatchPredicate( special )))
|
||||
{
|
||||
c->windowEvent( e );
|
||||
if( c->windowEvent( e ))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
switch (e->type)
|
||||
{
|
||||
|
@ -462,7 +465,7 @@ bool Workspace::netCheck( XEvent* e )
|
|||
/*!
|
||||
General handler for XEvents concerning the client window
|
||||
*/
|
||||
void Client::windowEvent( XEvent* e )
|
||||
bool Client::windowEvent( XEvent* e )
|
||||
{
|
||||
if( e->xany.window == window()) // avoid doing stuff on frame or wrapper
|
||||
{
|
||||
|
@ -497,15 +500,20 @@ void Client::windowEvent( XEvent* e )
|
|||
switch (e->type)
|
||||
{
|
||||
case UnmapNotify:
|
||||
return unmapNotifyEvent( &e->xunmap );
|
||||
unmapNotifyEvent( &e->xunmap );
|
||||
break;
|
||||
case DestroyNotify:
|
||||
return destroyNotifyEvent( &e->xdestroywindow );
|
||||
destroyNotifyEvent( &e->xdestroywindow );
|
||||
break;
|
||||
case MapRequest:
|
||||
// this one may pass the event to workspace
|
||||
return mapRequestEvent( &e->xmaprequest );
|
||||
case ConfigureRequest:
|
||||
return configureRequestEvent( &e->xconfigurerequest );
|
||||
configureRequestEvent( &e->xconfigurerequest );
|
||||
break;
|
||||
case PropertyNotify:
|
||||
return propertyNotifyEvent( &e->xproperty );
|
||||
propertyNotifyEvent( &e->xproperty );
|
||||
break;
|
||||
case KeyPress:
|
||||
updateUserTime();
|
||||
workspace()->setWasUserInteraction();
|
||||
|
@ -515,7 +523,7 @@ void Client::windowEvent( XEvent* e )
|
|||
workspace()->setWasUserInteraction();
|
||||
buttonPressEvent( e->xbutton.window, e->xbutton.button, e->xbutton.state,
|
||||
e->xbutton.x, e->xbutton.y, e->xbutton.x_root, e->xbutton.y_root );
|
||||
return;
|
||||
break;;
|
||||
case KeyRelease:
|
||||
// don't update user time on releases
|
||||
// e.g. if the user presses Alt+F2, the Alt release
|
||||
|
@ -527,11 +535,11 @@ void Client::windowEvent( XEvent* e )
|
|||
// would appear as user input to the currently active window
|
||||
buttonReleaseEvent( e->xbutton.window, e->xbutton.button, e->xbutton.state,
|
||||
e->xbutton.x, e->xbutton.y, e->xbutton.x_root, e->xbutton.y_root );
|
||||
return;
|
||||
break;
|
||||
case MotionNotify:
|
||||
motionNotifyEvent( e->xmotion.window, e->xmotion.state,
|
||||
e->xmotion.x, e->xmotion.y, e->xmotion.x_root, e->xmotion.y_root );
|
||||
return;
|
||||
break;
|
||||
case EnterNotify:
|
||||
enterNotifyEvent( &e->xcrossing );
|
||||
// MotionNotify is guaranteed to be generated only if the mouse
|
||||
|
@ -541,19 +549,23 @@ void Client::windowEvent( XEvent* e )
|
|||
// events simpler (Qt does that too).
|
||||
motionNotifyEvent( e->xcrossing.window, e->xcrossing.state,
|
||||
e->xcrossing.x, e->xcrossing.y, e->xcrossing.x_root, e->xcrossing.y_root );
|
||||
return;
|
||||
break;
|
||||
case LeaveNotify:
|
||||
motionNotifyEvent( e->xcrossing.window, e->xcrossing.state,
|
||||
e->xcrossing.x, e->xcrossing.y, e->xcrossing.x_root, e->xcrossing.y_root );
|
||||
return leaveNotifyEvent( &e->xcrossing );
|
||||
leaveNotifyEvent( &e->xcrossing );
|
||||
break;
|
||||
case FocusIn:
|
||||
return focusInEvent( &e->xfocus );
|
||||
focusInEvent( &e->xfocus );
|
||||
break;
|
||||
case FocusOut:
|
||||
return focusOutEvent( &e->xfocus );
|
||||
focusOutEvent( &e->xfocus );
|
||||
break;
|
||||
case ReparentNotify:
|
||||
break;
|
||||
case ClientMessage:
|
||||
return clientMessageEvent( &e->xclient );
|
||||
clientMessageEvent( &e->xclient );
|
||||
break;
|
||||
case ColormapChangeMask:
|
||||
if( e->xany.window == window())
|
||||
{
|
||||
|
@ -563,7 +575,8 @@ void Client::windowEvent( XEvent* e )
|
|||
}
|
||||
break;
|
||||
case VisibilityNotify:
|
||||
return visibilityNotifyEvent( &e->xvisibility );
|
||||
visibilityNotifyEvent( &e->xvisibility );
|
||||
break;
|
||||
default:
|
||||
if( e->xany.window == window())
|
||||
{
|
||||
|
@ -575,17 +588,20 @@ void Client::windowEvent( XEvent* e )
|
|||
}
|
||||
break;
|
||||
}
|
||||
return true; // eat all events
|
||||
}
|
||||
|
||||
/*!
|
||||
Handles map requests of the client window
|
||||
*/
|
||||
void Client::mapRequestEvent( XMapRequestEvent* e )
|
||||
bool Client::mapRequestEvent( XMapRequestEvent* e )
|
||||
{
|
||||
if( e->window != window())
|
||||
return; // no messing with frame etc.
|
||||
{
|
||||
return true; // no messing with frame etc.
|
||||
}
|
||||
if( isTopMenu() && workspace()->managingTopMenus())
|
||||
return; // kwin controls these
|
||||
return true; // kwin controls these
|
||||
switch ( mappingState() )
|
||||
{
|
||||
case WithdrawnState:
|
||||
|
@ -610,9 +626,9 @@ void Client::mapRequestEvent( XMapRequestEvent* e )
|
|||
// TODO fake MapNotify?
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Handles unmap notify events of the client window
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue