blob: f77ab55bd45b609c45817bfae63063b2bd331404 [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_H
25#define WESTON_DESKTOP_H
26
27#include "compositor.h"
28#include <pixman.h>
29#include <stdbool.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35enum weston_desktop_surface_edge {
36 WESTON_DESKTOP_SURFACE_EDGE_NONE = 0,
37 WESTON_DESKTOP_SURFACE_EDGE_TOP = 1,
38 WESTON_DESKTOP_SURFACE_EDGE_BOTTOM = 2,
39 WESTON_DESKTOP_SURFACE_EDGE_LEFT = 4,
40 WESTON_DESKTOP_SURFACE_EDGE_TOP_LEFT = 5,
41 WESTON_DESKTOP_SURFACE_EDGE_BOTTOM_LEFT = 6,
42 WESTON_DESKTOP_SURFACE_EDGE_RIGHT = 8,
43 WESTON_DESKTOP_SURFACE_EDGE_TOP_RIGHT = 9,
44 WESTON_DESKTOP_SURFACE_EDGE_BOTTOM_RIGHT = 10,
45};
46
47struct weston_desktop;
48struct weston_desktop_client;
49struct weston_desktop_surface;
50
51struct weston_desktop_api {
52 size_t struct_size;
53 void (*ping_timeout)(struct weston_desktop_client *client,
54 void *user_data);
55 void (*pong)(struct weston_desktop_client *client,
56 void *user_data);
57
58 void (*surface_added)(struct weston_desktop_surface *surface,
59 void *user_data);
60 void (*surface_removed)(struct weston_desktop_surface *surface,
61 void *user_data);
62 void (*committed)(struct weston_desktop_surface *surface,
63 int32_t sx, int32_t sy, void *user_data);
64 void (*show_window_menu)(struct weston_desktop_surface *surface,
65 struct weston_seat *seat, int32_t x, int32_t y,
66 void *user_data);
67 void (*set_parent)(struct weston_desktop_surface *surface,
68 struct weston_desktop_surface *parent,
69 void *user_data);
70 void (*move)(struct weston_desktop_surface *surface,
71 struct weston_seat *seat, uint32_t serial, void *user_data);
72 void (*resize)(struct weston_desktop_surface *surface,
73 struct weston_seat *seat, uint32_t serial,
74 enum weston_desktop_surface_edge edges, void *user_data);
75 void (*fullscreen_requested)(struct weston_desktop_surface *surface,
76 bool fullscreen,
77 struct weston_output *output,
78 void *user_data);
79 void (*maximized_requested)(struct weston_desktop_surface *surface,
80 bool maximized, void *user_data);
81 void (*minimized_requested)(struct weston_desktop_surface *surface,
82 void *user_data);
83};
84
85void
86weston_seat_break_desktop_grabs(struct weston_seat *seat);
87
88struct weston_desktop *
89weston_desktop_create(struct weston_compositor *compositor,
90 const struct weston_desktop_api *api, void *user_data);
91void
92weston_desktop_destroy(struct weston_desktop *desktop);
93
94struct wl_client *
95weston_desktop_client_get_client(struct weston_desktop_client *client);
96void
97weston_desktop_client_for_each_surface(struct weston_desktop_client *client,
98 void (*callback)(struct weston_desktop_surface *surface, void *user_data),
99 void *user_data);
100int
101weston_desktop_client_ping(struct weston_desktop_client *client);
102
103bool
104weston_surface_is_desktop_surface(struct weston_surface *surface);
105struct weston_desktop_surface *
106weston_surface_get_desktop_surface(struct weston_surface *surface);
107
108void
109weston_desktop_surface_set_user_data(struct weston_desktop_surface *self,
110 void *user_data);
111struct weston_view *
112weston_desktop_surface_create_view(struct weston_desktop_surface *surface);
113void
Quentin Glidicf01ecee2016-08-16 10:52:46 +0200114weston_desktop_surface_unlink_view(struct weston_view *view);
Quentin Glidic248dd102016-08-12 10:41:34 +0200115void
116weston_desktop_surface_propagate_layer(struct weston_desktop_surface *surface);
117void
118weston_desktop_surface_set_activated(struct weston_desktop_surface *surface,
119 bool activated);
120void
121weston_desktop_surface_set_fullscreen(struct weston_desktop_surface *surface,
122 bool fullscreen);
123void
124weston_desktop_surface_set_maximized(struct weston_desktop_surface *surface,
125 bool maximized);
126void
127weston_desktop_surface_set_resizing(struct weston_desktop_surface *surface,
128 bool resized);
129void
130weston_desktop_surface_set_size(struct weston_desktop_surface *surface,
131 int32_t width, int32_t height);
132void
133weston_desktop_surface_close(struct weston_desktop_surface *surface);
134
135void *
136weston_desktop_surface_get_user_data(struct weston_desktop_surface *surface);
137struct weston_desktop_client *
138weston_desktop_surface_get_client(struct weston_desktop_surface *surface);
139struct weston_surface *
140weston_desktop_surface_get_surface(struct weston_desktop_surface *surface);
141const char *
142weston_desktop_surface_get_title(struct weston_desktop_surface *surface);
143const char *
144weston_desktop_surface_get_app_id(struct weston_desktop_surface *surface);
145pid_t
146weston_desktop_surface_get_pid(struct weston_desktop_surface *surface);
147bool
148weston_desktop_surface_get_activated(struct weston_desktop_surface *surface);
149bool
150weston_desktop_surface_get_maximized(struct weston_desktop_surface *surface);
151bool
152weston_desktop_surface_get_fullscreen(struct weston_desktop_surface *surface);
153bool
154weston_desktop_surface_get_resizing(struct weston_desktop_surface *surface);
155struct weston_geometry
156weston_desktop_surface_get_geometry(struct weston_desktop_surface *surface);
157struct weston_size
158weston_desktop_surface_get_max_size(struct weston_desktop_surface *surface);
159struct weston_size
160weston_desktop_surface_get_min_size(struct weston_desktop_surface *surface);
161
162#ifdef __cplusplus
163}
164#endif
165
166#endif /* WESTON_DESKTOP_H */