mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
xdg-shell: add support for v6
This adds the suspended toplevel state
This commit is contained in:
parent
04e4e06986
commit
e8d545a977
3 changed files with 24 additions and 3 deletions
|
@ -127,7 +127,7 @@ enum wlr_xdg_surface_role {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_xdg_toplevel_state {
|
struct wlr_xdg_toplevel_state {
|
||||||
bool maximized, fullscreen, resizing, activated;
|
bool maximized, fullscreen, resizing, activated, suspended;
|
||||||
uint32_t tiled; // enum wlr_edges
|
uint32_t tiled; // enum wlr_edges
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
int32_t max_width, max_height;
|
int32_t max_width, max_height;
|
||||||
|
@ -148,7 +148,7 @@ enum wlr_xdg_toplevel_configure_field {
|
||||||
|
|
||||||
struct wlr_xdg_toplevel_configure {
|
struct wlr_xdg_toplevel_configure {
|
||||||
uint32_t fields; // enum wlr_xdg_toplevel_configure_field
|
uint32_t fields; // enum wlr_xdg_toplevel_configure_field
|
||||||
bool maximized, fullscreen, resizing, activated;
|
bool maximized, fullscreen, resizing, activated, suspended;
|
||||||
uint32_t tiled; // enum wlr_edges
|
uint32_t tiled; // enum wlr_edges
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
struct {
|
struct {
|
||||||
|
@ -383,6 +383,13 @@ uint32_t wlr_xdg_toplevel_set_bounds(struct wlr_xdg_toplevel *toplevel,
|
||||||
uint32_t wlr_xdg_toplevel_set_wm_capabilities(struct wlr_xdg_toplevel *toplevel,
|
uint32_t wlr_xdg_toplevel_set_wm_capabilities(struct wlr_xdg_toplevel *toplevel,
|
||||||
uint32_t caps);
|
uint32_t caps);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request that this toplevel consider itself suspended or not
|
||||||
|
* suspended. Returns the associated configure serial.
|
||||||
|
*/
|
||||||
|
uint32_t wlr_xdg_toplevel_set_suspended(struct wlr_xdg_toplevel *toplevel,
|
||||||
|
bool suspended);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request that this toplevel closes.
|
* Request that this toplevel closes.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "types/wlr_xdg_shell.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;
|
static const struct xdg_wm_base_interface xdg_shell_impl;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ void handle_xdg_toplevel_ack_configure(
|
||||||
toplevel->pending.resizing = configure->resizing;
|
toplevel->pending.resizing = configure->resizing;
|
||||||
toplevel->pending.activated = configure->activated;
|
toplevel->pending.activated = configure->activated;
|
||||||
toplevel->pending.tiled = configure->tiled;
|
toplevel->pending.tiled = configure->tiled;
|
||||||
|
toplevel->pending.suspended = configure->suspended;
|
||||||
|
|
||||||
toplevel->pending.width = configure->width;
|
toplevel->pending.width = configure->width;
|
||||||
toplevel->pending.height = configure->height;
|
toplevel->pending.height = configure->height;
|
||||||
|
@ -99,6 +100,11 @@ struct wlr_xdg_toplevel_configure *send_xdg_toplevel_configure(
|
||||||
states[nstates++] = XDG_TOPLEVEL_STATE_MAXIMIZED;
|
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]));
|
assert(nstates <= sizeof(states) / sizeof(states[0]));
|
||||||
|
|
||||||
int32_t width = configure->width;
|
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;
|
toplevel->scheduled.wm_capabilities = caps;
|
||||||
return wlr_xdg_surface_schedule_configure(toplevel->base);
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue