summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-13 04:45:22 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-13 04:45:22 (GMT)
commitfbacd0fb2eb41470b090a3cbca7535f78689a382 (patch)
tree4f6ca32958fd9c5c95ae9ca2f599bf56067d2c45 /src/gui/kernel
parent3e94b3a77affeef80544e48949e018ced4e0d96e (diff)
parent9f0884773a451a4feef80812e015266bd487dcdc (diff)
downloadQt-fbacd0fb2eb41470b090a3cbca7535f78689a382.zip
Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.tar.gz
Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (61 commits) Revert Merge Request 551. This introduces regressions to Qt. Fixed scroll area size calculation on Mac. Fix a race where QThread::exit() is "lost" when called after start() make a partial build of linguist in no-gui config make the code less of a trap fix build from top level Partially revert MR 543 changes to Linguist. Apply f176759fc41abc4cb901c2cbaa15264f2a9ac85b to stdout too. Autotest: add some debugging, just in case there's something wrong Autotest: fix the fix for the rounding error. Fix compile error with QT_NO_LIBRARY in QtMultimedia the _setmode() prototype is different on win ce qdoc: Changed qdoc to output the new doc format. Doc: update 'developing on mac' fcntl.h doesn't seem to exist, either - contrary to an example on msdn Autotest: fix paths on the test server after update. Force the repaint during a window resize. fix compile on wince remove CONFIG += ordered again Assistant: Check namespace and virtual folder syntax of help projects. ...
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication_mac.mm43
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h25
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm30
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm34
-rw-r--r--src/gui/kernel/qeventdispatcher_mac_p.h1
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm10
-rw-r--r--src/gui/kernel/qwidget_mac.mm5
7 files changed, 59 insertions, 89 deletions
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 28072fc..321492d 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1221,7 +1221,7 @@ void qt_init(QApplicationPrivate *priv, int)
}
#endif
- if (!app_proc_ae_handlerUPP) {
+ if (!app_proc_ae_handlerUPP && !QApplication::testAttribute(Qt::AA_MacPluginApplication)) {
app_proc_ae_handlerUPP = AEEventHandlerUPP(QApplicationPrivate::globalAppleEventProcessor);
for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) {
// Install apple event handler, but avoid overwriting an already
@@ -2446,25 +2446,30 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
}
if(!handled_event) {
if(cmd.commandID == kHICommandQuit) {
- handled_event = true;
- HiliteMenu(0);
- bool handle_quit = true;
- if(QApplicationPrivate::modalState()) {
- int visible = 0;
- const QWidgetList tlws = QApplication::topLevelWidgets();
- for(int i = 0; i < tlws.size(); ++i) {
- if(tlws.at(i)->isVisible())
- ++visible;
+ // Quitting the application is not Qt's responsibility if
+ // used in a plugin or just embedded into a native application.
+ // In that case, let the event pass down to the native apps event handler.
+ if (!QApplication::testAttribute(Qt::AA_MacPluginApplication)) {
+ handled_event = true;
+ HiliteMenu(0);
+ bool handle_quit = true;
+ if(QApplicationPrivate::modalState()) {
+ int visible = 0;
+ const QWidgetList tlws = QApplication::topLevelWidgets();
+ for(int i = 0; i < tlws.size(); ++i) {
+ if(tlws.at(i)->isVisible())
+ ++visible;
+ }
+ handle_quit = (visible <= 1);
+ }
+ if(handle_quit) {
+ QCloseEvent ev;
+ QApplication::sendSpontaneousEvent(app, &ev);
+ if(ev.isAccepted())
+ app->quit();
+ } else {
+ QApplication::beep();
}
- handle_quit = (visible <= 1);
- }
- if(handle_quit) {
- QCloseEvent ev;
- QApplication::sendSpontaneousEvent(app, &ev);
- if(ev.isAccepted())
- app->quit();
- } else {
- QApplication::beep();
}
} else if(cmd.commandID == kHICommandSelectWindow) {
if((GetCurrentKeyModifiers() & cmdKey))
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index 129e0a5..ec00915 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -58,7 +58,6 @@ QT_BEGIN_NAMESPACE
extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp
-extern bool qt_blockCocoaSettingModalWindowLevel; // qeventdispatcher_mac_p.h
Q_GLOBAL_STATIC(QPointer<QWidget>, currentDragTarget);
@@ -102,30 +101,6 @@ QT_END_NAMESPACE
return !(isPopup || isToolTip || isTool);
}
-- (void)orderWindow:(NSWindowOrderingMode)orderingMode relativeTo:(NSInteger)otherWindowNumber
-{
- if (qt_blockCocoaSettingModalWindowLevel) {
- // To avoid windows popping in front while restoring modal sessions
- // in the event dispatcher, we block cocoa from ordering this window
- // to front. The result of not doing this can be seen if executing
- // a native color dialog on top of another executing dialog.
- return;
- }
- [super orderWindow:orderingMode relativeTo:otherWindowNumber];
-}
-
-- (void)setLevel:(NSInteger)windowLevel
-{
- if (qt_blockCocoaSettingModalWindowLevel) {
- // To avoid windows popping in front while restoring modal sessions
- // in the event dispatcher, we block cocoa from ordering this window
- // to front. The result of not doing this can be seen if executing
- // a native color dialog on top of another executing dialog.
- return;
- }
- [super setLevel:windowLevel];
-}
-
- (void)toggleToolbarShown:(id)sender
{
macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 06eb7ff..9c5380b 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -657,23 +657,33 @@ static int qCocoaViewCount = 0;
{
if (!qwidget)
return;
-
if (qwidgetprivate->data.in_destructor)
return;
- QEvent enterEvent(QEvent::Enter);
- NSPoint windowPoint = [event locationInWindow];
- NSPoint globalPoint = [[event window] convertBaseToScreen:windowPoint];
- NSPoint viewPoint = [self convertPoint:windowPoint fromView:nil];
+
if (!qAppInstance()->activeModalWidget() || QApplicationPrivate::tryModalHelper(qwidget, 0)) {
+ QEvent enterEvent(QEvent::Enter);
+ NSPoint windowPoint = [event locationInWindow];
+ NSPoint globalPoint = [[event window] convertBaseToScreen:windowPoint];
+ NSPoint viewPoint = [self convertPoint:windowPoint fromView:nil];
QApplication::sendEvent(qwidget, &enterEvent);
qt_mouseover = qwidget;
- // Update cursor and dispatch hover events.
+ // Update cursor icon:
qt_mac_update_cursor_at_global_pos(flipPoint(globalPoint).toPoint());
- if (qwidget->testAttribute(Qt::WA_Hover) &&
- (!qAppInstance()->activePopupWidget() || qAppInstance()->activePopupWidget() == qwidget->window())) {
- QHoverEvent he(QEvent::HoverEnter, QPoint(viewPoint.x, viewPoint.y), QPoint(-1, -1));
- QApplicationPrivate::instance()->notify_helper(qwidget, &he);
+
+ // Send mouse move and hover events as well:
+ if (!qAppInstance()->activePopupWidget() || qAppInstance()->activePopupWidget() == qwidget->window()) {
+ if (qwidget->testAttribute(Qt::WA_MouseTracking)) {
+ NSEvent *mouseEvent = [NSEvent mouseEventWithType:NSMouseMoved
+ location:windowPoint modifierFlags:[event modifierFlags] timestamp:[event timestamp]
+ windowNumber:[event windowNumber] context:[event context] eventNumber:[event eventNumber]
+ clickCount:0 pressure:0];
+ qt_mac_handleMouseEvent(self, mouseEvent, QEvent::MouseMove, Qt::NoButton);
+ }
+ if (qwidget->testAttribute(Qt::WA_Hover)) {
+ QHoverEvent he(QEvent::HoverEnter, QPoint(viewPoint.x, viewPoint.y), QPoint(-1, -1));
+ QApplicationPrivate::instance()->notify_helper(qwidget, &he);
+ }
}
}
}
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index a7f1224..0d93b9f 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -97,11 +97,6 @@ QT_BEGIN_NAMESPACE
QT_USE_NAMESPACE
/*****************************************************************************
- Internal variables and functions
- *****************************************************************************/
-bool qt_blockCocoaSettingModalWindowLevel = false;
-
-/*****************************************************************************
Externals
*****************************************************************************/
extern void qt_event_request_timer(MacTimerInfo *); //qapplication_mac.cpp
@@ -752,7 +747,6 @@ bool QEventDispatcherMacPrivate::interrupt = false;
#ifdef QT_MAC_USE_COCOA
QStack<QCocoaModalSessionInfo> QEventDispatcherMacPrivate::cocoaModalSessionStack;
bool QEventDispatcherMacPrivate::currentExecIsNSAppRun = false;
-bool QEventDispatcherMacPrivate::modalSessionsTemporarilyStopped = false;
bool QEventDispatcherMacPrivate::nsAppRunCalledByQt = false;
bool QEventDispatcherMacPrivate::cleanupModalSessionsNeeded = false;
NSModalSession QEventDispatcherMacPrivate::currentModalSessionCached = 0;
@@ -788,19 +782,14 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
// we need to stop all the modal session first. To avoid changing
// the stacking order of the windows while doing so, we put
// up a block that is used in QCocoaWindow and QCocoaPanel:
- QBoolBlocker block1(blockSendPostedEvents, true);
- QBoolBlocker block2(qt_blockCocoaSettingModalWindowLevel, true);
-
int stackSize = cocoaModalSessionStack.size();
for (int i=stackSize-1; i>=0; --i) {
QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
if (info.session) {
- [NSApp runModalSession:info.session];
[NSApp endModalSession:info.session];
info.session = 0;
}
}
- modalSessionsTemporarilyStopped = true;
currentModalSessionCached = 0;
}
@@ -834,29 +823,12 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
// When creating a modal session cocoa will rearrange the windows.
// In order to avoid windows to be put behind another we need to
// keep the window level.
- {
- int level = [window level];
- info.session = [NSApp beginModalSessionForWindow:window];
- [window setLevel:level];
- }
+ int level = [window level];
+ info.session = [NSApp beginModalSessionForWindow:window];
+ [window setLevel:level];
}
currentModalSessionCached = info.session;
}
-
- if (modalSessionsTemporarilyStopped && currentModalSessionCached) {
- // After a call to temporarilyStopAllModalSessions, cocoa have
- // now posted events to restore ended modal session windows to
- // the correct window level. Those events will be processed
- // _after_ our new calls to beginModalSessionForWindow have
- // taken effect, which will end up stacking the windows wrong on
- // screen. To work around this, we block cocoa from changing the
- // stacking order of the windows, and flush out the pending events
- // (the block is used in QCocoaWindow and QCocoaPanel):
- QBoolBlocker block1(blockSendPostedEvents, true);
- QBoolBlocker block2(qt_blockCocoaSettingModalWindowLevel, true);
- [NSApp runModalSession:currentModalSessionCached];
- }
- modalSessionsTemporarilyStopped = false;
return currentModalSessionCached;
}
diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h
index 8ac7c65..a0afb84 100644
--- a/src/gui/kernel/qeventdispatcher_mac_p.h
+++ b/src/gui/kernel/qeventdispatcher_mac_p.h
@@ -176,7 +176,6 @@ public:
static bool currentExecIsNSAppRun;
static bool nsAppRunCalledByQt;
static bool cleanupModalSessionsNeeded;
- static bool modalSessionsTemporarilyStopped;
static NSModalSession currentModalSessionCached;
static NSModalSession currentModalSession();
static void updateChildrenWorksWhenModal();
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index b1e4c94..a05c7d5 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -882,7 +882,15 @@ void qt_mac_dispatchNCMouseMessage(void * /* NSWindow* */eventWindow, void * /*
}
}
- QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, button, keyMods);
+ Qt::MouseButtons buttons = 0;
+ {
+ UInt32 mac_buttons;
+ if (GetEventParameter((EventRef)[event eventRef], kEventParamMouseChord, typeUInt32, 0,
+ sizeof(mac_buttons), 0, &mac_buttons) == noErr)
+ buttons = qt_mac_get_buttons(mac_buttons);
+ }
+
+ QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, buttons, keyMods);
qt_sendSpontaneousEvent(widgetToGetEvent, &qme);
// We don't need to set the implicit grab widget here because we won't
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 3d86936..d7cd2eb 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4267,6 +4267,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
QMacCocoaAutoReleasePool pool;
bool realWindow = isRealWindow();
+ BOOL needDisplay = realWindow ? YES : NO;
if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen)){
adjustWithinMaxAndMinSize(w, h);
@@ -4314,7 +4315,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (currTopLeft.x() == x && currTopLeft.y() == y
&& cocoaFrameRect.size.width != 0
&& cocoaFrameRect.size.height != 0) {
- [window setFrame:cocoaFrameRect display:NO];
+ [window setFrame:cocoaFrameRect display:needDisplay];
} else {
// The window is moved and resized (or resized to zero).
// Since Cocoa usually only sends us a resize callback after
@@ -4323,7 +4324,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
// would have the same origin as the setFrame call) we shift the
// window back and forth inbetween.
cocoaFrameRect.origin.y += 1;
- [window setFrame:cocoaFrameRect display:NO];
+ [window setFrame:cocoaFrameRect display:needDisplay];
cocoaFrameRect.origin.y -= 1;
[window setFrameOrigin:cocoaFrameRect.origin];
}