summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-07-12 12:35:27 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-07-12 12:35:27 (GMT)
commit55ff179342bfb67b6f2592d7b1df66e1f3c6a350 (patch)
tree266b6e82ae4de9c1eb2f0c2d2c2310f774a55089 /src/gui/kernel
parent0713442baa4120050e85c13998797415bb40efce (diff)
parente4f5a81869e75a998278c19134f2772fefd998fe (diff)
downloadQt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.zip
Qt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.tar.gz
Qt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri11
-rw-r--r--src/gui/kernel/qapplication.cpp7
-rw-r--r--src/gui/kernel/qapplication.h8
-rw-r--r--src/gui/kernel/qapplication_s60.cpp15
-rw-r--r--src/gui/kernel/qapplication_win.cpp7
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp5
-rw-r--r--src/gui/kernel/qsoftkeymanager_common_p.h2
-rw-r--r--src/gui/kernel/qstandardgestures.cpp63
-rw-r--r--src/gui/kernel/qt_s60_p.h10
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/kernel/qwidget_mac.mm8
-rw-r--r--src/gui/kernel/qwidget_s60.cpp3
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qx11embed_x11.cpp1
14 files changed, 94 insertions, 50 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 6fd45ad..f9c84c1 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -120,18 +120,21 @@ symbian {
kernel/qkeymapper_s60.cpp\
kernel/qclipboard_s60.cpp\
kernel/qdnd_s60.cpp \
- kernel/qsound_s60.cpp \
- kernel/qsoftkeymanager_s60.cpp
+ kernel/qsound_s60.cpp
HEADERS += \
kernel/qt_s60_p.h \
- kernel/qeventdispatcher_s60_p.h \
- kernel/qsoftkeymanager_s60_p.h
+ kernel/qeventdispatcher_s60_p.h
LIBS += -lbafl -lestor
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
INCLUDEPATH += ../3rdparty/s60
+
+ contains(QT_CONFIG, s60) {
+ SOURCES += kernel/qsoftkeymanager_s60.cpp
+ HEADERS += kernel/qsoftkeymanager_s60_p.h
+ }
}
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 1680ef4..94211fd 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -81,7 +81,7 @@
#include <private/qt_x11_p.h>
#endif
-#if defined(Q_WS_X11) || defined(Q_WS_S60)
+#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN)
#include "qinputcontextfactory.h"
#endif
@@ -902,6 +902,7 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv,
#endif // Q_WS_X11
extern void qInitDrawhelperAsm();
+extern void qInitImageConversions();
extern int qRegisterGuiVariant();
extern int qUnregisterGuiVariant();
#ifndef QT_NO_STATEMACHINE
@@ -959,6 +960,8 @@ void QApplicationPrivate::initialize()
// Set up which span functions should be used in raster engine...
qInitDrawhelperAsm();
+ // and QImage conversion functions
+ qInitImageConversions();
#ifndef QT_NO_WHEELEVENT
QApplicationPrivate::wheel_scroll_lines = 3;
@@ -2771,7 +2774,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
qt_win_set_cursor(cursorWidget, true);
#elif defined(Q_WS_X11)
qt_x11_enforce_cursor(cursorWidget, true);
-#elif defined(Q_WS_S60)
+#elif defined(Q_OS_SYMBIAN)
qt_symbian_set_cursor(cursorWidget, true);
#endif
}
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index cb1d063..d31d9e5 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -61,7 +61,7 @@
QT_BEGIN_HEADER
-#if defined(Q_WS_S60)
+#if defined(Q_OS_SYMBIAN)
class CApaApplication;
#endif
@@ -118,7 +118,7 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication
public:
enum Type { Tty, GuiClient, GuiServer };
-#ifdef Q_WS_S60
+#ifdef Q_OS_SYMBIAN
typedef CApaApplication * (*QS60MainApplicationFactory)();
#endif
@@ -130,7 +130,7 @@ public:
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION);
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION);
#endif
-#if defined(Q_WS_S60)
+#if defined(Q_OS_SYMBIAN)
QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION);
#endif
#endif
@@ -366,7 +366,7 @@ public:
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0);
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
#endif
-#if defined(Q_WS_S60) || defined(qdoc)
+#if defined(Q_OS_SYMBIAN) || defined(qdoc)
QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv);
#endif
#endif
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index a7c7310..0d65811 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -69,14 +69,17 @@
#include "apgwgnam.h" // For CApaWindowGroupName
#include <mdaaudiotoneplayer.h> // For CMdaAudioToneUtility
+#if defined(Q_OS_SYMBIAN)
+# include <private/qs60mainapplication_p.h>
+# include <centralrepository.h>
+# include "qs60mainappui.h"
+# include "qinputcontext.h"
+#endif
+
#if defined(Q_WS_S60)
# if !defined(QT_NO_IM)
-# include "qinputcontext.h"
# include <private/qcoefepinputcontext_p.h>
# endif
-# include <private/qs60mainapplication_p.h>
-# include <centralrepository.h>
-# include "qs60mainappui.h"
#endif
#include "private/qstylesheetstyle_p.h"
@@ -894,7 +897,7 @@ TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent)
if (qic && qic->filterEvent(keyEvent))
return EKeyWasConsumed;
}
-#endif // !defined(QT_NO_IM) && defined(Q_WS_S60)
+#endif // !defined(QT_NO_IM) && defined(Q_OS_SYMBIAN)
if (widget && qt_sendSpontaneousEvent(widget, keyEvent))
if (keyEvent->isAccepted())
@@ -1974,10 +1977,10 @@ int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent)
ret = 1;
break;
default:
+#ifdef Q_WS_S60
bool handled = QSoftKeyManager::handleCommand(command);
if (handled)
ret = 1;
-#ifdef Q_WS_S60
else
ret = QMenuBarPrivate::symbianCommands(command);
#endif
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index ef719ca..9e8a128 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -4086,7 +4086,12 @@ void QApplicationPrivate::initializeMultitouch_sys()
{
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
static const int QT_SM_DIGITIZER = 94;
- QApplicationPrivate::HasTouchSupport = GetSystemMetrics(QT_SM_DIGITIZER);
+ int value = GetSystemMetrics(QT_SM_DIGITIZER);
+ static const int QT_NID_INTEGRATED_TOUCH = 0x01;
+ static const int QT_NID_EXTERNAL_TOUCH = 0x02;
+ static const int QT_NID_MULTI_INPUT = 0x40;
+ QApplicationPrivate::HasTouchSupport =
+ value & (QT_NID_INTEGRATED_TOUCH | QT_NID_EXTERNAL_TOUCH | QT_NID_MULTI_INPUT);
}
QLibrary library(QLatin1String("user32"));
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 04e4685..54e6317 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -162,6 +162,7 @@ void QSoftKeyManager::sendKeyEvent()
void QSoftKeyManager::updateSoftKeys()
{
+ QSoftKeyManager::instance()->d_func()->pendingUpdate = true;
QEvent *event = new QEvent(QEvent::UpdateSoftKeys);
QApplication::postEvent(QSoftKeyManager::instance(), event);
}
@@ -250,6 +251,7 @@ bool QSoftKeyManager::handleUpdateSoftKeys()
}
d->updateSoftKeys_sys();
+ d->pendingUpdate = false;
return true;
}
@@ -275,6 +277,9 @@ bool QSoftKeyManager::event(QEvent *e)
#ifdef Q_WS_S60
bool QSoftKeyManager::handleCommand(int command)
{
+ if (QSoftKeyManager::instance()->d_func()->pendingUpdate)
+ (void)QSoftKeyManager::instance()->handleUpdateSoftKeys();
+
return static_cast<QSoftKeyManagerPrivateS60*>(QSoftKeyManager::instance()->d_func())->handleCommand(command);
}
#endif
diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h
index 04ddf7d..1b364d4 100644
--- a/src/gui/kernel/qsoftkeymanager_common_p.h
+++ b/src/gui/kernel/qsoftkeymanager_common_p.h
@@ -71,7 +71,7 @@ protected:
QHash<QAction*, Qt::Key> keyedActions;
QMultiHash<int, QAction*> requestedSoftKeyActions;
QWidget *initialSoftKeySource;
-
+ bool pendingUpdate;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 8a3e89e..62d8a53 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -45,6 +45,7 @@
#include "qevent.h"
#include "qwidget.h"
#include "qabstractscrollarea.h"
+#include <qgraphicssceneevent.h>
#include "qdebug.h"
#ifndef QT_NO_GESTURES
@@ -509,49 +510,65 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
if (object == state && event->type() == QEvent::Timer) {
q->killTimer(d->timerId);
d->timerId = 0;
- return QGestureRecognizer::Ignore | QGestureRecognizer::ConsumeEventHint;
+ return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
}
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
-
- QGestureRecognizer::Result result = QGestureRecognizer::CancelGesture;
+ const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
+ const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
enum { TimerInterval = 2000 };
enum { TapRadius = 40 };
switch (event->type()) {
+ case QEvent::GraphicsSceneMousePress:
+ d->position = gsme->screenPos();
+ q->setHotSpot(d->position);
+ if (d->timerId)
+ q->killTimer(d->timerId);
+ d->timerId = q->startTimer(TimerInterval);
+ return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+ case QEvent::MouseButtonPress:
+ d->position = me->globalPos();
+ q->setHotSpot(d->position);
+ if (d->timerId)
+ q->killTimer(d->timerId);
+ d->timerId = q->startTimer(TimerInterval);
+ return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
case QEvent::TouchBegin:
- d->position = ev->touchPoints().at(0).pos();
+ d->position = ev->touchPoints().at(0).startScreenPos();
+ q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
d->timerId = q->startTimer(TimerInterval);
- q->setHotSpot(ev->touchPoints().at(0).startScreenPos());
- result = QGestureRecognizer::TriggerGesture;
- break;
+ return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+ case QEvent::GraphicsSceneMouseRelease:
+ case QEvent::MouseButtonRelease:
case QEvent::TouchEnd:
- if (d->timerId)
- result = QGestureRecognizer::CancelGesture;
- else
- result = QGestureRecognizer::FinishGesture;
- break;
+ return QGestureRecognizer::CancelGesture; // get out of the MayBeGesture state
case QEvent::TouchUpdate:
- if (q->state() != Qt::NoGesture && ev->touchPoints().size() == 1) {
+ if (d->timerId && ev->touchPoints().size() == 1) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
if (delta.manhattanLength() <= TapRadius)
- result = QGestureRecognizer::TriggerGesture;
+ return QGestureRecognizer::MayBeGesture;
}
- break;
- case QEvent::MouseButtonPress:
- case QEvent::MouseMove:
- case QEvent::MouseButtonRelease:
- result = QGestureRecognizer::Ignore;
- break;
+ return QGestureRecognizer::CancelGesture;
+ case QEvent::MouseMove: {
+ QPoint delta = me->globalPos() - d->position.toPoint();
+ if (d->timerId && delta.manhattanLength() <= TapRadius)
+ return QGestureRecognizer::MayBeGesture;
+ return QGestureRecognizer::CancelGesture;
+ }
+ case QEvent::GraphicsSceneMouseMove: {
+ QPoint delta = gsme->screenPos() - d->position.toPoint();
+ if (d->timerId && delta.manhattanLength() <= TapRadius)
+ return QGestureRecognizer::MayBeGesture;
+ return QGestureRecognizer::CancelGesture;
+ }
default:
- result = QGestureRecognizer::Ignore;
- break;
+ return QGestureRecognizer::Ignore;
}
- return result;
}
void QTapAndHoldGestureRecognizer::reset(QGesture *state)
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 204e38c..d8ef67d 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -155,7 +155,9 @@ public:
static inline CAknTitlePane* titlePane();
static inline CAknContextPane* contextPane();
static inline CEikButtonGroupContainer* buttonGroupContainer();
+#endif
+#ifdef Q_OS_SYMBIAN
TTrapHandler *s60InstalledTrapHandler;
#endif
};
@@ -208,7 +210,7 @@ protected: // from MAknFadedComponent
TInt CountFadedComponents() {return 1;}
CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;}
#else
- #warning No fallback implementation for QSymbianControl::FadeBehindPopup
+ // #warning No fallback implementation for QSymbianControl::FadeBehindPopup
void FadeBehindPopup(bool /*fade*/){ }
#endif
@@ -277,9 +279,9 @@ inline QS60Data::QS60Data()
avkonComponentsSupportTransparency(0),
menuBeingConstructed(0),
memoryLimitForHwRendering(0),
- s60ApplicationFactory(0),
-#ifdef Q_WS_S60
- s60InstalledTrapHandler(0)
+ s60ApplicationFactory(0)
+#ifdef Q_OS_SYMBIAN
+ ,s60InstalledTrapHandler(0)
#endif
{
}
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index dd568cd..233df15 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -10695,7 +10695,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_AcceptTouchEvents:
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60)
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN)
if (on)
d->registerTouchWindow();
#endif
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index a9bb691..e57ec77 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2861,9 +2861,11 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
}
if (wasWindow) {
oldToolbar = [oldWindow toolbar];
- [oldToolbar retain];
- oldToolbarVisible = [oldToolbar isVisible];
- [oldWindow setToolbar:nil];
+ if (oldToolbar) {
+ [oldToolbar retain];
+ oldToolbarVisible = [oldToolbar isVisible];
+ [oldWindow setToolbar:nil];
+ }
}
#endif
}
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 3f351d9..2818d88 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -54,6 +54,7 @@
#ifdef Q_WS_S60
#include <aknappui.h>
+#include <eikbtgpc.h>
#endif
// This is necessary in order to be able to perform delayed invokation on slots
@@ -1082,12 +1083,14 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
Qt::WindowStates oldstate = windowState();
const TBool isFullscreen = newstate & Qt::WindowFullScreen;
+#ifdef Q_WS_S60
const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint;
const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false;
const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible);
if (oldstate == newstate && !softkeyVisibilityChange)
return;
+#endif // Q_WS_S60
if (isWindow()) {
createWinId();
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 9c65aa0..0f05c6b 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1167,7 +1167,7 @@ void QWidgetPrivate::show_sys()
// This is to resolve the problem where popups are opened from the
// system tray and not being implicitly activated
if (q->windowType() == Qt::Popup &&
- (!q->parentWidget() || !q->parentWidget()->isActiveWindow()))
+ !q->parentWidget() && !qApp->activeWindow())
q->activateWindow();
}
diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp
index b527e72..9f1b1f8 100644
--- a/src/gui/kernel/qx11embed_x11.cpp
+++ b/src/gui/kernel/qx11embed_x11.cpp
@@ -1070,6 +1070,7 @@ QX11EmbedContainer::QX11EmbedContainer(QWidget *parent)
d->focusProxy = new QWidget(this);
d->focusProxy->setAttribute(Qt::WA_NativeWindow);
d->focusProxy->setAttribute(Qt::WA_DontCreateNativeAncestors);
+ d->focusProxy->createWinId();
d->focusProxy->setGeometry(-1, -1, 1, 1);
// We need events from the window (activation status) and