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,
58 Dispatch(new WaylandInput_KeyNotify(type, code));
61 void RemoteEventDispatcher::VirtualKeyNotify(ui::EventType type,
64 Dispatch(new WaylandInput_VirtualKeyNotify(type, key, modifiers));
67 void RemoteEventDispatcher::KeyModifiers(uint32_t mods_depressed,
68 uint32_t mods_latched,
71 Dispatch(new WaylandInput_KeyModifiers(mods_depressed,
77 void RemoteEventDispatcher::TouchNotify(ui::EventType type,
81 uint32_t time_stamp) {
82 Dispatch(new WaylandInput_TouchNotify(type, x, y, touch_id, time_stamp));
85 void RemoteEventDispatcher::OutputSizeChanged(unsigned width,
87 Dispatch(new WaylandInput_OutputSize(width, height));
90 void RemoteEventDispatcher::WindowResized(unsigned handle,
93 Dispatch(new WaylandWindow_Resized(handle, width, height));
96 void RemoteEventDispatcher::WindowUnminimized(unsigned handle) {
97 Dispatch(new WaylandWindow_Unminimized(handle));
100 void RemoteEventDispatcher::CloseWidget(unsigned handle) {
101 Dispatch(new WaylandInput_CloseWidget(handle));
104 void RemoteEventDispatcher::Commit(unsigned handle,
105 const std::string& text) {
106 Dispatch(new WaylandInput_Commit(handle, text));
109 void RemoteEventDispatcher::PreeditChanged(unsigned handle,
110 const std::string& text,
111 const std::string& commit) {
112 Dispatch(new WaylandInput_PreeditChanged(handle, text, commit));
115 void RemoteEventDispatcher::PreeditEnd() {
116 Dispatch(new WaylandInput_PreeditEnd());
119 void RemoteEventDispatcher::PreeditStart() {
120 Dispatch(new WaylandInput_PreeditStart());
123 void RemoteEventDispatcher::InitializeXKB(base::SharedMemoryHandle fd,
125 Dispatch(new WaylandInput_InitializeXKB(fd, size));
128 void RemoteEventDispatcher::Dispatch(IPC::Message* message) {
129 ui::EventConverterOzoneWayland::PostTaskOnMainLoop(
130 base::Bind(&RemoteEventDispatcher::Send, this, message));
133 void RemoteEventDispatcher::Send(RemoteEventDispatcher* dispatcher,
134 IPC::Message* message) {
135 dispatcher->sender_->Send(message);