Warning, /graphics/krita/3rdparty/ext_qt/0023-Implement-a-switch-for-tablet-API-on-Windows.patch is written in an unsupported language. File is not indexed.
0001 From 69df067982434797a0152fc74d5171eeccd41601 Mon Sep 17 00:00:00 2001 0002 From: Dmitry Kazakov <dimula73@gmail.com> 0003 Date: Wed, 3 Apr 2019 18:37:56 +0300 0004 Subject: [PATCH 04/47] Implement a switch for tablet API on Windows 0005 0006 Qt has support for two tablet APIs: WinTab and Windows Pointer API. 0007 The former one is used in professional graphical tablet devices, 0008 like Wacom, Huion and etc. The latter is mostly used in two-in-one 0009 convertible laptops, like Surface Pro. By default Qt prefers Windows 0010 Pointer API, if it is available. 0011 0012 The problem is that some devices (e.g. Huion tablets) do not 0013 support Windows Pointer API. More than that, even devices, which 0014 support Pointer API, must limit their capabilities to fit it: 0015 0016 1) Winodws Pointer API doesn't support more than one stylus barrel 0017 buttons, but all professional devices have at least two buttons. 0018 0019 2) Winodws Pointer API limits pressure resolution to 1024 levels, 0020 but even entry-level Wacom devices have at least 2048 levels. 0021 Professional-level devices have 4096 levels. 0022 0023 Therefore painting applications should be able to choose, which API 0024 they prefer. 0025 0026 This patch implements a special application attribute 0027 Qt::AA_MSWindowsUseWinTabAPI. Application should set it before creation 0028 of QApplication to force selection of WinTab API. 0029 0030 When running, application can check currently running API by 0031 testing this attribute. 0032 --- 0033 src/corelib/global/qnamespace.h | 1 + 0034 src/plugins/platforms/windows/qwindowsintegration.cpp | 8 +++++++- 0035 2 files changed, 8 insertions(+), 1 deletion(-) 0036 0037 diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h 0038 index dec2c44637..3ab9921986 100644 0039 --- a/src/corelib/global/qnamespace.h 0040 +++ b/src/corelib/global/qnamespace.h 0041 @@ -525,6 +525,7 @@ public: 0042 AA_DontShowShortcutsInContextMenus = 28, 0043 AA_CompressTabletEvents = 29, 0044 AA_DisableWindowContextHelpButton = 30, // ### Qt 6: remove me 0045 + AA_MSWindowsUseWinTabAPI = 31, // Win only 0046 0047 // Add new attributes before this line 0048 AA_AttributeCount 0049 diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp 0050 index 5c1fa00088..d2d12ff7e5 100644 0051 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp 0052 +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp 0053 @@ -236,10 +236,16 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL 0054 m_options = parseOptions(paramList, &tabletAbsoluteRange, &dpiAwareness); 0055 QWindowsFontDatabase::setFontOptions(m_options); 0056 0057 + if (QCoreApplication::testAttribute(Qt::AA_MSWindowsUseWinTabAPI)) { 0058 + m_options |= QWindowsIntegration::DontUseWMPointer; 0059 + } 0060 + 0061 if (m_context.initPointer(m_options)) { 0062 QCoreApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents); 0063 } else { 0064 - m_context.initTablet(m_options); 0065 + if (m_context.initTablet(m_options)) 0066 + QCoreApplication::setAttribute(Qt::AA_MSWindowsUseWinTabAPI); 0067 + 0068 if (tabletAbsoluteRange >= 0) 0069 m_context.setTabletAbsoluteRange(tabletAbsoluteRange); 0070 } 0071 -- 0072 2.20.1.windows.1 0073