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 4 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 )
{
if ( !qt_nograb() ) {
if ( mouseGrb )
if ( mouseGrb != this ) {
if ( mouseGrb ) {
mouseGrb->releaseMouse();
}
#if defined(QT_CHECK_STATE)
int status =
#endif
@ -1511,6 +1513,7 @@ void TQWidget::grabMouse( const TQCursor &cursor )
mouseGrb = this;
}
}
}
/*!
Releases the mouse grab.
@ -1548,13 +1551,15 @@ 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;
}
}
}
/*!
Releases the keyboard grab.

Loading…
Cancel
Save