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

Unified Diff: ui/events/ozone/evdev/keyboard_evdev.cc

Issue 959923002: Fix CapsLock remapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/ozone/evdev/keyboard_evdev.cc
diff --git a/ui/events/ozone/evdev/keyboard_evdev.cc b/ui/events/ozone/evdev/keyboard_evdev.cc
index 0132616cb6eb381e5e3cd282cca7fa37fcccfbe5..e9d8d8e35d56c92b42703f30752d098d2f0da0c3 100644
--- a/ui/events/ozone/evdev/keyboard_evdev.cc
+++ b/ui/events/ozone/evdev/keyboard_evdev.cc
@@ -24,7 +24,9 @@ const int kRepeatIntervalMs = 50;
int EventFlagToEvdevModifier(int flag) {
switch (flag) {
case EF_CAPS_LOCK_DOWN:
- return EVDEV_MODIFIER_CAPS_LOCK;
+ return EVDEV_MODIFIER_CAPS_LOCKED_STATE;
+ case EF_MOD3_DOWN:
+ return EVDEV_MODIFIER_CAPS_LOCK_HELD;
case EF_SHIFT_DOWN:
return EVDEV_MODIFIER_SHIFT;
case EF_CONTROL_DOWN:
@@ -46,10 +48,6 @@ int EventFlagToEvdevModifier(int flag) {
}
}
-bool IsModifierLock(int evdev_modifier) {
- return evdev_modifier == EVDEV_MODIFIER_CAPS_LOCK;
-}
-
} // namespace
KeyboardEvdev::KeyboardEvdev(EventModifiersEvdev* modifiers,
@@ -87,11 +85,11 @@ void KeyboardEvdev::OnKeyChange(unsigned int key,
}
void KeyboardEvdev::SetCapsLockEnabled(bool enabled) {
- modifiers_->SetModifierLock(EVDEV_MODIFIER_CAPS_LOCK, enabled);
+ modifiers_->SetModifierLock(EVDEV_MODIFIER_CAPS_LOCKED_STATE, enabled);
}
bool KeyboardEvdev::IsCapsLockEnabled() {
- return (modifiers_->GetModifierFlags() & EF_CAPS_LOCK_DOWN) != 0;
+ return (modifiers_->GetModifierLockFlags() & EF_CAPS_LOCK_DOWN) != 0;
}
bool KeyboardEvdev::IsAutoRepeatEnabled() {
@@ -121,11 +119,7 @@ void KeyboardEvdev::UpdateModifier(int modifier_flag, bool down) {
int modifier = EventFlagToEvdevModifier(modifier_flag);
if (modifier == EVDEV_MODIFIER_NONE)
return;
-
- if (IsModifierLock(modifier))
- modifiers_->UpdateModifierLock(modifier, down);
- else
- modifiers_->UpdateModifier(modifier, down);
+ modifiers_->UpdateModifier(modifier, down);
spang 2015/02/25 22:03:28 Wouldn't it work to just do // TODO: Do key remap
kpschoedel 2015/02/25 23:03:06 Done.
}
void KeyboardEvdev::UpdateKeyRepeat(unsigned int key, bool down) {

Powered by Google App Engine
This is Rietveld 408576698