- add sources.
[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 ozonewayland {
12
13 class WaylandCursor;
14 class WaylandDispatcher;
15 class WaylandWindow;
16
17 class WaylandPointer {
18  public:
19   WaylandPointer();
20   ~WaylandPointer();
21
22   void OnSeatCapabilities(wl_seat *seat, uint32_t caps);
23   WaylandCursor* Cursor() { return cursor_; }
24
25  private:
26   static void OnMotionNotify(
27       void* data,
28       wl_pointer* input_pointer,
29       uint32_t time,
30       wl_fixed_t sx_w,
31       wl_fixed_t sy_w);
32
33   static void OnButtonNotify(
34       void* data,
35       wl_pointer* input_pointer,
36       uint32_t serial,
37       uint32_t time,
38       uint32_t button,
39       uint32_t state);
40
41   static void OnAxisNotify(
42       void* data,
43       wl_pointer* input_pointer,
44       uint32_t time,
45       uint32_t axis,
46       int32_t value);
47
48   static void OnPointerEnter(
49       void* data,
50       wl_pointer* input_pointer,
51       uint32_t serial,
52       wl_surface* surface,
53       wl_fixed_t sx_w,
54       wl_fixed_t sy_w);
55
56   static void OnPointerLeave(
57       void* data,
58       wl_pointer* input_pointer,
59       uint32_t serial,
60       wl_surface* surface);
61
62   WaylandCursor* cursor_;
63   WaylandDispatcher* dispatcher_;
64   // Keeps track of current focused window.
65   unsigned focused_window_handle_;
66   // Keeps track of the last position for the motion event. We want to
67   // dispatch this with events such as wheel or button which don't have a
68   // position associated on Wayland.
69   gfx::Point pointer_position_;
70
71   DISALLOW_COPY_AND_ASSIGN(WaylandPointer);
72 };
73
74 }  // namespace ozonewayland
75
76 #endif  // OZONE_WAYLAND_INPUT_POINTER_H_