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