From 3335721dcf72cda957ba0e507608d795cab3f1ab Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 3 Mar 2010 12:45:14 +0100 Subject: Fix focus behavior bug on Mac OS X. With the Full Access Keyboard enabled, the focus could sometimes be stolen by the window. --- src/gui/kernel/qcocoaview_mac.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index a1dcc2a..f7cb21f 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1028,7 +1028,10 @@ static int qCocoaViewCount = 0; { if (!qwidget) return NO; - if (qwidget->isWindow()) + // Before accepting the focus for a window, we check that + // the focusWidget (if any) is not contained in the same window. + if (qwidget->isWindow() && (!qApp->focusWidget() + || qApp->focusWidget()->window() != qwidget)) return YES; // Always do it, so that windows can accept key press events. return qwidget->focusPolicy() != Qt::NoFocus; } -- cgit v0.12