OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/system_key_event_listener.h" | 5 #include "chrome/browser/chromeos/system_key_event_listener.h" |
6 | 6 |
7 #define XK_MISCELLANY 1 | 7 #define XK_MISCELLANY 1 |
8 #include <X11/keysymdef.h> | 8 #include <X11/keysymdef.h> |
9 #include <X11/XF86keysym.h> | 9 #include <X11/XF86keysym.h> |
10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
11 #undef Status | 11 #undef Status |
12 | 12 |
13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | |
14 #include "chrome/browser/chromeos/audio/audio_handler.h" | 13 #include "chrome/browser/chromeos/audio/audio_handler.h" |
15 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
16 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 15 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
17 #include "chrome/browser/chromeos/input_method/hotkey_manager.h" | 16 #include "chrome/browser/chromeos/input_method/hotkey_manager.h" |
18 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 17 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
19 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 18 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
20 #include "chrome/browser/chromeos/ui/brightness_bubble.h" | 19 #include "chrome/browser/chromeos/ui/brightness_bubble.h" |
21 #include "chrome/browser/chromeos/ui/volume_bubble.h" | 20 #include "chrome/browser/chromeos/ui/volume_bubble.h" |
22 #include "chrome/browser/extensions/system/system_api.h" | 21 #include "chrome/browser/extensions/system/system_api.h" |
23 #include "content/public/browser/user_metrics.h" | 22 #include "content/public/browser/user_metrics.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 const int32 keycode = xevent->xkey.keycode; | 335 const int32 keycode = xevent->xkey.keycode; |
337 if (keycode) { | 336 if (keycode) { |
338 const unsigned int state = (xevent->xkey.state & kSupportedModifiers); | 337 const unsigned int state = (xevent->xkey.state & kSupportedModifiers); |
339 | 338 |
340 #if !defined(USE_AURA) | 339 #if !defined(USE_AURA) |
341 // Toggle Caps Lock if Shift and Search keys are pressed. | 340 // Toggle Caps Lock if Shift and Search keys are pressed. |
342 // When Aura is in use, the shortcut is handled in Ash. | 341 // When Aura is in use, the shortcut is handled in Ash. |
343 if (XKeycodeToKeysym(ui::GetXDisplay(), keycode, 0) == XK_Super_L) { | 342 if (XKeycodeToKeysym(ui::GetXDisplay(), keycode, 0) == XK_Super_L) { |
344 const bool shift_is_held = (state & ShiftMask); | 343 const bool shift_is_held = (state & ShiftMask); |
345 const bool other_mods_are_held = (state & ~(ShiftMask | LockMask)); | 344 const bool other_mods_are_held = (state & ~(ShiftMask | LockMask)); |
346 | 345 if (shift_is_held && !other_mods_are_held) |
347 // When spoken feedback is enabled, the Search key is used as an | |
348 // accessibility modifier key. | |
349 const bool accessibility_enabled = | |
350 accessibility::IsSpokenFeedbackEnabled(); | |
351 | |
352 if (shift_is_held && !other_mods_are_held && !accessibility_enabled) { | |
353 input_method_manager->GetXKeyboard()->SetCapsLockEnabled( | 346 input_method_manager->GetXKeyboard()->SetCapsLockEnabled( |
354 !caps_lock_is_on_); | 347 !caps_lock_is_on_); |
355 } | |
356 } | 348 } |
357 #endif | 349 #endif |
358 | 350 |
359 // Only doing non-Alt/Shift/Ctrl modified keys | 351 // Only doing non-Alt/Shift/Ctrl modified keys |
360 if (!(state & (Mod1Mask | ShiftMask | ControlMask))) { | 352 if (!(state & (Mod1Mask | ShiftMask | ControlMask))) { |
361 if (keycode == key_f6_ || keycode == key_brightness_down_) { | 353 if (keycode == key_f6_ || keycode == key_brightness_down_) { |
362 if (keycode == key_f6_) | 354 if (keycode == key_f6_) |
363 content::RecordAction( | 355 content::RecordAction( |
364 UserMetricsAction("Accel_BrightnessDown_F6")); | 356 UserMetricsAction("Accel_BrightnessDown_F6")); |
365 OnBrightnessDown(); | 357 OnBrightnessDown(); |
(...skipping 20 matching lines...) Expand all Loading... |
386 OnVolumeUp(); | 378 OnVolumeUp(); |
387 return true; | 379 return true; |
388 } | 380 } |
389 } | 381 } |
390 } | 382 } |
391 } | 383 } |
392 return false; | 384 return false; |
393 } | 385 } |
394 | 386 |
395 } // namespace chromeos | 387 } // namespace chromeos |
OLD | NEW |