diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-23 16:48:35 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-23 16:48:35 (GMT) |
commit | bbc2099ea172ea65294bd91554145786c2a4a9e1 (patch) | |
tree | aa9c739c87775ff76b37ca839d987dc43a110b80 /src/gui | |
parent | 6566f5e341c18912f7f1a9fbf4727e0ac92a1a9f (diff) | |
parent | 05402ac27bd669c371e4ba08763ba45d6b31edc4 (diff) | |
download | Qt-bbc2099ea172ea65294bd91554145786c2a4a9e1.zip Qt-bbc2099ea172ea65294bd91554145786c2a4a9e1.tar.gz Qt-bbc2099ea172ea65294bd91554145786c2a4a9e1.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsview_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 116 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaapplication_mac.mm | 3 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 2 | ||||
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac.mm | 74 | ||||
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 4 | ||||
-rw-r--r-- | src/gui/kernel/qt_x11_p.h | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 5 | ||||
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 2 | ||||
-rw-r--r-- | src/gui/text/qstatictext.h | 4 | ||||
-rw-r--r-- | src/gui/util/qsystemtrayicon_mac.mm | 2 | ||||
-rw-r--r-- | src/gui/widgets/qabstractscrollarea_p.h | 2 |
12 files changed, 80 insertions, 141 deletions
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 9d3edcb..729837a 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE -class Q_AUTOTEST_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate +class Q_GUI_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate { Q_DECLARE_PUBLIC(QGraphicsView) public: diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 34865b5..c6e192b 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -208,11 +208,8 @@ static const char * x11_atomnames = { "_MOTIF_WM_HINTS\0" "DTWM_IS_RUNNING\0" - "KDE_FULL_SESSION\0" - "KWIN_RUNNING\0" - "KWM_RUNNING\0" - "GNOME_BACKGROUND_PROPERTIES\0" "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" "_SGI_DESKS_MANAGER\0" // EWMH (aka NETWM) @@ -626,8 +623,6 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err) || err->resourceid == XA_RGB_DEFAULT_MAP || err->resourceid == ATOM(_NET_SUPPORTED) || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) || err->resourceid == ATOM(XdndProxy) || err->resourceid == ATOM(XdndAware))) { // Perhaps we're running under SECURITY reduction? :/ @@ -2222,87 +2217,36 @@ void qt_init(QApplicationPrivate *priv, int, X11->desktopEnvironment = DE_UNKNOWN; X11->desktopVersion = 0; - // See if the current window manager is using the freedesktop.org spec to give its name - Window windowManagerWindow = XNone; - Atom typeReturned; - int formatReturned; - unsigned long nitemsReturned; - unsigned long unused; - unsigned char *data = 0; - if (XGetWindowProperty(QX11Info::display(), QX11Info::appRootWindow(), - ATOM(_NET_SUPPORTING_WM_CHECK), - 0, 1024, False, XA_WINDOW, &typeReturned, - &formatReturned, &nitemsReturned, &unused, &data) - == Success) { - if (typeReturned == XA_WINDOW && formatReturned == 32) - windowManagerWindow = *((Window*) data); - if (data) - XFree(data); - - if (windowManagerWindow != XNone) { - QString wmName; - Atom utf8atom = ATOM(UTF8_STRING); - if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME), - 0, 1024, False, utf8atom, &typeReturned, - &formatReturned, &nitemsReturned, &unused, &data) - == Success) { - if (typeReturned == utf8atom && formatReturned == 8) - wmName = QString::fromUtf8((const char*)data); - if (data) - XFree(data); - if (wmName == QLatin1String("KWin")) - X11->desktopEnvironment = DE_KDE; - if (wmName == QLatin1String("Metacity")) - X11->desktopEnvironment = DE_GNOME; - } - } - } - - // Running a different/newer/older window manager? Try some other things - if (X11->desktopEnvironment == DE_UNKNOWN){ - Atom type; - int format; - unsigned long length, after; - uchar *data = 0; - - QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); - if (session == QLatin1String("kde")) { - X11->desktopEnvironment = DE_KDE; - } else if (session == QLatin1String("gnome") || session == QLatin1String("xfce")) { - X11->desktopEnvironment = DE_GNOME; - } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), - 0, 1, False, AnyPropertyType, &type, &format, &length, - &after, &data) == Success && length) { - // DTWM is running, meaning most likely CDE is running... - X11->desktopEnvironment = DE_CDE; - } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), - ATOM(GNOME_BACKGROUND_PROPERTIES), 0, 1, False, AnyPropertyType, - &type, &format, &length, &after, &data) == Success && length) { - X11->desktopEnvironment = DE_GNOME; - } else if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty()) { - X11->desktopEnvironment = DE_GNOME; - } else if ((XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KDE_FULL_SESSION), - 0, 1, False, AnyPropertyType, &type, &format, &length, &after, &data) == Success - && length) - || (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KWIN_RUNNING), - 0, 1, False, AnyPropertyType, &type, &format, &length, - &after, &data) == Success - && length) - || (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KWM_RUNNING), - 0, 1, False, AnyPropertyType, &type, &format, &length, - &after, &data) == Success && length)) { - X11->desktopEnvironment = DE_KDE; - } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_SGI_DESKS_MANAGER), - 0, 1, False, XA_WINDOW, &type, &format, &length, &after, &data) == Success - && length) { - X11->desktopEnvironment = DE_4DWM; - } - if (data) - XFree((char *)data); + Atom type; + int format; + unsigned long length, after; + uchar *data = 0; + + if (!qgetenv("KDE_FULL_SESSION").isEmpty()) { + X11->desktopEnvironment = DE_KDE; + X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt(); + } else if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty() // Deprecated for some reason. + || qgetenv("DESKTOP_SESSION") == "gnome") { // De-facto-standardized by GNOME. + X11->desktopEnvironment = DE_GNOME; + } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE), + 0, 2, False, XA_STRING, &type, &format, &length, + &after, &data) == Success + && !strcmp(reinterpret_cast<char *>(data), "xfce4")) { + // Pretend that xfce4 is gnome, as it uses the same libraries. + // The detection above is stolen from xdg-open. + X11->desktopEnvironment = DE_GNOME; + } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), + 0, 1, False, AnyPropertyType, &type, &format, &length, + &after, &data) == Success && length) { + // DTWM is running, meaning most likely CDE is running... + X11->desktopEnvironment = DE_CDE; + } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_SGI_DESKS_MANAGER), + 0, 1, False, XA_WINDOW, &type, &format, &length, &after, &data) == Success + && length) { + X11->desktopEnvironment = DE_4DWM; } - - if (X11->desktopEnvironment == DE_KDE) - X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt(); + if (data) + XFree((char *)data); #if !defined(QT_NO_STYLE_GTK) if (X11->desktopEnvironment == DE_GNOME) { diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/gui/kernel/qcocoaapplication_mac.mm index 5629940..4962863 100644 --- a/src/gui/kernel/qcocoaapplication_mac.mm +++ b/src/gui/kernel/qcocoaapplication_mac.mm @@ -79,6 +79,8 @@ #include <private/qcocoaapplicationdelegate_mac_p.h> #include <private/qt_cocoa_helpers_mac_p.h> +QT_USE_NAMESPACE + @implementation NSApplication (QT_MANGLE_NAMESPACE(QApplicationIntegration)) - (void)QT_MANGLE_NAMESPACE(qt_setDockMenu):(NSMenu *)newMenu @@ -107,7 +109,6 @@ | NSFontPanelStrikethroughEffectModeMask; } - - (void)qt_sendPostedMessage:(NSEvent *)event { // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5! diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 0714f73..c347410 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -83,6 +83,7 @@ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm extern QPointer<QWidget> qt_mouseover; //qapplication_mac.mm extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp +extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); struct dndenum_mapper { @@ -693,7 +694,6 @@ extern "C" { qt_button_down = 0; } -extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); - (void)otherMouseDown:(NSEvent *)theEvent { if (!qt_button_down) diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 99b77d0..afea3ec 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -573,6 +573,18 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) QMacCocoaAutoReleasePool pool; NSEvent* event = 0; + // First, send all previously excluded input events, if any: + if (!(flags & QEventLoop::ExcludeUserInputEvents)) { + while (!d->queuedUserInputEvents.isEmpty()) { + event = static_cast<NSEvent *>(d->queuedUserInputEvents.takeFirst()); + if (!filterEvent(event)) { + qt_mac_send_event(flags, event, 0); + retVal = true; + } + [event release]; + } + } + // If Qt is used as a plugin, or as an extension in a native cocoa // application, we should not run or stop NSApplication; This will be // done from the application itself. And if processEvents is called @@ -606,49 +618,33 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) // We cannot block the thread (and run in a tight loop). // Instead we will process all current pending events and return. d->ensureNSAppInitialized(); - do { - bool releaseEvent = false; - - if (!(flags & QEventLoop::ExcludeUserInputEvents) - && !d->queuedUserInputEvents.isEmpty()) { - // Process a pending user input event - releaseEvent = true; - event = static_cast<NSEvent *>(d->queuedUserInputEvents.takeFirst()); - } else { - if (NSModalSession session = d->currentModalSession()) { - if (flags & QEventLoop::WaitForMoreEvents) - qt_mac_waitForMoreModalSessionEvents(); - NSInteger status = [NSApp runModalSession:session]; - if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { - // INVARIANT: Someone called [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(); - } - retVal = true; - break; - } else { - event = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:nil - inMode:NSDefaultRunLoopMode - dequeue: YES]; - - if (event != nil) { - if (flags & QEventLoop::ExcludeUserInputEvents) { - if (IsMouseOrKeyEvent(event)) { - [event retain]; - d->queuedUserInputEvents.append(event); - continue; - } - } - } - } + if (NSModalSession session = d->currentModalSession()) { + if (flags & QEventLoop::WaitForMoreEvents) + qt_mac_waitForMoreModalSessionEvents(); + NSInteger status = [NSApp runModalSession:session]; + if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { + // INVARIANT: Someone called [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(); } + retVal = true; + } else do { + event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSDefaultRunLoopMode + dequeue: YES]; + if (event) { + if (flags & QEventLoop::ExcludeUserInputEvents) { + if (IsMouseOrKeyEvent(event)) { + [event retain]; + d->queuedUserInputEvents.append(event); + continue; + } + } if (!filterEvent(event) && qt_mac_send_event(flags, event, 0)) retVal = true; - if (releaseEvent) - [event release]; } } while (!d->interrupt && event != nil); diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 901bf0e..e9fdbda 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -138,7 +138,6 @@ void QMacWindowFader::performFade() } extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // qapplication.cpp; -extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm extern QWidget * mac_mouse_grabber; extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp @@ -971,7 +970,7 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev #ifndef QT_NAMESPACE Q_ASSERT(clickCount > 0); #endif - if (clickCount % 2 == 0) + if (clickCount % 2 == 0 && buttons == button) eventType = QEvent::MouseButtonDblClick; if (button == Qt::LeftButton && (keyMods & Qt::MetaModifier)) { button = Qt::RightButton; @@ -983,6 +982,7 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev button = Qt::RightButton; [theView qt_setLeftButtonIsRightButton: false]; } + qt_button_down = 0; break; } [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->localPoint = localPoint; diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index b2ce754..167557b 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -564,11 +564,8 @@ struct QX11Data _MOTIF_WM_HINTS, DTWM_IS_RUNNING, - KDE_FULL_SESSION, - KWIN_RUNNING, - KWM_RUNNING, - GNOME_BACKGROUND_PROPERTIES, ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, _SGI_DESKS_MANAGER, // EWMH (aka NETWM) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 9e642b9..da9e9eb 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2853,13 +2853,14 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) //recreate and setup flags QObjectPrivate::setParent_helper(parent); - QPoint pt = q->pos(); bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); if (wasCreated && !qt_isGenuineQWidget(q)) return; - if ((data.window_flags & Qt::Sheet) && topData && topData->opacity == 242) + if (!q->testAttribute(Qt::WA_WState_WindowOpacitySet)) { q->setWindowOpacity(1.0f); + q->setAttribute(Qt::WA_WState_WindowOpacitySet, false); + } setWinId(0); //do after the above because they may want the id diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 40ee31d..116b03e 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3760,7 +3760,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QPalette np = tab->palette; np.setColor(QPalette::WindowText, QColor(255, 255, 255, 75)); QRect nr = subElementRect(SE_TabBarTabText, opt, w); - nr.moveTop(+1); + nr.moveTop(-1); int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic; proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, tab->text, QPalette::WindowText); diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h index 1e59944..00d42e0 100644 --- a/src/gui/text/qstatictext.h +++ b/src/gui/text/qstatictext.h @@ -97,10 +97,10 @@ private: friend class QStaticTextPrivate; }; -Q_DECLARE_METATYPE(QStaticText) - QT_END_NAMESPACE +Q_DECLARE_METATYPE(QStaticText) + QT_END_HEADER #endif // QSTATICTEXT_H diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm index 5cadbbd..348657e 100644 --- a/src/gui/util/qsystemtrayicon_mac.mm +++ b/src/gui/util/qsystemtrayicon_mac.mm @@ -93,6 +93,7 @@ extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret); //q extern void qtsystray_sendActivated(QSystemTrayIcon *i, int r); //qsystemtrayicon.cpp extern NSString *keySequenceToKeyEqivalent(const QKeySequence &accel); // qmenu_mac.mm extern NSUInteger keySequenceModifierMask(const QKeySequence &accel); // qmenu_mac.mm +extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); QT_END_NAMESPACE QT_USE_NAMESPACE @@ -382,7 +383,6 @@ QT_END_NAMESPACE [self menuTrackingDone:nil]; } -extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); - (void)otherMouseDown:(NSEvent *)mouseEvent { [self mousePressed:mouseEvent button:cocoaButton2QtButton([mouseEvent buttonNumber])]; diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 7c72859..9a0d66f 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QScrollBar; class QAbstractScrollAreaScrollBarContainer; -class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate +class Q_GUI_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate { Q_DECLARE_PUBLIC(QAbstractScrollArea) |