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

Side by Side Diff: chrome/test/chromedriver/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: sdf 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromedriver/keycode_text_conversion.h" 5 #include "chrome/test/chromedriver/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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 *error_msg = std::string(); 183 *error_msg = std::string();
184 int x_key_code = KeyboardCodeToXKeyCode(key_code); 184 int x_key_code = KeyboardCodeToXKeyCode(key_code);
185 if (x_key_code == -1) { 185 if (x_key_code == -1) {
186 *text = std::string(); 186 *text = std::string();
187 return true; 187 return true;
188 } 188 }
189 189
190 XEvent event; 190 XEvent event;
191 memset(&event, 0, sizeof(XEvent)); 191 memset(&event, 0, sizeof(XEvent));
192 XKeyEvent* key_event = &event.xkey; 192 XKeyEvent* key_event = &event.xkey;
193 Display* display = ui::GetXDisplay(); 193 XDisplay* display = gfx::GetXDisplay();
194 if (!display) { 194 if (!display) {
195 *error_msg = 195 *error_msg =
196 "an X display is required for keycode conversions, consider using Xvfb"; 196 "an X display is required for keycode conversions, consider using Xvfb";
197 *text = std::string(); 197 *text = std::string();
198 return false; 198 return false;
199 } 199 }
200 key_event->display = display; 200 key_event->display = display;
201 key_event->keycode = x_key_code; 201 key_event->keycode = x_key_code;
202 if (modifiers & kShiftKeyModifierMask) 202 if (modifiers & kShiftKeyModifierMask)
203 key_event->state |= ShiftMask; 203 key_event->state |= ShiftMask;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 found = true; 260 found = true;
261 break; 261 break;
262 } 262 }
263 } 263 }
264 if (found) { 264 if (found) {
265 *key_code = test_code; 265 *key_code = test_code;
266 *necessary_modifiers = test_modifiers; 266 *necessary_modifiers = test_modifiers;
267 } 267 }
268 return found; 268 return found;
269 } 269 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/event_rewriter.cc ('k') | content/browser/aura/software_output_device_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698