blob: a9c974b04a8cec0b51989b427fd7c5940795fcbd [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
84struct weston_desktop_seat *
85weston_desktop_seat_from_seat(struct weston_seat *wseat);
86
87struct weston_desktop_surface_implementation {
88 void (*set_activated)(struct weston_desktop_surface *surface,
89 void *user_data, bool activated);
90 void (*set_fullscreen)(struct weston_desktop_surface *surface,
91 void *user_data, bool fullscreen);
92 void (*set_maximized)(struct weston_desktop_surface *surface,
93 void *user_data, bool maximized);
94 void (*set_resizing)(struct weston_desktop_surface *surface,
95 void *user_data, bool resizing);
96 void (*set_size)(struct weston_desktop_surface *surface,
97 void *user_data, int32_t width, int32_t height);
98 void (*committed)(struct weston_desktop_surface *surface, void *user_data,
Quentin Glidic003da882016-08-15 12:21:39 +020099 int32_t sx, int32_t sy);
Quentin Glidic248dd102016-08-12 10:41:34 +0200100 void (*update_position)(struct weston_desktop_surface *surface,
101 void *user_data);
102 void (*ping)(struct weston_desktop_surface *surface, uint32_t serial,
103 void *user_data);
104 void (*close)(struct weston_desktop_surface *surface, void *user_data);
105
106 bool (*get_activated)(struct weston_desktop_surface *surface,
107 void *user_data);
108 bool (*get_fullscreen)(struct weston_desktop_surface *surface,
109 void *user_data);
110 bool (*get_maximized)(struct weston_desktop_surface *surface,
111 void *user_data);
112 bool (*get_resizing)(struct weston_desktop_surface *surface,
113 void *user_data);
114 struct weston_size
115 (*get_max_size)(struct weston_desktop_surface *surface,
116 void *user_data);
117 struct weston_size
118 (*get_min_size)(struct weston_desktop_surface *surface,
119 void *user_data);
120
121 void (*destroy)(struct weston_desktop_surface *surface,
122 void *user_data);
123};
124
125struct weston_desktop_client *
126weston_desktop_client_create(struct weston_desktop *desktop,
127 struct wl_client *client,
128 wl_dispatcher_func_t dispatcher,
129 const struct wl_interface *interface,
130 const void *implementation, uint32_t version,
131 uint32_t id);
132
133void
134weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client,
135 struct wl_listener *listener);
136struct weston_desktop *
137weston_desktop_client_get_desktop(struct weston_desktop_client *client);
138struct wl_resource *
139weston_desktop_client_get_resource(struct weston_desktop_client *client);
140struct wl_list *
141weston_desktop_client_get_surface_list(struct weston_desktop_client *client);
142
143void
144weston_desktop_client_pong(struct weston_desktop_client *client,
145 uint32_t serial);
146
147struct weston_desktop_surface *
148weston_desktop_surface_create(struct weston_desktop *desktop,
149 struct weston_desktop_client *client,
150 struct weston_surface *surface,
151 const struct weston_desktop_surface_implementation *implementation,
152 void *implementation_data);
153void
154weston_desktop_surface_destroy(struct weston_desktop_surface *surface);
155void
156weston_desktop_surface_resource_destroy(struct wl_resource *resource);
157struct wl_resource *
158weston_desktop_surface_add_resource(struct weston_desktop_surface *surface,
159 const struct wl_interface *interface,
160 const void *implementation, uint32_t id,
161 wl_resource_destroy_func_t destroy);
162struct weston_desktop_surface *
163weston_desktop_surface_from_grab_link(struct wl_list *grab_link);
164
165struct wl_list *
166weston_desktop_surface_get_client_link(struct weston_desktop_surface *surface);
167struct weston_desktop_surface *
168weston_desktop_surface_from_client_link(struct wl_list *link);
169bool
170weston_desktop_surface_has_implementation(struct weston_desktop_surface *surface,
171 const struct weston_desktop_surface_implementation *implementation);
172const struct weston_desktop_surface_implementation *
173weston_desktop_surface_get_implementation(struct weston_desktop_surface *surface);
174void *
175weston_desktop_surface_get_implementation_data(struct weston_desktop_surface *surface);
176struct weston_desktop_surface *
177weston_desktop_surface_get_parent(struct weston_desktop_surface *surface);
178bool
179weston_desktop_surface_get_grab(struct weston_desktop_surface *surface);
180
181void
182weston_desktop_surface_set_title(struct weston_desktop_surface *surface,
183 const char *title);
184void
185weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface,
186 const char *app_id);
187void
188weston_desktop_surface_set_pid(struct weston_desktop_surface *surface,
189 pid_t pid);
190void
191weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface,
192 struct weston_geometry geometry);
193void
194weston_desktop_surface_set_relative_to(struct weston_desktop_surface *surface,
195 struct weston_desktop_surface *parent,
196 int32_t x, int32_t y, bool use_geometry);
197void
198weston_desktop_surface_unset_relative_to(struct weston_desktop_surface *surface);
199void
200weston_desktop_surface_popup_grab(struct weston_desktop_surface *popup,
201 struct weston_desktop_seat *seat,
202 uint32_t serial);
203void
204weston_desktop_surface_popup_ungrab(struct weston_desktop_surface *popup,
205 struct weston_desktop_seat *seat);
206void
207weston_desktop_surface_popup_dismiss(struct weston_desktop_surface *surface);
208
209struct weston_desktop_surface *
210weston_desktop_seat_popup_grab_get_topmost_surface(struct weston_desktop_seat *seat);
211bool
212weston_desktop_seat_popup_grab_start(struct weston_desktop_seat *seat,
213 struct wl_client *client, uint32_t serial);
214void
215weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat,
216 struct wl_list *link);
217void
218weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat,
219 struct wl_list *link);
220
221void
222weston_desktop_destroy_request(struct wl_client *client,
223 struct wl_resource *resource);
224struct wl_global *
225weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
226 struct wl_display *display);
227struct wl_global *
228weston_desktop_xdg_shell_v5_create(struct weston_desktop *desktop,
229 struct wl_display *display);
230struct wl_global *
231weston_desktop_wl_shell_create(struct weston_desktop *desktop,
232 struct wl_display *display);
233void
234weston_desktop_xwayland_init(struct weston_desktop *desktop);
235
236#endif /* WESTON_DESKTOP_INTERNAL_H */