f44841807b137a1cab71fc1c353eac248cf8d43e
[platform/framework/web/crosswalk.git] / src / ozone / ui / events / event_converter_ozone_wayland.h
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.
4
5 #ifndef OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_
6 #define OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_
7
8 #include <string>
9
10 #include "base/message_loop/message_loop.h"
11 #include "ozone/platform/ozone_export_wayland.h"
12 #include "ui/events/event_constants.h"
13
14 namespace ui {
15
16 class WindowChangeObserver;
17 class OutputChangeObserver;
18
19 // In OzoneWayland, Chrome relies on Wayland protocol to recieve callback of
20 // any input/surface events. This class is responsible for the following:
21 // 1) Convert native input events to |ui::Event| and dispatching to aura.
22 // 2) Convert native events related to Window Activation and dispatch it to
23 //    WindowChangeObserver
24 class OZONE_WAYLAND_EXPORT EventConverterOzoneWayland {
25  public:
26   EventConverterOzoneWayland();
27   virtual ~EventConverterOzoneWayland();
28
29   virtual void MotionNotify(float x, float y) = 0;
30   virtual void ButtonNotify(unsigned handle,
31                             EventType type,
32                             EventFlags flags,
33                             float x,
34                             float y) = 0;
35   virtual void AxisNotify(float x, float y, int xoffset, int yoffset) = 0;
36   virtual void PointerEnter(unsigned handle, float x, float y) = 0;
37   virtual void PointerLeave(unsigned handle, float x, float y) = 0;
38   virtual void KeyNotify(ui::EventType type,
39                          unsigned code,
40                          unsigned modifiers) = 0;
41   virtual void TouchNotify(ui::EventType type,
42                            float x,
43                            float y,
44                            int32_t touch_id,
45                            uint32_t time_stamp) = 0;
46
47   virtual void OutputSizeChanged(unsigned width, unsigned height) = 0;
48   virtual void WindowResized(unsigned windowhandle,
49                              unsigned width,
50                              unsigned height) = 0;
51   virtual void CloseWidget(unsigned handle) = 0;
52   virtual void Commit(unsigned handle, const std::string& text) = 0;
53   virtual void PreeditChanged(unsigned handle, const std::string& text,
54                               const std::string& commit) = 0;
55   virtual void PreeditEnd() = 0;
56   virtual void PreeditStart() = 0;
57
58   // Sets the window change observer. Ownership is retained by the caller.
59   virtual void SetWindowChangeObserver(WindowChangeObserver* observer);
60   // Sets the output change observer. Ownership is retained by the caller.
61   virtual void SetOutputChangeObserver(OutputChangeObserver* observer);
62
63  protected:
64   // Posts task to main loop of the thread on which Dispatcher was initialized.
65   virtual void PostTaskOnMainLoop(const base::Closure& task);
66   base::MessageLoop* loop_;
67 };
68
69 }  // namespace ui
70
71 #endif  // OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_