summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2010-06-11 12:06:41 (GMT)
committerMartin Smith <martin.smith@nokia.com>2010-06-11 12:06:41 (GMT)
commitd92d1106e8cb2ca14b26b8c027d52608ee2915e9 (patch)
tree91b75077ecf9fb4709f000b89d5963ab98cdfc9b /src/gui/kernel
parenta295a69e76ff330a2716c97b70723f0bd408f197 (diff)
parent24bcac9de46c89f4d8b533946e7b0feeacca1b0d (diff)
downloadQt-d92d1106e8cb2ca14b26b8c027d52608ee2915e9.zip
Qt-d92d1106e8cb2ca14b26b8c027d52608ee2915e9.tar.gz
Qt-d92d1106e8cb2ca14b26b8c027d52608ee2915e9.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication.cpp27
-rw-r--r--src/gui/kernel/qapplication.h2
-rw-r--r--src/gui/kernel/qapplication_p.h9
-rw-r--r--src/gui/kernel/qapplication_s60.cpp27
-rw-r--r--src/gui/kernel/qapplication_win.cpp52
-rw-r--r--src/gui/kernel/qapplication_x11.cpp2
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm10
-rw-r--r--src/gui/kernel/qevent.cpp5
-rw-r--r--src/gui/kernel/qevent.h4
-rw-r--r--src/gui/kernel/qevent_p.h3
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm2
-rw-r--r--src/gui/kernel/qgesture.cpp4
-rw-r--r--src/gui/kernel/qgesture.h4
-rw-r--r--src/gui/kernel/qgesture_p.h4
-rw-r--r--src/gui/kernel/qgesturemanager.cpp13
-rw-r--r--src/gui/kernel/qgesturemanager_p.h4
-rw-r--r--src/gui/kernel/qgesturerecognizer.cpp4
-rw-r--r--src/gui/kernel/qgesturerecognizer.h4
-rw-r--r--src/gui/kernel/qkeysequence.cpp30
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac.mm4
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac_p.h4
-rw-r--r--src/gui/kernel/qstandardgestures.cpp7
-rw-r--r--src/gui/kernel/qstandardgestures_p.h4
-rw-r--r--src/gui/kernel/qwidget.cpp68
-rw-r--r--src/gui/kernel/qwidget.h4
-rw-r--r--src/gui/kernel/qwidget_mac.mm4
-rw-r--r--src/gui/kernel/qwidget_p.h49
-rw-r--r--src/gui/kernel/qwidget_s60.cpp10
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win.cpp4
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h34
31 files changed, 296 insertions, 108 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index a2c058a..438a17e 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -187,8 +187,10 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
directPainters = 0;
#endif
+#ifndef QT_NO_GESTURES
gestureManager = 0;
gestureWidget = 0;
+#endif // QT_NO_GESTURES
#if defined(Q_WS_X11) || defined(Q_WS_WIN)
move_cursor = 0;
@@ -780,6 +782,9 @@ void QApplicationPrivate::construct(
qt_is_gui_used = (qt_appType != QApplication::Tty);
process_cmdline();
+ // the environment variable has the lowest precedence of runtime graphicssystem switches
+ if (graphics_system_name.isEmpty())
+ graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM"));
// Must be called before initialize()
qt_init(this, qt_appType
#ifdef Q_WS_X11
@@ -1560,10 +1565,18 @@ QStyle* QApplication::setStyle(const QString& style)
on-screen widgets and QPixmaps. The available systems are \c{"native"},
\c{"raster"} and \c{"opengl"}.
- This function call overrides both the application commandline
- \c{-graphicssystem} switch and the configure \c{-graphicssystem} switch.
+ There are several ways to set the graphics backend, in order of decreasing
+ precedence:
+ \list
+ \o the application commandline \c{-graphicssystem} switch
+ \o QApplication::setGraphicsSystem()
+ \o the QT_GRAPHICSSYSTEM environment variable
+ \o the Qt configure \c{-graphicssystem} switch
+ \endlist
+ If the highest precedence switch sets an invalid name, the error will be
+ ignored and the default backend will be used.
- \warning This function must be called before the QApplication constructor
+ \warning This function is only effective before the QApplication constructor
is called.
\note The \c{"opengl"} option is currently experimental.
@@ -3707,6 +3720,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
#endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
}
+#ifndef QT_NO_GESTURES
// walk through parents and check for gestures
if (d->gestureManager) {
switch (e->type()) {
@@ -3751,7 +3765,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
}
}
-
+#endif // QT_NO_GESTURES
// User input and window activation makes tooltips sleep
switch (e->type()) {
@@ -4256,6 +4270,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
res = d->notify_helper(receiver, e);
break;
+#ifndef QT_NO_GESTURES
case QEvent::NativeGesture:
{
// only propagate the first gesture event (after the GID_BEGIN)
@@ -4334,6 +4349,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
break;
}
+#endif // QT_NO_GESTURES
default:
res = d->notify_helper(receiver, e);
break;
@@ -5297,6 +5313,7 @@ void QApplication::setInputContext(QInputContext *inputContext)
}
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = inputContext;
+ QApplicationPrivate::inputContext->setParent(this);
}
/*!
@@ -5766,6 +5783,7 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
}
+#ifndef QT_NO_GESTURES
QGestureManager* QGestureManager::instance()
{
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
@@ -5773,6 +5791,7 @@ QGestureManager* QGestureManager::instance()
qAppPriv->gestureManager = new QGestureManager(qApp);
return qAppPriv->gestureManager;
}
+#endif // QT_NO_GESTURES
// These pixmaps approximate the images in the Windows User Interface Guidelines.
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index c21b982..cb1d063 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -399,7 +399,9 @@ private:
friend class QDirectPainter;
friend class QDirectPainterPrivate;
#endif
+#ifndef QT_NO_GESTURES
friend class QGestureManager;
+#endif
#if defined(Q_WS_MAC) || defined(Q_WS_X11)
Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut())
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index e83cd71..3a3f816 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -84,7 +84,9 @@ class QInputContext;
class QObject;
class QWidget;
class QSocketNotifier;
+#ifndef QT_NO_GESTURES
class QGestureManager;
+#endif
extern bool qt_is_gui_used;
#ifndef QT_NO_CLIPBOARD
@@ -200,6 +202,7 @@ typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG);
typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int);
typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE);
+#ifndef QT_NO_GESTURES
typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID);
typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE);
typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE);
@@ -263,6 +266,8 @@ typedef struct tagGESTURECONFIG
#define GID_ROLLOVER 0xf003
#endif
+#endif // QT_NO_GESTURES
+
#endif // Q_WS_WIN
class QScopedLoopLevelCounter
@@ -519,6 +524,7 @@ public:
void sendSyntheticEnterLeave(QWidget *widget);
#endif
+#ifndef QT_NO_GESTURES
QGestureManager *gestureManager;
QWidget *gestureWidget;
#if defined(Q_WS_X11) || defined(Q_WS_WIN)
@@ -526,6 +532,7 @@ public:
QPixmap *copy_cursor;
QPixmap *link_cursor;
#endif
+#endif
#if defined(Q_WS_WIN)
QPixmap *ignore_cursor;
#endif
@@ -554,6 +561,7 @@ public:
QHash<DWORD, int> touchInputIDToTouchPointID;
bool translateTouchEvent(const MSG &msg);
+#ifndef QT_NO_GESTURES
PtrGetGestureInfo GetGestureInfo;
PtrGetGestureExtraArgs GetGestureExtraArgs;
PtrCloseGestureInfoHandle CloseGestureInfoHandle;
@@ -562,6 +570,7 @@ public:
PtrBeginPanningFeedback BeginPanningFeedback;
PtrUpdatePanningFeedback UpdatePanningFeedback;
PtrEndPanningFeedback EndPanningFeedback;
+#endif // QT_NO_GESTURES
#endif
#ifdef QT_RX71_MULTITOUCH
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 8ab82c9..a50fd95 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1032,6 +1032,9 @@ void QSymbianControl::SizeChanged()
qwidget->d_func()->syncBackingStore();
if (!slowResize && tlwExtra)
tlwExtra->inTopLevelResize = false;
+ } else {
+ QResizeEvent *e = new QResizeEvent(newSize, oldSize);
+ QApplication::postEvent(qwidget, e);
}
}
@@ -1800,19 +1803,27 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent
return 1;
const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged();
QWidget *w = QWidgetPrivate::mapper->value(control);
- if (!w->d_func()->maybeTopData())
+ QWidget *const window = w->window();
+ if (!window->d_func()->maybeTopData())
break;
+ QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore;
if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) {
- delete w->d_func()->topData()->backingStore;
- w->d_func()->topData()->backingStore = 0;
+ // Decrement backing store reference count
+ backingStore.deref();
// In order to ensure that any resources used by the window surface
// are immediately freed, we flush the WSERV command buffer.
S60->wsSession().Flush();
- } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
- && !w->d_func()->maybeBackingStore()) {
- w->d_func()->topData()->backingStore = new QWidgetBackingStore(w);
- w->d_func()->invalidateBuffer(w->rect());
- w->repaint();
+ } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) {
+ if (backingStore.data()) {
+ // Increment backing store reference count
+ backingStore.ref();
+ } else {
+ // Create backing store with an initial reference count of 1
+ backingStore.create(window);
+ backingStore.ref();
+ w->d_func()->invalidateBuffer(w->rect());
+ w->repaint();
+ }
}
return 1;
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 60fc5e1..0edb8fb 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -52,9 +52,11 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include <windowsm.h>
#include <tpcshell.h>
#ifdef QT_WINCE_GESTURES
+#ifndef QT_NO_GESTURES
#include <gesture.h>
#endif
#endif
+#endif
#include "qapplication.h"
#include "qdesktopwidget.h"
@@ -116,8 +118,6 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
# include <winable.h>
#endif
-#include "private/qwinnativepangesturerecognizer_win_p.h"
-
#ifndef WM_TOUCH
# define WM_TOUCH 0x0240
@@ -198,6 +198,7 @@ struct SHRGINFO {
#define SPI_SETSIPINFO 224
#endif
+#ifndef QT_NO_GESTURES
typedef DWORD (API *AygRecognizeGesture)(SHRGINFO*);
static AygRecognizeGesture ptrRecognizeGesture = 0;
static bool aygResolved = false;
@@ -211,6 +212,7 @@ static void resolveAygLibs()
ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture");
}
}
+#endif // QT_NO_GESTURES
#endif
@@ -463,7 +465,9 @@ public:
bool translateConfigEvent(const MSG &msg);
bool translateCloseEvent(const MSG &msg);
bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets);
+#ifndef QT_NO_GESTURES
bool translateGestureEvent(const MSG &msg, const GESTUREINFO &gi);
+#endif
void repolishStyle(QStyle &style);
inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); }
inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); }
@@ -843,6 +847,7 @@ void qt_init(QApplicationPrivate *priv, int)
ptrSetProcessDPIAware();
#endif
+#ifndef QT_NO_GESTURES
priv->GetGestureInfo = 0;
priv->GetGestureExtraArgs = 0;
priv->CloseGestureInfoHandle = 0;
@@ -883,6 +888,7 @@ void qt_init(QApplicationPrivate *priv, int)
(PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
"EndPanningFeedback");
#endif
+#endif // QT_NO_GESTURES
}
/*****************************************************************************
@@ -1542,7 +1548,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
case WM_SETTINGCHANGE:
#ifdef Q_WS_WINCE
// CE SIP hide/show
- if (wParam == SPI_SETSIPINFO) {
+ if (qt_desktopWidget && wParam == SPI_SETSIPINFO) {
QResizeEvent re(QSize(0, 0), QSize(0, 0)); // Calculated by QDesktopWidget
QApplication::sendEvent(qt_desktopWidget, &re);
break;
@@ -1667,12 +1673,14 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
shrg.ptDown.y = GET_Y_LPARAM(lParam);
shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION;
resolveAygLibs();
+#ifndef QT_NO_GESTURES
if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) {
if (QApplication::activePopupWidget())
QApplication::activePopupWidget()->close();
QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos);
result = qt_sendSpontaneousEvent(alienWidget, &e);
}
+#endif // QT_NO_GESTURES
}
}
}
@@ -2556,6 +2564,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
}
result = false;
break;
+#ifndef QT_NO_GESTURES
#if !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
case WM_GESTURE: {
GESTUREINFO gi;
@@ -2590,6 +2599,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
break;
}
#endif // !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
+#endif // QT_NO_GESTURES
#ifndef QT_NO_CURSOR
case WM_SETCURSOR: {
QCursor *ovr = QApplication::overrideCursor();
@@ -3825,6 +3835,7 @@ bool QETWidget::translateCloseEvent(const MSG &)
return d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
}
+#ifndef QT_NO_GESTURES
bool QETWidget::translateGestureEvent(const MSG &, const GESTUREINFO &gi)
{
const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
@@ -3863,7 +3874,7 @@ bool QETWidget::translateGestureEvent(const MSG &, const GESTUREINFO &gi)
qt_sendSpontaneousEvent(widget, &event);
return true;
}
-
+#endif // QT_NO_GESTURES
void QApplication::setCursorFlashTime(int msecs)
{
@@ -4053,36 +4064,9 @@ PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0;
void QApplicationPrivate::initializeMultitouch_sys()
{
- static const IID QT_IID_IInkTablets = {0x112086D9, 0x7779, 0x4535, {0xA6, 0x99, 0x86, 0x2B, 0x43, 0xAC, 0x18, 0x63} };
- static const IID QT_IID_IInkTablet2 = {0x90c91ad2, 0xfa36, 0x49d6, {0x95, 0x16, 0xce, 0x8d, 0x57, 0x0f, 0x6f, 0x85} };
- static const CLSID QT_CLSID_InkTablets = {0x6E4FCB12, 0x510A, 0x4d40, {0x93, 0x04, 0x1D, 0xA1, 0x0A, 0xE9, 0x14, 0x7C} };
-
- IInkTablets *iInkTablets = 0;
- HRESULT hr = CoCreateInstance(QT_CLSID_InkTablets, NULL, CLSCTX_ALL, QT_IID_IInkTablets, (void**)&iInkTablets);
- if (SUCCEEDED(hr)) {
- long count = 0;
- iInkTablets->get_Count(&count);
- for (long i = 0; i < count; ++i) {
- IInkTablet *iInkTablet = 0;
- hr = iInkTablets->Item(i, &iInkTablet);
- if (FAILED(hr))
- continue;
- IInkTablet2 *iInkTablet2 = 0;
- hr = iInkTablet->QueryInterface(QT_IID_IInkTablet2, (void**)&iInkTablet2);
- iInkTablet->Release();
- if (FAILED(hr))
- continue;
- TabletDeviceKind kind;
- hr = iInkTablet2->get_DeviceKind(&kind);
- iInkTablet2->Release();
- if (FAILED(hr))
- continue;
- if (kind == TDK_Touch) {
- QApplicationPrivate::HasTouchSupport = true;
- break;
- }
- }
- iInkTablets->Release();
+ if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
+ static const int QT_SM_DIGITIZER = 94;
+ QApplicationPrivate::HasTouchSupport = GetSystemMetrics(QT_SM_DIGITIZER);
}
QLibrary library(QLatin1String("user32"));
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 78fc704..3664743 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -5268,7 +5268,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
if (isVisible() && data->crect.size() != oldSize) {
Q_ASSERT(d->extra->topextra);
- QWidgetBackingStore *bs = d->extra->topextra->backingStore;
+ QWidgetBackingStore *bs = d->extra->topextra->backingStore.data();
const bool hasStaticContents = bs && bs->hasStaticContents();
// If we have a backing store with static contents, we have to disable the top-level
// resize optimization in order to get invalidated regions for resized widgets.
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 4953c48..eec9699 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -952,12 +952,14 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::Zoom;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.percentage = [event magnification];
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)rotateWithEvent:(NSEvent *)event;
@@ -965,12 +967,14 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::Rotate;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.percentage = -[event rotation];
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)swipeWithEvent:(NSEvent *)event;
@@ -978,6 +982,7 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::Swipe;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
@@ -991,6 +996,7 @@ static int qCocoaViewCount = 0;
else if ([event deltaY] == -1)
qNGEvent.angle = 270.0f;
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)beginGestureWithEvent:(NSEvent *)event;
@@ -998,11 +1004,13 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)endGestureWithEvent:(NSEvent *)event;
@@ -1010,11 +1018,13 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)frameDidChange:(NSNotification *)note
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index acf7184..92eed33 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3421,9 +3421,11 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child();
return dbg.space();
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
n = "Gesture";
break;
+#endif
default:
dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')';
return dbg.space();
@@ -4254,6 +4256,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
return *this;
}
+#ifndef QT_NO_GESTURES
/*!
\class QGestureEvent
\since 4.6
@@ -4558,4 +4561,6 @@ const QGestureEventPrivate *QGestureEvent::d_func() const
*/
#endif
+#endif // QT_NO_GESTURES
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 90242fe..9c70c02 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -62,7 +62,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QAction;
+#ifndef QT_NO_GESTURES
class QGesture;
+#endif
class Q_GUI_EXPORT QInputEvent : public QEvent
{
@@ -824,6 +826,7 @@ protected:
friend class QApplicationPrivate;
};
+#ifndef QT_NO_GESTURES
class QGesture;
class QGestureEventPrivate;
class Q_GUI_EXPORT QGestureEvent : public QEvent
@@ -875,6 +878,7 @@ private:
friend class QApplication;
friend class QGestureManager;
};
+#endif // QT_NO_GESTURES
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 5c94a23..e323aa9 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -120,6 +120,7 @@ public:
qreal pressure;
};
+#ifndef QT_NO_GESTURES
class QNativeGestureEvent : public QEvent
{
public:
@@ -164,7 +165,7 @@ public:
QMap<Qt::GestureType, bool> accepted;
QMap<Qt::GestureType, QWidget *> targetWidgets;
};
-
+#endif // QT_NO_GESTURES
class QFileOpenEventPrivate
{
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 0d93b9f..e26fbde 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -492,6 +492,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
case NSOtherMouseDown:
case NSOtherMouseUp:
case NSOtherMouseDragged:
+#ifndef QT_NO_GESTURES
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
case NSEventTypeGesture: // touch events
case NSEventTypeMagnify:
@@ -500,6 +501,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
case NSEventTypeBeginGesture:
case NSEventTypeEndGesture:
#endif
+#endif // QT_NO_GESTURES
result = true;
break;
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index 49bdea7..f5688f4 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -42,6 +42,8 @@
#include "qgesture.h"
#include "private/qgesture_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
/*!
@@ -725,3 +727,5 @@ void QTapAndHoldGesture::setPosition(const QPointF &value)
}
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index c9bdce6..8c10895 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -49,6 +49,8 @@
#include <QtCore/qrect.h>
#include <QtCore/qmetatype.h>
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_HEADER
Q_DECLARE_METATYPE(Qt::GestureState)
@@ -258,4 +260,6 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy)
QT_END_HEADER
+#endif // QT_NO_GESTURES
+
#endif // QGESTURE_H
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index bf60f97..f5474c1 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -59,6 +59,8 @@
#include "qelapsedtimer.h"
#include "private/qobject_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QGesturePrivate : public QObjectPrivate
@@ -179,4 +181,6 @@ public:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QGESTURE_P_H
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 43facef..e43a560 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -66,6 +66,8 @@
# define DEBUG qDebug
#endif
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
QGestureManager::QGestureManager(QObject *parent)
@@ -284,6 +286,9 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
// check if a running gesture switched back to maybe state
QSet<QGesture *> activeToMaybeGestures = m_activeGestures & newMaybeGestures;
+ // check if a maybe gesture switched to canceled - reset it but don't send an event
+ QSet<QGesture *> maybeToCanceledGestures = m_maybeGestures & notGestures;
+
// check if a running gesture switched back to not gesture state,
// i.e. were canceled
QSet<QGesture *> canceledGestures = m_activeGestures & notGestures;
@@ -343,7 +348,8 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
<< "\n\tstarted:" << startedGestures
<< "\n\ttriggered:" << triggeredGestures
<< "\n\tfinished:" << finishedGestures
- << "\n\tcanceled:" << canceledGestures;
+ << "\n\tcanceled:" << canceledGestures
+ << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
}
QSet<QGesture *> undeliveredGestures;
@@ -364,7 +370,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
// reset gestures that ended
QSet<QGesture *> endedGestures =
- finishedGestures + canceledGestures + undeliveredGestures;
+ finishedGestures + canceledGestures + undeliveredGestures + maybeToCanceledGestures;
foreach (QGesture *gesture, endedGestures) {
recycle(gesture);
m_gestureTargets.remove(gesture);
@@ -684,6 +690,7 @@ void QGestureManager::recycle(QGesture *gesture)
if (recognizer) {
gesture->setGestureCancelPolicy(QGesture::CancelNone);
recognizer->reset(gesture);
+ m_activeGestures.remove(gesture);
} else {
cleanupGesturesForRemovedRecognizer(gesture);
}
@@ -691,4 +698,6 @@ void QGestureManager::recycle(QGesture *gesture)
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#include "moc_qgesturemanager_p.cpp"
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index c452f49..747cb1a 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -58,6 +58,8 @@
#include "private/qwidget_p.h"
#include "qgesturerecognizer.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QBasicTimer;
@@ -143,4 +145,6 @@ private:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QGESTUREMANAGER_P_H
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp
index 9dcca17..3e23bbf 100644
--- a/src/gui/kernel/qgesturerecognizer.cpp
+++ b/src/gui/kernel/qgesturerecognizer.cpp
@@ -44,6 +44,8 @@
#include "private/qgesture_p.h"
#include "private/qgesturemanager_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
/*!
@@ -231,3 +233,5 @@ void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type)
}
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h
index 3e17c99..5afb43f 100644
--- a/src/gui/kernel/qgesturerecognizer.h
+++ b/src/gui/kernel/qgesturerecognizer.h
@@ -45,6 +45,8 @@
#include <QtCore/qglobal.h>
#include <QtCore/qnamespace.h>
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -95,4 +97,6 @@ QT_END_NAMESPACE
QT_END_HEADER
+#endif // QT_NO_GESTURES
+
#endif // QGESTURERECOGNIZER_H
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 931bc33..c2f275a 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -439,6 +439,10 @@ static const struct {
{ Qt::Key_MediaPrevious, QT_TRANSLATE_NOOP("QShortcut", "Media Previous") },
{ Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") },
{ Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") },
+ //: Media player pause button
+ { Qt::Key_MediaPause, QT_TRANSLATE_NOOP("QShortcut", "Media Pause") },
+ //: Media player button to toggle between playing and paused
+ { Qt::Key_MediaTogglePlayPause, QT_TRANSLATE_NOOP("QShortcut", "Toggle Media Play/Pause") },
{ Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") },
{ Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") },
{ Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") },
@@ -575,13 +579,25 @@ static const struct {
// --------------------------------------------------------------
// Device keys
- { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") },
- { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") },
- { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") },
- { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") },
- { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") },
- { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") },
- { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") },
+ { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") },
+ { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") },
+ { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") },
+ { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") },
+ //: Button to start a call (note: a separate button is used to end the call)
+ { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") },
+ //: Button to end a call (note: a separate button is used to start the call)
+ { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") },
+ //: Button that will hang up if we're in call, or make a call if we're not.
+ { Qt::Key_ToggleCallHangup, QT_TRANSLATE_NOOP("QShortcut", "Toggle Call/Hangup") },
+ { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") },
+ //: Button to trigger voice dialling
+ { Qt::Key_VoiceDial, QT_TRANSLATE_NOOP("QShortcut", "Voice Dial") },
+ //: Button to redial the last number called
+ { Qt::Key_LastNumberRedial, QT_TRANSLATE_NOOP("QShortcut", "Last Number Redial") },
+ //: Button to trigger the camera shutter (take a picture)
+ { Qt::Key_Camera, QT_TRANSLATE_NOOP("QShortcut", "Camera Shutter") },
+ //: Button to focus the camera
+ { Qt::Key_CameraFocus, QT_TRANSLATE_NOOP("QShortcut", "Camera Focus") },
// --------------------------------------------------------------
// Japanese keyboard support
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm
index fba839b..0ccbb52 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac.mm
+++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm
@@ -47,6 +47,8 @@
#include "qwidget.h"
#include "qdebug.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer()
@@ -260,3 +262,5 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture)
#endif // QT_MAC_USE_COCOA
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
index dd8a150..f48c160 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac_p.h
+++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
@@ -57,6 +57,8 @@
#include "qpoint.h"
#include "qgesturerecognizer.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QMacSwipeGestureRecognizer : public QGestureRecognizer
@@ -99,4 +101,6 @@ private:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QMACSWIPEGESTURERECOGNIZER_MAC_P_H
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index a575717..8a3e89e 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -47,6 +47,8 @@
#include "qabstractscrollarea.h"
#include "qdebug.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
QPanGestureRecognizer::QPanGestureRecognizer()
@@ -110,6 +112,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state,
p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2;
if (d->offset.x() > 10 || d->offset.y() > 10 ||
d->offset.x() < -10 || d->offset.y() < -10) {
+ q->setHotSpot(p1.startScreenPos());
result = QGestureRecognizer::TriggerGesture;
} else {
result = QGestureRecognizer::MayBeGesture;
@@ -439,6 +442,7 @@ QGestureRecognizer::Result QTapGestureRecognizer::recognize(QGesture *state,
switch (event->type()) {
case QEvent::TouchBegin: {
d->position = ev->touchPoints().at(0).pos();
+ q->setHotSpot(ev->touchPoints().at(0).screenPos());
result = QGestureRecognizer::TriggerGesture;
break;
}
@@ -521,6 +525,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
if (d->timerId)
q->killTimer(d->timerId);
d->timerId = q->startTimer(TimerInterval);
+ q->setHotSpot(ev->touchPoints().at(0).startScreenPos());
result = QGestureRecognizer::TriggerGesture;
break;
case QEvent::TouchEnd:
@@ -563,3 +568,5 @@ void QTapAndHoldGestureRecognizer::reset(QGesture *state)
}
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h
index 64505d8..da73b85 100644
--- a/src/gui/kernel/qstandardgestures_p.h
+++ b/src/gui/kernel/qstandardgestures_p.h
@@ -56,6 +56,8 @@
#include "qgesturerecognizer.h"
#include "private/qgesture_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QPanGestureRecognizer : public QGestureRecognizer
@@ -110,4 +112,6 @@ public:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QSTANDARDGESTURES_P_H
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 0fddbf8..30bbf99 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -161,6 +161,51 @@ static inline bool hasBackingStoreSupport()
extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp
extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
+
+QRefCountedWidgetBackingStore::QRefCountedWidgetBackingStore()
+ : m_ptr(0)
+ , m_count(0)
+{
+
+}
+
+QRefCountedWidgetBackingStore::~QRefCountedWidgetBackingStore()
+{
+ delete m_ptr;
+}
+
+void QRefCountedWidgetBackingStore::create(QWidget *widget)
+{
+ destroy();
+ m_ptr = new QWidgetBackingStore(widget);
+ m_count = 0;
+}
+
+void QRefCountedWidgetBackingStore::destroy()
+{
+ delete m_ptr;
+ m_ptr = 0;
+ m_count = 0;
+}
+
+void QRefCountedWidgetBackingStore::ref()
+{
+ Q_ASSERT(m_ptr);
+ ++m_count;
+}
+
+void QRefCountedWidgetBackingStore::deref()
+{
+ if (m_count) {
+ Q_ASSERT(m_ptr);
+ if (0 == --m_count) {
+ delete m_ptr;
+ m_ptr = 0;
+ }
+ }
+}
+
+
QWidgetPrivate::QWidgetPrivate(int version)
: QObjectPrivate(version)
, extra(0)
@@ -202,7 +247,9 @@ QWidgetPrivate::QWidgetPrivate(int version)
, picture(0)
#elif defined(Q_WS_WIN)
, noPaintOnScreen(0)
+ #ifndef QT_NO_GESTURES
, nativeGesturePanEnabled(0)
+ #endif
#elif defined(Q_WS_MAC)
, needWindowChange(0)
, hasAlienChildren(0)
@@ -332,6 +379,8 @@ void QWidget::setInputContext(QInputContext *context)
if (d->ic)
delete d->ic;
d->ic = context;
+ if (d->ic)
+ d->ic->setParent(this);
#endif
}
@@ -1347,11 +1396,9 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
// a real toplevel window needs a backing store
if (isWindow() && windowType() != Qt::Desktop) {
- delete d->topData()->backingStore;
- // QWidgetBackingStore will check this variable, hence it must be 0
- d->topData()->backingStore = 0;
+ d->topData()->backingStore.destroy();
if (hasBackingStoreSupport())
- d->topData()->backingStore = new QWidgetBackingStore(this);
+ d->topData()->backingStore.create(this);
}
d->setModal_sys();
@@ -1396,8 +1443,10 @@ QWidget::~QWidget()
qWarning("QWidget: %s (%s) deleted while being painted", className(), name());
#endif
+#ifndef QT_NO_GESTURES
foreach (Qt::GestureType type, d->gestureContext.keys())
ungrabGesture(type);
+#endif
// force acceptDrops false before winId is destroyed.
d->registerDropSite(false);
@@ -1477,8 +1526,7 @@ QWidget::~QWidget()
// the backing store will delete its window surface, which may or may
// not have a reference to this widget that will be used later to
// notify the window it no longer has a surface.
- delete d->extra->topextra->backingStore;
- d->extra->topextra->backingStore = 0;
+ d->extra->topextra->backingStore.destroy();
}
#endif
if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
@@ -1575,7 +1623,6 @@ void QWidgetPrivate::createTLExtra()
QTLWExtra* x = extra->topextra = new QTLWExtra;
x->icon = 0;
x->iconPixmap = 0;
- x->backingStore = 0;
x->windowSurface = 0;
x->sharedPainter = 0;
x->incw = x->inch = 0;
@@ -1659,7 +1706,7 @@ void QWidgetPrivate::deleteExtra()
#endif
if (extra->topextra) {
deleteTLSysExtra();
- delete extra->topextra->backingStore;
+ extra->topextra->backingStore.destroy();
delete extra->topextra->icon;
delete extra->topextra->iconPixmap;
#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER)
@@ -8538,9 +8585,11 @@ bool QWidget::event(QEvent *event)
#endif // Q_WS_MAC
break;
}
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
event->ignore();
break;
+#endif
#ifndef QT_NO_PROPERTIES
case QEvent::DynamicPropertyChange: {
const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
@@ -11956,6 +12005,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const
Synonym for QList<QWidget *>.
*/
+#ifndef QT_NO_GESTURES
/*!
Subscribes the widget to a given \a gesture with specific \a flags.
@@ -11983,7 +12033,7 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
manager->cleanupCachedGestures(this, gesture);
}
}
-
+#endif // QT_NO_GESTURES
/*!
\typedef WId
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index e12148b..941bd68 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -360,8 +360,10 @@ public:
void setGraphicsEffect(QGraphicsEffect *effect);
#endif //QT_NO_GRAPHICSEFFECT
+#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
void ungrabGesture(Qt::GestureType type);
+#endif
public Q_SLOTS:
void setWindowTitle(const QString &);
@@ -742,8 +744,10 @@ private:
friend class QGraphicsProxyWidgetPrivate;
friend class QStyleSheetStyle;
friend struct QWidgetExceptionCleaner;
+#ifndef QT_NO_GESTURES
friend class QGestureManager;
friend class QWinNativePanGestureRecognizer;
+#endif // QT_NO_GESTURES
friend class QWidgetEffectSourcePrivate;
#ifdef Q_WS_MAC
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index f12c956..1928599 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -752,6 +752,7 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt
return window;
}
+#ifndef QT_NO_GESTURES
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
/* We build the release package against the 10.4 SDK.
So, to enable gestures for applications running on
@@ -768,6 +769,7 @@ enum {
kEventParamMagnificationAmount = 'magn'
};
#endif
+#endif // QT_NO_GESTURES
// window events
static EventTypeSpec window_events[] = {
@@ -1076,6 +1078,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
handled_event = false;
break; }
+#ifndef QT_NO_GESTURES
case kEventClassGesture: {
// First, find the widget that was under
// the mouse when the gesture happened:
@@ -1142,6 +1145,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
QApplication::sendSpontaneousEvent(widget, &qNGEvent);
break; }
+#endif // QT_NO_GESTURES
default:
handled_event = false;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 3f494d8..49a2dc8 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -110,13 +110,53 @@ class QWidgetItemV2;
class QStyle;
+class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore
+{
+public:
+ QRefCountedWidgetBackingStore();
+ ~QRefCountedWidgetBackingStore();
+
+ void create(QWidget *tlw);
+ void destroy();
+
+ void ref();
+ void deref();
+
+ inline QWidgetBackingStore* data()
+ {
+ return m_ptr;
+ }
+
+ inline QWidgetBackingStore* operator->()
+ {
+ return m_ptr;
+ }
+
+ inline QWidgetBackingStore& operator*()
+ {
+ return *m_ptr;
+ }
+
+ inline operator bool() const
+ {
+ return (0 != m_ptr);
+ }
+
+private:
+ Q_DISABLE_COPY(QRefCountedWidgetBackingStore)
+
+private:
+ QWidgetBackingStore* m_ptr;
+ int m_count;
+};
+
struct QTLWExtra {
// *************************** Cross-platform variables *****************************
// Regular pointers (keep them together to avoid gaps on 64 bits architectures).
QIcon *icon; // widget icon
QPixmap *iconPixmap;
- QWidgetBackingStore *backingStore;
+ QRefCountedWidgetBackingStore backingStore;
QWindowSurface *windowSurface;
QPainter *sharedPainter;
@@ -685,7 +725,9 @@ public:
#ifndef QT_NO_ACTION
QList<QAction*> actions;
#endif
+#ifndef QT_NO_GESTURES
QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
+#endif
// Bit fields.
uint high_attributes[4]; // the low ones are in QWidget::widget_attributes
@@ -714,8 +756,9 @@ public:
void updateX11AcceptFocus();
#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN
uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine()
+#ifndef QT_NO_GESTURES
uint nativeGesturePanEnabled : 1;
-
+#endif
bool shouldShowMaximizeButton();
void winUpdateIsOpaque();
void reparentChildren();
@@ -929,7 +972,7 @@ inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const
{
Q_Q(const QWidget);
QTLWExtra *x = q->window()->d_func()->maybeTopData();
- return x ? x->backingStore : 0;
+ return x ? x->backingStore.data() : 0;
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 02e7cb8..86b858d 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -433,6 +433,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
// Request mouse move events.
drawableWindow->PointerFilter(EPointerFilterEnterExit
| EPointerFilterMove | EPointerFilterDrag, 0);
+ drawableWindow->EnableVisibilityChangeEvents();
if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) {
activateSymbianWindow(control.data());
@@ -487,11 +488,8 @@ void QWidgetPrivate::show_sys()
&& !S60->buttonGroupContainer() && !S60->statusPane()) {
bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
- bool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- // If the window is fullscreen and has not explicitly requested that the CBA be visible
- // we delay the creation even more.
- if ((!isFullscreen || cbaRequested) && !q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {
// Create the status pane and CBA here
CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
@@ -911,14 +909,12 @@ void QWidgetPrivate::registerDropSite(bool /* on */)
void QWidgetPrivate::createTLSysExtra()
{
- extra->topextra->backingStore = 0;
extra->topextra->inExpose = 0;
}
void QWidgetPrivate::deleteTLSysExtra()
{
- delete extra->topextra->backingStore;
- extra->topextra->backingStore = 0;
+ extra->topextra->backingStore.destroy();
}
void QWidgetPrivate::createSysExtra()
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 5482da3..a7e66bf 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -2075,7 +2075,7 @@ void QWidgetPrivate::registerTouchWindow()
void QWidgetPrivate::winSetupGestures()
{
-#if !defined(QT_NO_NATIVE_GESTURES)
+#if !defined(QT_NO_GESTURES) && !defined(QT_NO_NATIVE_GESTURES)
Q_Q(QWidget);
if (!q || !q->isVisible() || !nativeGesturePanEnabled)
return;
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
index 0bddbf6..780de5d 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
@@ -50,6 +50,8 @@
#include "private/qapplication_p.h"
#include "private/qwidget_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_NATIVE_GESTURES)
@@ -127,3 +129,5 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state)
#endif // QT_NO_NATIVE_GESTURES
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
index 146b067..9d0e6f7 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
@@ -54,38 +54,8 @@
//
#include <QGestureRecognizer>
-#include <objbase.h>
-class IInkRectangle;
-class TabletHardwareCapabilities;
-class TabletPropertyMetricUnit;
-DECLARE_INTERFACE_(IInkTablet, IDispatch)
-{
- STDMETHOD(get_Name)(THIS_ BSTR *Name) PURE;
- STDMETHOD(get_PlugAndPlayId)(THIS_ BSTR *Id) PURE;
- STDMETHOD(get_MaximumInputRectangle)(THIS_ IInkRectangle **Rectangle) PURE;
- STDMETHOD(get_HardwareCapabilities)(THIS_ TabletHardwareCapabilities *Capabilities) PURE;
- STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName) PURE;
- STDMETHOD(GetPropertyMetrics)(THIS_ BSTR propertyName, long *Minimum, long *Maximum, TabletPropertyMetricUnit *Units, float *Resolution) PURE;
-};
-enum TabletDeviceKind
-{
- TDK_Mouse = 0,
- TDK_Pen = 1,
- TDK_Touch = 2
-};
-DECLARE_INTERFACE_(IInkTablet2, IDispatch)
-{
- STDMETHOD(get_DeviceKind)(THIS_ TabletDeviceKind *Kind) PURE;
-};
-DECLARE_INTERFACE_(IInkTablets, IDispatch)
-{
- STDMETHOD(get_Count)(THIS_ long *Count) PURE;
- STDMETHOD(get__NewEnum)(THIS_ IUnknown **_NewEnum) PURE;
- STDMETHOD(get_DefaultTablet)(THIS_ IInkTablet **DefaultTablet) PURE;
- STDMETHOD(Item)(THIS_ long Index, IInkTablet **Tablet) PURE;
- STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName, VARIANT_BOOL *Supported) PURE;
-};
+#ifndef QT_NO_GESTURES
QT_BEGIN_NAMESPACE
@@ -105,4 +75,6 @@ public:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H