Quentin Glidic | 248dd10 | 2016-08-12 10:41:34 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 29 | struct weston_desktop_seat; |
| 30 | struct weston_desktop_client; |
| 31 | |
| 32 | struct weston_compositor * |
| 33 | weston_desktop_get_compositor(struct weston_desktop *desktop); |
| 34 | struct wl_display * |
| 35 | weston_desktop_get_display(struct weston_desktop *desktop); |
| 36 | |
| 37 | void |
| 38 | weston_desktop_api_ping_timeout(struct weston_desktop *desktop, |
| 39 | struct weston_desktop_client *client); |
| 40 | void |
| 41 | weston_desktop_api_pong(struct weston_desktop *desktop, |
| 42 | struct weston_desktop_client *client); |
| 43 | void |
| 44 | weston_desktop_api_surface_added(struct weston_desktop *desktop, |
| 45 | struct weston_desktop_surface *surface); |
| 46 | void |
| 47 | weston_desktop_api_surface_removed(struct weston_desktop *desktop, |
| 48 | struct weston_desktop_surface *surface); |
| 49 | void |
| 50 | weston_desktop_api_committed(struct weston_desktop *desktop, |
| 51 | struct weston_desktop_surface *surface, |
| 52 | int32_t sx, int32_t sy); |
| 53 | void |
| 54 | weston_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); |
| 58 | void |
| 59 | weston_desktop_api_set_parent(struct weston_desktop *desktop, |
| 60 | struct weston_desktop_surface *surface, |
| 61 | struct weston_desktop_surface *parent); |
| 62 | void |
| 63 | weston_desktop_api_move(struct weston_desktop *desktop, |
| 64 | struct weston_desktop_surface *surface, |
| 65 | struct weston_seat *seat, uint32_t serial); |
| 66 | void |
| 67 | weston_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); |
| 71 | void |
| 72 | weston_desktop_api_fullscreen_requested(struct weston_desktop *desktop, |
| 73 | struct weston_desktop_surface *surface, |
| 74 | bool fullscreen, |
| 75 | struct weston_output *output); |
| 76 | void |
| 77 | weston_desktop_api_maximized_requested(struct weston_desktop *desktop, |
| 78 | struct weston_desktop_surface *surface, |
| 79 | bool maximized); |
| 80 | void |
| 81 | weston_desktop_api_minimized_requested(struct weston_desktop *desktop, |
| 82 | struct weston_desktop_surface *surface); |
| 83 | |
| 84 | struct weston_desktop_seat * |
| 85 | weston_desktop_seat_from_seat(struct weston_seat *wseat); |
| 86 | |
| 87 | struct 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 Glidic | 003da88 | 2016-08-15 12:21:39 +0200 | [diff] [blame^] | 99 | int32_t sx, int32_t sy); |
Quentin Glidic | 248dd10 | 2016-08-12 10:41:34 +0200 | [diff] [blame] | 100 | 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 | |
| 125 | struct weston_desktop_client * |
| 126 | weston_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 | |
| 133 | void |
| 134 | weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client, |
| 135 | struct wl_listener *listener); |
| 136 | struct weston_desktop * |
| 137 | weston_desktop_client_get_desktop(struct weston_desktop_client *client); |
| 138 | struct wl_resource * |
| 139 | weston_desktop_client_get_resource(struct weston_desktop_client *client); |
| 140 | struct wl_list * |
| 141 | weston_desktop_client_get_surface_list(struct weston_desktop_client *client); |
| 142 | |
| 143 | void |
| 144 | weston_desktop_client_pong(struct weston_desktop_client *client, |
| 145 | uint32_t serial); |
| 146 | |
| 147 | struct weston_desktop_surface * |
| 148 | weston_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); |
| 153 | void |
| 154 | weston_desktop_surface_destroy(struct weston_desktop_surface *surface); |
| 155 | void |
| 156 | weston_desktop_surface_resource_destroy(struct wl_resource *resource); |
| 157 | struct wl_resource * |
| 158 | weston_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); |
| 162 | struct weston_desktop_surface * |
| 163 | weston_desktop_surface_from_grab_link(struct wl_list *grab_link); |
| 164 | |
| 165 | struct wl_list * |
| 166 | weston_desktop_surface_get_client_link(struct weston_desktop_surface *surface); |
| 167 | struct weston_desktop_surface * |
| 168 | weston_desktop_surface_from_client_link(struct wl_list *link); |
| 169 | bool |
| 170 | weston_desktop_surface_has_implementation(struct weston_desktop_surface *surface, |
| 171 | const struct weston_desktop_surface_implementation *implementation); |
| 172 | const struct weston_desktop_surface_implementation * |
| 173 | weston_desktop_surface_get_implementation(struct weston_desktop_surface *surface); |
| 174 | void * |
| 175 | weston_desktop_surface_get_implementation_data(struct weston_desktop_surface *surface); |
| 176 | struct weston_desktop_surface * |
| 177 | weston_desktop_surface_get_parent(struct weston_desktop_surface *surface); |
| 178 | bool |
| 179 | weston_desktop_surface_get_grab(struct weston_desktop_surface *surface); |
| 180 | |
| 181 | void |
| 182 | weston_desktop_surface_set_title(struct weston_desktop_surface *surface, |
| 183 | const char *title); |
| 184 | void |
| 185 | weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface, |
| 186 | const char *app_id); |
| 187 | void |
| 188 | weston_desktop_surface_set_pid(struct weston_desktop_surface *surface, |
| 189 | pid_t pid); |
| 190 | void |
| 191 | weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface, |
| 192 | struct weston_geometry geometry); |
| 193 | void |
| 194 | weston_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); |
| 197 | void |
| 198 | weston_desktop_surface_unset_relative_to(struct weston_desktop_surface *surface); |
| 199 | void |
| 200 | weston_desktop_surface_popup_grab(struct weston_desktop_surface *popup, |
| 201 | struct weston_desktop_seat *seat, |
| 202 | uint32_t serial); |
| 203 | void |
| 204 | weston_desktop_surface_popup_ungrab(struct weston_desktop_surface *popup, |
| 205 | struct weston_desktop_seat *seat); |
| 206 | void |
| 207 | weston_desktop_surface_popup_dismiss(struct weston_desktop_surface *surface); |
| 208 | |
| 209 | struct weston_desktop_surface * |
| 210 | weston_desktop_seat_popup_grab_get_topmost_surface(struct weston_desktop_seat *seat); |
| 211 | bool |
| 212 | weston_desktop_seat_popup_grab_start(struct weston_desktop_seat *seat, |
| 213 | struct wl_client *client, uint32_t serial); |
| 214 | void |
| 215 | weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat, |
| 216 | struct wl_list *link); |
| 217 | void |
| 218 | weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat, |
| 219 | struct wl_list *link); |
| 220 | |
| 221 | void |
| 222 | weston_desktop_destroy_request(struct wl_client *client, |
| 223 | struct wl_resource *resource); |
| 224 | struct wl_global * |
| 225 | weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop, |
| 226 | struct wl_display *display); |
| 227 | struct wl_global * |
| 228 | weston_desktop_xdg_shell_v5_create(struct weston_desktop *desktop, |
| 229 | struct wl_display *display); |
| 230 | struct wl_global * |
| 231 | weston_desktop_wl_shell_create(struct weston_desktop *desktop, |
| 232 | struct wl_display *display); |
| 233 | void |
| 234 | weston_desktop_xwayland_init(struct weston_desktop *desktop); |
| 235 | |
| 236 | #endif /* WESTON_DESKTOP_INTERNAL_H */ |