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

Side by Side Diff: chrome/browser/chromeos/system_key_event_listener.cc

Issue 9475005: Ignore Shift+Search when spoken feedback is enabled (non-Aura). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
13 #include "chrome/browser/chromeos/audio/audio_handler.h" 14 #include "chrome/browser/chromeos/audio/audio_handler.h"
14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 15 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
15 #include "chrome/browser/chromeos/dbus/power_manager_client.h" 16 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
16 #include "chrome/browser/chromeos/input_method/hotkey_manager.h" 17 #include "chrome/browser/chromeos/input_method/hotkey_manager.h"
17 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 18 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
18 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 19 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
19 #include "chrome/browser/chromeos/ui/brightness_bubble.h" 20 #include "chrome/browser/chromeos/ui/brightness_bubble.h"
20 #include "chrome/browser/chromeos/ui/volume_bubble.h" 21 #include "chrome/browser/chromeos/ui/volume_bubble.h"
21 #include "chrome/browser/extensions/system/system_api.h" 22 #include "chrome/browser/extensions/system/system_api.h"
22 #include "content/public/browser/user_metrics.h" 23 #include "content/public/browser/user_metrics.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } else if (xevent->type == KeyPress) { 341 } else if (xevent->type == KeyPress) {
341 const int32 keycode = xevent->xkey.keycode; 342 const int32 keycode = xevent->xkey.keycode;
342 if (keycode) { 343 if (keycode) {
343 const unsigned int state = (xevent->xkey.state & kSupportedModifiers); 344 const unsigned int state = (xevent->xkey.state & kSupportedModifiers);
344 345
345 // Toggle Caps Lock if Shift and Search keys are pressed. 346 // Toggle Caps Lock if Shift and Search keys are pressed.
346 // When Aura is in use, the shortcut is handled in Ash. 347 // When Aura is in use, the shortcut is handled in Ash.
347 if (XKeycodeToKeysym(ui::GetXDisplay(), keycode, 0) == XK_Super_L) { 348 if (XKeycodeToKeysym(ui::GetXDisplay(), keycode, 0) == XK_Super_L) {
348 const bool shift_is_held = (state & ShiftMask); 349 const bool shift_is_held = (state & ShiftMask);
349 const bool other_mods_are_held = (state & ~(ShiftMask | LockMask)); 350 const bool other_mods_are_held = (state & ~(ShiftMask | LockMask));
350 if (shift_is_held && !other_mods_are_held) 351
352 // When spoken feedback is enabled, the Search key is used as an
353 // accessibility modifier key.
354 const bool accessibility_enabled =
355 accessibility::IsSpokenFeedbackEnabled();
356
357 if (shift_is_held && !other_mods_are_held && !accessibility_enabled) {
351 input_method_manager->GetXKeyboard()->SetCapsLockEnabled( 358 input_method_manager->GetXKeyboard()->SetCapsLockEnabled(
352 !caps_lock_is_on_); 359 !caps_lock_is_on_);
360 }
353 } 361 }
354 362
355 // Only doing non-Alt/Shift/Ctrl modified keys 363 // Only doing non-Alt/Shift/Ctrl modified keys
356 if (!(state & (Mod1Mask | ShiftMask | ControlMask))) { 364 if (!(state & (Mod1Mask | ShiftMask | ControlMask))) {
357 if (keycode == key_f6_ || keycode == key_brightness_down_) { 365 if (keycode == key_f6_ || keycode == key_brightness_down_) {
358 if (keycode == key_f6_) 366 if (keycode == key_f6_)
359 content::RecordAction( 367 content::RecordAction(
360 UserMetricsAction("Accel_BrightnessDown_F6")); 368 UserMetricsAction("Accel_BrightnessDown_F6"));
361 OnBrightnessDown(); 369 OnBrightnessDown();
362 return true; 370 return true;
(...skipping 20 matching lines...) Expand all
383 return true; 391 return true;
384 } 392 }
385 } 393 }
386 } 394 }
387 #endif 395 #endif
388 } 396 }
389 return false; 397 return false;
390 } 398 }
391 399
392 } // namespace chromeos 400 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698