| 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/events/system_key_event_listener.h" | 5 #include "chrome/browser/chromeos/events/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 Stop(); | 69 Stop(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SystemKeyEventListener::Stop() { | 72 void SystemKeyEventListener::Stop() { |
| 73 if (stopped_) | 73 if (stopped_) |
| 74 return; | 74 return; |
| 75 base::MessageLoopForUI::current()->RemoveObserver(this); | 75 base::MessageLoopForUI::current()->RemoveObserver(this); |
| 76 stopped_ = true; | 76 stopped_ = true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 base::EventStatus SystemKeyEventListener::WillProcessEvent( | 79 void SystemKeyEventListener::WillProcessEvent(const base::NativeEvent& event) { |
| 80 const base::NativeEvent& event) { | 80 ProcessedXEvent(event); |
| 81 return ProcessedXEvent(event) ? base::EVENT_HANDLED : base::EVENT_CONTINUE; | |
| 82 } | 81 } |
| 83 | 82 |
| 84 void SystemKeyEventListener::DidProcessEvent(const base::NativeEvent& event) { | 83 void SystemKeyEventListener::DidProcessEvent(const base::NativeEvent& event) { |
| 85 } | 84 } |
| 86 | 85 |
| 87 bool SystemKeyEventListener::ProcessedXEvent(XEvent* xevent) { | 86 void SystemKeyEventListener::ProcessedXEvent(XEvent* xevent) { |
| 88 input_method::InputMethodManager* input_method_manager = | 87 input_method::InputMethodManager* input_method_manager = |
| 89 input_method::InputMethodManager::Get(); | 88 input_method::InputMethodManager::Get(); |
| 90 | 89 |
| 91 if (xevent->type == xkb_event_base_) { | 90 if (xevent->type == xkb_event_base_) { |
| 92 // TODO(yusukes): Move this part to aura::WindowTreeHost. | 91 // TODO(yusukes): Move this part to aura::WindowTreeHost. |
| 93 XkbEvent* xkey_event = reinterpret_cast<XkbEvent*>(xevent); | 92 XkbEvent* xkey_event = reinterpret_cast<XkbEvent*>(xevent); |
| 94 if (xkey_event->any.xkb_type == XkbStateNotify) { | 93 if (xkey_event->any.xkb_type == XkbStateNotify) { |
| 95 if (xkey_event->state.mods) { | 94 if (xkey_event->state.mods) { |
| 96 // TODO(yusukes,adlr): Let the user know that num lock is unsupported. | 95 // TODO(yusukes,adlr): Let the user know that num lock is unsupported. |
| 97 // Force turning off Num Lock (crosbug.com/29169) | 96 // Force turning off Num Lock (crosbug.com/29169) |
| 98 input_method_manager->GetXKeyboard()->DisableNumLock(); | 97 input_method_manager->GetXKeyboard()->DisableNumLock(); |
| 99 } | 98 } |
| 100 return true; | |
| 101 } | 99 } |
| 102 } | 100 } |
| 103 return false; | |
| 104 } | 101 } |
| 105 | 102 |
| 106 } // namespace chromeos | 103 } // namespace chromeos |
| OLD | NEW |