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 "ui/aura/root_window_host_x11.h" | 5 #include "ui/aura/root_window_host_x11.h" |
6 | 6 |
7 #include <strings.h> | 7 #include <strings.h> |
8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
9 #include <X11/extensions/Xfixes.h> | 9 #include <X11/extensions/Xfixes.h> |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // |mask| back to 0). | 119 // |mask| back to 0). |
120 // TODO(sad): Figure out why this happens. http://crbug.com/153976 | 120 // TODO(sad): Figure out why this happens. http://crbug.com/153976 |
121 #if defined(USE_XI2_MT) | 121 #if defined(USE_XI2_MT) |
122 XISetMask(mask, XI_TouchBegin); | 122 XISetMask(mask, XI_TouchBegin); |
123 XISetMask(mask, XI_TouchUpdate); | 123 XISetMask(mask, XI_TouchUpdate); |
124 XISetMask(mask, XI_TouchEnd); | 124 XISetMask(mask, XI_TouchEnd); |
125 XISelectEvents(display, root_window, &evmask, 1); | 125 XISelectEvents(display, root_window, &evmask, 1); |
126 #endif | 126 #endif |
127 } | 127 } |
128 | 128 |
129 // We emulate Windows' WM_KEYDOWN and WM_CHAR messages. WM_CHAR events are only | |
130 // generated for certain keys; see | |
131 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms646268.aspx. Per | |
132 // discussion on http://crbug.com/108480, char events should furthermore not be | |
133 // generated for Tab, Escape, and Backspace. | |
134 bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) { | |
135 if ((keycode >= ui::VKEY_0 && keycode <= ui::VKEY_9) || | |
136 (keycode >= ui::VKEY_A && keycode <= ui::VKEY_Z) || | |
137 (keycode >= ui::VKEY_NUMPAD0 && keycode <= ui::VKEY_NUMPAD9)) { | |
138 return true; | |
139 } | |
140 | |
141 switch (keycode) { | |
142 case ui::VKEY_RETURN: | |
143 case ui::VKEY_SPACE: | |
144 // In addition to the keys listed at MSDN, we include other | |
145 // graphic-character and numpad keys. | |
146 case ui::VKEY_MULTIPLY: | |
147 case ui::VKEY_ADD: | |
148 case ui::VKEY_SUBTRACT: | |
149 case ui::VKEY_DECIMAL: | |
150 case ui::VKEY_DIVIDE: | |
151 case ui::VKEY_OEM_1: | |
152 case ui::VKEY_OEM_2: | |
153 case ui::VKEY_OEM_3: | |
154 case ui::VKEY_OEM_4: | |
155 case ui::VKEY_OEM_5: | |
156 case ui::VKEY_OEM_6: | |
157 case ui::VKEY_OEM_7: | |
158 case ui::VKEY_OEM_102: | |
159 case ui::VKEY_OEM_PLUS: | |
160 case ui::VKEY_OEM_COMMA: | |
161 case ui::VKEY_OEM_MINUS: | |
162 case ui::VKEY_OEM_PERIOD: | |
163 return true; | |
164 default: | |
165 return false; | |
166 } | |
167 } | |
168 | |
169 bool default_override_redirect = false; | 129 bool default_override_redirect = false; |
170 | 130 |
171 } // namespace | 131 } // namespace |
172 | 132 |
173 namespace internal { | 133 namespace internal { |
174 | 134 |
175 // Accomplishes 2 tasks concerning touch event calibration: | 135 // Accomplishes 2 tasks concerning touch event calibration: |
176 // 1. Being a message-pump observer, | 136 // 1. Being a message-pump observer, |
177 // routes all the touch events to the X root window, | 137 // routes all the touch events to the X root window, |
178 // where they can be calibrated later. | 138 // where they can be calibrated later. |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 } | 1067 } |
1108 | 1068 |
1109 namespace test { | 1069 namespace test { |
1110 | 1070 |
1111 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 1071 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
1112 default_override_redirect = override_redirect; | 1072 default_override_redirect = override_redirect; |
1113 } | 1073 } |
1114 | 1074 |
1115 } // namespace test | 1075 } // namespace test |
1116 } // namespace aura | 1076 } // namespace aura |
OLD | NEW |