Improved code for keyboard and mouse grabbing and releasing to avoid

unnecessary actions. This relates loosely to bug 2955.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/25/head
Michele Calgaro 5 years ago
parent 8520b59ce9
commit f086971876
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -1487,8 +1487,10 @@ void TQWidget::grabMouse()
void TQWidget::grabMouse( const TQCursor &cursor ) void TQWidget::grabMouse( const TQCursor &cursor )
{ {
if ( !qt_nograb() ) { if ( !qt_nograb() ) {
if ( mouseGrb ) if ( mouseGrb != this ) {
if ( mouseGrb ) {
mouseGrb->releaseMouse(); mouseGrb->releaseMouse();
}
#if defined(QT_CHECK_STATE) #if defined(QT_CHECK_STATE)
int status = int status =
#endif #endif
@ -1510,6 +1512,7 @@ void TQWidget::grabMouse( const TQCursor &cursor )
#endif #endif
mouseGrb = this; mouseGrb = this;
} }
}
} }
/*! /*!
@ -1548,12 +1551,14 @@ void TQWidget::releaseMouse()
void TQWidget::grabKeyboard() void TQWidget::grabKeyboard()
{ {
if ( !qt_nograb() ) { if ( !qt_nograb() ) {
if ( keyboardGrb ) if ( keyboardGrb != this ) {
if ( keyboardGrb ) {
keyboardGrb->releaseKeyboard(); keyboardGrb->releaseKeyboard();
XGrabKeyboard( x11Display(), winid, False, GrabModeAsync, GrabModeAsync, }
tqt_x_time ); XGrabKeyboard( x11Display(), winid, False, GrabModeAsync, GrabModeAsync, tqt_x_time );
keyboardGrb = this; keyboardGrb = this;
} }
}
} }
/*! /*!

Loading…
Cancel
Save