diff --git a/libs/ui/input/wintab/kis_tablet_support_win.cpp b/libs/ui/input/wintab/kis_tablet_support_win.cpp --- a/libs/ui/input/wintab/kis_tablet_support_win.cpp +++ b/libs/ui/input/wintab/kis_tablet_support_win.cpp @@ -77,6 +77,7 @@ QWindowsTabletSupport *QTAB = 0; static QPointer targetWindow = 0; //< Window receiving last tablet event static QPointer qt_tablet_target = 0; //< Widget receiving last tablet event +static bool dialogOpen = false; //< KisTabletSupportWin is not a Q_OBJECT and can't accept dialog signals HWND createDummyWindow(const QString &className, const wchar_t *windowName, WNDPROC wndProc) { @@ -604,17 +605,43 @@ result.maxTanPressure = int(axis.axMax); LOGCONTEXT defaultLc; + /* get default region */ QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEFCONTEXT, 0, &defaultLc); result.maxX = int(defaultLc.lcInExtX) - int(defaultLc.lcInOrgX); result.maxY = int(defaultLc.lcInExtY) - int(defaultLc.lcInOrgY); result.maxZ = int(defaultLc.lcInExtZ) - int(defaultLc.lcInOrgZ); result.currentDevice = deviceType(cursorType); + // Define a rectangle representing the whole screen as seen by Wintab. + QRect qtDesktopRect = QApplication::desktop()->geometry(); + QRect wintabDesktopRect(defaultLc.lcSysOrgX, defaultLc.lcSysOrgY, + defaultLc.lcSysExtX, defaultLc.lcSysExtY); + qDebug() << ppVar(qtDesktopRect); + qDebug() << ppVar(wintabDesktopRect); + + // Show screen choice dialog + { + KisScreenSizeChoiceDialog dlg(0, + wintabDesktopRect, + qtDesktopRect); + + KisExtendedModifiersMapper mapper; + KisExtendedModifiersMapper::ExtendedModifiers modifiers = + mapper.queryExtendedModifiers(); + + if (modifiers.contains(Qt::Key_Shift) || + (!dlg.canUseDefaultSettings() && + qtDesktopRect != wintabDesktopRect)) { + + dialogOpen = true; + dlg.exec(); + } + + result.virtualDesktopArea = dlg.screenRect(); + dialogOpen = false; + } - // These define a rectangle representing the whole screen as seen by Wintab. - result.virtualDesktopArea = QRect(defaultLc.lcSysOrgX, defaultLc.lcSysOrgY, - defaultLc.lcSysExtX, defaultLc.lcSysExtY); return result; }; @@ -659,7 +686,7 @@ { static PACKET localPacketBuf[TabletPacketQSize]; // our own tablet packet queue. const int packetCount = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, TabletPacketQSize, &localPacketBuf); - if (!packetCount || m_currentDevice < 0) + if (!packetCount || m_currentDevice < 0 || dialogOpen) return false; // In contrast to Qt, these will not be "const" during our loop.