#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"
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();
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)
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);
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();
// 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;
KeySym keysym,
unsigned int mask) {
xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym);
- host->PostNativeEvent(xevent);
+ aura::test::PostEventToWindowTreeHost(*xevent, host);
xevent->xkey.state |= mask;
}
KeySym keysym) {
xevent->xkey.state ^= mask;
xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym);
- host->PostNativeEvent(xevent);
+ aura::test::PostEventToWindowTreeHost(*xevent, host);
}
// Our X11 state.