From 5af6a09b6faf55bf70237913f49dcf4ba2358f52 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 5 Jun 2011 04:16:13 -0700 Subject: [PATCH] Avoid bogus accessibility focus events from menus. Do not send accessibility focus events when menus are involved. There are focus events to preserve the old focus when showing a new popup window. Reviewed-by: Jan-Arve (cherry picked from commit 32079bb0b348ef5f7126e69be9bcfb249c1a6412) Change-Id: Id4838a3aede1d60a1850385e97660d085f055d64 Reviewed-on: http://codereview.qt.nokia.com/3021 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/gui/kernel/qwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 60f2064..231fc26 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6444,6 +6444,10 @@ void QWidget::setFocus(Qt::FocusReason reason) if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId())) //setFocusWidget will already post a focus event for us (that the AT client receives) on Windows # endif +# ifdef Q_OS_UNIX + // menus update the focus manually and this would create bogus events + if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem"))) +# endif QAccessible::updateAccessibility(f, 0, QAccessible::Focus); #endif #ifndef QT_NO_GRAPHICSVIEW -- 2.7.4