mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
xdg-shell: specify version in wlr_xdg_shell_create
With protocol additions such as [1], compositors currently have no way to opt out of the version upgrade. The protocol upgrade will always be backwards-compatible but may require new compositor features. The status quo doesn't make it possible to ship a protocol addition without breaking the wlroots API. This will be an issue for API stabilization [2]. To address this, let compositors provide a maximum version in the function creating the global. We need to support all previous versions of the interface anyways because of older clients. This mechanism works the same way as Wayland clients passing a version in wl_global.bind. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514 [2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3397
This commit is contained in:
parent
19896e7fb6
commit
8fe3aa29da
5 changed files with 19 additions and 8 deletions
|
|
@ -137,20 +137,24 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
|||
free(xdg_shell);
|
||||
}
|
||||
|
||||
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display) {
|
||||
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display,
|
||||
uint32_t version) {
|
||||
assert(version <= WM_BASE_VERSION);
|
||||
|
||||
struct wlr_xdg_shell *xdg_shell =
|
||||
calloc(1, sizeof(struct wlr_xdg_shell));
|
||||
if (!xdg_shell) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xdg_shell->version = version;
|
||||
xdg_shell->ping_timeout = 10000;
|
||||
|
||||
wl_list_init(&xdg_shell->clients);
|
||||
wl_list_init(&xdg_shell->popup_grabs);
|
||||
|
||||
struct wl_global *global = wl_global_create(display,
|
||||
&xdg_wm_base_interface, WM_BASE_VERSION, xdg_shell, xdg_shell_bind);
|
||||
&xdg_wm_base_interface, version, xdg_shell, xdg_shell_bind);
|
||||
if (!global) {
|
||||
free(xdg_shell);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel,
|
|||
if (toplevel->parent) {
|
||||
wl_list_remove(&toplevel->parent_unmap.link);
|
||||
}
|
||||
|
||||
|
||||
if (parent && parent->base->mapped) {
|
||||
toplevel->parent = parent;
|
||||
toplevel->parent_unmap.notify = handle_parent_unmap;
|
||||
|
|
@ -497,6 +497,7 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_toplevel *toplevel,
|
|||
|
||||
uint32_t wlr_xdg_toplevel_set_tiled(struct wlr_xdg_toplevel *toplevel,
|
||||
uint32_t tiled) {
|
||||
assert(toplevel->base->client->shell->version >= 2);
|
||||
toplevel->scheduled.tiled = tiled;
|
||||
return wlr_xdg_surface_schedule_configure(toplevel->base);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue