Marius Vlad | d98c7e8 | 2021-03-08 18:02:32 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021 Collabora, Ltd. |
| 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 | |
| 25 | #include "config.h" |
| 26 | #include "shared/helpers.h" |
| 27 | #include <libweston/libweston.h> |
| 28 | |
Marius Vlad | 2be0937 | 2021-03-08 22:45:52 +0200 | [diff] [blame] | 29 | /* parameter for create_solid_color_surface() */ |
| 30 | struct weston_solid_color_surface { |
| 31 | int (*get_label)(struct weston_surface *es, char *buf, size_t len); |
| 32 | void (*surface_committed)(struct weston_surface *es, int32_t sx, int32_t sy); |
| 33 | void *surface_private; |
| 34 | float r, g, b; |
| 35 | }; |
| 36 | |
Marius Vlad | d98c7e8 | 2021-03-08 18:02:32 +0200 | [diff] [blame] | 37 | struct weston_output * |
| 38 | get_default_output(struct weston_compositor *compositor); |
| 39 | |
| 40 | struct weston_output * |
| 41 | get_focused_output(struct weston_compositor *compositor); |
| 42 | |
| 43 | void |
| 44 | center_on_output(struct weston_view *view, struct weston_output *output); |
| 45 | |
| 46 | void |
| 47 | surface_subsurfaces_boundingbox(struct weston_surface *surface, int32_t *x, |
| 48 | int32_t *y, int32_t *w, int32_t *h); |
Marius Vlad | 2be0937 | 2021-03-08 22:45:52 +0200 | [diff] [blame] | 49 | |
| 50 | int |
| 51 | surface_get_label(struct weston_surface *surface, char *buf, size_t len); |
| 52 | |
| 53 | /* helper to create a view w/ a color |
| 54 | */ |
| 55 | struct weston_view * |
| 56 | create_solid_color_surface(struct weston_compositor *compositor, |
| 57 | struct weston_solid_color_surface *ss, |
| 58 | float x, float y, int w, int h); |