gecko-dev/widget/windows/InputDeviceUtils.cpp
Hiroyuki Ikezoe 3ce66a8f65 Bug 1035774 - Support dynamic input device changes for windows. r=aklotz
Note that this dynamic change will not work without a patch for bug 1478576
if user doesn't touch browser windows.

Differential Revision: https://phabricator.services.mozilla.com/D3301
2018-08-14 16:38:03 +09:00

42 lines
1.1 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:set ts=2 sts=2 sw=2 et cin: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "InputDeviceUtils.h"
#define INITGUID
#include <dbt.h>
#include <hidclass.h>
#include <ntddmou.h>
namespace mozilla {
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;
return RegisterDeviceNotification(aHwnd,
&filter,
DEVICE_NOTIFY_WINDOW_HANDLE);
}
void
InputDeviceUtils::UnregisterNotification(HDEVNOTIFY aHandle)
{
if (!aHandle) {
return;
}
UnregisterDeviceNotification(aHandle);
}
} // namespace widget
} // namespace mozilla