summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h3
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp3
4 files changed, 25 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index a5c05bf1a3..e703b5d47e 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -120,6 +120,7 @@ enum WindowsEventType // Simplify event types
QueryEndSessionApplicationEvent = ApplicationEventFlag + 4,
EndSessionApplicationEvent = ApplicationEventFlag + 5,
AppCommandEvent = ApplicationEventFlag + 6,
+ DeviceChangeEvent = ApplicationEventFlag + 7,
InputMethodStartCompositionEvent = InputMethodEventFlag + 1,
InputMethodCompositionEvent = InputMethodEventFlag + 2,
InputMethodEndCompositionEvent = InputMethodEventFlag + 3,
@@ -271,6 +272,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
#endif
case WM_GESTURE:
return QtWindows::GestureEvent;
+ case WM_DEVICECHANGE:
+ return QtWindows::DeviceChangeEvent;
case WM_DPICHANGED:
return QtWindows::DpiChangedEvent;
default:
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 5745fc6d19..b7a866679f 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -79,6 +79,7 @@
#include <stdio.h>
#include <windowsx.h>
#include <comdef.h>
+#include <dbt.h>
QT_BEGIN_NAMESPACE
@@ -322,6 +323,13 @@ bool QWindowsContext::initTouch(unsigned integrationOptions)
QWindowSystemInterface::registerTouchDevice(touchDevice);
d->m_systemInfo |= QWindowsContext::SI_SupportsTouch;
+
+ // A touch device was plugged while the app is running. Register all windows for touch.
+ if (QGuiApplicationPrivate::is_app_running) {
+ for (QWindowsWindow *w : qAsConst(d->m_windows))
+ w->registerTouchWindow();
+ }
+
return true;
}
@@ -965,6 +973,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
}
switch (et) {
+ case QtWindows::DeviceChangeEvent:
+ if (d->m_systemInfo & QWindowsContext::SI_SupportsTouch)
+ break;
+ // See if there are any touch devices added
+ if (wParam == DBT_DEVNODES_CHANGED)
+ initTouch();
+ break;
case QtWindows::KeyboardLayoutChangeEvent:
if (QWindowsInputContext *wic = windowsInputContext())
wic->handleInputLanguageChanged(wParam, lParam);
diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp
index 7f9c9bd205..48332b35f8 100644
--- a/src/plugins/platforms/windows/qwindowsservices.cpp
+++ b/src/plugins/platforms/windows/qwindowsservices.cpp
@@ -98,7 +98,11 @@ static inline QString mailCommand()
RegQueryValueEx(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(command), &bufferSize);
RegCloseKey(handle);
}
- if (!command[0])
+ // QTBUG-57816: As of Windows 10, if there is no mail client installed, an entry like
+ // "rundll32.exe .. url.dll,MailToProtocolHandler %l" is returned. Launching it
+ // silently fails or brings up a broken dialog after a long time, so exclude it and
+ // fall back to ShellExecute() which brings up the URL assocation dialog.
+ if (!command[0] || wcsstr(command, L",MailToProtocolHandler") != nullptr)
return QString();
wchar_t expandedCommand[MAX_PATH] = {0};
return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ?
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index e30a7c1935..a3337509a7 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2532,7 +2532,8 @@ void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWind
void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes)
{
- if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)) {
+ if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
+ && !testFlag(TouchRegistered)) {
ULONG touchFlags = 0;
const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags);
// Return if it is not a touch window or the flags are already set by a hook