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

Side by Side Diff: chrome/test/webdriver/keycode_text_conversion_x.cc

Issue 23460052: Move XID, XDisplay, GetXDisplay and a few other types to ui/gfx/x/x11_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
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/test/webdriver/keycode_text_conversion.h" 5 #include "chrome/test/webdriver/keycode_text_conversion.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <X11/keysym.h> 8 #include <X11/keysym.h>
9 #include <X11/XKBlib.h> 9 #include <X11/XKBlib.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } // namespace 180 } // namespace
181 181
182 std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { 182 std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) {
183 int x_key_code = KeyboardCodeToXKeyCode(key_code); 183 int x_key_code = KeyboardCodeToXKeyCode(key_code);
184 if (x_key_code == -1) 184 if (x_key_code == -1)
185 return ""; 185 return "";
186 186
187 XEvent event; 187 XEvent event;
188 memset(&event, 0, sizeof(XEvent)); 188 memset(&event, 0, sizeof(XEvent));
189 XKeyEvent* key_event = &event.xkey; 189 XKeyEvent* key_event = &event.xkey;
190 Display* display = ui::GetXDisplay(); 190 XDisplay* display = gfx::GetXDisplay();
191 key_event->display = display; 191 key_event->display = display;
192 key_event->keycode = x_key_code; 192 key_event->keycode = x_key_code;
193 if (modifiers & automation::kShiftKeyMask) 193 if (modifiers & automation::kShiftKeyMask)
194 key_event->state |= ShiftMask; 194 key_event->state |= ShiftMask;
195 if (modifiers & automation::kControlKeyMask) 195 if (modifiers & automation::kControlKeyMask)
196 key_event->state |= ControlMask; 196 key_event->state |= ControlMask;
197 197
198 // Make a best attempt for non-standard modifiers. 198 // Make a best attempt for non-standard modifiers.
199 int x_modifier; 199 int x_modifier;
200 if (modifiers & automation::kAltKeyMask && 200 if (modifiers & automation::kAltKeyMask &&
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 242 }
243 } 243 }
244 if (found) { 244 if (found) {
245 *key_code = test_code; 245 *key_code = test_code;
246 *necessary_modifiers = test_modifiers; 246 *necessary_modifiers = test_modifiers;
247 } 247 }
248 return found; 248 return found;
249 } 249 }
250 250
251 } // namespace webdriver 251 } // namespace webdriver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698