Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / ozone / wayland / input / pointer.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_WAYLAND_INPUT_POINTER_H_
6 #define OZONE_WAYLAND_INPUT_POINTER_H_
7
8 #include "ozone/wayland/display.h"
9 #include "ui/gfx/point.h"
10
11 namespace ui {
12 class EventConverterOzoneWayland;
13 }
14
15 namespace ozonewayland {
16
17 class WaylandCursor;
18 class WaylandWindow;
19
20 class WaylandPointer {
21  public:
22   WaylandPointer();
23   ~WaylandPointer();
24
25   void OnSeatCapabilities(wl_seat *seat, uint32_t caps);
26   WaylandCursor* Cursor() const { return cursor_; }
27
28  private:
29   static void OnMotionNotify(
30       void* data,
31       wl_pointer* input_pointer,
32       uint32_t time,
33       wl_fixed_t sx_w,
34       wl_fixed_t sy_w);
35
36   static void OnButtonNotify(
37       void* data,
38       wl_pointer* input_pointer,
39       uint32_t serial,
40       uint32_t time,
41       uint32_t button,
42       uint32_t state);
43
44   static void OnAxisNotify(
45       void* data,
46       wl_pointer* input_pointer,
47       uint32_t time,
48       uint32_t axis,
49       int32_t value);
50
51   static void OnPointerEnter(
52       void* data,
53       wl_pointer* input_pointer,
54       uint32_t serial,
55       wl_surface* surface,
56       wl_fixed_t sx_w,
57       wl_fixed_t sy_w);
58
59   static void OnPointerLeave(
60       void* data,
61       wl_pointer* input_pointer,
62       uint32_t serial,
63       wl_surface* surface);
64
65   WaylandCursor* cursor_;
66   ui::EventConverterOzoneWayland* dispatcher_;
67   // Keeps track of the last position for the motion event. We want to
68   // dispatch this with events such as wheel or button which don't have a
69   // position associated on Wayland.
70   gfx::Point pointer_position_;
71   struct wl_pointer *input_pointer_;
72
73   DISALLOW_COPY_AND_ASSIGN(WaylandPointer);
74 };
75
76 }  // namespace ozonewayland
77
78 #endif  // OZONE_WAYLAND_INPUT_POINTER_H_