ext-foreign-toplevel-list-v1: new protocol implementation

This implements the new ext-foreign-toplevel-list-v1 protocol [1].
Implemented analog to the zwlr-foreign-toplevel-management-v1 implementation.
The additional _ext_ in the names was added to avoid name collisions.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/187

Co-authored-by: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
This commit is contained in:
columbarius 2024-02-10 23:14:05 +01:00
parent cb815e8847
commit 9e426e70e6
4 changed files with 344 additions and 0 deletions

View file

@ -0,0 +1,67 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_FOREIGN_TOPLEVEL_LIST_V1_H
#define WLR_TYPES_WLR_FOREIGN_TOPLEVEL_LIST_V1_H
#include <wayland-server-core.h>
struct wlr_ext_foreign_toplevel_list_v1 {
struct wl_global *global;
struct wl_list resources; // wl_resource_get_link()
struct wl_list toplevels; // ext_foreign_toplevel_handle_v1.link
struct wl_listener display_destroy;
struct {
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_ext_foreign_toplevel_handle_v1 {
struct wlr_ext_foreign_toplevel_list_v1 *list;
struct wl_list resources; // wl_resource_get_link()
struct wl_list link; // wlr_ext_foreign_toplevel_list_v1.toplevels
char *title;
char *app_id;
char *identifier;
struct {
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_ext_foreign_toplevel_handle_v1_state {
const char *title;
const char *app_id;
};
struct wlr_ext_foreign_toplevel_list_v1 *wlr_ext_foreign_toplevel_list_v1_create(
struct wl_display *display, uint32_t version);
struct wlr_ext_foreign_toplevel_handle_v1 *wlr_ext_foreign_toplevel_handle_v1_create(
struct wlr_ext_foreign_toplevel_list_v1 *list,
const struct wlr_ext_foreign_toplevel_handle_v1_state *state);
/**
* Destroy the given toplevel handle, sending the closed event to any
* client.
*/
void wlr_ext_foreign_toplevel_handle_v1_destroy(
struct wlr_ext_foreign_toplevel_handle_v1 *toplevel);
void wlr_ext_foreign_toplevel_handle_v1_update_state(
struct wlr_ext_foreign_toplevel_handle_v1 *toplevel,
const struct wlr_ext_foreign_toplevel_handle_v1_state *state);
#endif