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

Side by Side Diff: ui/base/keycodes/keyboard_code_conversion_x.cc

Issue 8802002: Rename ui::DefaultSymbolFromXEvent to ui::GetCharacterFromXEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/keycodes/keyboard_code_conversion_x.h ('k') | ui/views/events/event_x.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base/keycodes/keyboard_code_conversion_x.h" 5 #include "ui/base/keycodes/keyboard_code_conversion_x.h"
6 6
7 #include <X11/keysym.h> 7 #include <X11/keysym.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/Xutil.h> 9 #include <X11/Xutil.h>
10 10
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 case XK_F23: 312 case XK_F23:
313 case XK_F24: 313 case XK_F24:
314 return static_cast<KeyboardCode>(VKEY_F1 + (keysym - XK_F1)); 314 return static_cast<KeyboardCode>(VKEY_F1 + (keysym - XK_F1));
315 315
316 // TODO(sad): some keycodes are still missing. 316 // TODO(sad): some keycodes are still missing.
317 } 317 }
318 DLOG(WARNING) << "Unknown keysym: " << StringPrintf("0x%x", keysym); 318 DLOG(WARNING) << "Unknown keysym: " << StringPrintf("0x%x", keysym);
319 return VKEY_UNKNOWN; 319 return VKEY_UNKNOWN;
320 } 320 }
321 321
322 unsigned int DefaultSymbolFromXEvent(XEvent* xev) { 322 uint16 GetCharacterFromXEvent(XEvent* xev) {
323 char buf[6]; 323 char buf[6];
324 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); 324 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL);
325 DCHECK_LE(bytes_written, 6); 325 DCHECK_LE(bytes_written, 6);
326 326
327 string16 result; 327 string16 result;
328 return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) && 328 return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) &&
329 result.length() == 1) ? result[0] : 0; 329 result.length() == 1) ? result[0] : 0;
330 } 330 }
331 331
332 unsigned int DefaultXKeysymFromHardwareKeycode(unsigned int hardware_code) { 332 unsigned int DefaultXKeysymFromHardwareKeycode(unsigned int hardware_code) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 case VKEY_F24: 616 case VKEY_F24:
617 return XK_F1 + (keycode - VKEY_F1); 617 return XK_F1 + (keycode - VKEY_F1);
618 618
619 default: 619 default:
620 LOG(WARNING) << "Unknown keycode:" << keycode; 620 LOG(WARNING) << "Unknown keycode:" << keycode;
621 return 0; 621 return 0;
622 } 622 }
623 } 623 }
624 624
625 } // namespace ui 625 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/keycodes/keyboard_code_conversion_x.h ('k') | ui/views/events/event_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698