remove some passive grab combinations on active windows. Helps GIMP, TK and Co.

svn path=/trunk/kdebase/kwin/; revision=45057
This commit is contained in:
Matthias Ettrich 2000-03-29 14:53:25 +00:00
parent 126ef189bd
commit 5a7b9ed8aa
2 changed files with 37 additions and 1 deletions

View file

@ -153,6 +153,39 @@ WindowWrapper::~WindowWrapper()
releaseWindow();
}
static void ungrabButton( WId winId, int modifier )
{
XUngrabButton( qt_xdisplay(), AnyButton, modifier, winId );
XUngrabButton( qt_xdisplay(), AnyButton, modifier | LockMask, winId );
}
/*!
Called by the client to notify the window wrapper when activation
state changes.
Releases the passive grab for some modifier combinations when a
window becomes active. This helps broken X programs that
missinterpret LeaveNotify events in grab mode to work properly
(Motif, AWT, Tk, ...)
*/
void WindowWrapper::setActive( bool active )
{
if ( active ) {
ungrabButton( winId(), None );
ungrabButton( winId(), ShiftMask );
ungrabButton( winId(), ControlMask );
ungrabButton( winId(), ControlMask | ShiftMask );
} else {
XGrabButton(qt_xdisplay(), AnyButton, AnyModifier, winId(), FALSE,
ButtonPressMask,
GrabModeSync, GrabModeAsync,
None, None );
}
}
QSize WindowWrapper::sizeHint() const
{
return size();
@ -1429,6 +1462,7 @@ void Client::setShade( bool s )
*/
void Client::setActive( bool act)
{
windowWrapper()->setActive( act );
if ( act )
workspace()->setActiveClient( this );

View file

@ -26,6 +26,8 @@ public:
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
void setActive( bool );
protected:
void resizeEvent( QResizeEvent * );
void showEvent( QShowEvent* );
@ -132,7 +134,7 @@ public:
bool providesContextHelp() const;
bool performMouseCommand( Options::MouseCommand, QPoint globalPos );
QCString windowRole();
QCString sessionId();