| Index: ui/aura/desktop_host_linux.cc
|
| diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc
|
| index 6d2b4fa0bfab27eff0791fe31be0e6a4a6c537c1..7b4e792fd0a2c9e59768e843e6a73b45910c92a1 100644
|
| --- a/ui/aura/desktop_host_linux.cc
|
| +++ b/ui/aura/desktop_host_linux.cc
|
| @@ -17,6 +17,7 @@
|
| #include "ui/aura/cursor.h"
|
| #include "ui/aura/desktop.h"
|
| #include "ui/aura/event.h"
|
| +#include "ui/base/keycodes/keyboard_codes.h"
|
| #include "ui/base/touch/touch_factory.h"
|
| #include "ui/base/x/x11_util.h"
|
| #include "ui/gfx/compositor/layer.h"
|
| @@ -180,6 +181,19 @@ int CoalescePendingXIMotionEvents(const XEvent* xev, XEvent* last_event) {
|
| return num_coalesed;
|
| }
|
|
|
| +// We emulate Windows' WM_KEYDOWN and WM_CHAR messages. WM_CHAR events are only
|
| +// generated for certain keys; see
|
| +// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646268(v=vs.85).aspx
|
| +bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) {
|
| + return (keycode >= ui::VKEY_0 && keycode <= ui::VKEY_9) ||
|
| + (keycode >= ui::VKEY_A && keycode <= ui::VKEY_Z) ||
|
| + keycode == ui::VKEY_BACK ||
|
| + keycode == ui::VKEY_RETURN ||
|
| + keycode == ui::VKEY_ESCAPE ||
|
| + // TODO: SHIFT+ENTER (linefeed)?
|
| + keycode == ui::VKEY_TAB;
|
| +}
|
| +
|
| class DesktopHostLinux : public DesktopHost {
|
| public:
|
| explicit DesktopHostLinux(const gfx::Rect& bounds);
|
| @@ -256,8 +270,10 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
|
| case KeyPress: {
|
| KeyEvent keydown_event(xev, false);
|
| handled = desktop_->DispatchKeyEvent(&keydown_event);
|
| - KeyEvent char_event(xev, true);
|
| - handled |= desktop_->DispatchKeyEvent(&char_event);
|
| + if (ShouldSendCharEventForKeyboardCode(keydown_event.key_code())) {
|
| + KeyEvent char_event(xev, true);
|
| + handled |= desktop_->DispatchKeyEvent(&char_event);
|
| + }
|
| break;
|
| }
|
| case KeyRelease: {
|
|
|