Bug 1498294 - Watch GUID_DEVINTERFACE_HID device changes instead of GUID_DEVINTERFACE_MOUSE. r=masayuki
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 12 Oct 2018 13:45:24 +0000
changeset 489414 ddb585f4d9d751d42c3b69ebad15b9c3128efbab
parent 489413 0bad7b51e301e52d3887745546c569c0db412f3b
child 489415 a232864e100291f7fe7e7b60745aae2094786b43
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersmasayuki
bugs1498294
milestone64.0a1
Bug 1498294 - Watch GUID_DEVINTERFACE_HID device changes instead of GUID_DEVINTERFACE_MOUSE. r=masayuki It seems some touchscreen devices are recognized as an HID not a mouse, so for such devices we need to use GUID_DEVINTERFACE_HID instead. I've confirmed that WM_DEVICECHANGE is received when a mouse is connected/disconnected on a Thinkpad even if we use GUID_DEVINTERFACE_HID here. Differential Revision: https://phabricator.services.mozilla.com/D8526
widget/windows/InputDeviceUtils.cpp
--- a/widget/windows/InputDeviceUtils.cpp
+++ b/widget/windows/InputDeviceUtils.cpp
@@ -17,18 +17,19 @@ namespace widget {
 
 HDEVNOTIFY
 InputDeviceUtils::RegisterNotification(HWND aHwnd)
 {
   DEV_BROADCAST_DEVICEINTERFACE filter = {};
 
   filter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
   filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
-  // We only need notifications for mouse type devices.
-  filter.dbcc_classguid = GUID_DEVINTERFACE_MOUSE;
+  // Some touchsreen devices are not GUID_DEVINTERFACE_MOUSE, so here we use
+  // GUID_DEVINTERFACE_HID instead.
+  filter.dbcc_classguid = GUID_DEVINTERFACE_HID;
   return RegisterDeviceNotification(aHwnd,
                                     &filter,
                                     DEVICE_NOTIFY_WINDOW_HANDLE);
 }
 
 void
 InputDeviceUtils::UnregisterNotification(HDEVNOTIFY aHandle)
 {