summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-11-17 13:22:03 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-11-17 13:22:03 (GMT)
commitfaf6d0de6e3b8168fbd6f04c5380f47d350e2a22 (patch)
treed3c35778ad9c7abe68b681b39dd004027fd50880 /src/gui/kernel
parent3a92f40e1faf4d81f5071a66558b051a9fda727e (diff)
parent499a9aaabad0756cbca7b39751684308a6ba88ea (diff)
downloadQt-faf6d0de6e3b8168fbd6f04c5380f47d350e2a22.zip
Qt-faf6d0de6e3b8168fbd6f04c5380f47d350e2a22.tar.gz
Qt-faf6d0de6e3b8168fbd6f04c5380f47d350e2a22.tar.bz2
Merge remote branch 'staging/4.6' into 4.6
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm6
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac.mm2
-rw-r--r--src/gui/kernel/qwidget.cpp21
-rw-r--r--src/gui/kernel/qwidget_mac.mm3
-rw-r--r--src/gui/kernel/qwidget_p.h6
5 files changed, 28 insertions, 10 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index c9dd949..427f0b0 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -571,6 +571,12 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse)
qt_mac_waitForMoreModalSessionEvents();
+ if (!d->interrupt && session == d->currentModalSessionCached) {
+ // Someone called e.g. [NSApp stopModal:] from outside the event
+ // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+ // 'session' as well. As a result, we need to restart all internal sessions:
+ d->temporarilyStopAllModalSessions();
+ }
} else {
d->nsAppRunCalledByQt = true;
QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm
index f142d71..3e0ba23 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac.mm
+++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm
@@ -67,7 +67,7 @@ QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
case QNativeGestureEvent::Swipe: {
QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
g->setSwipeAngle(ev->angle);
- return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
+ return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
break; }
default:
break;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 4aa358f..0d8da0c 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -3084,9 +3084,10 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
#endif
#ifndef QT_NO_IM
if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) {
- QInputContext *qic = inputContext();
+ QWidget *focusWidget = effectiveFocusWidget();
+ QInputContext *qic = focusWidget->d_func()->inputContext();
if (enable) {
- qic->setFocusWidget(q);
+ qic->setFocusWidget(focusWidget);
} else {
qic->reset();
qic->setFocusWidget(0);
@@ -10348,9 +10349,10 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break; }
case Qt::WA_NativeWindow: {
#ifndef QT_NO_IM
+ QWidget *focusWidget = d->effectiveFocusWidget();
QInputContext *ic = 0;
if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) {
- ic = d->inputContext();
+ ic = focusWidget->d_func()->inputContext();
ic->reset();
ic->setFocusWidget(0);
}
@@ -10359,7 +10361,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))
d->createWinId();
if (ic && isEnabled())
- ic->setFocusWidget(this);
+ ic->setFocusWidget(focusWidget);
#endif //QT_NO_IM
break;
}
@@ -10391,13 +10393,14 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_InputMethodEnabled: {
#ifndef QT_NO_IM
- QInputContext *ic = d->ic;
+ QWidget *focusWidget = d->effectiveFocusWidget();
+ QInputContext *ic = focusWidget->d_func()->ic;
if (!ic && (!on || hasFocus()))
- ic = d->inputContext();
+ ic = focusWidget->d_func()->inputContext();
if (ic) {
- if (on && hasFocus() && ic->focusWidget() != this && isEnabled()) {
- ic->setFocusWidget(this);
- } else if (!on && ic->focusWidget() == this) {
+ if (on && hasFocus() && ic->focusWidget() != focusWidget && isEnabled()) {
+ ic->setFocusWidget(focusWidget);
+ } else if (!on && ic->focusWidget() == focusWidget) {
ic->reset();
ic->setFocusWidget(0);
}
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 75f9a59..71f0077 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2673,7 +2673,10 @@ void QWidgetPrivate::transferChildren()
// site disabled until it is part of the new hierarchy.
bool oldRegistered = w->testAttribute(Qt::WA_DropSiteRegistered);
w->setAttribute(Qt::WA_DropSiteRegistered, false);
+ [qt_mac_nativeview_for(w) retain];
+ [qt_mac_nativeview_for(w) removeFromSuperview];
[qt_mac_nativeview_for(q) addSubview:qt_mac_nativeview_for(w)];
+ [qt_mac_nativeview_for(w) release];
w->setAttribute(Qt::WA_DropSiteRegistered, oldRegistered);
#endif
}
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index eea929b..66efcb5 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -465,6 +465,12 @@ public:
void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0);
QInputContext *inputContext() const;
+ inline QWidget *effectiveFocusWidget() {
+ QWidget *w = q_func();
+ while (w->focusProxy())
+ w = w->focusProxy();
+ return w;
+ }
void setModal_sys();