X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fui%2Fviews%2Ftest%2Fui_controls_factory_desktop_aurax11.cc;h=7e52286ad4670d24828736c8c26e11173df71953;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=a7982bfbb100e6f960dc1f50dfad4c1d484c54ea;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/ui/views/test/ui_controls_factory_desktop_aurax11.cc b/src/ui/views/test/ui_controls_factory_desktop_aurax11.cc index a7982bf..7e52286 100644 --- a/src/ui/views/test/ui_controls_factory_desktop_aurax11.cc +++ b/src/ui/views/test/ui_controls_factory_desktop_aurax11.cc @@ -16,6 +16,7 @@ #include "ui/aura/env.h" #include "ui/aura/test/aura_test_utils.h" #include "ui/aura/test/ui_controls_factory_aura.h" +#include "ui/aura/test/x11_event_sender.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/base/test/ui_controls_aura.h" #include "ui/base/x/x11_util.h" @@ -68,29 +69,26 @@ class UIControlsDesktopX11 : public UIControlsAura { XStoreName(x_display_, x_window_, "Chromium UIControlsDesktopX11 Window"); } - virtual ~UIControlsDesktopX11() { - XDestroyWindow(x_display_, x_window_); - } + ~UIControlsDesktopX11() override { XDestroyWindow(x_display_, x_window_); } - virtual bool SendKeyPress(gfx::NativeWindow window, - ui::KeyboardCode key, - bool control, - bool shift, - bool alt, - bool command) OVERRIDE { + bool SendKeyPress(gfx::NativeWindow window, + ui::KeyboardCode key, + bool control, + bool shift, + bool alt, + bool command) override { DCHECK(!command); // No command key on Aura return SendKeyPressNotifyWhenDone( window, key, control, shift, alt, command, base::Closure()); } - virtual bool SendKeyPressNotifyWhenDone( - gfx::NativeWindow window, - ui::KeyboardCode key, - bool control, - bool shift, - bool alt, - bool command, - const base::Closure& closure) OVERRIDE { + bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, + ui::KeyboardCode key, + bool control, + bool shift, + bool alt, + bool command, + const base::Closure& closure) override { DCHECK(!command); // No command key on Aura aura::WindowTreeHost* host = window->GetHost(); @@ -107,11 +105,11 @@ class UIControlsDesktopX11 : public UIControlsAura { xevent.xkey.keycode = XKeysymToKeycode(x_display_, ui::XKeysymForWindowsKeyCode(key, shift)); - host->PostNativeEvent(&xevent); + aura::test::PostEventToWindowTreeHost(xevent, host); // Send key release events. xevent.xkey.type = KeyRelease; - host->PostNativeEvent(&xevent); + aura::test::PostEventToWindowTreeHost(xevent, host); if (alt) UnmaskAndSetKeycodeThenSend(host, &xevent, Mod1Mask, XK_Alt_L); if (shift) @@ -124,13 +122,12 @@ class UIControlsDesktopX11 : public UIControlsAura { return true; } - virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { + bool SendMouseMove(long screen_x, long screen_y) override { return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); } - virtual bool SendMouseMoveNotifyWhenDone( - long screen_x, - long screen_y, - const base::Closure& closure) OVERRIDE { + bool SendMouseMoveNotifyWhenDone(long screen_x, + long screen_y, + const base::Closure& closure) override { gfx::Point screen_location(screen_x, screen_y); gfx::Point root_location = screen_location; aura::Window* root_window = RootWindowForPoint(screen_location); @@ -160,18 +157,17 @@ class UIControlsDesktopX11 : public UIControlsAura { xmotion->state = button_down_mask; xmotion->same_screen = True; // RootWindow will take care of other necessary fields. - host->PostNativeEvent(&xevent); + aura::test::PostEventToWindowTreeHost(xevent, host); } RunClosureAfterAllPendingUIEvents(closure); return true; } - virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE { + bool SendMouseEvents(MouseButton type, int state) override { return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); } - virtual bool SendMouseEventsNotifyWhenDone( - MouseButton type, - int state, - const base::Closure& closure) OVERRIDE { + bool SendMouseEventsNotifyWhenDone(MouseButton type, + int state, + const base::Closure& closure) override { XEvent xevent = {0}; XButtonEvent* xbutton = &xevent.xbutton; gfx::Point mouse_loc = aura::Env::GetInstance()->last_mouse_location(); @@ -200,22 +196,22 @@ class UIControlsDesktopX11 : public UIControlsAura { // RootWindow will take care of other necessary fields. if (state & DOWN) { xevent.xbutton.type = ButtonPress; - root_window->GetHost()->PostNativeEvent(&xevent); + aura::test::PostEventToWindowTreeHost(xevent, root_window->GetHost()); button_down_mask |= xbutton->state; } if (state & UP) { xevent.xbutton.type = ButtonRelease; - root_window->GetHost()->PostNativeEvent(&xevent); + aura::test::PostEventToWindowTreeHost(xevent, root_window->GetHost()); button_down_mask = (button_down_mask | xbutton->state) ^ xbutton->state; } RunClosureAfterAllPendingUIEvents(closure); return true; } - virtual bool SendMouseClick(MouseButton type) OVERRIDE { + bool SendMouseClick(MouseButton type) override { return SendMouseEvents(type, UP | DOWN); } - virtual void RunClosureAfterAllPendingUIEvents( - const base::Closure& closure) OVERRIDE { + void RunClosureAfterAllPendingUIEvents( + const base::Closure& closure) override { if (closure.is_null()) return; static XEvent* marker_event = NULL; @@ -256,7 +252,7 @@ class UIControlsDesktopX11 : public UIControlsAura { KeySym keysym, unsigned int mask) { xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym); - host->PostNativeEvent(xevent); + aura::test::PostEventToWindowTreeHost(*xevent, host); xevent->xkey.state |= mask; } @@ -266,7 +262,7 @@ class UIControlsDesktopX11 : public UIControlsAura { KeySym keysym) { xevent->xkey.state ^= mask; xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym); - host->PostNativeEvent(xevent); + aura::test::PostEventToWindowTreeHost(*xevent, host); } // Our X11 state.