Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Unified Diff: ui/events/x/device_data_manager_x11.cc

Issue 618283003: Adds special support to the device manager for keyboards devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change in ozone. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/x/device_data_manager_x11.cc
diff --git a/ui/events/x/device_data_manager_x11.cc b/ui/events/x/device_data_manager_x11.cc
index 795cc44be7b4af79def8f0bbfce52cdd02ea6664..5d915140fff6f42298880abdd88e90b084ea74bf 100644
--- a/ui/events/x/device_data_manager_x11.cc
+++ b/ui/events/x/device_data_manager_x11.cc
@@ -13,6 +13,7 @@
#include "base/sys_info.h"
#include "ui/events/event_constants.h"
#include "ui/events/event_switches.h"
+#include "ui/events/keyboard_device.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/events/x/device_list_cache_x.h"
#include "ui/events/x/touch_factory_x11.h"
@@ -681,10 +682,14 @@ void DeviceDataManagerX11::SetDisabledKeyboardAllowedKeys(
void DeviceDataManagerX11::DisableDevice(unsigned int deviceid) {
blocked_devices_.set(deviceid, true);
+ OnTouchscreenDevicesUpdated(touchscreen_devices());
+ OnKeyboardDevicesUpdated(keyboard_devices());
}
void DeviceDataManagerX11::EnableDevice(unsigned int deviceid) {
blocked_devices_.set(deviceid, false);
+ OnTouchscreenDevicesUpdated(touchscreen_devices());
+ OnKeyboardDevicesUpdated(keyboard_devices());
}
bool DeviceDataManagerX11::IsEventBlocked(
@@ -707,4 +712,21 @@ bool DeviceDataManagerX11::IsEventBlocked(
return blocked_devices_.test(xievent->sourceid);
}
+bool DeviceDataManagerX11::ShouldIgnoreKeyboard(
+ ui::KeyboardDevice keyboard, DeviceDataManagerX11* manager) {
flackr 2014/10/06 18:31:11 Since this is only used once internally, maybe mak
rsadam 2014/10/06 19:38:01 Done.
+ return manager->blocked_devices_.test(keyboard.id);
+}
+
+void DeviceDataManagerX11::OnKeyboardDevicesUpdated(
+ const std::vector<KeyboardDevice>& devices) {
+ std::vector<KeyboardDevice> keyboards(devices);
+ keyboards.erase(
+ std::remove_if(keyboards.begin(), keyboards.end(),
+ std::bind2nd(
+ std::ptr_fun(&DeviceDataManagerX11::ShouldIgnoreKeyboard),
+ this)),
+ keyboards.end());
+ DeviceDataManager::OnKeyboardDevicesUpdated(keyboards);
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698