1 | /*
|
---|
2 | * Copyright © 2014 Intel Corporation
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, distribute, and sell this software
|
---|
5 | * and its documentation for any purpose is hereby granted without
|
---|
6 | * fee, provided that the above copyright notice appear in all copies
|
---|
7 | * and that both that copyright notice and this permission notice
|
---|
8 | * appear in supporting documentation, and that the name of the
|
---|
9 | * copyright holders not be used in advertising or publicity
|
---|
10 | * pertaining to distribution of the software without specific,
|
---|
11 | * written prior permission. The copyright holders make no
|
---|
12 | * representations about the suitability of this software for any
|
---|
13 | * purpose. It is provided "as is" without express or implied
|
---|
14 | * warranty.
|
---|
15 | *
|
---|
16 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
---|
17 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
---|
18 | * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
---|
19 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
20 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
---|
21 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
---|
22 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
23 | * SOFTWARE.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef XWAYLAND_H
|
---|
27 | #define XWAYLAND_H
|
---|
28 |
|
---|
29 | #include <dix-config.h>
|
---|
30 |
|
---|
31 | #include <stdio.h>
|
---|
32 | #include <unistd.h>
|
---|
33 | #include <errno.h>
|
---|
34 |
|
---|
35 | #include <wayland-client.h>
|
---|
36 |
|
---|
37 | #include <X11/X.h>
|
---|
38 |
|
---|
39 | #include <fb.h>
|
---|
40 | #include <input.h>
|
---|
41 | #include <dix.h>
|
---|
42 | #include <randrstr.h>
|
---|
43 | #include <exevents.h>
|
---|
44 |
|
---|
45 | struct xwl_screen {
|
---|
46 | int width;
|
---|
47 | int height;
|
---|
48 | int depth;
|
---|
49 | ScreenPtr screen;
|
---|
50 | WindowPtr pointer_limbo_window;
|
---|
51 | int expecting_event;
|
---|
52 |
|
---|
53 | int wm_fd;
|
---|
54 | int listen_fds[5];
|
---|
55 | int listen_fd_count;
|
---|
56 | int rootless;
|
---|
57 | int glamor;
|
---|
58 |
|
---|
59 | CreateScreenResourcesProcPtr CreateScreenResources;
|
---|
60 | CloseScreenProcPtr CloseScreen;
|
---|
61 | CreateWindowProcPtr CreateWindow;
|
---|
62 | DestroyWindowProcPtr DestroyWindow;
|
---|
63 | RealizeWindowProcPtr RealizeWindow;
|
---|
64 | UnrealizeWindowProcPtr UnrealizeWindow;
|
---|
65 | XYToWindowProcPtr XYToWindow;
|
---|
66 |
|
---|
67 | struct xorg_list output_list;
|
---|
68 | struct xorg_list seat_list;
|
---|
69 | struct xorg_list damage_window_list;
|
---|
70 |
|
---|
71 | int wayland_fd;
|
---|
72 | struct wl_display *display;
|
---|
73 | struct wl_registry *registry;
|
---|
74 | struct wl_registry *input_registry;
|
---|
75 | struct wl_compositor *compositor;
|
---|
76 | struct wl_shm *shm;
|
---|
77 | struct wl_shell *shell;
|
---|
78 |
|
---|
79 | uint32_t serial;
|
---|
80 |
|
---|
81 | #define XWL_FORMAT_ARGB8888 (1 << 0)
|
---|
82 | #define XWL_FORMAT_XRGB8888 (1 << 1)
|
---|
83 | #define XWL_FORMAT_RGB565 (1 << 2)
|
---|
84 |
|
---|
85 | int prepare_read;
|
---|
86 |
|
---|
87 | char *device_name;
|
---|
88 | int drm_fd;
|
---|
89 | int fd_render_node;
|
---|
90 | struct wl_drm *drm;
|
---|
91 | uint32_t formats;
|
---|
92 | uint32_t capabilities;
|
---|
93 | void *egl_display, *egl_context;
|
---|
94 | struct gbm_device *gbm;
|
---|
95 | struct glamor_context *glamor_ctx;
|
---|
96 | };
|
---|
97 |
|
---|
98 | struct xwl_window {
|
---|
99 | struct xwl_screen *xwl_screen;
|
---|
100 | struct wl_surface *surface;
|
---|
101 | struct wl_shell_surface *shell_surface;
|
---|
102 | WindowPtr window;
|
---|
103 | DamagePtr damage;
|
---|
104 | struct xorg_list link_damage;
|
---|
105 | struct wl_callback *frame_callback;
|
---|
106 | };
|
---|
107 |
|
---|
108 | #define MODIFIER_META 0x01
|
---|
109 |
|
---|
110 | struct xwl_seat {
|
---|
111 | DeviceIntPtr pointer;
|
---|
112 | DeviceIntPtr keyboard;
|
---|
113 | struct xwl_screen *xwl_screen;
|
---|
114 | struct wl_seat *seat;
|
---|
115 | struct wl_pointer *wl_pointer;
|
---|
116 | struct wl_keyboard *wl_keyboard;
|
---|
117 | struct wl_array keys;
|
---|
118 | struct wl_surface *cursor;
|
---|
119 | struct xwl_window *focus_window;
|
---|
120 | uint32_t id;
|
---|
121 | uint32_t pointer_enter_serial;
|
---|
122 | struct xorg_list link;
|
---|
123 | CursorPtr x_cursor;
|
---|
124 |
|
---|
125 | wl_fixed_t horizontal_scroll;
|
---|
126 | wl_fixed_t vertical_scroll;
|
---|
127 | uint32_t scroll_time;
|
---|
128 |
|
---|
129 | size_t keymap_size;
|
---|
130 | char *keymap;
|
---|
131 | struct wl_surface *keyboard_focus;
|
---|
132 | };
|
---|
133 |
|
---|
134 | struct xwl_output {
|
---|
135 | struct xorg_list link;
|
---|
136 | struct wl_output *output;
|
---|
137 | struct xwl_screen *xwl_screen;
|
---|
138 | RROutputPtr randr_output;
|
---|
139 | RRCrtcPtr randr_crtc;
|
---|
140 | int32_t x, y, width, height;
|
---|
141 | Rotation rotation;
|
---|
142 | };
|
---|
143 |
|
---|
144 | struct xwl_pixmap;
|
---|
145 |
|
---|
146 | Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
|
---|
147 |
|
---|
148 | struct xwl_screen *xwl_screen_get(ScreenPtr screen);
|
---|
149 |
|
---|
150 | void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
|
---|
151 |
|
---|
152 | void xwl_seat_destroy(struct xwl_seat *xwl_seat);
|
---|
153 |
|
---|
154 | Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
|
---|
155 |
|
---|
156 | struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
|
---|
157 | uint32_t id);
|
---|
158 |
|
---|
159 | void xwl_output_destroy(struct xwl_output *xwl_output);
|
---|
160 |
|
---|
161 | RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
|
---|
162 | float VRefresh, Bool Reduced, Bool Interlaced);
|
---|
163 |
|
---|
164 | void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
|
---|
165 | struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
|
---|
166 |
|
---|
167 |
|
---|
168 | Bool xwl_shm_create_screen_resources(ScreenPtr screen);
|
---|
169 | PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height,
|
---|
170 | int depth, unsigned int hint);
|
---|
171 | Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
|
---|
172 | struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
|
---|
173 |
|
---|
174 |
|
---|
175 | Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
|
---|
176 |
|
---|
177 | Bool xwl_screen_init_glamor(struct xwl_screen *xwl_screen,
|
---|
178 | uint32_t id, uint32_t version);
|
---|
179 | struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap);
|
---|
180 |
|
---|
181 | #endif
|
---|