diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 35 | ||||
-rw-r--r-- | src/gui/kernel/qgesturemanager.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_win.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwinnativepangesturerecognizer_win_p.h | 32 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle_p.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindowlayout_mac.mm | 2 |
7 files changed, 76 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index b3ec732..ce39334 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -530,6 +530,7 @@ public: const QList<QTouchEvent::TouchPoint> &touchPoints); #if defined(Q_WS_WIN) + static bool HasTouchSupport; static PtrRegisterTouchWindow RegisterTouchWindow; static PtrGetTouchInputInfo GetTouchInputInfo; static PtrCloseTouchInputHandle CloseTouchInputHandle; diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index da6869d..49cb0f2 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -115,6 +115,8 @@ 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 @@ -4000,12 +4002,45 @@ void QSessionManager::cancel() #endif //QT_NO_SESSIONMANAGER +bool QApplicationPrivate::HasTouchSupport = false; PtrRegisterTouchWindow QApplicationPrivate::RegisterTouchWindow = 0; PtrGetTouchInputInfo QApplicationPrivate::GetTouchInputInfo = 0; 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(); + } + QLibrary library(QLatin1String("user32")); // MinGW (g++ 3.4.5) accepts only C casts. RegisterTouchWindow = (PtrRegisterTouchWindow)(library.resolve("RegisterTouchWindow")); diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 89ad94d..aa6720e 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -45,6 +45,7 @@ #include "private/qgesture_p.h" #include "private/qgraphicsitem_p.h" #include "private/qevent_p.h" +#include "private/qapplication_p.h" #include "qgesture.h" #include "qevent.h" #include "qgraphicsitem.h" @@ -86,7 +87,8 @@ QGestureManager::QGestureManager(QObject *parent) #endif #if defined(Q_OS_WIN) #if !defined(QT_NO_NATIVE_GESTURES) - registerGestureRecognizer(new QWinNativePanGestureRecognizer); + if (QApplicationPrivate::HasTouchSupport) + registerGestureRecognizer(new QWinNativePanGestureRecognizer); #endif #else registerGestureRecognizer(new QTapAndHoldGestureRecognizer); diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 10522ed..9acfb70 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2052,6 +2052,8 @@ void QWidgetPrivate::winSetupGestures() if (!q || !q->isVisible() || !nativeGesturePanEnabled) return; + if (!QApplicationPrivate::HasTouchSupport) + return; QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); if (!qAppPriv->SetGestureConfig) return; diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index c65fa50..146b067 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -54,6 +54,38 @@ // #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; +}; QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp index f3c7a5b..ad6746f 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -530,7 +530,7 @@ void QGtkStylePrivate::initGtkWidgets() const GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new(); addWidget(gtkButton); g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), 0); - addWidget(QGtkStylePrivate::gtk_tool_button_new(NULL, NULL)); + addWidget(QGtkStylePrivate::gtk_tool_button_new(NULL, "Qt")); addWidget(QGtkStylePrivate::gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE)); addWidget(QGtkStylePrivate::gtk_hbutton_box_new()); addWidget(QGtkStylePrivate::gtk_check_button_new()); diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index d92168a..9527057 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -463,6 +463,8 @@ void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar) NSToolbarItem *item = static_cast<NSToolbarItem *>(it.key()); [[qt_mac_window_for(layoutState.mainWindow->window()) toolbar] removeItemAtIndex:toolbarItemsCopy.indexOf(item)]; + unifiedToolbarHash.remove(item); + qtoolbarsInUnifiedToolbarList.removeAll(toolbar); #endif break; } |