FreeRDP
uwac-priv.h
1 /*
2  * Copyright © 2014 David FORT <contact@hardening-consulting.com>
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that copyright
7  * notice and this permission notice appear in supporting documentation, and
8  * that the name of the copyright holders not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission. The copyright holders make no representations
11  * about the suitability of this software for any purpose. It is provided "as
12  * is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20  * OF THIS SOFTWARE.
21  */
22 
23 #ifndef UWAC_PRIV_H_
24 #define UWAC_PRIV_H_
25 
26 #include <uwac/config.h>
27 
28 #include <stdbool.h>
29 #include <wayland-client.h>
30 #include "xdg-shell-client-protocol.h"
31 #include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h"
32 #include "xdg-decoration-unstable-v1-client-protocol.h"
33 #include "server-decoration-client-protocol.h"
34 #include "viewporter-client-protocol.h"
35 
36 #ifdef BUILD_IVI
37 #include "ivi-application-client-protocol.h"
38 #endif
39 #ifdef BUILD_FULLSCREEN_SHELL
40 #include "fullscreen-shell-unstable-v1-client-protocol.h"
41 #endif
42 
43 #ifdef UWAC_HAVE_PIXMAN_REGION
44 #include <pixman-1/pixman.h>
45 #else
46 #include <freerdp/codec/region.h>
47 #endif
48 
49 #include <xkbcommon/xkbcommon.h>
50 
51 #include <uwac/uwac.h>
52 
53 extern UwacErrorHandler uwacErrorHandler;
54 
55 typedef struct uwac_task UwacTask;
56 
59 struct uwac_task
60 {
61  void (*run)(UwacTask* task, uint32_t events);
62  struct wl_list link;
63 };
64 
68 {
69  uint32_t name;
70  char* interface;
71  uint32_t version;
72  struct wl_list link;
73 };
74 typedef struct uwac_global UwacGlobal;
75 
77 typedef struct uwac_event_list_item UwacEventListItem;
78 
82 {
83  UwacEvent event;
84  UwacEventListItem *tail, *head;
85 };
86 
90 {
91  struct wl_list globals;
92 
93  struct wl_display* display;
94  struct wl_registry* registry;
95  struct wl_compositor* compositor;
96  struct wp_viewporter* viewporter;
97  struct wl_subcompositor* subcompositor;
98  struct wl_shell* shell;
99  struct xdg_toplevel* xdg_toplevel;
100  struct xdg_wm_base* xdg_base;
101  struct wl_data_device_manager* devicemanager;
102  struct zwp_keyboard_shortcuts_inhibit_manager_v1* keyboard_inhibit_manager;
103  struct zxdg_decoration_manager_v1* deco_manager;
104  struct org_kde_kwin_server_decoration_manager* kde_deco_manager;
105 #ifdef BUILD_IVI
106  struct ivi_application* ivi_application;
107 #endif
108 #ifdef BUILD_FULLSCREEN_SHELL
109  struct zwp_fullscreen_shell_v1* fullscreen_shell;
110 #endif
111 
112  struct wl_shm* shm;
113  enum wl_shm_format* shm_formats;
114  uint32_t shm_formats_nb;
115  bool has_rgb565;
116 
117  struct wl_data_device_manager* data_device_manager;
118  struct text_cursor_position* text_cursor_position;
119  struct workspace_manager* workspace_manager;
120 
121  struct wl_list seats;
122 
123  int display_fd;
124  UwacReturnCode last_error;
125  uint32_t display_fd_events;
126  int epoll_fd;
127  bool running;
128  UwacTask dispatch_fd_task;
129  uint32_t serial;
130  uint32_t pointer_focus_serial;
131  int actual_scale;
132 
133  struct wl_list windows;
134 
135  struct wl_list outputs;
136 
137  UwacEventListItem *push_queue, *pop_queue;
138 };
139 
142 {
143  UwacDisplay* display;
144 
145  bool doneNeeded;
146  bool doneReceived;
147 
148  UwacPosition position;
149  UwacSize resolution;
150  int transform;
151  int scale;
152  char* make;
153  char* model;
154  uint32_t server_output_id;
155  struct wl_output* output;
156 
157  struct wl_list link;
158  char* name;
159  char* description;
160 };
161 
163 struct uwac_seat
164 {
165  UwacDisplay* display;
166  char* name;
167  struct wl_seat* seat;
168  uint32_t seat_id;
169  uint32_t seat_version;
170  struct wl_data_device* data_device;
171  struct wl_data_source* data_source;
172  struct wl_pointer* pointer;
173  struct wl_surface* pointer_surface;
174  struct wl_cursor_image* pointer_image;
175  struct wl_cursor_theme* cursor_theme;
176  struct wl_cursor* default_cursor;
177  void* pointer_data;
178  size_t pointer_size;
179  int pointer_type;
180  struct wl_keyboard* keyboard;
181  struct wl_touch* touch;
182  struct wl_data_offer* offer;
183  struct xkb_context* xkb_context;
184  struct zwp_keyboard_shortcuts_inhibitor_v1* keyboard_inhibitor;
185 
186  struct
187  {
188  struct xkb_keymap* keymap;
189  struct xkb_state* state;
190  xkb_mod_mask_t control_mask;
191  xkb_mod_mask_t alt_mask;
192  xkb_mod_mask_t shift_mask;
193  xkb_mod_mask_t caps_mask;
194  xkb_mod_mask_t num_mask;
195  } xkb;
196  uint32_t modifiers;
197  int32_t repeat_rate_sec, repeat_rate_nsec;
198  int32_t repeat_delay_sec, repeat_delay_nsec;
199  uint32_t repeat_sym, repeat_key, repeat_time;
200 
201  struct wl_array pressed_keys;
202 
203  UwacWindow* pointer_focus;
204 
205  UwacWindow* keyboard_focus;
206 
207  UwacWindow* touch_focus;
208  bool touch_frame_started;
209 
210  int repeat_timer_fd;
211  UwacTask repeat_task;
212  double sx, sy;
213  struct wl_list link;
214 
215  void* data_context;
216  UwacDataTransferHandler transfer_data;
217  UwacCancelDataTransferHandler cancel_data;
218  bool ignore_announcement;
219 };
220 
223 {
224  bool used;
225  bool dirty;
226 #ifdef UWAC_HAVE_PIXMAN_REGION
227  pixman_region32_t damage;
228 #else
229  REGION16 damage;
230 #endif
231  struct wl_buffer* wayland_buffer;
232  void* data;
233  size_t size;
234 };
235 typedef struct uwac_buffer UwacBuffer;
236 
239 {
240  UwacDisplay* display;
241  int width, height, stride;
242  int surfaceStates;
243  enum wl_shm_format format;
244 
245  size_t nbuffers;
246  UwacBuffer* buffers;
247 
248  struct wl_region* opaque_region;
249  struct wl_region* input_region;
250  ssize_t drawingBufferIdx;
251  ssize_t pendingBufferIdx;
252  struct wl_surface* surface;
253  struct wp_viewport* viewport;
254  struct wl_shell_surface* shell_surface;
255  struct xdg_surface* xdg_surface;
256  struct xdg_toplevel* xdg_toplevel;
257  struct zxdg_toplevel_decoration_v1* deco;
258  struct org_kde_kwin_server_decoration* kde_deco;
259 #ifdef BUILD_IVI
260  struct ivi_surface* ivi_surface;
261 #endif
262  struct wl_list link;
263 
264  uint32_t pointer_enter_serial;
265  uint32_t pointer_cursor_serial;
266  int pointer_current_cursor;
267 };
268 
271 {
272  UwacWindow* window;
273  size_t bufferIdx;
274 };
275 typedef struct uwac_buffer_release_data UwacBufferReleaseData;
276 
277 /* in uwa-display.c */
278 UwacEvent* UwacDisplayNewEvent(UwacDisplay* d, int type);
279 int UwacDisplayWatchFd(UwacDisplay* display, int fd, uint32_t events, UwacTask* task);
280 
281 /* in uwac-input.c */
282 UwacSeat* UwacSeatNew(UwacDisplay* d, uint32_t id, uint32_t version);
283 void UwacSeatDestroy(UwacSeat* s);
284 
285 /* in uwac-output.c */
286 UwacOutput* UwacCreateOutput(UwacDisplay* d, uint32_t id, uint32_t version);
287 int UwacDestroyOutput(UwacOutput* output);
288 
289 UwacReturnCode UwacSeatRegisterClipboard(UwacSeat* s);
290 
291 #endif /* UWAC_PRIV_H_ */
data to pass to wl_buffer release listener
Definition: uwac-priv.h:271
a buffer used for drawing a surface frame
Definition: uwac-priv.h:223
main connection object to a wayland display
Definition: uwac-priv.h:90
double linked list element
Definition: uwac-priv.h:82
a global registry object
Definition: uwac-priv.h:68
an output on a wayland display
Definition: uwac-priv.h:142
a seat attached to a wayland display
Definition: uwac-priv.h:164
task struct
Definition: uwac-priv.h:60
a window
Definition: uwac-priv.h:239