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 <libweston/libweston.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 void 85 weston_desktop_api_set_xwayland_position(struct weston_desktop *desktop, 86 struct weston_desktop_surface *surface, 87 int32_t x, int32_t y); 88 89 struct weston_desktop_seat * 90 weston_desktop_seat_from_seat(struct weston_seat *wseat); 91 92 struct 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, 104 int32_t sx, int32_t sy); 105 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 130 struct weston_desktop_client * 131 weston_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 138 void 139 weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client, 140 struct wl_listener *listener); 141 struct weston_desktop * 142 weston_desktop_client_get_desktop(struct weston_desktop_client *client); 143 struct wl_resource * 144 weston_desktop_client_get_resource(struct weston_desktop_client *client); 145 struct wl_list * 146 weston_desktop_client_get_surface_list(struct weston_desktop_client *client); 147 148 void 149 weston_desktop_client_pong(struct weston_desktop_client *client, 150 uint32_t serial); 151 152 struct weston_desktop_surface * 153 weston_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); 158 void 159 weston_desktop_surface_destroy(struct weston_desktop_surface *surface); 160 void 161 weston_desktop_surface_resource_destroy(struct wl_resource *resource); 162 struct wl_resource * 163 weston_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); 167 struct weston_desktop_surface * 168 weston_desktop_surface_from_grab_link(struct wl_list *grab_link); 169 170 struct wl_list * 171 weston_desktop_surface_get_client_link(struct weston_desktop_surface *surface); 172 struct weston_desktop_surface * 173 weston_desktop_surface_from_client_link(struct wl_list *link); 174 bool 175 weston_desktop_surface_has_implementation(struct weston_desktop_surface *surface, 176 const struct weston_desktop_surface_implementation *implementation); 177 const struct weston_desktop_surface_implementation * 178 weston_desktop_surface_get_implementation(struct weston_desktop_surface *surface); 179 void * 180 weston_desktop_surface_get_implementation_data(struct weston_desktop_surface *surface); 181 struct weston_desktop_surface * 182 weston_desktop_surface_get_parent(struct weston_desktop_surface *surface); 183 bool 184 weston_desktop_surface_get_grab(struct weston_desktop_surface *surface); 185 186 void 187 weston_desktop_surface_set_title(struct weston_desktop_surface *surface, 188 const char *title); 189 void 190 weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface, 191 const char *app_id); 192 void 193 weston_desktop_surface_set_pid(struct weston_desktop_surface *surface, 194 pid_t pid); 195 void 196 weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface, 197 struct weston_geometry geometry); 198 void 199 weston_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); 202 void 203 weston_desktop_surface_unset_relative_to(struct weston_desktop_surface *surface); 204 void 205 weston_desktop_surface_popup_grab(struct weston_desktop_surface *popup, 206 struct weston_desktop_seat *seat, 207 uint32_t serial); 208 void 209 weston_desktop_surface_popup_ungrab(struct weston_desktop_surface *popup, 210 struct weston_desktop_seat *seat); 211 void 212 weston_desktop_surface_popup_dismiss(struct weston_desktop_surface *surface); 213 214 struct weston_desktop_surface * 215 weston_desktop_seat_popup_grab_get_topmost_surface(struct weston_desktop_seat *seat); 216 bool 217 weston_desktop_seat_popup_grab_start(struct weston_desktop_seat *seat, 218 struct wl_client *client, uint32_t serial); 219 void 220 weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat, 221 struct wl_list *link); 222 void 223 weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat, 224 struct wl_list *link); 225 226 void 227 weston_desktop_destroy_request(struct wl_client *client, 228 struct wl_resource *resource); 229 struct wl_global * 230 weston_desktop_xdg_wm_base_create(struct weston_desktop *desktop, 231 struct wl_display *display); 232 struct wl_global * 233 weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop, 234 struct wl_display *display); 235 struct wl_global * 236 weston_desktop_wl_shell_create(struct weston_desktop *desktop, 237 struct wl_display *display); 238 239 void 240 weston_desktop_xwayland_init(struct weston_desktop *desktop); 241 242 #endif /* WESTON_DESKTOP_INTERNAL_H */ 243