diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-20 09:29:40 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-20 09:29:40 (GMT) |
commit | 33afa6c1fbe230dec4eea435f9ad5d4141c128a8 (patch) | |
tree | 2ace5c779c10288503b348a8d8bac8748dad0cae /src/gui/kernel | |
parent | ee1e6222114028c2ff181f972e32f15011723b5f (diff) | |
parent | 9f668a352df15404234ea30bc9bb0c1ef774c1b0 (diff) | |
download | Qt-33afa6c1fbe230dec4eea435f9ad5d4141c128a8.zip Qt-33afa6c1fbe230dec4eea435f9ad5d4141c128a8.tar.gz Qt-33afa6c1fbe230dec4eea435f9ad5d4141c128a8.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into windows-7-multitouch
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 4 | ||||
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 17 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_x11.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qx11embed_x11.cpp | 7 |
6 files changed, 27 insertions, 15 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index cef8cf2..4878ea7 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3205,10 +3205,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg) if (popupButtonFocus) { target = popupButtonFocus; } else if (popupChild) { - // forward mouse events to the popup child. mouse move events - // are only forwarded to popup children that enable mouse tracking. - if (type != QEvent::MouseMove || popupChild->hasMouseTracking()) - target = popupChild; + target = popupChild; } pos = target->mapFromGlobal(globalPos); diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 670226b..dcb3564 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -632,7 +632,7 @@ extern "C" { for (NSView *lookView in viewsToLookAt) { NSPoint tmpPoint = [lookView convertPoint:windowPoint fromView:nil]; for (NSView *view in [lookView subviews]) { - if (view == mouseView) + if (view == mouseView || [view isHidden]) continue; NSRect frameRect = [view frame]; if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) @@ -651,7 +651,7 @@ extern "C" { NSPoint tmpPoint = [viewForDescent convertPoint:windowPoint fromView:nil]; // Apply same rule as above wrt z-order. for (NSView *view in [viewForDescent subviews]) { - if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) + if (![view isHidden] && NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) lowerView = view; } if (!lowerView) // Low as we can be at this point. diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 9c381b4..52e76d8 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -555,12 +555,15 @@ bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widge int keyLength = [keyChars length]; if (keyLength == 0) return false; // Dead Key, nothing to do! + bool ignoreText = false; Qt::Key qtKey = Qt::Key_unknown; if (keyLength == 1) { QChar ch([keyChars characterAtIndex:0]); if (ch.isLower()) ch = ch.toUpper(); qtKey = cocoaKey2QtKey(ch); + // Do not set the text for Function-Key Unicodes characters (0xF700–0xF8FF). + ignoreText = (ch.unicode() >= 0xF700 && ch.unicode() <= 0xF8FF); } Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([event modifierFlags]); QString text; @@ -568,7 +571,7 @@ bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widge // To quote from the Carbon port: This is actually wrong--but it is the best that // can be done for now because of the Control/Meta mapping issues // (we always get text on the Mac) - if (!(keyMods & (Qt::ControlModifier | Qt::MetaModifier))) + if (!ignoreText && !(keyMods & (Qt::ControlModifier | Qt::MetaModifier))) text = QCFString::toQString(reinterpret_cast<CFStringRef>(keyChars)); UInt32 macScanCode = 1; diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 5d91c74..ec05f12 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -459,7 +459,18 @@ Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget *w) if (hiview){ OSWindowRef window = qt_mac_window_for(hiview); if (!window && qt_isGenuineQWidget(hiview)) { - w->window()->d_func()->createWindow_sys(); + QWidget *myWindow = w->window(); + // This is a workaround for NSToolbar. When a widget is hidden + // by clicking the toolbar button, Cocoa reparents the widgets + // to another window (but Qt doesn't know about it). + // When we start showing them, it reparents back, + // but at this point it's window is nil, but the window it's being brought + // into (the Qt one) is for sure created. + // This stops the hierarchy moving under our feet. + if (myWindow != w && qt_mac_window_for(qt_mac_nativeview_for(myWindow))) + return qt_mac_window_for(qt_mac_nativeview_for(myWindow)); + + myWindow->d_func()->createWindow_sys(); // Reget the hiview since the "create window could potentially move the view (I guess). hiview = qt_mac_nativeview_for(w); window = qt_mac_window_for(hiview); @@ -2841,10 +2852,10 @@ void QWidgetPrivate::updateSystemBackground() void QWidgetPrivate::setCursor_sys(const QCursor &) { - Q_Q(QWidget); #ifndef QT_MAC_USE_COCOA qt_mac_update_cursor(); #else + Q_Q(QWidget); if (q->testAttribute(Qt::WA_WState_Created)) { [qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)]; } @@ -2853,10 +2864,10 @@ void QWidgetPrivate::setCursor_sys(const QCursor &) void QWidgetPrivate::unsetCursor_sys() { - Q_Q(QWidget); #ifndef QT_MAC_USE_COCOA qt_mac_update_cursor(); #else + Q_Q(QWidget); if (q->testAttribute(Qt::WA_WState_Created)) { [qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)]; } diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index ea8af93..76734d4 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1750,8 +1750,8 @@ void QWidgetPrivate::show_sys() mwmhints.functions &= ~MWM_FUNC_RESIZE; } - mwmhints.flags |= MWM_HINTS_DECORATIONS; if (mwmhints.decorations == MWM_DECOR_ALL) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; mwmhints.decorations = (MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU); @@ -1760,10 +1760,12 @@ void QWidgetPrivate::show_sys() } if (q->windowFlags() & Qt::WindowMinimizeButtonHint) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; mwmhints.decorations |= MWM_DECOR_MINIMIZE; mwmhints.functions |= MWM_FUNC_MINIMIZE; } if (q->windowFlags() & Qt::WindowMaximizeButtonHint) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; mwmhints.decorations |= MWM_DECOR_MAXIMIZE; mwmhints.functions |= MWM_FUNC_MAXIMIZE; } diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index e49c4d6..6329135 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -481,7 +481,7 @@ QX11EmbedWidget::QX11EmbedWidget(QWidget *parent) | ExposureMask | StructureNotifyMask | SubstructureNotifyMask | PropertyChangeMask); - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), internalWinId(), ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*) data, 2); @@ -1571,7 +1571,7 @@ void QX11EmbedContainer::showEvent(QShowEvent *) { Q_D(QX11EmbedContainer); if (d->client) { - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char *) data, 2); } @@ -1587,8 +1587,7 @@ void QX11EmbedContainer::hideEvent(QHideEvent *) { Q_D(QX11EmbedContainer); if (d->client) { - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; - + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char *) data, 2); } |