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

Side by Side Diff: ui/events/ozone/evdev/input_controller_evdev.cc

Issue 971753006: ozone: evdev: Sync caps lock LED state to evdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: aand forgot to sync on hotplug Created 5 years, 9 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 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/ozone/evdev/input_controller_evdev.h" 5 #include "ui/events/ozone/evdev/input_controller_evdev.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 9
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h" 11 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h"
12 #include "ui/events/ozone/evdev/keyboard_evdev.h" 12 #include "ui/events/ozone/evdev/keyboard_evdev.h"
13 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" 13 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
14 14
15 namespace ui { 15 namespace ui {
16 16
17 InputControllerEvdev::InputControllerEvdev(KeyboardEvdev* keyboard, 17 InputControllerEvdev::InputControllerEvdev(KeyboardEvdev* keyboard,
18 MouseButtonMapEvdev* button_map) 18 MouseButtonMapEvdev* button_map)
19 : settings_update_pending_(false), 19 : settings_update_pending_(false),
20 input_device_factory_(nullptr), 20 input_device_factory_(nullptr),
21 keyboard_(keyboard), 21 keyboard_(keyboard),
22 button_map_(button_map), 22 button_map_(button_map),
23 has_mouse_(false), 23 has_mouse_(false),
24 has_touchpad_(false), 24 has_touchpad_(false),
25 caps_lock_led_state_(false),
25 weak_ptr_factory_(this) { 26 weak_ptr_factory_(this) {
26 } 27 }
27 28
28 InputControllerEvdev::~InputControllerEvdev() { 29 InputControllerEvdev::~InputControllerEvdev() {
29 } 30 }
30 31
31 void InputControllerEvdev::SetInputDeviceFactory( 32 void InputControllerEvdev::SetInputDeviceFactory(
32 InputDeviceFactoryEvdevProxy* input_device_factory) { 33 InputDeviceFactoryEvdevProxy* input_device_factory) {
33 input_device_factory_ = input_device_factory; 34 input_device_factory_ = input_device_factory;
34 35
35 UpdateDeviceSettings(); 36 UpdateDeviceSettings();
37 UpdateCapsLockLed();
36 } 38 }
37 39
38 void InputControllerEvdev::set_has_mouse(bool has_mouse) { 40 void InputControllerEvdev::set_has_mouse(bool has_mouse) {
39 has_mouse_ = has_mouse; 41 has_mouse_ = has_mouse;
40 } 42 }
41 43
42 void InputControllerEvdev::set_has_touchpad(bool has_touchpad) { 44 void InputControllerEvdev::set_has_touchpad(bool has_touchpad) {
43 has_touchpad_ = has_touchpad; 45 has_touchpad_ = has_touchpad;
44 } 46 }
45 47
46 bool InputControllerEvdev::HasMouse() { 48 bool InputControllerEvdev::HasMouse() {
47 return has_mouse_; 49 return has_mouse_;
48 } 50 }
49 51
50 bool InputControllerEvdev::HasTouchpad() { 52 bool InputControllerEvdev::HasTouchpad() {
51 return has_touchpad_; 53 return has_touchpad_;
52 } 54 }
53 55
54 bool InputControllerEvdev::IsCapsLockEnabled() { 56 bool InputControllerEvdev::IsCapsLockEnabled() {
55 return keyboard_->IsCapsLockEnabled(); 57 return keyboard_->IsCapsLockEnabled();
56 } 58 }
57 59
58 void InputControllerEvdev::SetCapsLockEnabled(bool enabled) { 60 void InputControllerEvdev::SetCapsLockEnabled(bool enabled) {
59 keyboard_->SetCapsLockEnabled(enabled); 61 keyboard_->SetCapsLockEnabled(enabled);
62
63 if (input_device_factory_)
kpschoedel 2015/03/02 22:19:35 This doesn't thrill me because the connection betw
spang 2015/03/02 22:43:15 Done.
64 UpdateCapsLockLed();
60 } 65 }
61 66
62 void InputControllerEvdev::SetNumLockEnabled(bool enabled) { 67 void InputControllerEvdev::SetNumLockEnabled(bool enabled) {
63 NOTIMPLEMENTED(); 68 NOTIMPLEMENTED();
64 } 69 }
65 70
66 bool InputControllerEvdev::IsAutoRepeatEnabled() { 71 bool InputControllerEvdev::IsAutoRepeatEnabled() {
67 return keyboard_->IsAutoRepeatEnabled(); 72 return keyboard_->IsAutoRepeatEnabled();
68 } 73 }
69 74
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 FROM_HERE, base::Bind(&InputControllerEvdev::UpdateDeviceSettings, 176 FROM_HERE, base::Bind(&InputControllerEvdev::UpdateDeviceSettings,
172 weak_ptr_factory_.GetWeakPtr())); 177 weak_ptr_factory_.GetWeakPtr()));
173 settings_update_pending_ = true; 178 settings_update_pending_ = true;
174 } 179 }
175 180
176 void InputControllerEvdev::UpdateDeviceSettings() { 181 void InputControllerEvdev::UpdateDeviceSettings() {
177 input_device_factory_->UpdateInputDeviceSettings(input_device_settings_); 182 input_device_factory_->UpdateInputDeviceSettings(input_device_settings_);
178 settings_update_pending_ = false; 183 settings_update_pending_ = false;
179 } 184 }
180 185
186 void InputControllerEvdev::UpdateCapsLockLed() {
187 bool caps_lock_state = IsCapsLockEnabled();
188 if (caps_lock_state != caps_lock_led_state_)
189 input_device_factory_->SetCapsLockLed(caps_lock_state);
190 caps_lock_led_state_ = caps_lock_state;
191 }
192
181 } // namespace ui 193 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698