7a566bb4bfaa3f842477209a18da0c9401eb648d
[platform/core/uifw/libds-tizen.git] / src / libds / seat / seat_private.h
1 #ifndef DS_SEAT_PRIVATE_H
2 #define DS_SEAT_PRIVATE_H
3
4 #include <time.h>
5 #include <wayland-server.h>
6
7 #include "libds/seat.h"
8 #include "seat.h"
9 #include "surface.h"
10
11 struct ds_seat_client
12 {
13     struct ds_seat *seat;
14     struct wl_client *wl_client;
15     struct wl_list link;
16
17     struct wl_list resources; // wl_seat
18     struct wl_list pointers; // wl_pointer
19     struct wl_list keyboards; // wl_keyboard
20     struct wl_list touches; // wl_touch
21
22     struct {
23         struct wl_signal destroy;
24     } events;
25
26     bool needs_touch_frame;
27 };
28
29 #define DS_POINTER_BUTTONS_CAP 16
30
31 struct ds_seat_pointer
32 {
33     struct ds_seat *seat;
34     struct ds_seat_client *focused_client;
35     struct ds_surface *focused_surface;
36     double sx, sy;
37
38     struct ds_seat_pointer_grab *grab;
39     struct ds_seat_pointer_grab *default_grab;
40
41     bool sent_axis_source;
42     enum ds_axis_source cached_axis_source;
43
44     uint32_t buttons[DS_POINTER_BUTTONS_CAP];
45     size_t button_count;
46     uint32_t grab_button;
47     uint32_t grab_serial;
48     uint32_t grab_time;
49
50     struct wl_listener surface_destroy;
51
52     struct {
53         struct wl_signal focus_change;
54     } events;
55 };
56
57 struct ds_seat_keyboard
58 {
59     struct ds_seat *seat;
60
61     struct ds_seat_client *focused_client;
62     struct ds_surface *focused_surface;
63
64     struct wl_listener surface_destroy;
65
66     struct ds_seat_keyboard_grab *grab;
67     struct ds_seat_keyboard_grab *default_grab;
68
69     struct {
70         struct wl_signal focus_change;
71     } events;
72 };
73
74 struct ds_touch_point
75 {
76     int32_t touch_id;
77     struct ds_surface *surface;
78     struct ds_seat_client *seat_client;
79
80     struct ds_seat_client *focused_client;
81     struct ds_surface *focused_surface;
82     double sx, sy;
83
84     struct wl_listener surface_destroy;
85     struct wl_listener focused_surface_destroy;
86     struct wl_listener client_destroy;
87
88     struct {
89         struct wl_signal destroy;
90     } events;
91
92     struct wl_list link;
93 };
94
95 struct ds_seat_touch
96 {
97     struct ds_seat *seat;
98     struct wl_list touch_points; // ds_touch_point::link
99
100     uint32_t grab_serial;
101     uint32_t grab_id;
102
103     struct ds_seat_touch_grab *grab;
104     struct ds_seat_touch_grab *default_grab;
105 };
106
107 struct ds_seat
108 {
109     char *name;
110     enum wl_seat_capability capabilities;
111     enum wl_seat_capability accumulated_capabilities;
112     struct timespec last_event;
113
114     struct wl_display *display;
115     struct wl_global *global;
116
117     struct wl_list clients; // ds_seat_client::link
118
119     struct ds_seat_pointer pointer;
120     struct ds_seat_keyboard keyboard;
121     struct ds_seat_touch touch;
122
123     struct wl_listener display_destroy;
124
125     struct {
126         struct wl_signal destroy;
127
128         struct wl_signal pointer_grab_begin;
129         struct wl_signal pointer_grab_end;
130
131         struct wl_signal keyboard_grab_begin;
132         struct wl_signal keyboard_grab_end;
133
134         struct wl_signal touch_grab_begin;
135         struct wl_signal touch_grab_end;
136     } events;
137 };
138
139 struct ds_seat_client *
140 seat_client_for_wl_client(struct ds_seat *seat, struct wl_client *wl_client);
141
142 bool seat_pointer_init(struct ds_seat *seat);
143
144 void seat_pointer_finish(struct ds_seat *seat);
145
146 void seat_client_add_pointer_resource(struct ds_seat_client *seat_client,
147         uint32_t version, uint32_t id);
148
149 void
150 seat_client_remove_all_pointer_resources(struct ds_seat_client *seat_client);
151
152 bool seat_keyboard_init(struct ds_seat *seat);
153
154 void seat_keyboard_finish(struct ds_seat *seat);
155
156 void seat_client_add_keyboard_resource(struct ds_seat_client *seat_client,
157         uint32_t version, uint32_t id);
158
159 void
160 seat_client_remove_all_keyboard_resources(struct ds_seat_client *seat_client);
161
162 bool seat_touch_init(struct ds_seat *seat);
163
164 void seat_touch_finish(struct ds_seat *seat);
165
166 void seat_client_add_touch_resource(struct ds_seat_client *seat_client,
167         uint32_t version, uint32_t id);
168
169 void
170 seat_client_remove_all_touch_resources(struct ds_seat_client *seat_client);
171
172 #endif