blob: 763355bf05793a935952dfb549a5e3a783fa7a3a [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
27#include "compositor.h"
28
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);
137
138void
139weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client,
140 struct wl_listener *listener);
141struct weston_desktop *
142weston_desktop_client_get_desktop(struct weston_desktop_client *client);
143struct wl_resource *
144weston_desktop_client_get_resource(struct weston_desktop_client *client);
145struct wl_list *
146weston_desktop_client_get_surface_list(struct weston_desktop_client *client);
147
148void
149weston_desktop_client_pong(struct weston_desktop_client *client,
150 uint32_t serial);
151
152struct weston_desktop_surface *
153weston_desktop_surface_create(struct weston_desktop *desktop,
154 struct weston_desktop_client *client,
155 struct weston_surface *surface,
156 const struct weston_desktop_surface_implementation *implementation,
157 void *implementation_data);
158void
159weston_desktop_surface_destroy(struct weston_desktop_surface *surface);
160void
161weston_desktop_surface_resource_destroy(struct wl_resource *resource);
162struct wl_resource *
163weston_desktop_surface_add_resource(struct weston_desktop_surface *surface,
164 const struct wl_interface *interface,
165 const void *implementation, uint32_t id,
166 wl_resource_destroy_func_t destroy);
167struct weston_desktop_surface *
168weston_desktop_surface_from_grab_link(struct wl_list *grab_link);
169
170struct wl_list *
171weston_desktop_surface_get_client_link(struct weston_desktop_surface *surface);
172struct weston_desktop_surface *
173weston_desktop_surface_from_client_link(struct wl_list *link);
174bool
175weston_desktop_surface_has_implementation(struct weston_desktop_surface *surface,
176 const struct weston_desktop_surface_implementation *implementation);
177const struct weston_desktop_surface_implementation *
178weston_desktop_surface_get_implementation(struct weston_desktop_surface *surface);
179void *
180weston_desktop_surface_get_implementation_data(struct weston_desktop_surface *surface);
181struct weston_desktop_surface *
182weston_desktop_surface_get_parent(struct weston_desktop_surface *surface);
183bool
184weston_desktop_surface_get_grab(struct weston_desktop_surface *surface);
185
186void
187weston_desktop_surface_set_title(struct weston_desktop_surface *surface,
188 const char *title);
189void
190weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface,
191 const char *app_id);
192void
193weston_desktop_surface_set_pid(struct weston_desktop_surface *surface,
194 pid_t pid);
195void
196weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface,
197 struct weston_geometry geometry);
198void
199weston_desktop_surface_set_relative_to(struct weston_desktop_surface *surface,
200 struct weston_desktop_surface *parent,
201 int32_t x, int32_t y, bool use_geometry);
202void
203weston_desktop_surface_unset_relative_to(struct weston_desktop_surface *surface);
204void
205weston_desktop_surface_popup_grab(struct weston_desktop_surface *popup,
206 struct weston_desktop_seat *seat,
207 uint32_t serial);
208void
209weston_desktop_surface_popup_ungrab(struct weston_desktop_surface *popup,
210 struct weston_desktop_seat *seat);
211void
212weston_desktop_surface_popup_dismiss(struct weston_desktop_surface *surface);
213
214struct weston_desktop_surface *
215weston_desktop_seat_popup_grab_get_topmost_surface(struct weston_desktop_seat *seat);
216bool
217weston_desktop_seat_popup_grab_start(struct weston_desktop_seat *seat,
218 struct wl_client *client, uint32_t serial);
219void
220weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat,
221 struct wl_list *link);
222void
223weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat,
224 struct wl_list *link);
225
226void
227weston_desktop_destroy_request(struct wl_client *client,
228 struct wl_resource *resource);
229struct wl_global *
230weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
231 struct wl_display *display);
232struct wl_global *
233weston_desktop_xdg_shell_v5_create(struct weston_desktop *desktop,
234 struct wl_display *display);
235struct wl_global *
236weston_desktop_wl_shell_create(struct weston_desktop *desktop,
237 struct wl_display *display);
238void
239weston_desktop_xwayland_init(struct weston_desktop *desktop);
240
241#endif /* WESTON_DESKTOP_INTERNAL_H */