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>
(cherry picked from commit f086971876)
r14.0.x
Michele Calgaro 5 years ago
parent f48c8f677c
commit de4a08d56a
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

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

Loading…
Cancel
Save