blob: 2606d279b32c8c6fbe9ad1b1ce96008036971ac5 [file] [log] [blame]
Quentin Glidic248dd102016-08-12 10:41:34 +02001/*
2 * Copyright © 2016 Quentin "Sardem FF7" Glidic
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef WESTON_DESKTOP_INTERNAL_H
25#define WESTON_DESKTOP_INTERNAL_H
26
Pekka Paalanen3d5d9472019-03-28 16:28:47 +020027#include <libweston/libweston.h>
Quentin Glidic248dd102016-08-12 10:41:34 +020028
29struct weston_desktop_seat;
30struct weston_desktop_client;
31
32struct weston_compositor *
33weston_desktop_get_compositor(struct weston_desktop *desktop);
34struct wl_display *
35weston_desktop_get_display(struct weston_desktop *desktop);
36
37void
38weston_desktop_api_ping_timeout(struct weston_desktop *desktop,
39 struct weston_desktop_client *client);
40void
41weston_desktop_api_pong(struct weston_desktop *desktop,
42 struct weston_desktop_client *client);
43void
44weston_desktop_api_surface_added(struct weston_desktop *desktop,
45 struct weston_desktop_surface *surface);
46void
47weston_desktop_api_surface_removed(struct weston_desktop *desktop,
48 struct weston_desktop_surface *surface);
49void
50weston_desktop_api_committed(struct weston_desktop *desktop,
51 struct weston_desktop_surface *surface,
52 int32_t sx, int32_t sy);
53void
54weston_desktop_api_show_window_menu(struct weston_desktop *desktop,
55 struct weston_desktop_surface *surface,
56 struct weston_seat *seat,
57 int32_t x, int32_t y);
58void
59weston_desktop_api_set_parent(struct weston_desktop *desktop,
60 struct weston_desktop_surface *surface,
61 struct weston_desktop_surface *parent);
62void
63weston_desktop_api_move(struct weston_desktop *desktop,
64 struct weston_desktop_surface *surface,
65 struct weston_seat *seat, uint32_t serial);
66void
67weston_desktop_api_resize(struct weston_desktop *desktop,
68 struct weston_desktop_surface *surface,
69 struct weston_seat *seat, uint32_t serial,
70 enum weston_desktop_surface_edge edges);
71void
72weston_desktop_api_fullscreen_requested(struct weston_desktop *desktop,
73 struct weston_desktop_surface *surface,
74 bool fullscreen,
75 struct weston_output *output);
76void
77weston_desktop_api_maximized_requested(struct weston_desktop *desktop,
78 struct weston_desktop_surface *surface,
79 bool maximized);
80void
81weston_desktop_api_minimized_requested(struct weston_desktop *desktop,
82 struct weston_desktop_surface *surface);
83
Pekka Paalanen37111e12016-11-16 14:03:31 +020084void
85weston_desktop_api_set_xwayland_position(struct weston_desktop *desktop,
86 struct weston_desktop_surface *surface,
87 int32_t x, int32_t y);
88
Quentin Glidic248dd102016-08-12 10:41:34 +020089struct weston_desktop_seat *
90weston_desktop_seat_from_seat(struct weston_seat *wseat);
91
92struct weston_desktop_surface_implementation {
93 void (*set_activated)(struct weston_desktop_surface *surface,
94 void *user_data, bool activated);
95 void (*set_fullscreen)(struct weston_desktop_surface *surface,
96 void *user_data, bool fullscreen);
97 void (*set_maximized)(struct weston_desktop_surface *surface,
98 void *user_data, bool maximized);
99 void (*set_resizing)(struct weston_desktop_surface *surface,
100 void *user_data, bool resizing);
101 void (*set_size)(struct weston_desktop_surface *surface,
102 void *user_data, int32_t width, int32_t height);
103 void (*committed)(struct weston_desktop_surface *surface, void *user_data,
Quentin Glidic003da882016-08-15 12:21:39 +0200104 int32_t sx, int32_t sy);
Quentin Glidic248dd102016-08-12 10:41:34 +0200105 void (*update_position)(struct weston_desktop_surface *surface,
106 void *user_data);
107 void (*ping)(struct weston_desktop_surface *surface, uint32_t serial,
108 void *user_data);
109 void (*close)(struct weston_desktop_surface *surface, void *user_data);
110
111 bool (*get_activated)(struct weston_desktop_surface *surface,
112 void *user_data);
113 bool (*get_fullscreen)(struct weston_desktop_surface *surface,
114 void *user_data);
115 bool (*get_maximized)(struct weston_desktop_surface *surface,
116 void *user_data);
117 bool (*get_resizing)(struct weston_desktop_surface *surface,
118 void *user_data);
119 struct weston_size
120 (*get_max_size)(struct weston_desktop_surface *surface,
121 void *user_data);
122 struct weston_size
123 (*get_min_size)(struct weston_desktop_surface *surface,
124 void *user_data);
125
126 void (*destroy)(struct weston_desktop_surface *surface,
127 void *user_data);
128};
129
130struct weston_desktop_client *
131weston_desktop_client_create(struct weston_desktop *desktop,
132 struct wl_client *client,
133 wl_dispatcher_func_t dispatcher,
134 const struct wl_interface *interface,
135 const void *implementation, uint32_t version,
136 uint32_t id);
Pekka Paalanenf53c05d2021-05-14 16:04:45 +0300137void
138weston_desktop_client_destroy(struct weston_desktop_client *client);
Quentin Glidic248dd102016-08-12 10:41:34 +0200139
140void
141weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client,
142 struct wl_listener *listener);
143struct weston_desktop *
144weston_desktop_client_get_desktop(struct weston_desktop_client *client);
145struct wl_resource *
146weston_desktop_client_get_resource(struct weston_desktop_client *client);
147struct wl_list *
148weston_desktop_client_get_surface_list(struct weston_desktop_client *client);
149
150void
151weston_desktop_client_pong(struct weston_desktop_client *client,
152 uint32_t serial);
153
154struct weston_desktop_surface *
155weston_desktop_surface_create(struct weston_desktop *desktop,
156 struct weston_desktop_client *client,
157 struct weston_surface *surface,
158 const struct weston_desktop_surface_implementation *implementation,
159 void *implementation_data);
160void
161weston_desktop_surface_destroy(struct weston_desktop_surface *surface);
162void
163weston_desktop_surface_resource_destroy(struct wl_resource *resource);
164struct wl_resource *
165weston_desktop_surface_add_resource(struct weston_desktop_surface *surface,
166 const struct wl_interface *interface,
167 const void *implementation, uint32_t id,
168 wl_resource_destroy_func_t destroy);
169struct weston_desktop_surface *
170weston_desktop_surface_from_grab_link(struct wl_list *grab_link);
171
172struct wl_list *
173weston_desktop_surface_get_client_link(struct weston_desktop_surface *surface);
174struct weston_desktop_surface *
175weston_desktop_surface_from_client_link(struct wl_list *link);
176bool
177weston_desktop_surface_has_implementation(struct weston_desktop_surface *surface,
178 const struct weston_desktop_surface_implementation *implementation);
179const struct weston_desktop_surface_implementation *
180weston_desktop_surface_get_implementation(struct weston_desktop_surface *surface);
181void *
182weston_desktop_surface_get_implementation_data(struct weston_desktop_surface *surface);
183struct weston_desktop_surface *
184weston_desktop_surface_get_parent(struct weston_desktop_surface *surface);
185bool
186weston_desktop_surface_get_grab(struct weston_desktop_surface *surface);
187
188void
189weston_desktop_surface_set_title(struct weston_desktop_surface *surface,
190 const char *title);
191void
192weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface,
193 const char *app_id);
194void
195weston_desktop_surface_set_pid(struct weston_desktop_surface *surface,
196 pid_t pid);
197void
198weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface,
199 struct weston_geometry geometry);
200void
201weston_desktop_surface_set_relative_to(struct weston_desktop_surface *surface,
202 struct weston_desktop_surface *parent,
203 int32_t x, int32_t y, bool use_geometry);
204void
205weston_desktop_surface_unset_relative_to(struct weston_desktop_surface *surface);
206void
207weston_desktop_surface_popup_grab(struct weston_desktop_surface *popup,
208 struct weston_desktop_seat *seat,
209 uint32_t serial);
210void
211weston_desktop_surface_popup_ungrab(struct weston_desktop_surface *popup,
212 struct weston_desktop_seat *seat);
213void
214weston_desktop_surface_popup_dismiss(struct weston_desktop_surface *surface);
215
216struct weston_desktop_surface *
217weston_desktop_seat_popup_grab_get_topmost_surface(struct weston_desktop_seat *seat);
218bool
219weston_desktop_seat_popup_grab_start(struct weston_desktop_seat *seat,
220 struct wl_client *client, uint32_t serial);
221void
222weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat,
223 struct wl_list *link);
224void
225weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat,
226 struct wl_list *link);
227
228void
229weston_desktop_destroy_request(struct wl_client *client,
230 struct wl_resource *resource);
231struct wl_global *
ant8med8d9f5e2018-11-28 22:46:37 +0100232weston_desktop_xdg_wm_base_create(struct weston_desktop *desktop,
233 struct wl_display *display);
234struct wl_global *
Quentin Glidic248dd102016-08-12 10:41:34 +0200235weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
236 struct wl_display *display);
237struct wl_global *
Quentin Glidic248dd102016-08-12 10:41:34 +0200238weston_desktop_wl_shell_create(struct weston_desktop *desktop,
239 struct wl_display *display);
ant8med8d9f5e2018-11-28 22:46:37 +0100240
Quentin Glidic248dd102016-08-12 10:41:34 +0200241void
242weston_desktop_xwayland_init(struct weston_desktop *desktop);
Pekka Paalanene2583ca2021-05-14 16:12:35 +0300243void
244weston_desktop_xwayland_fini(struct weston_desktop *desktop);
Quentin Glidic248dd102016-08-12 10:41:34 +0200245
246#endif /* WESTON_DESKTOP_INTERNAL_H */