159 return; |
159 return; |
160 firstTime = false; |
160 firstTime = false; |
161 qt_tablet_widget = new QWidget(0); |
161 qt_tablet_widget = new QWidget(0); |
162 qt_tablet_widget->createWinId(); |
162 qt_tablet_widget->createWinId(); |
163 qt_tablet_widget->setObjectName(QLatin1String("Qt internal tablet widget")); |
163 qt_tablet_widget->setObjectName(QLatin1String("Qt internal tablet widget")); |
|
164 // We dont need this internal widget to appear in QApplication::topLevelWidgets() |
|
165 if (QWidgetPrivate::allWidgets) |
|
166 QWidgetPrivate::allWidgets->remove(qt_tablet_widget); |
164 LOGCONTEXT lcMine; |
167 LOGCONTEXT lcMine; |
165 qAddPostRoutine(qt_tablet_cleanup); |
168 qAddPostRoutine(qt_tablet_cleanup); |
166 struct tagAXIS tpOri[3]; |
169 struct tagAXIS tpOri[3]; |
167 init_wintab_functions(); |
170 init_wintab_functions(); |
168 if (ptrWTInfo && ptrWTOpen && ptrWTQueueSizeGet && ptrWTQueueSizeSet) { |
171 if (ptrWTInfo && ptrWTOpen && ptrWTQueueSizeGet && ptrWTQueueSizeSet) { |
672 { |
675 { |
673 Q_D(const QWidget); |
676 Q_D(const QWidget); |
674 QWidget *parentWindow = window(); |
677 QWidget *parentWindow = window(); |
675 QWExtra *extra = parentWindow->d_func()->extra; |
678 QWExtra *extra = parentWindow->d_func()->extra; |
676 if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId() |
679 if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId() |
677 || (extra && extra->proxyWidget)) { |
680 || (extra |
|
681 #ifndef QT_NO_GRAPHICSVIEW |
|
682 && extra->proxyWidget |
|
683 #endif //QT_NO_GRAPHICSVIEW |
|
684 )) { |
678 if (extra && extra->topextra && extra->topextra->embedded) { |
685 if (extra && extra->topextra && extra->topextra->embedded) { |
679 QPoint pt = mapTo(parentWindow, pos); |
686 QPoint pt = mapTo(parentWindow, pos); |
680 POINT p = {pt.x(), pt.y()}; |
687 POINT p = {pt.x(), pt.y()}; |
681 ClientToScreen(parentWindow->effectiveWinId(), &p); |
688 ClientToScreen(parentWindow->effectiveWinId(), &p); |
682 return QPoint(p.x, p.y); |
689 return QPoint(p.x, p.y); |
699 { |
706 { |
700 Q_D(const QWidget); |
707 Q_D(const QWidget); |
701 QWidget *parentWindow = window(); |
708 QWidget *parentWindow = window(); |
702 QWExtra *extra = parentWindow->d_func()->extra; |
709 QWExtra *extra = parentWindow->d_func()->extra; |
703 if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId() |
710 if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId() |
704 || (extra && extra->proxyWidget)) { |
711 || (extra |
|
712 #ifndef QT_NO_GRAPHICSVIEW |
|
713 && extra->proxyWidget |
|
714 #endif //QT_NO_GRAPHICSVIEW |
|
715 )) { |
705 if (extra && extra->topextra && extra->topextra->embedded) { |
716 if (extra && extra->topextra && extra->topextra->embedded) { |
706 POINT p = {pos.x(), pos.y()}; |
717 POINT p = {pos.x(), pos.y()}; |
707 ScreenToClient(parentWindow->effectiveWinId(), &p); |
718 ScreenToClient(parentWindow->effectiveWinId(), &p); |
708 return mapFrom(parentWindow, QPoint(p.x, p.y)); |
719 return mapFrom(parentWindow, QPoint(p.x, p.y)); |
709 } else { |
720 } else { |
849 mouseGrb->releaseMouse(); |
860 mouseGrb->releaseMouse(); |
850 journalRec = SetWindowsHookEx(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandle(0), 0); |
861 journalRec = SetWindowsHookEx(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandle(0), 0); |
851 Q_ASSERT(testAttribute(Qt::WA_WState_Created)); |
862 Q_ASSERT(testAttribute(Qt::WA_WState_Created)); |
852 SetCapture(effectiveWinId()); |
863 SetCapture(effectiveWinId()); |
853 mouseGrb = this; |
864 mouseGrb = this; |
|
865 #ifndef QT_NO_CURSOR |
854 mouseGrbCur = new QCursor(mouseGrb->cursor()); |
866 mouseGrbCur = new QCursor(mouseGrb->cursor()); |
855 } |
867 #endif |
856 } |
868 } |
857 |
869 } |
|
870 |
|
871 #ifndef QT_NO_CURSOR |
858 void QWidget::grabMouse(const QCursor &cursor) |
872 void QWidget::grabMouse(const QCursor &cursor) |
859 { |
873 { |
860 if (!qt_nograb()) { |
874 if (!qt_nograb()) { |
861 if (mouseGrb) |
875 if (mouseGrb) |
862 mouseGrb->releaseMouse(); |
876 mouseGrb->releaseMouse(); |
1322 return; |
1337 return; |
1323 |
1338 |
1324 if (isResize && !q->testAttribute(Qt::WA_StaticContents) && q->internalWinId()) |
1339 if (isResize && !q->testAttribute(Qt::WA_StaticContents) && q->internalWinId()) |
1325 ValidateRgn(q->internalWinId(), 0); |
1340 ValidateRgn(q->internalWinId(), 0); |
1326 |
1341 |
|
1342 #ifdef Q_WS_WINCE |
|
1343 // On Windows CE we can't just fiddle around with the window state. |
|
1344 // Too much magic in setWindowState. |
|
1345 if (isResize && q->isMaximized()) |
|
1346 q->setWindowState(q->windowState() & ~Qt::WindowMaximized); |
|
1347 #else |
1327 if (isResize) |
1348 if (isResize) |
1328 data.window_state &= ~Qt::WindowMaximized; |
1349 data.window_state &= ~Qt::WindowMaximized; |
|
1350 #endif |
1329 |
1351 |
1330 if (data.window_state & Qt::WindowFullScreen) { |
1352 if (data.window_state & Qt::WindowFullScreen) { |
1331 QTLWExtra *top = topData(); |
1353 QTLWExtra *top = topData(); |
1332 |
1354 |
1333 if (q->isWindow()) { |
1355 if (q->isWindow()) { |
2023 QApplicationPrivate::RegisterTouchWindow(q->effectiveWinId(), 0); |
2045 QApplicationPrivate::RegisterTouchWindow(q->effectiveWinId(), 0); |
2024 } |
2046 } |
2025 |
2047 |
2026 void QWidgetPrivate::winSetupGestures() |
2048 void QWidgetPrivate::winSetupGestures() |
2027 { |
2049 { |
2028 Q_Q(QWidget); |
2050 #if !defined(QT_NO_NATIVE_GESTURES) |
2029 if (!q || !q->isVisible()) |
2051 Q_Q(QWidget); |
|
2052 if (!q || !q->isVisible() || !nativeGesturePanEnabled) |
2030 return; |
2053 return; |
|
2054 |
2031 QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); |
2055 QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); |
2032 WId winid = q->effectiveWinId(); |
2056 if (!qAppPriv->SetGestureConfig) |
|
2057 return; |
|
2058 WId winid = q->internalWinId(); |
2033 |
2059 |
2034 bool needh = false; |
2060 bool needh = false; |
2035 bool needv = false; |
2061 bool needv = false; |
2036 bool singleFingerPanEnabled = false; |
2062 bool singleFingerPanEnabled = false; |
2037 |
2063 |
|
2064 #ifndef QT_NO_SCROLLAREA |
2038 if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q->parent())) { |
2065 if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q->parent())) { |
2039 QScrollBar *hbar = asa->horizontalScrollBar(); |
2066 QScrollBar *hbar = asa->horizontalScrollBar(); |
2040 QScrollBar *vbar = asa->verticalScrollBar(); |
2067 QScrollBar *vbar = asa->verticalScrollBar(); |
2041 Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy(); |
2068 Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy(); |
2042 Qt::ScrollBarPolicy vbarpolicy = asa->verticalScrollBarPolicy(); |
2069 Qt::ScrollBarPolicy vbarpolicy = asa->verticalScrollBarPolicy(); |
2043 needh = (hbarpolicy == Qt::ScrollBarAlwaysOn || |
2070 needh = (hbarpolicy == Qt::ScrollBarAlwaysOn || |
2044 (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); |
2071 (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); |
2045 needv = (vbarpolicy == Qt::ScrollBarAlwaysOn || |
2072 needv = (vbarpolicy == Qt::ScrollBarAlwaysOn || |
2046 (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); |
2073 (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); |
2047 singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; |
2074 singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; |
2048 } |
2075 if (!winid) { |
2049 if (winid && qAppPriv->SetGestureConfig) { |
2076 winid = q->winId(); // enforces the native winid on the viewport |
|
2077 } |
|
2078 } |
|
2079 #endif //QT_NO_SCROLLAREA |
|
2080 if (winid) { |
2050 GESTURECONFIG gc[1]; |
2081 GESTURECONFIG gc[1]; |
2051 memset(gc, 0, sizeof(gc)); |
2082 memset(gc, 0, sizeof(gc)); |
2052 gc[0].dwID = GID_PAN; |
2083 gc[0].dwID = GID_PAN; |
2053 if (nativeGesturePanEnabled) { |
2084 if (nativeGesturePanEnabled) { |
2054 gc[0].dwWant = GC_PAN; |
2085 gc[0].dwWant = GC_PAN; |
2062 gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; |
2093 gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; |
2063 } else { |
2094 } else { |
2064 gc[0].dwBlock = GC_PAN; |
2095 gc[0].dwBlock = GC_PAN; |
2065 } |
2096 } |
2066 |
2097 |
2067 // gc[1].dwID = GID_ZOOM; |
|
2068 // if (gestures.pinch) |
|
2069 // gc[1].dwWant = GC_ZOOM; |
|
2070 // else |
|
2071 // gc[1].dwBlock = GC_ZOOM; |
|
2072 // gc[2].dwID = GID_ROTATE; |
|
2073 // if (gestures.pinch) |
|
2074 // gc[2].dwWant = GC_ROTATE; |
|
2075 // else |
|
2076 // gc[2].dwBlock = GC_ROTATE; |
|
2077 |
|
2078 qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); |
2098 qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); |
2079 } |
2099 } |
|
2100 #endif |
2080 } |
2101 } |
2081 |
2102 |
2082 QT_END_NAMESPACE |
2103 QT_END_NAMESPACE |
2083 |
2104 |
2084 #ifdef Q_WS_WINCE |
2105 #ifdef Q_WS_WINCE |