You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weston/libweston/desktop/internal.h

250 lines
9.6 KiB

/*
* Copyright © 2016 Quentin "Sardem FF7" Glidic
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef WESTON_DESKTOP_INTERNAL_H
#define WESTON_DESKTOP_INTERNAL_H
#include <libweston/libweston.h>
struct weston_desktop_seat;
struct weston_desktop_client;
struct weston_compositor *
weston_desktop_get_compositor(struct weston_desktop *desktop);
struct wl_display *
weston_desktop_get_display(struct weston_desktop *desktop);
void
weston_desktop_api_ping_timeout(struct weston_desktop *desktop,
struct weston_desktop_client *client);
void
weston_desktop_api_pong(struct weston_desktop *desktop,
struct weston_desktop_client *client);
void
weston_desktop_api_surface_added(struct weston_desktop *desktop,
struct weston_desktop_surface *surface);
void
weston_desktop_api_surface_removed(struct weston_desktop *desktop,
struct weston_desktop_surface *surface);
void
weston_desktop_api_committed(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
int32_t sx, int32_t sy);
void
weston_desktop_api_show_window_menu(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat,
int32_t x, int32_t y);
void
weston_desktop_api_set_parent(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_desktop_surface *parent);
void
weston_desktop_api_move(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat, uint32_t serial);
void
weston_desktop_api_resize(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat, uint32_t serial,
enum weston_desktop_surface_edge edges);
void
weston_desktop_api_fullscreen_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
bool fullscreen,
struct weston_output *output);
void
weston_desktop_api_maximized_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
bool maximized);
void
weston_desktop_api_minimized_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface);
void
weston_desktop_api_set_xwayland_position(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
int32_t x, int32_t y);
void
weston_desktop_api_get_position(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
int32_t *x, int32_t *y);
struct weston_desktop_seat *
weston_desktop_seat_from_seat(struct weston_seat *wseat);
struct weston_desktop_surface_implementation {
void (*set_activated)(struct weston_desktop_surface *surface,
void *user_data, bool activated);
void (*set_fullscreen)(struct weston_desktop_surface *surface,
void *user_data, bool fullscreen);
void (*set_maximized)(struct weston_desktop_surface *surface,
void *user_data, bool maximized);
void (*set_resizing)(struct weston_desktop_surface *surface,
void *user_data, bool resizing);
void (*set_size)(struct weston_desktop_surface *surface,
void *user_data, int32_t width, int32_t height);
void (*set_orientation)(struct weston_desktop_surface *surface,
void *user_data, enum weston_top_level_tiled_orientation tiled_orientation);
void (*committed)(struct weston_desktop_surface *surface, void *user_data,
int32_t sx, int32_t sy);
void (*update_position)(struct weston_desktop_surface *surface,
void *user_data);
void (*ping)(struct weston_desktop_surface *surface, uint32_t serial,
void *user_data);
void (*close)(struct weston_desktop_surface *surface, void *user_data);
bool (*get_activated)(struct weston_desktop_surface *surface,
void *user_data);
bool (*get_fullscreen)(struct weston_desktop_surface *surface,
void *user_data);
bool (*get_maximized)(struct weston_desktop_surface *surface,
void *user_data);
bool (*get_resizing)(struct weston_desktop_surface *surface,
void *user_data);
struct weston_size
(*get_max_size)(struct weston_desktop_surface *surface,
void *user_data);
struct weston_size
(*get_min_size)(struct weston_desktop_surface *surface,
void *user_data);
void (*destroy)(struct weston_desktop_surface *surface,
void *user_data);
};
struct weston_desktop_client *
weston_desktop_client_create(struct weston_desktop *desktop,
struct wl_client *client,
wl_dispatcher_func_t dispatcher,
const struct wl_interface *interface,
const void *implementation, uint32_t version,
uint32_t id);
void
weston_desktop_client_destroy(struct weston_desktop_client *client);
void
weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client,
struct wl_listener *listener);
struct weston_desktop *
weston_desktop_client_get_desktop(struct weston_desktop_client *client);
struct wl_resource *
weston_desktop_client_get_resource(struct weston_desktop_client *client);
struct wl_list *
weston_desktop_client_get_surface_list(struct weston_desktop_client *client);
void
weston_desktop_client_pong(struct weston_desktop_client *client,
uint32_t serial);
struct weston_desktop_surface *
weston_desktop_surface_create(struct weston_desktop *desktop,
struct weston_desktop_client *client,
struct weston_surface *surface,
const struct weston_desktop_surface_implementation *implementation,
void *implementation_data);
void
weston_desktop_surface_destroy(struct weston_desktop_surface *surface);
void
weston_desktop_surface_resource_destroy(struct wl_resource *resource);
struct wl_resource *
weston_desktop_surface_add_resource(struct weston_desktop_surface *surface,
const struct wl_interface *interface,
const void *implementation, uint32_t id,
wl_resource_destroy_func_t destroy);
struct weston_desktop_surface *
weston_desktop_surface_from_grab_link(struct wl_list *grab_link);
struct wl_list *
weston_desktop_surface_get_client_link(struct weston_desktop_surface *surface);
struct weston_desktop_surface *
weston_desktop_surface_from_client_link(struct wl_list *link);
bool
weston_desktop_surface_has_implementation(struct weston_desktop_surface *surface,
const struct weston_desktop_surface_implementation *implementation);
const struct weston_desktop_surface_implementation *
weston_desktop_surface_get_implementation(struct weston_desktop_surface *surface);
void *
weston_desktop_surface_get_implementation_data(struct weston_desktop_surface *surface);
struct weston_desktop_surface *
weston_desktop_surface_get_parent(struct weston_desktop_surface *surface);
bool
weston_desktop_surface_get_grab(struct weston_desktop_surface *surface);
void
weston_desktop_surface_set_title(struct weston_desktop_surface *surface,
const char *title);
void
weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface,
const char *app_id);
void
weston_desktop_surface_set_pid(struct weston_desktop_surface *surface,
pid_t pid);
void
weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface,
struct weston_geometry geometry);
void
weston_desktop_surface_set_relative_to(struct weston_desktop_surface *surface,
struct weston_desktop_surface *parent,
int32_t x, int32_t y, bool use_geometry);
void
weston_desktop_surface_unset_relative_to(struct weston_desktop_surface *surface);
void
weston_desktop_surface_popup_grab(struct weston_desktop_surface *popup,
struct weston_desktop_seat *seat,
uint32_t serial);
void
weston_desktop_surface_popup_ungrab(struct weston_desktop_surface *popup,
struct weston_desktop_seat *seat);
void
weston_desktop_surface_popup_dismiss(struct weston_desktop_surface *surface);
struct weston_desktop_surface *
weston_desktop_seat_popup_grab_get_topmost_surface(struct weston_desktop_seat *seat);
bool
weston_desktop_seat_popup_grab_start(struct weston_desktop_seat *seat,
struct wl_client *client, uint32_t serial);
void
weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat,
struct wl_list *link);
void
weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat,
struct wl_list *link);
void
weston_desktop_destroy_request(struct wl_client *client,
struct wl_resource *resource);
struct wl_global *
weston_desktop_xdg_wm_base_create(struct weston_desktop *desktop,
struct wl_display *display);
struct wl_global *
weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
struct wl_display *display);
void
weston_desktop_xwayland_init(struct weston_desktop *desktop);
libweston-desktop: add weston_desktop_xwayland_fini() This fixes the following leaks detected by ASan in ./tests/test-alpha-blending: Direct leak of 176 byte(s) in 2 object(s) allocated from: #0 0x7fb447880518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518) #1 0x7fb4432c12d7 in zalloc ../../git/weston/include/libweston/zalloc.h:38 #2 0x7fb4432c2ca6 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410 #3 0x7fb4432baadf in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87 #4 0x7fb4432e1e1f in wet_shell_init ../../git/weston/tests/weston-test-desktop-shell.c:224 #5 0x7fb44775fddd in wet_load_shell ../../git/weston/compositor/main.c:956 #6 0x7fb447770db1 in wet_main ../../git/weston/compositor/main.c:3434 #7 0x56172c599279 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432 #8 0x56172c59cce5 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528 #9 0x56172c58dc8c in fixture_setup ../../git/weston/tests/alpha-blending-test.c:65 #10 0x56172c58dd31 in fixture_setup_run_ ../../git/weston/tests/alpha-blending-test.c:67 #11 0x56172c59d29a in main ../../git/weston/tests/weston-test-runner.c:661 #12 0x7fb4473d509a in __libc_start_main ../csu/libc-start.c:308 Indirect leak of 144 byte(s) in 2 object(s) allocated from: #0 0x7fb447880518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518) #1 0x7fb4432bb592 in zalloc ../../git/weston/include/libweston/zalloc.h:38 #2 0x7fb4432bb882 in weston_desktop_client_create ../../git/weston/libweston-desktop/client.c:108 #3 0x7fb4432c2d0e in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:415 #4 0x7fb4432baadf in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87 #5 0x7fb4432e1e1f in wet_shell_init ../../git/weston/tests/weston-test-desktop-shell.c:224 #6 0x7fb44775fddd in wet_load_shell ../../git/weston/compositor/main.c:956 #7 0x7fb447770db1 in wet_main ../../git/weston/compositor/main.c:3434 #8 0x56172c599279 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432 #9 0x56172c59cce5 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528 #10 0x56172c58dc8c in fixture_setup ../../git/weston/tests/alpha-blending-test.c:65 #11 0x56172c58dd31 in fixture_setup_run_ ../../git/weston/tests/alpha-blending-test.c:67 #12 0x56172c59d29a in main ../../git/weston/tests/weston-test-runner.c:661 #13 0x7fb4473d509a in __libc_start_main ../csu/libc-start.c:308 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
3 years ago
void
weston_desktop_xwayland_fini(struct weston_desktop *desktop);
#endif /* WESTON_DESKTOP_INTERNAL_H */