diff options
author | axis <qt-info@nokia.com> | 2010-02-23 15:23:05 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-02-23 15:23:05 (GMT) |
commit | f67062af3a076468442c29127cb48bb13937ce0e (patch) | |
tree | a12cd4c644fb528dd5f95cb58559732a0b8b6311 /src/gui/kernel | |
parent | a670009fd378d48ff891602ec31204614e8a476f (diff) | |
parent | c15307e9e916aa613096275919ca91deba64454f (diff) | |
download | Qt-f67062af3a076468442c29127cb48bb13937ce0e.zip Qt-f67062af3a076468442c29127cb48bb13937ce0e.tar.gz Qt-f67062af3a076468442c29127cb48bb13937ce0e.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts:
mkspecs/features/symbian/qt.prf
qmake/Makefile.unix
qmake/Makefile.win32
qmake/Makefile.win32-g++
qmake/Makefile.win32-g++-sh
qmake/generators/symbian/initprojectdeploy_symbian.cpp
src/src.pro
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 116 | ||||
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac.mm | 8 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager.cpp | 29 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qt_x11_p.h | 5 |
6 files changed, 58 insertions, 108 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 336be91..4ec2ae2 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -122,15 +122,19 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp static void initResources() { #if defined(Q_WS_WINCE) + Q_INIT_RESOURCE_EXTERN(qstyle_wince) Q_INIT_RESOURCE(qstyle_wince); #elif defined(Q_OS_SYMBIAN) + Q_INIT_RESOURCE_EXTERN(qstyle_s60) Q_INIT_RESOURCE(qstyle_s60); #else + Q_INIT_RESOURCE_EXTERN(qstyle) Q_INIT_RESOURCE(qstyle); #endif - + Q_INIT_RESOURCE_EXTERN(qmessagebox) Q_INIT_RESOURCE(qmessagebox); #if !defined(QT_NO_PRINTDIALOG) + Q_INIT_RESOURCE_EXTERN(qprintdialog) Q_INIT_RESOURCE(qprintdialog); #endif 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/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 8a67dee..99b77d0 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -497,6 +497,14 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) case NSOtherMouseDown: case NSOtherMouseUp: case NSOtherMouseDragged: +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + case NSEventTypeGesture: // touch events + case NSEventTypeMagnify: + case NSEventTypeSwipe: + case NSEventTypeRotate: + case NSEventTypeBeginGesture: + case NSEventTypeEndGesture: +#endif result = true; break; diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 6d108b0..c9a94ee 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -55,24 +55,24 @@ QT_BEGIN_NAMESPACE QSoftKeyManager *QSoftKeyManagerPrivate::self = 0; -const char *QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey) +QString QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey) { - const char *softKeyText = 0; + QString softKeyText; switch (standardKey) { case OkSoftKey: - softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Ok"); + softKeyText = QSoftKeyManager::tr("Ok"); break; case SelectSoftKey: - softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Select"); + softKeyText = QSoftKeyManager::tr("Select"); break; case DoneSoftKey: - softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Done"); + softKeyText = QSoftKeyManager::tr("Done"); break; case MenuSoftKey: - softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Options"); + softKeyText = QSoftKeyManager::tr("Options"); break; case CancelSoftKey: - softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Cancel"); + softKeyText = QSoftKeyManager::tr("Cancel"); break; default: break; @@ -100,8 +100,7 @@ QSoftKeyManager::QSoftKeyManager() : QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget) { - const char* text = standardSoftKeyText(standardKey); - QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget); + QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget); QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { case MenuSoftKey: // FALL-THROUGH @@ -211,13 +210,11 @@ bool QSoftKeyManager::handleUpdateSoftKeys() d->requestedSoftKeyActions.clear(); bool recursiveMerging = false; QWidget *source = softkeySource(NULL, recursiveMerging); - do { - if (source) { - bool added = appendSoftkeys(*source, level); - source = softkeySource(source, recursiveMerging); - level = added ? ++level : level; - } - } while (source); + while (source) { + if (appendSoftkeys(*source, level)) + ++level; + source = softkeySource(source, recursiveMerging); + } d->updateSoftKeys_sys(); return true; diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index ce902fe..a6fe17e 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -87,6 +87,7 @@ public: static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); + static QString standardSoftKeyText(StandardSoftKey standardKey); protected: bool event(QEvent *e); @@ -94,7 +95,6 @@ protected: private: QSoftKeyManager(); static QSoftKeyManager *instance(); - static const char *standardSoftKeyText(StandardSoftKey standardKey); bool appendSoftkeys(const QWidget &source, int level); QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging); bool handleUpdateSoftKeys(); 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) |