Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.7, 5.15.8
-
None
-
Windows 10 1604
Description
We have a Qt Quick based application that replaces explorer.exe as the Shell (i.e. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Shell) in a Windows 10-based embedded system.
Intermittently (as high as 30% of the time on some systems, <1% of the time on other systems) we experience the following symptoms:
- On boot up and application launch, the application does not respond to touch input.
- Anywhere between 1 and 5 minutes later, the application begins properly responding to touch input events
- When in this lack-of-touch state, we can launch another application and see that touch input is properly handled by that application. We've tested this with both another (much simpler) Qt based application of our own and with a third party non-Qt-based application.
- When setting the shell to another application we never see the intermittent lack-of-touch bug. We've tested this with the same two applications as above.
Enabling qt.qpa.*=true log messages and adding logging to our application like this during startup (after the main window has been shown) and then periodically every 5 seconds:
LOGDBG() << QTouchDevice::devices().count() << "touch device(s) detected";
Shows the following when the problem occurs:
20220114-13:00:11:050 | 4156 | debug | general.TouchDeviceDiagnostic: 0 touch device(s) detected ... 20220114-13:00:12:155 | 4156 | debug | qt.qpa.events: Digitizers: 0x41 Ready: 0x80 Tablet PC: 1 Max touch points: 10 ... 20220114-13:00:16:072 | 4156 | debug | general.TouchDeviceDiagnostic: 1 touch device(s) detected
By looking at Qt's touch device registration in QWindowsContext::windowsProc and QWindowsContext::initTouch we've come up with the following workaround that runs at startup after the main window has been shown:
LOGDBG() << QTouchDevice::devices().count() << "touch device(s) detected"; #ifdef Q_OS_WIN auto hwnd = getNativeWindow(); LOGDBG() << "Sending fake WM_DEVICECHANGE message"; SendMessage(hwnd, WM_DEVICECHANGE, DBT_DEVNODES_CHANGED, 0); #endif