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 | #include <xorg-server.h>
|
---|
31 |
|
---|
32 | #include <stdio.h>
|
---|
33 | #include <unistd.h>
|
---|
34 | #include <errno.h>
|
---|
35 |
|
---|
36 | #include <wayland-client.h>
|
---|
37 |
|
---|
38 | #include <X11/X.h>
|
---|
39 |
|
---|
40 | #include <fb.h>
|
---|
41 | #include <input.h>
|
---|
42 | #include <dix.h>
|
---|
43 | #include <randrstr.h>
|
---|
44 | #include <exevents.h>
|
---|
45 |
|
---|
46 | struct xwl_screen {
|
---|
47 | int width;
|
---|
48 | int height;
|
---|
49 | int depth;
|
---|
50 | ScreenPtr screen;
|
---|
51 | WindowPtr pointer_limbo_window;
|
---|
52 | int expecting_event;
|
---|
53 |
|
---|
54 | int wm_fd;
|
---|
55 | int listen_fds[5];
|
---|
56 | int listen_fd_count;
|
---|
57 | int rootless;
|
---|
58 | int glamor;
|
---|
59 |
|
---|
60 | CreateScreenResourcesProcPtr CreateScreenResources;
|
---|
61 | CloseScreenProcPtr CloseScreen;
|
---|
62 | CreateWindowProcPtr CreateWindow;
|
---|
63 | DestroyWindowProcPtr DestroyWindow;
|
---|
64 | RealizeWindowProcPtr RealizeWindow;
|
---|
65 | UnrealizeWindowProcPtr UnrealizeWindow;
|
---|
66 | XYToWindowProcPtr XYToWindow;
|
---|
67 |
|
---|
68 | struct xorg_list output_list;
|
---|
69 | struct xorg_list seat_list;
|
---|
70 | struct xorg_list damage_window_list;
|
---|
71 |
|
---|
72 | int wayland_fd;
|
---|
73 | struct wl_display *display;
|
---|
74 | struct wl_registry *registry;
|
---|
75 | struct wl_registry *input_registry;
|
---|
76 | struct wl_compositor *compositor;
|
---|
77 | struct wl_shm *shm;
|
---|
78 | struct wl_shell *shell;
|
---|
79 |
|
---|
80 | uint32_t serial;
|
---|
81 |
|
---|
82 | #define XWL_FORMAT_ARGB8888 (1 << 0)
|
---|
83 | #define XWL_FORMAT_XRGB8888 (1 << 1)
|
---|
84 | #define XWL_FORMAT_RGB565 (1 << 2)
|
---|
85 |
|
---|
86 | int prepare_read;
|
---|
87 |
|
---|
88 | char *device_name;
|
---|
89 | int drm_fd;
|
---|
90 | int fd_render_node;
|
---|
91 | struct wl_drm *drm;
|
---|
92 | uint32_t formats;
|
---|
93 | uint32_t capabilities;
|
---|
94 | void *egl_display, *egl_context;
|
---|
95 | struct gbm_device *gbm;
|
---|
96 | struct glamor_context *glamor_ctx;
|
---|
97 | };
|
---|
98 |
|
---|
99 | struct xwl_window {
|
---|
100 | struct xwl_screen *xwl_screen;
|
---|
101 | struct wl_surface *surface;
|
---|
102 | struct wl_shell_surface *shell_surface;
|
---|
103 | WindowPtr window;
|
---|
104 | DamagePtr damage;
|
---|
105 | struct xorg_list link_damage;
|
---|
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
|
---|