xdg-shell: add support for v6

This adds the suspended toplevel state
This commit is contained in:
Leonardo Hernández Hernández 2023-07-23 20:30:43 -06:00
parent 04e4e06986
commit e8d545a977
No known key found for this signature in database
GPG key ID: E538897EE11B9624
3 changed files with 24 additions and 3 deletions

View file

@ -2,7 +2,7 @@
#include <stdlib.h>
#include "types/wlr_xdg_shell.h"
#define WM_BASE_VERSION 5
#define WM_BASE_VERSION 6
static const struct xdg_wm_base_interface xdg_shell_impl;

View file

@ -14,6 +14,7 @@ void handle_xdg_toplevel_ack_configure(
toplevel->pending.resizing = configure->resizing;
toplevel->pending.activated = configure->activated;
toplevel->pending.tiled = configure->tiled;
toplevel->pending.suspended = configure->suspended;
toplevel->pending.width = configure->width;
toplevel->pending.height = configure->height;
@ -99,6 +100,11 @@ struct wlr_xdg_toplevel_configure *send_xdg_toplevel_configure(
states[nstates++] = XDG_TOPLEVEL_STATE_MAXIMIZED;
}
}
if (configure->suspended &&
version >= XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION) {
states[nstates++] = XDG_TOPLEVEL_STATE_SUSPENDED;
}
assert(nstates <= sizeof(states) / sizeof(states[0]));
int32_t width = configure->width;
@ -617,3 +623,11 @@ uint32_t wlr_xdg_toplevel_set_wm_capabilities(struct wlr_xdg_toplevel *toplevel,
toplevel->scheduled.wm_capabilities = caps;
return wlr_xdg_surface_schedule_configure(toplevel->base);
}
uint32_t wlr_xdg_toplevel_set_suspended(struct wlr_xdg_toplevel *toplevel,
bool suspended) {
assert(toplevel->base->client->shell->version >=
XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION);
toplevel->scheduled.suspended = suspended;
return wlr_xdg_surface_schedule_configure(toplevel->base);
}