windows.networking.hostname/tests: Check if passed HSTRING is duplicated.
[wine.git] / dlls / winewayland.drv / waylanddrv.h
blob0fd2a7a6c771efcb8d20c80f8304f6fbbe613511
1 /*
2 * Wayland driver
4 * Copyright 2020 Alexandros Frantzis for Collabora Ltd
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_WAYLANDDRV_H
22 #define __WINE_WAYLANDDRV_H
24 #ifndef __WINE_CONFIG_H
25 # error You must include config.h to use this header
26 #endif
28 #include <pthread.h>
29 #include <wayland-client.h>
30 #include "xdg-output-unstable-v1-client-protocol.h"
31 #include "xdg-shell-client-protocol.h"
33 #include "windef.h"
34 #include "winbase.h"
35 #include "ntgdi.h"
36 #include "wine/gdi_driver.h"
37 #include "wine/rbtree.h"
39 #include "unixlib.h"
41 /* We only use 4 byte formats. */
42 #define WINEWAYLAND_BYTES_PER_PIXEL 4
44 /**********************************************************************
45 * Globals
48 extern struct wayland process_wayland DECLSPEC_HIDDEN;
50 /**********************************************************************
51 * Definitions for wayland types
54 enum wayland_window_message
56 WM_WAYLAND_INIT_DISPLAY_DEVICES = 0x80001000
59 struct wayland
61 BOOL initialized;
62 struct wl_display *wl_display;
63 struct wl_event_queue *wl_event_queue;
64 struct wl_registry *wl_registry;
65 struct zxdg_output_manager_v1 *zxdg_output_manager_v1;
66 struct wl_compositor *wl_compositor;
67 struct xdg_wm_base *xdg_wm_base;
68 struct wl_shm *wl_shm;
69 struct wl_list output_list;
70 /* Protects the output_list and the wayland_output.current states. */
71 pthread_mutex_t output_mutex;
74 struct wayland_output_mode
76 struct rb_entry entry;
77 int32_t width;
78 int32_t height;
79 int32_t refresh;
82 struct wayland_output_state
84 struct rb_tree modes;
85 struct wayland_output_mode *current_mode;
86 char *name;
87 int logical_x, logical_y;
88 int logical_w, logical_h;
91 struct wayland_output
93 struct wl_list link;
94 struct wl_output *wl_output;
95 struct zxdg_output_v1 *zxdg_output_v1;
96 uint32_t global_id;
97 unsigned int pending_flags;
98 struct wayland_output_state pending;
99 struct wayland_output_state current;
102 struct wayland_surface
104 HWND hwnd;
105 struct wl_surface *wl_surface;
106 struct xdg_surface *xdg_surface;
107 struct xdg_toplevel *xdg_toplevel;
108 pthread_mutex_t mutex;
109 uint32_t current_serial;
110 struct wayland_shm_buffer *latest_window_buffer;
113 struct wayland_shm_buffer
115 struct wl_list link;
116 struct wl_buffer *wl_buffer;
117 int width, height;
118 void *map_data;
119 size_t map_size;
120 BOOL busy;
121 LONG ref;
122 HRGN damage_region;
125 /**********************************************************************
126 * Wayland initialization
129 BOOL wayland_process_init(void) DECLSPEC_HIDDEN;
130 void wayland_init_display_devices(BOOL force) DECLSPEC_HIDDEN;
132 /**********************************************************************
133 * Wayland output
136 BOOL wayland_output_create(uint32_t id, uint32_t version) DECLSPEC_HIDDEN;
137 void wayland_output_destroy(struct wayland_output *output) DECLSPEC_HIDDEN;
138 void wayland_output_use_xdg_extension(struct wayland_output *output) DECLSPEC_HIDDEN;
140 /**********************************************************************
141 * Wayland surface
144 struct wayland_surface *wayland_surface_create(HWND hwnd) DECLSPEC_HIDDEN;
145 void wayland_surface_destroy(struct wayland_surface *surface) DECLSPEC_HIDDEN;
146 void wayland_surface_make_toplevel(struct wayland_surface *surface) DECLSPEC_HIDDEN;
147 void wayland_surface_clear_role(struct wayland_surface *surface) DECLSPEC_HIDDEN;
148 void wayland_surface_attach_shm(struct wayland_surface *surface,
149 struct wayland_shm_buffer *shm_buffer,
150 HRGN surface_damage_region) DECLSPEC_HIDDEN;
152 /**********************************************************************
153 * Wayland SHM buffer
156 struct wayland_shm_buffer *wayland_shm_buffer_create(int width, int height,
157 enum wl_shm_format format) DECLSPEC_HIDDEN;
158 void wayland_shm_buffer_ref(struct wayland_shm_buffer *shm_buffer) DECLSPEC_HIDDEN;
159 void wayland_shm_buffer_unref(struct wayland_shm_buffer *shm_buffer) DECLSPEC_HIDDEN;
161 /**********************************************************************
162 * Wayland window surface
165 struct window_surface *wayland_window_surface_create(HWND hwnd, const RECT *rect) DECLSPEC_HIDDEN;
166 void wayland_window_surface_update_wayland_surface(struct window_surface *surface,
167 struct wayland_surface *wayland_surface) DECLSPEC_HIDDEN;
168 void wayland_window_flush(HWND hwnd) DECLSPEC_HIDDEN;
170 /**********************************************************************
171 * Helpers
174 static inline BOOL intersect_rect(RECT *dst, const RECT *src1, const RECT *src2)
176 dst->left = max(src1->left, src2->left);
177 dst->top = max(src1->top, src2->top);
178 dst->right = min(src1->right, src2->right);
179 dst->bottom = min(src1->bottom, src2->bottom);
180 return !IsRectEmpty(dst);
183 RGNDATA *get_region_data(HRGN region) DECLSPEC_HIDDEN;
185 /**********************************************************************
186 * USER driver functions
189 LRESULT WAYLAND_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) DECLSPEC_HIDDEN;
190 void WAYLAND_DestroyWindow(HWND hwnd) DECLSPEC_HIDDEN;
191 BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manager,
192 BOOL force, void *param) DECLSPEC_HIDDEN;
193 LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) DECLSPEC_HIDDEN;
194 void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
195 const RECT *window_rect, const RECT *client_rect,
196 const RECT *visible_rect, const RECT *valid_rects,
197 struct window_surface *surface) DECLSPEC_HIDDEN;
198 BOOL WAYLAND_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags,
199 const RECT *window_rect, const RECT *client_rect,
200 RECT *visible_rect, struct window_surface **surface) DECLSPEC_HIDDEN;
202 #endif /* __WINE_WAYLANDDRV_H */