Commit 369b9b81 authored by yusukes@chromium.org's avatar yusukes@chromium.org

Rename ui::DefaultSymbolFromXEvent to ui::GetCharacterFromXEvent following suzhe's suggestion.

The new name would be more consistent since other functions that return a Unicode code point use ui::GetCharacterXXX. For example, keyboard_code_conversion.h has ui::GetCharacterFromKeyCode.

BUG=None
TEST=ran try


Review URL: http://codereview.chromium.org/8802002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113586 0039d316-1c4b-4281-b951-d872f2087c98
parent 5115912b
...@@ -304,7 +304,7 @@ WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent( ...@@ -304,7 +304,7 @@ WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent(
if (webkit_event.windowsKeyCode == ui::VKEY_RETURN) if (webkit_event.windowsKeyCode == ui::VKEY_RETURN)
webkit_event.unmodifiedText[0] = '\r'; webkit_event.unmodifiedText[0] = '\r';
else else
webkit_event.unmodifiedText[0] = ui::DefaultSymbolFromXEvent(native_event); webkit_event.unmodifiedText[0] = ui::GetCharacterFromXEvent(native_event);
if (webkit_event.modifiers & WebKit::WebInputEvent::ControlKey) { if (webkit_event.modifiers & WebKit::WebInputEvent::ControlKey) {
webkit_event.text[0] = webkit_event.text[0] =
......
...@@ -211,7 +211,7 @@ uint16 KeyEvent::GetCharacter() const { ...@@ -211,7 +211,7 @@ uint16 KeyEvent::GetCharacter() const {
DCHECK(native_event()->type == KeyPress || DCHECK(native_event()->type == KeyPress ||
native_event()->type == KeyRelease); native_event()->type == KeyRelease);
uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); uint16 ch = ui::GetCharacterFromXEvent(native_event());
return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags()); return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags());
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
...@@ -242,7 +242,7 @@ uint16 KeyEvent::GetUnmodifiedCharacter() const { ...@@ -242,7 +242,7 @@ uint16 KeyEvent::GetUnmodifiedCharacter() const {
// We can't use things like (key.state & ShiftMask), as it may mask out bits // We can't use things like (key.state & ShiftMask), as it may mask out bits
// used by X11 internally. // used by X11 internally.
key->state &= ~kIgnoredModifiers; key->state &= ~kIgnoredModifiers;
uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); uint16 ch = ui::GetCharacterFromXEvent(native_event());
return ch ? ch : return ch ? ch :
ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN);
#else #else
......
...@@ -653,7 +653,7 @@ void InputMethodIBus::ProcessUnfilteredKeyPressEvent( ...@@ -653,7 +653,7 @@ void InputMethodIBus::ProcessUnfilteredKeyPressEvent(
const uint32 state = const uint32 state =
EventFlagsFromXFlags(GetKeyEvent(native_event)->state); EventFlagsFromXFlags(GetKeyEvent(native_event)->state);
uint16 ch = ui::DefaultSymbolFromXEvent(native_event); uint16 ch = ui::GetCharacterFromXEvent(native_event);
if (!ch) { if (!ch) {
ch = ui::GetCharacterFromKeyCode( ch = ui::GetCharacterFromKeyCode(
ui::KeyboardCodeFromNative(native_event), state); ui::KeyboardCodeFromNative(native_event), state);
......
...@@ -73,7 +73,7 @@ void MockInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) { ...@@ -73,7 +73,7 @@ void MockInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) {
if (text_input_client_) { if (text_input_client_) {
// then send a Char event via ui::TextInputClient. // then send a Char event via ui::TextInputClient.
const KeyboardCode key_code = ui::KeyboardCodeFromNative(native_event); const KeyboardCode key_code = ui::KeyboardCodeFromNative(native_event);
uint16 ch = ui::DefaultSymbolFromXEvent(native_event); uint16 ch = ui::GetCharacterFromXEvent(native_event);
if (!ch) if (!ch)
ch = ui::GetCharacterFromKeyCode(key_code, state); ch = ui::GetCharacterFromKeyCode(key_code, state);
if (ch) if (ch)
......
...@@ -319,7 +319,7 @@ KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) { ...@@ -319,7 +319,7 @@ KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) {
return VKEY_UNKNOWN; return VKEY_UNKNOWN;
} }
unsigned int DefaultSymbolFromXEvent(XEvent* xev) { uint16 GetCharacterFromXEvent(XEvent* xev) {
char buf[6]; char buf[6];
int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL);
DCHECK_LE(bytes_written, 6); DCHECK_LE(bytes_written, 6);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ #ifndef UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_
#define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ #define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_
#include "base/basictypes.h"
#include "ui/base/keycodes/keyboard_codes_posix.h" #include "ui/base/keycodes/keyboard_codes_posix.h"
#include "ui/base/ui_export.h" #include "ui/base/ui_export.h"
...@@ -16,8 +17,8 @@ UI_EXPORT KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev); ...@@ -16,8 +17,8 @@ UI_EXPORT KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev);
UI_EXPORT KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym); UI_EXPORT KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym);
// Returns a key symbol on a standard US PC keyboard from an XEvent. // Returns a character on a standard US PC keyboard from an XEvent.
UI_EXPORT unsigned int DefaultSymbolFromXEvent(XEvent* xev); UI_EXPORT uint16 GetCharacterFromXEvent(XEvent* xev);
// Converts a KeyboardCode into an X KeySym. // Converts a KeyboardCode into an X KeySym.
UI_EXPORT int XKeysymForWindowsKeyCode(KeyboardCode keycode, bool shift); UI_EXPORT int XKeysymForWindowsKeyCode(KeyboardCode keycode, bool shift);
......
...@@ -63,7 +63,7 @@ uint16 KeyEvent::GetCharacter() const { ...@@ -63,7 +63,7 @@ uint16 KeyEvent::GetCharacter() const {
DCHECK(native_event()->type == KeyPress || DCHECK(native_event()->type == KeyPress ||
native_event()->type == KeyRelease); native_event()->type == KeyRelease);
uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); uint16 ch = ui::GetCharacterFromXEvent(native_event());
return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags()); return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags());
} }
...@@ -109,7 +109,7 @@ uint16 KeyEvent::GetUnmodifiedCharacter() const { ...@@ -109,7 +109,7 @@ uint16 KeyEvent::GetUnmodifiedCharacter() const {
// We can't use things like (key.state & ShiftMask), as it may mask out bits // We can't use things like (key.state & ShiftMask), as it may mask out bits
// used by X11 internally. // used by X11 internally.
key->state &= ~kIgnoredModifiers; key->state &= ~kIgnoredModifiers;
uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); uint16 ch = ui::GetCharacterFromXEvent(native_event());
return ch ? ch : return ch ? ch :
ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment