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

Side by Side Diff: ui/events/devices/x11/device_data_manager_x11.cc

Issue 1412623006: Developer Feature: Add Debug Accelerators to Toggle Touchscreen/Touchpad On or Off (CrOS) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sadrul's comment Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/devices/x11/device_data_manager_x11.h" 5 #include "ui/events/devices/x11/device_data_manager_x11.h"
6 6
7 #include <X11/extensions/XInput.h> 7 #include <X11/extensions/XInput.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 10
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 blocked_keyboards_.find(deviceid); 735 blocked_keyboards_.find(deviceid);
736 if (it != blocked_keyboards_.end()) { 736 if (it != blocked_keyboards_.end()) {
737 std::vector<KeyboardDevice> devices = keyboard_devices(); 737 std::vector<KeyboardDevice> devices = keyboard_devices();
738 // Add device to current list of active devices. 738 // Add device to current list of active devices.
739 devices.push_back((*it).second); 739 devices.push_back((*it).second);
740 blocked_keyboards_.erase(it); 740 blocked_keyboards_.erase(it);
741 DeviceDataManager::OnKeyboardDevicesUpdated(devices); 741 DeviceDataManager::OnKeyboardDevicesUpdated(devices);
742 } 742 }
743 } 743 }
744 744
745 bool DeviceDataManagerX11::IsDeviceEnabled(int device_id) const {
746 return blocked_devices_.test(device_id);
747 }
748
745 bool DeviceDataManagerX11::IsEventBlocked( 749 bool DeviceDataManagerX11::IsEventBlocked(
746 const base::NativeEvent& native_event) { 750 const base::NativeEvent& native_event) {
747 // Only check XI2 events which have a source device id. 751 // Only check XI2 events which have a source device id.
748 if (native_event->type != GenericEvent) 752 if (native_event->type != GenericEvent)
749 return false; 753 return false;
750 754
751 XIDeviceEvent* xievent = 755 XIDeviceEvent* xievent =
752 static_cast<XIDeviceEvent*>(native_event->xcookie.data); 756 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
753 // Allow any key events from blocked_keyboard_allowed_keys_. 757 // Allow any key events from blocked_keyboard_allowed_keys_.
754 if (blocked_keyboard_allowed_keys_ && 758 if (blocked_keyboard_allowed_keys_ &&
(...skipping 25 matching lines...) Expand all
780 } else { 784 } else {
781 keyboards.erase(it); 785 keyboards.erase(it);
782 ++blocked_iter; 786 ++blocked_iter;
783 } 787 }
784 } 788 }
785 // Notify base class of updated list. 789 // Notify base class of updated list.
786 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); 790 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards);
787 } 791 }
788 792
789 } // namespace ui 793 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698