1 // Copyright 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ozone/ui/events/remote_event_dispatcher.h"
8 #include "ozone/ui/public/messages.h"
12 RemoteEventDispatcher::RemoteEventDispatcher()
13 : EventConverterOzoneWayland(),
17 RemoteEventDispatcher::~RemoteEventDispatcher() {
20 void RemoteEventDispatcher::ChannelEstablished(IPC::Sender* sender) {
21 loop_ = base::MessageLoop::current();
25 void RemoteEventDispatcher::MotionNotify(float x, float y) {
26 Dispatch(new WaylandInput_MotionNotify(x, y));
29 void RemoteEventDispatcher::ButtonNotify(unsigned handle,
34 Dispatch(new WaylandInput_ButtonNotify(handle, type, flags, x, y));
37 void RemoteEventDispatcher::AxisNotify(float x,
41 Dispatch(new WaylandInput_AxisNotify(x, y, xoffset, yoffset));
44 void RemoteEventDispatcher::PointerEnter(unsigned handle,
47 Dispatch(new WaylandInput_PointerEnter(handle, x, y));
50 void RemoteEventDispatcher::PointerLeave(unsigned handle,
53 Dispatch(new WaylandInput_PointerLeave(handle, x, y));
56 void RemoteEventDispatcher::KeyNotify(ui::EventType type,
59 Dispatch(new WaylandInput_KeyNotify(type, code, modifiers));
62 void RemoteEventDispatcher::TouchNotify(ui::EventType type,
66 uint32_t time_stamp) {
67 Dispatch(new WaylandInput_TouchNotify(type, x, y, touch_id, time_stamp));
70 void RemoteEventDispatcher::OutputSizeChanged(unsigned width,
72 Dispatch(new WaylandInput_OutputSize(width, height));
75 void RemoteEventDispatcher::WindowResized(unsigned handle,
78 Dispatch(new WaylandWindow_Resized(handle, width, height));
81 void RemoteEventDispatcher::CloseWidget(unsigned handle) {
82 Dispatch(new WaylandInput_CloseWidget(handle));
85 void RemoteEventDispatcher::Commit(unsigned handle,
86 const std::string& text) {
87 Dispatch(new WaylandInput_Commit(handle, text));
90 void RemoteEventDispatcher::PreeditChanged(unsigned handle,
91 const std::string& text,
92 const std::string& commit) {
93 Dispatch(new WaylandInput_PreeditChanged(handle, text, commit));
96 void RemoteEventDispatcher::PreeditEnd() {
97 Dispatch(new WaylandInput_PreeditEnd());
100 void RemoteEventDispatcher::PreeditStart() {
101 Dispatch(new WaylandInput_PreeditStart());
104 void RemoteEventDispatcher::Dispatch(IPC::Message* message) {
105 ui::EventConverterOzoneWayland::PostTaskOnMainLoop(
106 base::Bind(&RemoteEventDispatcher::Send, this, message));
109 void RemoteEventDispatcher::Send(RemoteEventDispatcher* dispatcher,
110 IPC::Message* message) {
111 dispatcher->sender_->Send(message);