1 From 6990ea4b3501a7eece77a7593a9fda512ad5aa25 Mon Sep 17 00:00:00 2001
2 From: Alexander Shalamov <alexander.shalamov@intel.com>
3 Date: Fri, 28 Jun 2013 09:57:28 +0300
4 Subject: [PATCH 04/33] Event handling implementation
6 Keyboard + Mouse events are handled
7 Fix unicode and raw key events handling
9 .../renderer_host/native_web_keyboard_event_efl.cc | 19 +-
10 .../renderer_host/render_widget_host_view_efl.cc | 33 +-
11 .../renderer_host/render_widget_host_view_efl.h | 14 +-
12 .../renderer_host/web_input_event_factory_efl.cc | 417 +++++++++++++++++++++
13 .../renderer_host/web_input_event_factory_efl.h | 32 ++
14 content/content_browser.gypi | 7 +-
15 ui/gfx/efl_event.h | 33 ++
16 ui/gfx/native_widget_types.h | 5 +-
17 ui/gfx/preserve_window_delegate_efl.h | 12 +-
19 10 files changed, 538 insertions(+), 35 deletions(-)
20 create mode 100644 content/browser/renderer_host/web_input_event_factory_efl.cc
21 create mode 100644 content/browser/renderer_host/web_input_event_factory_efl.h
22 create mode 100644 ui/gfx/efl_event.h
24 diff --git a/content/browser/renderer_host/native_web_keyboard_event_efl.cc b/content/browser/renderer_host/native_web_keyboard_event_efl.cc
25 index 78b258a..23ae9c2 100644
26 --- a/content/browser/renderer_host/native_web_keyboard_event_efl.cc
27 +++ b/content/browser/renderer_host/native_web_keyboard_event_efl.cc
29 // Use of this source code is governed by a BSD-style license that can be
30 // found in the LICENSE file.
32 +#include "content/browser/renderer_host/web_input_event_factory_efl.h"
33 #include "content/public/browser/native_web_keyboard_event.h"
35 -#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
39 -NativeWebKeyboardEvent::NativeWebKeyboardEvent() {
40 +NativeWebKeyboardEvent::NativeWebKeyboardEvent()
42 + skip_in_browser(false) {
45 -NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) {
46 +NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event)
47 + : WebKeyboardEvent(content::keyboardEvent(native_event)),
48 + skip_in_browser(false) {
51 -NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent&) {
52 +NativeWebKeyboardEvent::NativeWebKeyboardEvent(
53 + const NativeWebKeyboardEvent& other)
54 + : WebKeyboardEvent(other),
55 + skip_in_browser(other.skip_in_browser) {
58 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
59 const NativeWebKeyboardEvent& other) {
60 + WebKeyboardEvent::operator=(other);
62 + skip_in_browser = other.skip_in_browser;
66 diff --git a/content/browser/renderer_host/render_widget_host_view_efl.cc b/content/browser/renderer_host/render_widget_host_view_efl.cc
67 index 9118002..9858418 100644
68 --- a/content/browser/renderer_host/render_widget_host_view_efl.cc
69 +++ b/content/browser/renderer_host/render_widget_host_view_efl.cc
71 #include "content/browser/renderer_host/render_view_host_delegate.h"
72 #include "content/browser/renderer_host/render_view_host_impl.h"
73 #include "content/browser/renderer_host/window_utils_efl.h"
74 +#include "content/browser/renderer_host/web_input_event_factory_efl.h"
75 #include "content/common/edit_command.h"
76 #include "content/common/gpu/gpu_messages.h"
77 #include "content/public/browser/browser_context.h"
79 #include "ui/base/text/text_elider.h"
80 #include "ui/base/x/active_window_watcher_x.h"
81 #include "ui/base/x/x11_util.h"
82 +#include "ui/gfx/efl_event.h"
83 #include "ui/gfx/preserve_window_efl.h"
84 #include "webkit/plugins/npapi/webplugin.h"
86 @@ -100,37 +102,43 @@ RenderWidgetHostViewEfl::~RenderWidgetHostViewEfl() {
90 -bool RenderWidgetHostViewEfl::PreserveWindowMouseDown(Evas_Event_Mouse_Down* event) {
92 +void RenderWidgetHostViewEfl::PreserveWindowMouseDown(Evas_Event_Mouse_Down* mouse_down) {
93 + host_->ForwardMouseEvent(content::mouseEvent(mouse_down));
96 -bool RenderWidgetHostViewEfl::PreserveWindowMouseUp(Evas_Event_Mouse_Up* event) {
98 +void RenderWidgetHostViewEfl::PreserveWindowMouseUp(Evas_Event_Mouse_Up* mouse_up) {
99 + host_->ForwardMouseEvent(content::mouseEvent(mouse_up));
102 -bool RenderWidgetHostViewEfl::PreserveWindowMouseMove(Evas_Event_Mouse_Move* event) {
104 +void RenderWidgetHostViewEfl::PreserveWindowMouseMove(Evas_Event_Mouse_Move* mouse_move) {
105 + host_->ForwardMouseEvent(content::mouseEvent(mouse_move));
108 -bool RenderWidgetHostViewEfl::PreserveWindowMouseWheel(Evas_Event_Mouse_Wheel* event) {
110 +void RenderWidgetHostViewEfl::PreserveWindowMouseWheel(Evas_Event_Mouse_Wheel* mouse_wheel) {
111 + host_->ForwardWheelEvent(content::mouseWheelEvent(mouse_wheel));
114 -bool RenderWidgetHostViewEfl::PreserveWindowKeyDown(Evas_Event_Key_Down* event) {
116 +void RenderWidgetHostViewEfl::PreserveWindowKeyDown(Evas_Event_Key_Down* key_down) {
117 + gfx::EflEvent event = gfx::EflEvent(gfx::EflEvent::EventTypeKeyDown,
119 + host_->ForwardKeyboardEvent(NativeWebKeyboardEvent(&event));
122 -bool RenderWidgetHostViewEfl::PreserveWindowKeyUp(Evas_Event_Key_Up* event) {
124 +void RenderWidgetHostViewEfl::PreserveWindowKeyUp(Evas_Event_Key_Up* key_up) {
125 + gfx::EflEvent event = gfx::EflEvent(gfx::EflEvent::EventTypeKeyUp,
127 + host_->ForwardKeyboardEvent(NativeWebKeyboardEvent(&event));
130 void RenderWidgetHostViewEfl::PreserveWindowFocusIn() {
133 void RenderWidgetHostViewEfl::PreserveWindowFocusOut() {
134 +// root_window_host_delegate_->OnHostLostMouseGrab();
137 void RenderWidgetHostViewEfl::PreserveWindowShow() {
138 +// root_window_host_delegate_->OnHostActivated();
141 void RenderWidgetHostViewEfl::PreserveWindowHide() {
142 @@ -291,7 +299,6 @@ void RenderWidgetHostViewEfl::UpdateCursor(const WebCursor& cursor) {
145 void RenderWidgetHostViewEfl::SetIsLoading(bool is_loading) {
149 void RenderWidgetHostViewEfl::TextInputStateChanged(
150 diff --git a/content/browser/renderer_host/render_widget_host_view_efl.h b/content/browser/renderer_host/render_widget_host_view_efl.h
151 index 617bce9..e20f51b 100644
152 --- a/content/browser/renderer_host/render_widget_host_view_efl.h
153 +++ b/content/browser/renderer_host/render_widget_host_view_efl.h
155 #include "ipc/ipc_sender.h"
156 #include "ui/base/animation/animation_delegate.h"
157 #include "ui/base/animation/slide_animation.h"
158 -//#include "ui/base/x/active_window_watcher_x_observer.h"
159 #include "ui/gfx/native_widget_types.h"
160 #include "ui/gfx/point.h"
161 #include "ui/gfx/preserve_window_delegate_efl.h"
162 #include "ui/gfx/rect.h"
163 #include "webkit/glue/webcursor.h"
164 -//#include "webkit/plugins/npapi/gtk_plugin_container_manager.h"
167 class PreserveWindow;
168 @@ -47,12 +45,12 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
169 virtual ~RenderWidgetHostViewEfl();
171 // PreserveWindowDelegate implementation.
172 - virtual bool PreserveWindowMouseDown(Evas_Event_Mouse_Down* event);
173 - virtual bool PreserveWindowMouseUp(Evas_Event_Mouse_Up* event);
174 - virtual bool PreserveWindowMouseMove(Evas_Event_Mouse_Move* event);
175 - virtual bool PreserveWindowMouseWheel(Evas_Event_Mouse_Wheel* event);
176 - virtual bool PreserveWindowKeyDown(Evas_Event_Key_Down* event);
177 - virtual bool PreserveWindowKeyUp(Evas_Event_Key_Up* event);
178 + virtual void PreserveWindowMouseDown(Evas_Event_Mouse_Down* event);
179 + virtual void PreserveWindowMouseUp(Evas_Event_Mouse_Up* event);
180 + virtual void PreserveWindowMouseMove(Evas_Event_Mouse_Move* event);
181 + virtual void PreserveWindowMouseWheel(Evas_Event_Mouse_Wheel* event);
182 + virtual void PreserveWindowKeyDown(Evas_Event_Key_Down* event);
183 + virtual void PreserveWindowKeyUp(Evas_Event_Key_Up* event);
184 virtual void PreserveWindowFocusIn();
185 virtual void PreserveWindowFocusOut();
186 virtual void PreserveWindowShow();
187 diff --git a/content/browser/renderer_host/web_input_event_factory_efl.cc b/content/browser/renderer_host/web_input_event_factory_efl.cc
189 index 0000000..66df8a7
191 +++ b/content/browser/renderer_host/web_input_event_factory_efl.cc
193 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
194 +// Use of this source code is governed by a BSD-style license that can be
195 +// found in the LICENSE file.
197 +#include "base/logging.h"
198 +#include "base/time.h"
199 +#include "base/string_number_conversions.h"
200 +#include "base/string_util.h"
201 +#include "base/utf_string_conversions.h"
202 +#include "content/browser/renderer_host/web_input_event_factory_efl.h"
203 +#include "content/public/browser/native_web_keyboard_event.h"
204 +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
205 +#include "ui/base/events/event_constants.h"
206 +#include "ui/base/keycodes/keyboard_codes_posix.h"
207 +#include "ui/gfx/efl_event.h"
214 +// Taken from web_input_event_aura.h
215 +const int kPixelsPerTick = 53;
217 +// Keycode map efl->windows vkeys.
218 +static std::map<std::string, ui::KeyboardCode> efl_keycode_map;
220 +static int eflModifierToWebEventModifiers(const Evas_Modifier* efl_modidier,
223 + // FIXME: check what else we need to handle from WebKit::WebInputEvent::Modifiers
224 + if (evas_key_modifier_is_set(efl_modidier, "Shift"))
225 + modifiers |= WebKit::WebInputEvent::ShiftKey;
226 + if (evas_key_modifier_is_set(efl_modidier, "Control"))
227 + modifiers |= WebKit::WebInputEvent::ControlKey;
228 + if (evas_key_modifier_is_set(efl_modidier, "Alt"))
229 + modifiers |= WebKit::WebInputEvent::AltKey;
230 + if (evas_key_modifier_is_set(efl_modidier, "Meta"))
231 + modifiers |= WebKit::WebInputEvent::MetaKey;
233 + modifiers |= WebKit::WebInputEvent::LeftButtonDown;
235 + modifiers |= WebKit::WebInputEvent::MiddleButtonDown;
237 + modifiers |= WebKit::WebInputEvent::RightButtonDown;
241 +static int clickCountFromEflFlags(unsigned int flags)
243 + if (flags & EVAS_BUTTON_TRIPLE_CLICK)
245 + else if (flags & EVAS_BUTTON_DOUBLE_CLICK)
251 +template<typename T>
252 +WebKit::WebMouseEvent toWebMouseEvent(WebKit::WebInputEvent::Type type, T* event)
254 + WebKit::WebMouseEvent result;
256 + result.timeStampSeconds = base::Time::UnixEpoch().ToDoubleT();
257 + result.modifiers = eflModifierToWebEventModifiers(event->modifiers, event->button);
258 + result.x = event->canvas.x;
259 + result.y = event->canvas.y;
260 + result.windowX = result.x;
261 + result.windowY = result.y;
262 + // FIXME: initialise global position.
263 + // result.globalX = ;
264 + // result.globalY = ;
265 + result.clickCount = clickCountFromEflFlags(event->flags);
266 + result.type = type;
267 + result.button = static_cast<WebKit::WebMouseEvent::Button>(event->button - 1);
272 +static inline void addKey(std::string key, ui::KeyboardCode key_code)
274 + efl_keycode_map.insert(std::pair<std::string, ui::KeyboardCode>(key, key_code));
277 +static inline void addRangeToKeycodeMap(const char from, const char to, int rangeStart)
279 + for (char c = from; c <= to; c++) {
280 + addKey(std::string(1,c), (ui::KeyboardCode)rangeStart++);
284 +static void createEflToWindowsKeyMap()
288 + // VKEY_CLEAR = 0x0C,
289 + // VKEY_MENU = 0x12,
290 + // VKEY_PAUSE = 0x13,
291 + // VKEY_CAPITAL = 0x14,
292 + // VKEY_KANA = 0x15,
293 + // VKEY_HANGUL = 0x15,
294 + // VKEY_JUNJA = 0x17,
295 + // VKEY_FINAL = 0x18,
296 + // VKEY_HANJA = 0x19,
297 + // VKEY_KANJI = 0x19,
298 + // VKEY_CONVERT = 0x1C,
299 + // VKEY_NONCONVERT = 0x1D,
300 + // VKEY_ACCEPT = 0x1E,
301 + // VKEY_MODECHANGE = 0x1F,
302 + // VKEY_SELECT = 0x29,
303 + // VKEY_EXECUTE = 0x2B,
304 + // VKEY_SNAPSHOT = 0x2C,
305 + // VKEY_HELP = 0x2F,
306 + // VKEY_LWIN = 0x5B,
307 + // VKEY_COMMAND = VKEY_LWIN, // Provide the Mac name for convenience.
308 + // VKEY_RWIN = 0x5C,
309 + // VKEY_APPS = 0x5D,
310 + // VKEY_SLEEP = 0x5F,
311 + // VKEY_SEPARATOR = 0x6C,
312 + // VKEY_F13 = 0x7C,
313 + // VKEY_F14 = 0x7D,
314 + // VKEY_F15 = 0x7E,
315 + // VKEY_F16 = 0x7F,
316 + // VKEY_F17 = 0x80,
317 + // VKEY_F18 = 0x81,
318 + // VKEY_F19 = 0x82,
319 + // VKEY_F20 = 0x83,
320 + // VKEY_F21 = 0x84,
321 + // VKEY_F22 = 0x85,
322 + // VKEY_F23 = 0x86,
323 + // VKEY_F24 = 0x87,
324 + // VKEY_LMENU = 0xA4,
325 + // VKEY_RMENU = 0xA5,
326 + // VKEY_BROWSER_BACK = 0xA6,
327 + // VKEY_BROWSER_FORWARD = 0xA7,
328 + // VKEY_BROWSER_REFRESH = 0xA8,
329 + // VKEY_BROWSER_STOP = 0xA9,
330 + // VKEY_BROWSER_SEARCH = 0xAA,
331 + // VKEY_BROWSER_FAVORITES = 0xAB,
332 + // VKEY_BROWSER_HOME = 0xAC,
333 + // VKEY_VOLUME_MUTE = 0xAD,
334 + // VKEY_VOLUME_DOWN = 0xAE,
335 + // VKEY_VOLUME_UP = 0xAF,
336 + // VKEY_MEDIA_NEXT_TRACK = 0xB0,
337 + // VKEY_MEDIA_PREV_TRACK = 0xB1,
338 + // VKEY_MEDIA_STOP = 0xB2,
339 + // VKEY_MEDIA_PLAY_PAUSE = 0xB3,
340 + // VKEY_MEDIA_LAUNCH_MAIL = 0xB4,
341 + // VKEY_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5,
342 + // VKEY_MEDIA_LAUNCH_APP1 = 0xB6,
343 + // VKEY_MEDIA_LAUNCH_APP2 = 0xB7,
344 + // VKEY_OEM_1 = 0xBA,
345 + // VKEY_OEM_PLUS = 0xBB,
346 + // VKEY_OEM_COMMA = 0xBC,
347 + // VKEY_OEM_MINUS = 0xBD,
348 + // VKEY_OEM_PERIOD = 0xBE,
349 + // VKEY_OEM_2 = 0xBF,
350 + // VKEY_OEM_3 = 0xC0,
351 + // VKEY_OEM_4 = 0xDB,
352 + // VKEY_OEM_5 = 0xDC,
353 + // VKEY_OEM_6 = 0xDD,
354 + // VKEY_OEM_7 = 0xDE,
355 + // VKEY_OEM_8 = 0xDF,
356 + // VKEY_OEM_102 = 0xE2,
357 + // VKEY_PROCESSKEY = 0xE5,
358 + // VKEY_PACKET = 0xE7,
359 + // VKEY_DBE_SBCSCHAR = 0xF3,
360 + // VKEY_DBE_DBCSCHAR = 0xF4,
361 + // VKEY_ATTN = 0xF6,
362 + // VKEY_CRSEL = 0xF7,
363 + // VKEY_EXSEL = 0xF8,
364 + // VKEY_EREOF = 0xF9,
365 + // VKEY_PLAY = 0xFA,
366 + // VKEY_ZOOM = 0xFB,
367 + // VKEY_NONAME = 0xFC,
368 + // VKEY_PA1 = 0xFD,
369 + // VKEY_OEM_CLEAR = 0xFE,
371 + addKey(std::string("BackSpace"), ui::VKEY_BACK);
372 + addKey(std::string("Tab"), ui::VKEY_TAB);
373 + addKey(std::string("ISO_Left_Tab"), ui::VKEY_BACKTAB);
374 + addKey(std::string("Return"), ui::VKEY_RETURN);
375 + addKey(std::string("Escape"), ui::VKEY_ESCAPE);
376 + addKey(std::string("space"), ui::VKEY_SPACE);
377 + addKey(std::string("Prior"), ui::VKEY_PRIOR);
378 + addKey(std::string("KP_Prior"), ui::VKEY_PRIOR);
379 + addKey(std::string("Next"), ui::VKEY_NEXT);
380 + addKey(std::string("Next"), ui::VKEY_NEXT);
381 + addKey(std::string("End"), ui::VKEY_END);
382 + addKey(std::string("KP_End"), ui::VKEY_END);
383 + addKey(std::string("Home"), ui::VKEY_HOME);
384 + addKey(std::string("KP_Home"), ui::VKEY_HOME);
385 + addKey(std::string("Left"), ui::VKEY_LEFT);
386 + addKey(std::string("KP_Left"), ui::VKEY_LEFT);
387 + addKey(std::string("Up"), ui::VKEY_UP);
388 + addKey(std::string("KP_Up"), ui::VKEY_UP);
389 + addKey(std::string("Right"), ui::VKEY_RIGHT);
390 + addKey(std::string("KP_Rright"), ui::VKEY_RIGHT);
391 + addKey(std::string("Down"), ui::VKEY_DOWN);
392 + addKey(std::string("KP_Down"), ui::VKEY_DOWN);
393 + addKey(std::string("Print"), ui::VKEY_PRINT);
394 + addKey(std::string("Insert"), ui::VKEY_INSERT);
395 + addKey(std::string("KP_Insert"), ui::VKEY_INSERT);
396 + addKey(std::string("Delete"), ui::VKEY_DELETE);
397 + addKey(std::string("KP_Delete"), ui::VKEY_DELETE);
398 + addKey(std::string("Shift_L"), ui::VKEY_LSHIFT);
399 + addKey(std::string("Shift_R"), ui::VKEY_RSHIFT);
400 + addKey(std::string("Control_R"), ui::VKEY_RCONTROL);
401 + addKey(std::string("Control_L"), ui::VKEY_LCONTROL);
402 + addKey(std::string("KP_Multiply"), ui::VKEY_MULTIPLY);
403 + addKey(std::string("KP_Add"), ui::VKEY_ADD);
404 + addKey(std::string("KP_Subtract"), ui::VKEY_SUBTRACT);
405 + addKey(std::string("KP_Decimal"), ui::VKEY_DECIMAL);
406 + addKey(std::string("KP_Divide"), ui::VKEY_DIVIDE);
407 + addKey(std::string("Num_Lock"), ui::VKEY_NUMLOCK);
408 + addKey(std::string("Scroll_Lock"), ui::VKEY_SCROLL);
411 + for (int i = 0; i < 9; i++) {
412 + addKey(std::string("KP_") + base::IntToString(i), (ui::KeyboardCode)(ui::VKEY_NUMPAD0 + i));
416 + for (int i = 0; i < 12; i++) {
417 + addKey(std::string("F") + base::IntToString(i), (ui::KeyboardCode)(ui::VKEY_F1 + i));
420 + addRangeToKeycodeMap('0', '9', ui::VKEY_0);
421 + addRangeToKeycodeMap('a', 'z', ui::VKEY_A);
422 + addRangeToKeycodeMap('A', 'Z', ui::VKEY_A);
425 +// temporarily copied from WebKeyboardEvent::windowsKeyCodeWithoutLocation
426 +static int windowsKeyCodeWithoutLocation(ui::KeyboardCode keycode)
429 + case ui::VKEY_LCONTROL:
430 + case ui::VKEY_RCONTROL:
431 + return ui::VKEY_CONTROL;
432 + case ui::VKEY_LSHIFT:
433 + case ui::VKEY_RSHIFT:
434 + return ui::VKEY_SHIFT;
435 + case ui::VKEY_LMENU:
436 + case ui::VKEY_RMENU:
437 + return ui::VKEY_MENU;
443 +// temporarily copied from WebKeyboardEvent::windowsKeyCodeWithoutLocation
444 +static int locationModifiersFromWindowsKeyCode(ui::KeyboardCode keycode)
447 + case ui::VKEY_LCONTROL:
448 + case ui::VKEY_LSHIFT:
449 + case ui::VKEY_LMENU:
450 + case ui::VKEY_LWIN:
451 + return WebKit::WebKeyboardEvent::IsLeft;
452 + case ui::VKEY_RCONTROL:
453 + case ui::VKEY_RSHIFT:
454 + case ui::VKEY_RMENU:
455 + case ui::VKEY_RWIN:
456 + return WebKit::WebKeyboardEvent::IsRight;
462 +static bool setKeyText(ui::KeyboardCode code,
463 + WebKit::WebKeyboardEvent& webkit_event,
464 + const char* efl_event_string)
467 + bool rawKeyEvent = true;
470 + case ui::VKEY_RETURN:
471 + webkit_event.unmodifiedText[0] = '\r';
473 + case ui::VKEY_BACK:
474 + webkit_event.unmodifiedText[0] = '\x8';
477 + webkit_event.unmodifiedText[0] = '\t';
480 + if (efl_event_string) {
481 + base::string16 out_str;
482 + bool success = UTF8ToUTF16(efl_event_string, strlen(efl_event_string), &out_str);
484 + webkit_event.unmodifiedText[0] = out_str[0];
485 + rawKeyEvent = false;
490 + return rawKeyEvent;
493 +ui::KeyboardCode windowsKeyboardCodeFromEvasKeyEventName(const char* eventName)
495 + if (efl_keycode_map.empty()) {
496 + createEflToWindowsKeyMap();
499 + const std::map<std::string, ui::KeyboardCode>::iterator it =
500 + efl_keycode_map.find(std::string(eventName));
501 + return it != efl_keycode_map.end() ? it->second : ui::VKEY_UNKNOWN;
504 +template<typename T>
505 +WebKit::WebKeyboardEvent toWebKeyboardEvent(T* event,
506 + gfx::EflEvent::EflEventType type)
508 + WebKit::WebKeyboardEvent result;
510 + result.timeStampSeconds = event->timestamp / 1000;
511 + result.modifiers = eflModifierToWebEventModifiers(event->modifiers);
512 + ui::KeyboardCode windowsKeyCode = windowsKeyboardCodeFromEvasKeyEventName(event->keyname);
513 + result.windowsKeyCode = windowsKeyCodeWithoutLocation(windowsKeyCode);
514 + result.modifiers |= locationModifiersFromWindowsKeyCode(windowsKeyCode);
515 + bool is_raw_key = setKeyText(windowsKeyCode, result, event->string);
517 + if (type == gfx::EflEvent::EventTypeKeyDown) {
518 + result.type = is_raw_key ? WebKit::WebInputEvent::RawKeyDown :
519 + WebKit::WebInputEvent::KeyDown;
521 + result.type = WebKit::WebInputEvent::KeyUp;
524 + result.text[0] = result.unmodifiedText[0];
526 + result.setKeyIdentifierFromWindowsKeyCode();
528 + if (event->key && StartsWithASCII(std::string(event->key), std::string("KP_"), true))
529 + result.modifiers |= WebKit::WebInputEvent::IsKeyPad;
534 +WebKit::WebKeyboardEvent keyboardEvent(gfx::NativeEvent event)
538 + switch(event->eventType()) {
539 + case gfx::EflEvent::EventTypeKeyUp:
540 + return toWebKeyboardEvent(static_cast<Evas_Event_Key_Up*>(event->eflEvent()),
541 + gfx::EflEvent::EventTypeKeyUp);
542 + case gfx::EflEvent::EventTypeKeyDown:
543 + return toWebKeyboardEvent(static_cast<Evas_Event_Key_Down*>(event->eflEvent()),
544 + gfx::EflEvent::EventTypeKeyDown);
549 + return WebKit::WebKeyboardEvent();
552 +WebKit::WebMouseEvent mouseEvent(Evas_Event_Mouse_Down* mouse_down)
554 + DCHECK(mouse_down);
555 + return toWebMouseEvent(WebKit::WebInputEvent::MouseDown, mouse_down);
558 +WebKit::WebMouseEvent mouseEvent(Evas_Event_Mouse_Up* mouse_up)
561 + return toWebMouseEvent(WebKit::WebInputEvent::MouseUp, mouse_up);
564 +WebKit::WebMouseEvent mouseEvent(Evas_Event_Mouse_Move* mouse_move)
566 + DCHECK(mouse_move);
568 + WebKit::WebMouseEvent result;
570 + result.timeStampSeconds = base::Time::UnixEpoch().ToDoubleT();
571 + result.modifiers = eflModifierToWebEventModifiers(mouse_move->modifiers, mouse_move->buttons);
572 + result.x = mouse_move->cur.canvas.x;
573 + result.y = mouse_move->cur.canvas.y;
574 + result.windowX = result.x;
575 + result.windowY = result.y;
576 + result.clickCount = 0;
577 + result.type = WebKit::WebInputEvent::MouseMove;
578 + result.button = static_cast<WebKit::WebMouseEvent::Button>(mouse_move->buttons - 1);
583 +WebKit::WebMouseWheelEvent mouseWheelEvent(Evas_Event_Mouse_Wheel* mouse_wheel)
585 + DCHECK(mouse_wheel);
589 + if (mouse_wheel->direction == 0) {
590 + y_offset = -mouse_wheel->z;
591 + } else if (mouse_wheel->direction == 1) {
592 + x_offset = -mouse_wheel->z;
595 + WebKit::WebMouseWheelEvent event;
597 + event.type = WebKit::WebInputEvent::MouseWheel;
598 + event.button = WebKit::WebMouseEvent::ButtonNone;
599 + event.modifiers = eflModifierToWebEventModifiers(mouse_wheel->modifiers);
600 + event.timeStampSeconds = base::Time::UnixEpoch().ToDoubleT();
601 + event.deltaX = x_offset * kPixelsPerTick;
602 + event.deltaY = y_offset * kPixelsPerTick;
603 + event.wheelTicksX = x_offset;
604 + event.wheelTicksY = y_offset;
609 +} // namespace content
610 diff --git a/content/browser/renderer_host/web_input_event_factory_efl.h b/content/browser/renderer_host/web_input_event_factory_efl.h
612 index 0000000..47e76df
614 +++ b/content/browser/renderer_host/web_input_event_factory_efl.h
616 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
617 +// Use of this source code is governed by a BSD-style license that can be
618 +// found in the LICENSE file.
620 +#ifndef CONTENT_BROWSER_RENDERER_HOST_WEB_INPUT_EVENT_FACTORY_EFL_H_
621 +#define CONTENT_BROWSER_RENDERER_HOST_WEB_INPUT_EVENT_FACTORY_EFL_H_
623 +#include "content/common/content_export.h"
624 +#include "ui/gfx/native_widget_types.h"
626 +typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down;
627 +typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up;
628 +typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move;
629 +typedef struct _Evas_Event_Mouse_Wheel Evas_Event_Mouse_Wheel;
632 +struct WebMouseEvent;
633 +struct WebMouseWheelEvent;
634 +struct WebKeyboardEvent;
639 +CONTENT_EXPORT WebKit::WebKeyboardEvent keyboardEvent(gfx::NativeEvent);
640 +CONTENT_EXPORT WebKit::WebMouseEvent mouseEvent(Evas_Event_Mouse_Down*);
641 +CONTENT_EXPORT WebKit::WebMouseEvent mouseEvent(Evas_Event_Mouse_Up*);
642 +CONTENT_EXPORT WebKit::WebMouseEvent mouseEvent(Evas_Event_Mouse_Move*);
643 +CONTENT_EXPORT WebKit::WebMouseWheelEvent mouseWheelEvent(Evas_Event_Mouse_Wheel*);
645 +} // namespace content
647 +#endif // CONTENT_BROWSER_RENDERER_HOST_WEB_INPUT_EVENT_FACTORY_EFL_H_
648 diff --git a/content/content_browser.gypi b/content/content_browser.gypi
649 index 1484aaa..92aed8d 100644
650 --- a/content/content_browser.gypi
651 +++ b/content/content_browser.gypi
653 'browser/renderer_host/media/webrtc_logging_handler_host.h',
654 'browser/renderer_host/native_web_keyboard_event_android.cc',
655 'browser/renderer_host/native_web_keyboard_event_aura.cc',
656 - 'browser/renderer_host/native_web_keyboard_event.cc',
657 'browser/renderer_host/native_web_keyboard_event_efl.cc',
658 - 'browser/renderer_host/native_web_keyboard_event_gtk.cc',
659 + 'browser/renderer_host/native_web_keyboard_event.cc',
660 + 'browser/renderer_host/native_web_keyboard_event_gtk.cc'
661 'browser/renderer_host/native_web_keyboard_event_mac.mm',
662 'browser/renderer_host/native_web_keyboard_event_win.cc',
663 'browser/renderer_host/overscroll_configuration.cc',
665 'browser/renderer_host/web_input_event_aura.h',
666 'browser/renderer_host/web_input_event_aurawin.cc',
667 'browser/renderer_host/web_input_event_aurax11.cc',
668 + 'browser/renderer_host/web_input_event_factory_efl.h',
669 + 'browser/renderer_host/web_input_event_factory_efl.cc',
670 'browser/renderer_host/window_utils_efl.h',
671 'browser/renderer_host/window_utils_efl.cc',
672 'browser/resolve_proxy_msg_helper.cc',
673 @@ -1178,6 +1180,7 @@
675 ['exclude', 'browser/web_contents/web_contents_view_gtk.cc'],
676 ['exclude', 'browser/web_contents/web_contents_view_gtk.h'],
677 + ['exclude', 'browser/renderer_host/native_web_keyboard_event_gtk.cc'],
678 ['exclude', 'browser/renderer_host/render_widget_host_view_gtk.cc'],
679 ['exclude', 'browser/renderer_host/render_widget_host_view_gtk.h'],
680 ['exclude', 'browser/renderer_host/gtk_im_context_wrapper.cc'],
681 diff --git a/ui/gfx/efl_event.h b/ui/gfx/efl_event.h
683 index 0000000..07ecb0f
685 +++ b/ui/gfx/efl_event.h
687 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
688 +// Use of this source code is governed by a BSD-style license that can be
689 +// found in the LICENSE file.
691 +#ifndef UI_GFX_EFL_EVENT_H_
692 +#define UI_GFX_EFL_EVENT_H_
694 +#include "ui/base/ui_export.h"
698 +class UI_EXPORT EflEvent {
701 + enum EflEventType {
706 + EflEvent(EflEventType type, void* efl_event) : type_(type),
707 + efl_event_(efl_event) {}
709 + EflEventType eventType() const { return type_; }
710 + void* eflEvent() { return efl_event_; }
713 + EflEventType type_;
719 +#endif // UI_GFX_EFL_EVENT_H_
720 diff --git a/ui/gfx/native_widget_types.h b/ui/gfx/native_widget_types.h
721 index 8916610..b60a27e 100644
722 --- a/ui/gfx/native_widget_types.h
723 +++ b/ui/gfx/native_widget_types.h
724 @@ -107,6 +107,9 @@ typedef struct _GdkRegion GdkRegion;
725 typedef struct _GtkWidget GtkWidget;
726 typedef struct _GtkWindow GtkWindow;
727 #elif defined(TOOLKIT_EFL)
731 typedef struct _Evas_Object Evas_Object;
732 #elif defined(OS_ANDROID)
733 struct ANativeWindow;
734 @@ -152,7 +155,7 @@ typedef void* NativeCursor;
735 typedef Evas_Object* NativeView;
736 typedef void* NativeRegion;
737 typedef Evas_Object* NativeWindow;
738 -typedef void* NativeEvent;
739 +typedef EflEvent* NativeEvent;
740 #elif defined(OS_ANDROID)
741 typedef void* NativeCursor;
742 typedef ui::ViewAndroid* NativeView;
743 diff --git a/ui/gfx/preserve_window_delegate_efl.h b/ui/gfx/preserve_window_delegate_efl.h
744 index aa7863b..e75218f 100644
745 --- a/ui/gfx/preserve_window_delegate_efl.h
746 +++ b/ui/gfx/preserve_window_delegate_efl.h
747 @@ -18,12 +18,12 @@ namespace gfx {
748 // with their owning PreserveWindow.
749 class UI_EXPORT PreserveWindowDelegate {
751 - virtual bool PreserveWindowMouseDown(Evas_Event_Mouse_Down* event) = 0;
752 - virtual bool PreserveWindowMouseUp(Evas_Event_Mouse_Up* event) = 0;
753 - virtual bool PreserveWindowMouseMove(Evas_Event_Mouse_Move* event) = 0;
754 - virtual bool PreserveWindowMouseWheel(Evas_Event_Mouse_Wheel* event) = 0;
755 - virtual bool PreserveWindowKeyDown(Evas_Event_Key_Down* event) = 0;
756 - virtual bool PreserveWindowKeyUp(Evas_Event_Key_Up* event) = 0;
757 + virtual void PreserveWindowMouseDown(Evas_Event_Mouse_Down* event) = 0;
758 + virtual void PreserveWindowMouseUp(Evas_Event_Mouse_Up* event) = 0;
759 + virtual void PreserveWindowMouseMove(Evas_Event_Mouse_Move* event) = 0;
760 + virtual void PreserveWindowMouseWheel(Evas_Event_Mouse_Wheel* event) = 0;
761 + virtual void PreserveWindowKeyDown(Evas_Event_Key_Down* event) = 0;
762 + virtual void PreserveWindowKeyUp(Evas_Event_Key_Up* event) = 0;
764 // Called when the windowing system activates the window.
765 virtual void PreserveWindowFocusIn() = 0;
766 diff --git a/ui/ui.gyp b/ui/ui.gyp
767 index e6c240e..059652c 100644
772 'base/clipboard/clipboard_efl.cc',
773 'base/resource/resource_bundle_efl.cc',