OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 // static | 70 // static |
71 SystemKeyEventListener* SystemKeyEventListener::GetInstance() { | 71 SystemKeyEventListener* SystemKeyEventListener::GetInstance() { |
72 VLOG_IF(1, !g_system_key_event_listener) | 72 VLOG_IF(1, !g_system_key_event_listener) |
73 << "SystemKeyEventListener::GetInstance() with NULL global instance."; | 73 << "SystemKeyEventListener::GetInstance() with NULL global instance."; |
74 return g_system_key_event_listener; | 74 return g_system_key_event_listener; |
75 } | 75 } |
76 | 76 |
77 SystemKeyEventListener::SystemKeyEventListener() | 77 SystemKeyEventListener::SystemKeyEventListener() |
78 : stopped_(false), | 78 : stopped_(false), |
79 num_lock_mask_(input_method::XKeyboard::GetNumLockMask()), | 79 num_lock_mask_(0), |
80 xkb_event_base_(0) { | 80 xkb_event_base_(0) { |
81 input_method::XKeyboard::GetLockedModifiers( | 81 input_method::XKeyboard* xkeyboard = |
82 num_lock_mask_, &caps_lock_is_on_, &num_lock_is_on_); | 82 input_method::InputMethodManager::GetInstance()->GetXKeyboard(); |
| 83 num_lock_mask_ = xkeyboard->GetNumLockMask(); |
| 84 xkeyboard->GetLockedModifiers(&caps_lock_is_on_, &num_lock_is_on_); |
83 | 85 |
84 Display* display = ui::GetXDisplay(); | 86 Display* display = ui::GetXDisplay(); |
85 key_brightness_down_ = XKeysymToKeycode(display, | 87 key_brightness_down_ = XKeysymToKeycode(display, |
86 XF86XK_MonBrightnessDown); | 88 XF86XK_MonBrightnessDown); |
87 key_brightness_up_ = XKeysymToKeycode(display, XF86XK_MonBrightnessUp); | 89 key_brightness_up_ = XKeysymToKeycode(display, XF86XK_MonBrightnessUp); |
88 key_volume_mute_ = XKeysymToKeycode(display, XF86XK_AudioMute); | 90 key_volume_mute_ = XKeysymToKeycode(display, XF86XK_AudioMute); |
89 key_volume_down_ = XKeysymToKeycode(display, XF86XK_AudioLowerVolume); | 91 key_volume_down_ = XKeysymToKeycode(display, XF86XK_AudioLowerVolume); |
90 key_volume_up_ = XKeysymToKeycode(display, XF86XK_AudioRaiseVolume); | 92 key_volume_up_ = XKeysymToKeycode(display, XF86XK_AudioRaiseVolume); |
91 key_f6_ = XKeysymToKeycode(display, XK_F6); | 93 key_f6_ = XKeysymToKeycode(display, XK_F6); |
92 key_f7_ = XKeysymToKeycode(display, XK_F7); | 94 key_f7_ = XKeysymToKeycode(display, XK_F7); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 OnVolumeUp(); | 379 OnVolumeUp(); |
378 return true; | 380 return true; |
379 } | 381 } |
380 } | 382 } |
381 } | 383 } |
382 } | 384 } |
383 return false; | 385 return false; |
384 } | 386 } |
385 | 387 |
386 } // namespace chromeos | 388 } // namespace chromeos |
OLD | NEW |