diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-03-24 10:36:40 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-03-24 15:04:38 (GMT) |
commit | 26b572903a800163972817cd717b5df454b96eb2 (patch) | |
tree | bb4ab24c797136cb655b9c2dab0260c0da4ee94b /src/gui/kernel | |
parent | cb530c3336964914fcec26c6ea001122104353ba (diff) | |
download | Qt-26b572903a800163972817cd717b5df454b96eb2.zip Qt-26b572903a800163972817cd717b5df454b96eb2.tar.gz Qt-26b572903a800163972817cd717b5df454b96eb2.tar.bz2 |
Do not move keyboard focus to invisible windows on X11.
When QWidget::activateWindow() is called we check if the window was already
mapped and just do not do anything if it wasn't. We used to try to active it
by giving it keyboard focus, but that always fails because it isn't allowed to
call XSetInputFocus on invisible windows, and the error message was swalled by
Qt in the error handler. So now we just don't bother even trying if we know the
call will fail.
Task-number: QTBUG-4042
Reviewed-by: Benjamin Poulain
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_x11.cpp | 3 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 67e0865..78fc704 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -669,11 +669,6 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err) return 0; break; - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - default: #if !defined(QT_NO_XINPUT) if (err->request_code == X11->xinput_major diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 457e92c..37ac6bf 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1661,7 +1661,8 @@ void QWidget::activateWindow() XSendEvent(X11->display, RootWindow(X11->display, tlw->x11Info().screen()), false, SubstructureNotifyMask | SubstructureRedirectMask, &e); } else { - XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time); + if (!qt_widget_private(tlw)->topData()->waitingForMapNotify) + XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time); } } } |