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

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: s/PLOG/LOG/ for short write. errno is not set in this case 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 UpdateCapsLockLed();
60 } 63 }
61 64
62 void InputControllerEvdev::SetNumLockEnabled(bool enabled) { 65 void InputControllerEvdev::SetNumLockEnabled(bool enabled) {
63 NOTIMPLEMENTED(); 66 NOTIMPLEMENTED();
64 } 67 }
65 68
66 bool InputControllerEvdev::IsAutoRepeatEnabled() { 69 bool InputControllerEvdev::IsAutoRepeatEnabled() {
67 return keyboard_->IsAutoRepeatEnabled(); 70 return keyboard_->IsAutoRepeatEnabled();
68 } 71 }
69 72
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 FROM_HERE, base::Bind(&InputControllerEvdev::UpdateDeviceSettings, 174 FROM_HERE, base::Bind(&InputControllerEvdev::UpdateDeviceSettings,
172 weak_ptr_factory_.GetWeakPtr())); 175 weak_ptr_factory_.GetWeakPtr()));
173 settings_update_pending_ = true; 176 settings_update_pending_ = true;
174 } 177 }
175 178
176 void InputControllerEvdev::UpdateDeviceSettings() { 179 void InputControllerEvdev::UpdateDeviceSettings() {
177 input_device_factory_->UpdateInputDeviceSettings(input_device_settings_); 180 input_device_factory_->UpdateInputDeviceSettings(input_device_settings_);
178 settings_update_pending_ = false; 181 settings_update_pending_ = false;
179 } 182 }
180 183
184 void InputControllerEvdev::UpdateCapsLockLed() {
185 if (!input_device_factory_)
186 return;
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
« no previous file with comments | « ui/events/ozone/evdev/input_controller_evdev.h ('k') | ui/events/ozone/evdev/input_device_factory_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698