diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-01 04:49:06 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-01 04:49:06 +0000 |
commit | ad53baa575a30701cf26e77d748252c010fb96ab (patch) | |
tree | 168fccfcfe9852812f34c0675fdc8b0656cb6af5 /chrome/common | |
parent | 29bba6f380ab785dc70d0632b62e98b47f5f4763 (diff) | |
download | chromium_src-ad53baa575a30701cf26e77d748252c010fb96ab.zip chromium_src-ad53baa575a30701cf26e77d748252c010fb96ab.tar.gz chromium_src-ad53baa575a30701cf26e77d748252c010fb96ab.tar.bz2 |
[Linux]Improve keyboard event handling code of RWHV.
Just like what Mac port already did, this CL changes the method to determine if a keyboard event should be processed by the browser to use a boolean field instead of setting the keyval of os_event to GDK_VoidSymbol. Because in some cases, GDK_VoidSymbol might be valid key value, for example ctrl-b on Arabic keyboard.
BUG=35117 Emacs key binding ctrl-b doesn't work in web page when using Arabic keyboard layout.
TEST=Enable Emacs key theme and switch to Arabic keyboard layout, then try ctrl-b (move cursor backwards) in web page's text area.
Review URL: http://codereview.chromium.org/661149
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/native_web_keyboard_event.h | 7 | ||||
-rw-r--r-- | chrome/common/native_web_keyboard_event_linux.cc | 16 | ||||
-rw-r--r-- | chrome/common/native_web_keyboard_event_win.cc | 12 |
3 files changed, 25 insertions, 10 deletions
diff --git a/chrome/common/native_web_keyboard_event.h b/chrome/common/native_web_keyboard_event.h index 438d159..381ad31 100644 --- a/chrome/common/native_web_keyboard_event.h +++ b/chrome/common/native_web_keyboard_event.h @@ -48,15 +48,16 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent { MSG os_event; #elif defined(OS_MACOSX) NSEvent* os_event; +#elif defined(OS_LINUX) + GdkEventKey* os_event; +#endif // True if the browser should ignore this event if it's not handled by the // renderer. This happens for RawKeyDown events that are created while IME is // active and is necessary to prevent backspace from doing "history back" if // it is hit in ime mode. + // Currently, it's only used by Linux and Mac ports. bool skip_in_browser; -#elif defined(OS_LINUX) - GdkEventKey* os_event; -#endif }; #endif // CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ diff --git a/chrome/common/native_web_keyboard_event_linux.cc b/chrome/common/native_web_keyboard_event_linux.cc index c671654..571550e 100644 --- a/chrome/common/native_web_keyboard_event_linux.cc +++ b/chrome/common/native_web_keyboard_event_linux.cc @@ -32,11 +32,13 @@ void FreeEvent(GdkEventKey* event) { NativeWebKeyboardEvent::NativeWebKeyboardEvent() - : os_event(NULL) { + : os_event(NULL), + skip_in_browser(false) { } NativeWebKeyboardEvent::NativeWebKeyboardEvent(const GdkEventKey* native_event) - : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(native_event)) { + : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(native_event)), + skip_in_browser(false) { CopyEventTo(native_event, &os_event); } @@ -46,11 +48,14 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character, : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character, state, time_stamp_seconds)), - os_event(NULL) { + os_event(NULL), + skip_in_browser(false) { } NativeWebKeyboardEvent::NativeWebKeyboardEvent( - const NativeWebKeyboardEvent& other) : WebKeyboardEvent(other) { + const NativeWebKeyboardEvent& other) + : WebKeyboardEvent(other), + skip_in_browser(other.skip_in_browser) { CopyEventTo(other.os_event, &os_event); } @@ -60,6 +65,9 @@ NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( FreeEvent(os_event); CopyEventTo(other.os_event, &os_event); + + skip_in_browser = other.skip_in_browser; + return *this; } diff --git a/chrome/common/native_web_keyboard_event_win.cc b/chrome/common/native_web_keyboard_event_win.cc index a2ba45f..7608ec6 100644 --- a/chrome/common/native_web_keyboard_event_win.cc +++ b/chrome/common/native_web_keyboard_event_win.cc @@ -9,14 +9,16 @@ using WebKit::WebInputEventFactory; using WebKit::WebKeyboardEvent; -NativeWebKeyboardEvent::NativeWebKeyboardEvent() { +NativeWebKeyboardEvent::NativeWebKeyboardEvent() + : skip_in_browser(false) { memset(&os_event, 0, sizeof(os_event)); } NativeWebKeyboardEvent::NativeWebKeyboardEvent( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) : WebKeyboardEvent( - WebInputEventFactory::keyboardEvent(hwnd, message, wparam, lparam)) { + WebInputEventFactory::keyboardEvent(hwnd, message, wparam, lparam)), + skip_in_browser(false) { os_event.hwnd = hwnd; os_event.message = message; os_event.wParam = wparam; @@ -25,7 +27,8 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent( NativeWebKeyboardEvent::NativeWebKeyboardEvent( const NativeWebKeyboardEvent& other) - : WebKeyboardEvent(other) { + : WebKeyboardEvent(other), + skip_in_browser(other.skip_in_browser) { os_event.hwnd = other.os_event.hwnd; os_event.message = other.os_event.message; os_event.wParam = other.os_event.wParam; @@ -40,6 +43,9 @@ NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( os_event.message = other.os_event.message; os_event.wParam = other.os_event.wParam; os_event.lParam = other.os_event.lParam; + + skip_in_browser = other.skip_in_browser; + return *this; } |