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 "ash/accelerators/accelerator_dispatcher.h" | 5 #include "ash/accelerators/accelerator_dispatcher.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 // Xlib defines RootWindow | 10 // Xlib defines RootWindow |
(...skipping 30 matching lines...) Expand all Loading... |
41 return xev->type == KeyPress || xev->type == KeyRelease; | 41 return xev->type == KeyPress || xev->type == KeyRelease; |
42 } | 42 } |
43 #endif | 43 #endif |
44 | 44 |
45 bool IsPossibleAcceleratorNotForMenu(const ui::KeyEvent& key_event) { | 45 bool IsPossibleAcceleratorNotForMenu(const ui::KeyEvent& key_event) { |
46 // For shortcuts generated by Ctrl or Alt plus a letter, number or | 46 // For shortcuts generated by Ctrl or Alt plus a letter, number or |
47 // the tab key, we want to exit the context menu first and then | 47 // the tab key, we want to exit the context menu first and then |
48 // repost the event. That allows for the shortcut execution after | 48 // repost the event. That allows for the shortcut execution after |
49 // the context menu has exited. | 49 // the context menu has exited. |
50 if (key_event.type() == ui::ET_KEY_PRESSED && | 50 if (key_event.type() == ui::ET_KEY_PRESSED && |
51 key_event.flags() & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)) { | 51 (key_event.flags() & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN))) { |
52 const ui::KeyboardCode key_code = key_event.key_code(); | 52 const ui::KeyboardCode key_code = key_event.key_code(); |
53 if ((key_code >= ui::VKEY_A && key_code <= ui::VKEY_Z) || | 53 if ((key_code >= ui::VKEY_A && key_code <= ui::VKEY_Z) || |
54 (key_code >= ui::VKEY_0 && key_code <= ui::VKEY_9) || | 54 (key_code >= ui::VKEY_0 && key_code <= ui::VKEY_9) || |
55 (key_code == ui::VKEY_TAB)) { | 55 (key_code == ui::VKEY_TAB)) { |
56 return true; | 56 return true; |
57 } | 57 } |
58 } | 58 } |
59 return false; | 59 return false; |
60 } | 60 } |
61 | 61 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 return nested_dispatcher_->Dispatch(key_event.native_event()); | 127 return nested_dispatcher_->Dispatch(key_event.native_event()); |
128 } | 128 } |
129 | 129 |
130 return nested_dispatcher_->Dispatch(event); | 130 return nested_dispatcher_->Dispatch(event); |
131 } | 131 } |
132 | 132 |
133 } // namespace ash | 133 } // namespace ash |
OLD | NEW |