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_H |
| 25 | #define WESTON_DESKTOP_H |
| 26 | |
| 27 | #include "compositor.h" |
| 28 | #include <pixman.h> |
| 29 | #include <stdbool.h> |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
| 35 | enum 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 | |
| 47 | struct weston_desktop; |
| 48 | struct weston_desktop_client; |
| 49 | struct weston_desktop_surface; |
| 50 | |
| 51 | struct 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 | |
| 85 | void |
| 86 | weston_seat_break_desktop_grabs(struct weston_seat *seat); |
| 87 | |
| 88 | struct weston_desktop * |
| 89 | weston_desktop_create(struct weston_compositor *compositor, |
| 90 | const struct weston_desktop_api *api, void *user_data); |
| 91 | void |
| 92 | weston_desktop_destroy(struct weston_desktop *desktop); |
| 93 | |
| 94 | struct wl_client * |
| 95 | weston_desktop_client_get_client(struct weston_desktop_client *client); |
| 96 | void |
| 97 | weston_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); |
| 100 | int |
| 101 | weston_desktop_client_ping(struct weston_desktop_client *client); |
| 102 | |
| 103 | bool |
| 104 | weston_surface_is_desktop_surface(struct weston_surface *surface); |
| 105 | struct weston_desktop_surface * |
| 106 | weston_surface_get_desktop_surface(struct weston_surface *surface); |
| 107 | |
| 108 | void |
| 109 | weston_desktop_surface_set_user_data(struct weston_desktop_surface *self, |
| 110 | void *user_data); |
| 111 | struct weston_view * |
| 112 | weston_desktop_surface_create_view(struct weston_desktop_surface *surface); |
| 113 | void |
Quentin Glidic | f01ecee | 2016-08-16 10:52:46 +0200 | [diff] [blame^] | 114 | weston_desktop_surface_unlink_view(struct weston_view *view); |
Quentin Glidic | 248dd10 | 2016-08-12 10:41:34 +0200 | [diff] [blame] | 115 | void |
| 116 | weston_desktop_surface_propagate_layer(struct weston_desktop_surface *surface); |
| 117 | void |
| 118 | weston_desktop_surface_set_activated(struct weston_desktop_surface *surface, |
| 119 | bool activated); |
| 120 | void |
| 121 | weston_desktop_surface_set_fullscreen(struct weston_desktop_surface *surface, |
| 122 | bool fullscreen); |
| 123 | void |
| 124 | weston_desktop_surface_set_maximized(struct weston_desktop_surface *surface, |
| 125 | bool maximized); |
| 126 | void |
| 127 | weston_desktop_surface_set_resizing(struct weston_desktop_surface *surface, |
| 128 | bool resized); |
| 129 | void |
| 130 | weston_desktop_surface_set_size(struct weston_desktop_surface *surface, |
| 131 | int32_t width, int32_t height); |
| 132 | void |
| 133 | weston_desktop_surface_close(struct weston_desktop_surface *surface); |
| 134 | |
| 135 | void * |
| 136 | weston_desktop_surface_get_user_data(struct weston_desktop_surface *surface); |
| 137 | struct weston_desktop_client * |
| 138 | weston_desktop_surface_get_client(struct weston_desktop_surface *surface); |
| 139 | struct weston_surface * |
| 140 | weston_desktop_surface_get_surface(struct weston_desktop_surface *surface); |
| 141 | const char * |
| 142 | weston_desktop_surface_get_title(struct weston_desktop_surface *surface); |
| 143 | const char * |
| 144 | weston_desktop_surface_get_app_id(struct weston_desktop_surface *surface); |
| 145 | pid_t |
| 146 | weston_desktop_surface_get_pid(struct weston_desktop_surface *surface); |
| 147 | bool |
| 148 | weston_desktop_surface_get_activated(struct weston_desktop_surface *surface); |
| 149 | bool |
| 150 | weston_desktop_surface_get_maximized(struct weston_desktop_surface *surface); |
| 151 | bool |
| 152 | weston_desktop_surface_get_fullscreen(struct weston_desktop_surface *surface); |
| 153 | bool |
| 154 | weston_desktop_surface_get_resizing(struct weston_desktop_surface *surface); |
| 155 | struct weston_geometry |
| 156 | weston_desktop_surface_get_geometry(struct weston_desktop_surface *surface); |
| 157 | struct weston_size |
| 158 | weston_desktop_surface_get_max_size(struct weston_desktop_surface *surface); |
| 159 | struct weston_size |
| 160 | weston_desktop_surface_get_min_size(struct weston_desktop_surface *surface); |
| 161 | |
| 162 | #ifdef __cplusplus |
| 163 | } |
| 164 | #endif |
| 165 | |
| 166 | #endif /* WESTON_DESKTOP_H */ |