1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright © 2014 Intel Corporation
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software
5*4882a593Smuzhiyun * and its documentation for any purpose is hereby granted without
6*4882a593Smuzhiyun * fee, provided that the above copyright notice appear in all copies
7*4882a593Smuzhiyun * and that both that copyright notice and this permission notice
8*4882a593Smuzhiyun * appear in supporting documentation, and that the name of the
9*4882a593Smuzhiyun * copyright holders not be used in advertising or publicity
10*4882a593Smuzhiyun * pertaining to distribution of the software without specific,
11*4882a593Smuzhiyun * written prior permission. The copyright holders make no
12*4882a593Smuzhiyun * representations about the suitability of this software for any
13*4882a593Smuzhiyun * purpose. It is provided "as is" without express or implied
14*4882a593Smuzhiyun * warranty.
15*4882a593Smuzhiyun *
16*4882a593Smuzhiyun * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17*4882a593Smuzhiyun * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18*4882a593Smuzhiyun * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19*4882a593Smuzhiyun * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20*4882a593Smuzhiyun * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21*4882a593Smuzhiyun * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
22*4882a593Smuzhiyun * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23*4882a593Smuzhiyun * SOFTWARE.
24*4882a593Smuzhiyun */
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun #ifndef XWAYLAND_H
27*4882a593Smuzhiyun #define XWAYLAND_H
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun #include <xwayland-config.h>
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun #include <stdio.h>
32*4882a593Smuzhiyun #include <unistd.h>
33*4882a593Smuzhiyun #include <errno.h>
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun #include <wayland-client.h>
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun #include <X11/X.h>
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun #include <fb.h>
40*4882a593Smuzhiyun #include <input.h>
41*4882a593Smuzhiyun #include <dix.h>
42*4882a593Smuzhiyun #include <randrstr.h>
43*4882a593Smuzhiyun #include <exevents.h>
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun #include "relative-pointer-unstable-v1-client-protocol.h"
46*4882a593Smuzhiyun #include "pointer-constraints-unstable-v1-client-protocol.h"
47*4882a593Smuzhiyun #include "tablet-unstable-v2-client-protocol.h"
48*4882a593Smuzhiyun #include "xwayland-keyboard-grab-unstable-v1-client-protocol.h"
49*4882a593Smuzhiyun #include "xdg-output-unstable-v1-client-protocol.h"
50*4882a593Smuzhiyun #include "linux-dmabuf-unstable-v1-client-protocol.h"
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun struct xwl_format {
53*4882a593Smuzhiyun uint32_t format;
54*4882a593Smuzhiyun int num_modifiers;
55*4882a593Smuzhiyun uint64_t *modifiers;
56*4882a593Smuzhiyun };
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun struct xwl_pixmap;
59*4882a593Smuzhiyun struct xwl_window;
60*4882a593Smuzhiyun struct xwl_screen;
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun struct xwl_egl_backend {
63*4882a593Smuzhiyun /* Set by the backend if available */
64*4882a593Smuzhiyun Bool is_available;
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun /* Called once for each interface in the global registry. Backends
67*4882a593Smuzhiyun * should use this to bind to any wayland interfaces they need.
68*4882a593Smuzhiyun */
69*4882a593Smuzhiyun Bool (*init_wl_registry)(struct xwl_screen *xwl_screen,
70*4882a593Smuzhiyun struct wl_registry *wl_registry,
71*4882a593Smuzhiyun uint32_t id, const char *name,
72*4882a593Smuzhiyun uint32_t version);
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun /* Check that the required Wayland interfaces are available.
75*4882a593Smuzhiyun */
76*4882a593Smuzhiyun Bool (*has_wl_interfaces)(struct xwl_screen *xwl_screen);
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun /* Called before glamor has been initialized. Backends should setup a
79*4882a593Smuzhiyun * valid, glamor compatible EGL context in this hook.
80*4882a593Smuzhiyun */
81*4882a593Smuzhiyun Bool (*init_egl)(struct xwl_screen *xwl_screen);
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun /* Called after glamor has been initialized, and after all of the
84*4882a593Smuzhiyun * common Xwayland DDX hooks have been connected. Backends should use
85*4882a593Smuzhiyun * this to setup any required wraps around X server callbacks like
86*4882a593Smuzhiyun * CreatePixmap.
87*4882a593Smuzhiyun */
88*4882a593Smuzhiyun Bool (*init_screen)(struct xwl_screen *xwl_screen);
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun /* Called by Xwayland to retrieve a pointer to a valid wl_buffer for
91*4882a593Smuzhiyun * the given window/pixmap combo so that damage to the pixmap may be
92*4882a593Smuzhiyun * displayed on-screen. Backends should use this to create a new
93*4882a593Smuzhiyun * wl_buffer for a currently buffer-less pixmap, or simply return the
94*4882a593Smuzhiyun * pixmap they've prepared beforehand.
95*4882a593Smuzhiyun */
96*4882a593Smuzhiyun struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap,
97*4882a593Smuzhiyun Bool *created);
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun /* Called by Xwayland to perform any pre-wl_surface damage routines
100*4882a593Smuzhiyun * that are required by the backend. If your backend is poorly
101*4882a593Smuzhiyun * designed and lacks the ability to render directly to a surface,
102*4882a593Smuzhiyun * you should implement blitting from the glamor pixmap to the wayland
103*4882a593Smuzhiyun * pixmap here. Otherwise, this callback is optional.
104*4882a593Smuzhiyun */
105*4882a593Smuzhiyun void (*post_damage)(struct xwl_window *xwl_window,
106*4882a593Smuzhiyun PixmapPtr pixmap, RegionPtr region);
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun /* Called by Xwayland to confirm with the egl backend that the given
109*4882a593Smuzhiyun * pixmap is completely setup and ready for display on-screen. This
110*4882a593Smuzhiyun * callback is optional.
111*4882a593Smuzhiyun */
112*4882a593Smuzhiyun Bool (*allow_commits)(struct xwl_window *xwl_window);
113*4882a593Smuzhiyun };
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun struct xwl_screen {
116*4882a593Smuzhiyun int width;
117*4882a593Smuzhiyun int height;
118*4882a593Smuzhiyun int depth;
119*4882a593Smuzhiyun ScreenPtr screen;
120*4882a593Smuzhiyun int expecting_event;
121*4882a593Smuzhiyun enum RootClipMode root_clip_mode;
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun int wm_fd;
124*4882a593Smuzhiyun int listen_fds[5];
125*4882a593Smuzhiyun int listen_fd_count;
126*4882a593Smuzhiyun int rootless;
127*4882a593Smuzhiyun int glamor;
128*4882a593Smuzhiyun int present;
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun CreateScreenResourcesProcPtr CreateScreenResources;
131*4882a593Smuzhiyun CloseScreenProcPtr CloseScreen;
132*4882a593Smuzhiyun RealizeWindowProcPtr RealizeWindow;
133*4882a593Smuzhiyun UnrealizeWindowProcPtr UnrealizeWindow;
134*4882a593Smuzhiyun DestroyWindowProcPtr DestroyWindow;
135*4882a593Smuzhiyun XYToWindowProcPtr XYToWindow;
136*4882a593Smuzhiyun SetWindowPixmapProcPtr SetWindowPixmap;
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun struct xorg_list output_list;
139*4882a593Smuzhiyun struct xorg_list seat_list;
140*4882a593Smuzhiyun struct xorg_list damage_window_list;
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun int wayland_fd;
143*4882a593Smuzhiyun struct wl_display *display;
144*4882a593Smuzhiyun struct wl_registry *registry;
145*4882a593Smuzhiyun struct wl_registry *input_registry;
146*4882a593Smuzhiyun struct wl_compositor *compositor;
147*4882a593Smuzhiyun struct zwp_tablet_manager_v2 *tablet_manager;
148*4882a593Smuzhiyun struct wl_shm *shm;
149*4882a593Smuzhiyun struct wl_shell *shell;
150*4882a593Smuzhiyun struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
151*4882a593Smuzhiyun struct zwp_pointer_constraints_v1 *pointer_constraints;
152*4882a593Smuzhiyun struct zwp_xwayland_keyboard_grab_manager_v1 *wp_grab;
153*4882a593Smuzhiyun struct zxdg_output_manager_v1 *xdg_output_manager;
154*4882a593Smuzhiyun uint32_t serial;
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun #define XWL_FORMAT_ARGB8888 (1 << 0)
157*4882a593Smuzhiyun #define XWL_FORMAT_XRGB8888 (1 << 1)
158*4882a593Smuzhiyun #define XWL_FORMAT_RGB565 (1 << 2)
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun int prepare_read;
161*4882a593Smuzhiyun int wait_flush;
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun uint32_t num_formats;
164*4882a593Smuzhiyun struct xwl_format *formats;
165*4882a593Smuzhiyun void *egl_display, *egl_context;
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun struct xwl_egl_backend gbm_backend;
168*4882a593Smuzhiyun struct xwl_egl_backend eglstream_backend;
169*4882a593Smuzhiyun /* pointer to the current backend for creating pixmaps on wayland */
170*4882a593Smuzhiyun struct xwl_egl_backend *egl_backend;
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun struct glamor_context *glamor_ctx;
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun Atom allow_commits_prop;
175*4882a593Smuzhiyun };
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun struct xwl_window {
178*4882a593Smuzhiyun struct xwl_screen *xwl_screen;
179*4882a593Smuzhiyun struct wl_surface *surface;
180*4882a593Smuzhiyun struct wl_shell_surface *shell_surface;
181*4882a593Smuzhiyun WindowPtr window;
182*4882a593Smuzhiyun struct xorg_list link_damage;
183*4882a593Smuzhiyun struct wl_callback *frame_callback;
184*4882a593Smuzhiyun Bool allow_commits;
185*4882a593Smuzhiyun #ifdef GLAMOR_HAS_GBM
186*4882a593Smuzhiyun struct xorg_list frame_callback_list;
187*4882a593Smuzhiyun Bool present_flipped;
188*4882a593Smuzhiyun #endif
189*4882a593Smuzhiyun };
190*4882a593Smuzhiyun
191*4882a593Smuzhiyun #ifdef GLAMOR_HAS_GBM
192*4882a593Smuzhiyun struct xwl_present_window {
193*4882a593Smuzhiyun struct xwl_screen *xwl_screen;
194*4882a593Smuzhiyun struct xwl_present_event *sync_flip;
195*4882a593Smuzhiyun WindowPtr window;
196*4882a593Smuzhiyun struct xorg_list frame_callback_list;
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun uint64_t msc;
199*4882a593Smuzhiyun uint64_t ust;
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun OsTimerPtr frame_timer;
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun struct wl_callback *sync_callback;
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun struct xorg_list event_list;
206*4882a593Smuzhiyun struct xorg_list release_queue;
207*4882a593Smuzhiyun };
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun struct xwl_present_event {
210*4882a593Smuzhiyun uint64_t event_id;
211*4882a593Smuzhiyun uint64_t target_msc;
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun Bool abort;
214*4882a593Smuzhiyun Bool pending;
215*4882a593Smuzhiyun Bool buffer_released;
216*4882a593Smuzhiyun
217*4882a593Smuzhiyun struct xwl_present_window *xwl_present_window;
218*4882a593Smuzhiyun PixmapPtr pixmap;
219*4882a593Smuzhiyun
220*4882a593Smuzhiyun struct xorg_list list;
221*4882a593Smuzhiyun };
222*4882a593Smuzhiyun #endif
223*4882a593Smuzhiyun
224*4882a593Smuzhiyun #define MODIFIER_META 0x01
225*4882a593Smuzhiyun
226*4882a593Smuzhiyun struct xwl_touch {
227*4882a593Smuzhiyun struct xwl_window *window;
228*4882a593Smuzhiyun int32_t id;
229*4882a593Smuzhiyun int x, y;
230*4882a593Smuzhiyun struct xorg_list link_touch;
231*4882a593Smuzhiyun };
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun struct xwl_pointer_warp_emulator {
234*4882a593Smuzhiyun struct xwl_seat *xwl_seat;
235*4882a593Smuzhiyun struct xwl_window *locked_window;
236*4882a593Smuzhiyun struct zwp_locked_pointer_v1 *locked_pointer;
237*4882a593Smuzhiyun };
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun struct xwl_cursor {
240*4882a593Smuzhiyun void (* update_proc) (struct xwl_cursor *);
241*4882a593Smuzhiyun struct wl_surface *surface;
242*4882a593Smuzhiyun struct wl_callback *frame_cb;
243*4882a593Smuzhiyun Bool needs_update;
244*4882a593Smuzhiyun };
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun struct xwl_seat {
247*4882a593Smuzhiyun DeviceIntPtr pointer;
248*4882a593Smuzhiyun DeviceIntPtr relative_pointer;
249*4882a593Smuzhiyun DeviceIntPtr keyboard;
250*4882a593Smuzhiyun DeviceIntPtr touch;
251*4882a593Smuzhiyun DeviceIntPtr stylus;
252*4882a593Smuzhiyun DeviceIntPtr eraser;
253*4882a593Smuzhiyun DeviceIntPtr puck;
254*4882a593Smuzhiyun struct xwl_screen *xwl_screen;
255*4882a593Smuzhiyun struct wl_seat *seat;
256*4882a593Smuzhiyun struct wl_pointer *wl_pointer;
257*4882a593Smuzhiyun struct zwp_relative_pointer_v1 *wp_relative_pointer;
258*4882a593Smuzhiyun struct wl_keyboard *wl_keyboard;
259*4882a593Smuzhiyun struct wl_touch *wl_touch;
260*4882a593Smuzhiyun struct zwp_tablet_seat_v2 *tablet_seat;
261*4882a593Smuzhiyun struct wl_array keys;
262*4882a593Smuzhiyun struct xwl_window *focus_window;
263*4882a593Smuzhiyun struct xwl_window *tablet_focus_window;
264*4882a593Smuzhiyun uint32_t id;
265*4882a593Smuzhiyun uint32_t pointer_enter_serial;
266*4882a593Smuzhiyun struct xorg_list link;
267*4882a593Smuzhiyun CursorPtr x_cursor;
268*4882a593Smuzhiyun struct xwl_cursor cursor;
269*4882a593Smuzhiyun WindowPtr last_xwindow;
270*4882a593Smuzhiyun
271*4882a593Smuzhiyun struct xorg_list touches;
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun size_t keymap_size;
274*4882a593Smuzhiyun char *keymap;
275*4882a593Smuzhiyun struct wl_surface *keyboard_focus;
276*4882a593Smuzhiyun
277*4882a593Smuzhiyun struct xorg_list axis_discrete_pending;
278*4882a593Smuzhiyun struct xorg_list sync_pending;
279*4882a593Smuzhiyun
280*4882a593Smuzhiyun struct xwl_pointer_warp_emulator *pointer_warp_emulator;
281*4882a593Smuzhiyun
282*4882a593Smuzhiyun struct xwl_window *cursor_confinement_window;
283*4882a593Smuzhiyun struct zwp_confined_pointer_v1 *confined_pointer;
284*4882a593Smuzhiyun
285*4882a593Smuzhiyun struct {
286*4882a593Smuzhiyun Bool has_absolute;
287*4882a593Smuzhiyun wl_fixed_t x;
288*4882a593Smuzhiyun wl_fixed_t y;
289*4882a593Smuzhiyun
290*4882a593Smuzhiyun Bool has_relative;
291*4882a593Smuzhiyun double dx;
292*4882a593Smuzhiyun double dy;
293*4882a593Smuzhiyun double dx_unaccel;
294*4882a593Smuzhiyun double dy_unaccel;
295*4882a593Smuzhiyun } pending_pointer_event;
296*4882a593Smuzhiyun
297*4882a593Smuzhiyun struct xorg_list tablets;
298*4882a593Smuzhiyun struct xorg_list tablet_tools;
299*4882a593Smuzhiyun struct xorg_list tablet_pads;
300*4882a593Smuzhiyun struct zwp_xwayland_keyboard_grab_v1 *keyboard_grab;
301*4882a593Smuzhiyun };
302*4882a593Smuzhiyun
303*4882a593Smuzhiyun struct xwl_tablet {
304*4882a593Smuzhiyun struct xorg_list link;
305*4882a593Smuzhiyun struct zwp_tablet_v2 *tablet;
306*4882a593Smuzhiyun struct xwl_seat *seat;
307*4882a593Smuzhiyun };
308*4882a593Smuzhiyun
309*4882a593Smuzhiyun struct xwl_tablet_tool {
310*4882a593Smuzhiyun struct xorg_list link;
311*4882a593Smuzhiyun struct zwp_tablet_tool_v2 *tool;
312*4882a593Smuzhiyun struct xwl_seat *seat;
313*4882a593Smuzhiyun
314*4882a593Smuzhiyun DeviceIntPtr xdevice;
315*4882a593Smuzhiyun uint32_t proximity_in_serial;
316*4882a593Smuzhiyun double x;
317*4882a593Smuzhiyun double y;
318*4882a593Smuzhiyun uint32_t pressure;
319*4882a593Smuzhiyun double tilt_x;
320*4882a593Smuzhiyun double tilt_y;
321*4882a593Smuzhiyun double rotation;
322*4882a593Smuzhiyun double slider;
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun uint32_t buttons_now,
325*4882a593Smuzhiyun buttons_prev;
326*4882a593Smuzhiyun
327*4882a593Smuzhiyun int32_t wheel_clicks;
328*4882a593Smuzhiyun
329*4882a593Smuzhiyun struct xwl_cursor cursor;
330*4882a593Smuzhiyun };
331*4882a593Smuzhiyun
332*4882a593Smuzhiyun struct xwl_tablet_pad_ring {
333*4882a593Smuzhiyun unsigned int index;
334*4882a593Smuzhiyun struct xorg_list link;
335*4882a593Smuzhiyun struct xwl_tablet_pad_group *group;
336*4882a593Smuzhiyun struct zwp_tablet_pad_ring_v2 *ring;
337*4882a593Smuzhiyun };
338*4882a593Smuzhiyun
339*4882a593Smuzhiyun struct xwl_tablet_pad_strip {
340*4882a593Smuzhiyun unsigned int index;
341*4882a593Smuzhiyun struct xorg_list link;
342*4882a593Smuzhiyun struct xwl_tablet_pad_group *group;
343*4882a593Smuzhiyun struct zwp_tablet_pad_strip_v2 *strip;
344*4882a593Smuzhiyun };
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun struct xwl_tablet_pad_group {
347*4882a593Smuzhiyun struct xorg_list link;
348*4882a593Smuzhiyun struct xwl_tablet_pad *pad;
349*4882a593Smuzhiyun struct zwp_tablet_pad_group_v2 *group;
350*4882a593Smuzhiyun
351*4882a593Smuzhiyun struct xorg_list pad_group_ring_list;
352*4882a593Smuzhiyun struct xorg_list pad_group_strip_list;
353*4882a593Smuzhiyun };
354*4882a593Smuzhiyun
355*4882a593Smuzhiyun struct xwl_tablet_pad {
356*4882a593Smuzhiyun struct xorg_list link;
357*4882a593Smuzhiyun struct zwp_tablet_pad_v2 *pad;
358*4882a593Smuzhiyun struct xwl_seat *seat;
359*4882a593Smuzhiyun
360*4882a593Smuzhiyun DeviceIntPtr xdevice;
361*4882a593Smuzhiyun
362*4882a593Smuzhiyun unsigned int nbuttons;
363*4882a593Smuzhiyun struct xorg_list pad_group_list;
364*4882a593Smuzhiyun };
365*4882a593Smuzhiyun
366*4882a593Smuzhiyun struct xwl_output {
367*4882a593Smuzhiyun struct xorg_list link;
368*4882a593Smuzhiyun struct wl_output *output;
369*4882a593Smuzhiyun struct zxdg_output_v1 *xdg_output;
370*4882a593Smuzhiyun uint32_t server_output_id;
371*4882a593Smuzhiyun struct xwl_screen *xwl_screen;
372*4882a593Smuzhiyun RROutputPtr randr_output;
373*4882a593Smuzhiyun RRCrtcPtr randr_crtc;
374*4882a593Smuzhiyun int32_t x, y, width, height, refresh;
375*4882a593Smuzhiyun Rotation rotation;
376*4882a593Smuzhiyun Bool wl_output_done;
377*4882a593Smuzhiyun Bool xdg_output_done;
378*4882a593Smuzhiyun };
379*4882a593Smuzhiyun
380*4882a593Smuzhiyun void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
381*4882a593Smuzhiyun
382*4882a593Smuzhiyun void xwl_sync_events (struct xwl_screen *xwl_screen);
383*4882a593Smuzhiyun
384*4882a593Smuzhiyun void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);
385*4882a593Smuzhiyun
386*4882a593Smuzhiyun Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
387*4882a593Smuzhiyun
388*4882a593Smuzhiyun struct xwl_screen *xwl_screen_get(ScreenPtr screen);
389*4882a593Smuzhiyun
390*4882a593Smuzhiyun void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
391*4882a593Smuzhiyun void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
392*4882a593Smuzhiyun
393*4882a593Smuzhiyun void xwl_seat_destroy(struct xwl_seat *xwl_seat);
394*4882a593Smuzhiyun
395*4882a593Smuzhiyun void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window);
396*4882a593Smuzhiyun
397*4882a593Smuzhiyun void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat,
398*4882a593Smuzhiyun struct xwl_window *xwl_window,
399*4882a593Smuzhiyun SpritePtr sprite,
400*4882a593Smuzhiyun int x, int y);
401*4882a593Smuzhiyun
402*4882a593Smuzhiyun void xwl_seat_destroy_pointer_warp_emulator(struct xwl_seat *xwl_seat);
403*4882a593Smuzhiyun
404*4882a593Smuzhiyun void xwl_seat_cursor_visibility_changed(struct xwl_seat *xwl_seat);
405*4882a593Smuzhiyun
406*4882a593Smuzhiyun void xwl_seat_confine_pointer(struct xwl_seat *xwl_seat,
407*4882a593Smuzhiyun struct xwl_window *xwl_window);
408*4882a593Smuzhiyun void xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat);
409*4882a593Smuzhiyun
410*4882a593Smuzhiyun Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
411*4882a593Smuzhiyun
412*4882a593Smuzhiyun struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
413*4882a593Smuzhiyun uint32_t id);
414*4882a593Smuzhiyun
415*4882a593Smuzhiyun void xwl_output_destroy(struct xwl_output *xwl_output);
416*4882a593Smuzhiyun
417*4882a593Smuzhiyun void xwl_output_remove(struct xwl_output *xwl_output);
418*4882a593Smuzhiyun
419*4882a593Smuzhiyun RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
420*4882a593Smuzhiyun float VRefresh, Bool Reduced, Bool Interlaced);
421*4882a593Smuzhiyun
422*4882a593Smuzhiyun void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
423*4882a593Smuzhiyun struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
424*4882a593Smuzhiyun
425*4882a593Smuzhiyun struct xwl_window *xwl_window_from_window(WindowPtr window);
426*4882a593Smuzhiyun
427*4882a593Smuzhiyun Bool xwl_shm_create_screen_resources(ScreenPtr screen);
428*4882a593Smuzhiyun PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height,
429*4882a593Smuzhiyun int depth, unsigned int hint);
430*4882a593Smuzhiyun Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
431*4882a593Smuzhiyun struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
432*4882a593Smuzhiyun
433*4882a593Smuzhiyun #ifdef XWL_HAS_GLAMOR
434*4882a593Smuzhiyun void xwl_glamor_init_backends(struct xwl_screen *xwl_screen,
435*4882a593Smuzhiyun Bool use_eglstream);
436*4882a593Smuzhiyun void xwl_glamor_select_backend(struct xwl_screen *xwl_screen,
437*4882a593Smuzhiyun Bool use_eglstream);
438*4882a593Smuzhiyun Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
439*4882a593Smuzhiyun
440*4882a593Smuzhiyun Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen,
441*4882a593Smuzhiyun uint32_t id, uint32_t version);
442*4882a593Smuzhiyun Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen,
443*4882a593Smuzhiyun uint32_t id, uint32_t version);
444*4882a593Smuzhiyun struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
445*4882a593Smuzhiyun Bool *created);
446*4882a593Smuzhiyun void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
447*4882a593Smuzhiyun struct wl_registry *registry,
448*4882a593Smuzhiyun uint32_t id, const char *interface,
449*4882a593Smuzhiyun uint32_t version);
450*4882a593Smuzhiyun Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
451*4882a593Smuzhiyun struct xwl_egl_backend *xwl_egl_backend);
452*4882a593Smuzhiyun void xwl_glamor_post_damage(struct xwl_window *xwl_window,
453*4882a593Smuzhiyun PixmapPtr pixmap, RegionPtr region);
454*4882a593Smuzhiyun Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
455*4882a593Smuzhiyun void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
456*4882a593Smuzhiyun
457*4882a593Smuzhiyun #ifdef GLAMOR_HAS_GBM
458*4882a593Smuzhiyun void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
459*4882a593Smuzhiyun Bool xwl_present_init(ScreenPtr screen);
460*4882a593Smuzhiyun void xwl_present_cleanup(WindowPtr window);
461*4882a593Smuzhiyun void xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window);
462*4882a593Smuzhiyun #endif /* GLAMOR_HAS_GBM */
463*4882a593Smuzhiyun
464*4882a593Smuzhiyun #ifdef XV
465*4882a593Smuzhiyun /* glamor Xv Adaptor */
466*4882a593Smuzhiyun Bool xwl_glamor_xv_init(ScreenPtr pScreen);
467*4882a593Smuzhiyun #endif /* XV */
468*4882a593Smuzhiyun
469*4882a593Smuzhiyun #endif /* XWL_HAS_GLAMOR */
470*4882a593Smuzhiyun
471*4882a593Smuzhiyun void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
472*4882a593Smuzhiyun
473*4882a593Smuzhiyun void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
474*4882a593Smuzhiyun
475*4882a593Smuzhiyun #ifdef XF86VIDMODE
476*4882a593Smuzhiyun void xwlVidModeExtensionInit(void);
477*4882a593Smuzhiyun #endif
478*4882a593Smuzhiyun
479*4882a593Smuzhiyun #ifdef GLAMOR_HAS_GBM
480*4882a593Smuzhiyun void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen);
481*4882a593Smuzhiyun #else
xwl_glamor_init_gbm(struct xwl_screen * xwl_screen)482*4882a593Smuzhiyun static inline void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
483*4882a593Smuzhiyun {
484*4882a593Smuzhiyun }
485*4882a593Smuzhiyun #endif
486*4882a593Smuzhiyun
487*4882a593Smuzhiyun #ifdef XWL_HAS_EGLSTREAM
488*4882a593Smuzhiyun void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen);
489*4882a593Smuzhiyun #else
xwl_glamor_init_eglstream(struct xwl_screen * xwl_screen)490*4882a593Smuzhiyun static inline void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen)
491*4882a593Smuzhiyun {
492*4882a593Smuzhiyun }
493*4882a593Smuzhiyun #endif
494*4882a593Smuzhiyun
495*4882a593Smuzhiyun #endif
496