Commit e57924db authored by Joe Downing's avatar Joe Downing Committed by Commit Bot

Fixing the RawInputDevice removal logic in UserInputMonitorWin

This fix is a result of an investigation to find out why KeyboardLock
stops working after approving the microphone permission on another
website (even after it has been navigated away from or the tab closed).

I tracked the issue down to this class as it registers a RawInputDevice
to listen for keyboard input but failed to unregister it properly when
the monitor was stopped.

Per MSDN, the HWND param should be NULL when unregistering the device:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerrawinputdevices

Change-Id: Icf54f3ac61fe5020b00472e6680e4e533b1fd256
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2482044Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Joe Downing <joedow@google.com>
Cr-Commit-Position: refs/heads/master@{#818584}
parent 10d077a1
...@@ -164,8 +164,7 @@ void UserInputMonitorWinCore::StopMonitor() { ...@@ -164,8 +164,7 @@ void UserInputMonitorWinCore::StopMonitor() {
// Stop receiving raw input. // Stop receiving raw input.
std::unique_ptr<RAWINPUTDEVICE> device( std::unique_ptr<RAWINPUTDEVICE> device(
GetRawInputDevices(window_->hwnd(), RIDEV_REMOVE)); GetRawInputDevices(nullptr, RIDEV_REMOVE));
if (!RegisterRawInputDevices(device.get(), 1, sizeof(*device))) { if (!RegisterRawInputDevices(device.get(), 1, sizeof(*device))) {
PLOG(INFO) << "RegisterRawInputDevices() failed for RIDEV_REMOVE"; PLOG(INFO) << "RegisterRawInputDevices() failed for RIDEV_REMOVE";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment