aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-10-25 21:30:38 +0300
committerKirill Primak <vyivel@eclair.cafe>2023-10-29 15:51:12 +0000
commit5fac9b1beb2281fb13d3e5de7fdd10ff7ba0f30b (patch)
tree7791d82ee6c5a0f5a9a975df67e72c5830aceff1
parentaf165acb427dd166f2768cf806d28f106bc61fd7 (diff)
xdg-toplevel: don't send maximized if tiled is requested but not supported
This is a bit too magical and may break compositors which try not to send duplicate configure events.
-rw-r--r--types/xdg_shell/wlr_xdg_toplevel.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c
index 23e04db5..6b163599 100644
--- a/types/xdg_shell/wlr_xdg_toplevel.c
+++ b/types/xdg_shell/wlr_xdg_toplevel.c
@@ -78,31 +78,25 @@ struct wlr_xdg_toplevel_configure *send_xdg_toplevel_configure(
if (configure->activated) {
states[nstates++] = XDG_TOPLEVEL_STATE_ACTIVATED;
}
- if (configure->tiled) {
- if (version >= XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) {
- const struct {
- enum wlr_edges edge;
- enum xdg_toplevel_state state;
- } tiled[] = {
- { WLR_EDGE_LEFT, XDG_TOPLEVEL_STATE_TILED_LEFT },
- { WLR_EDGE_RIGHT, XDG_TOPLEVEL_STATE_TILED_RIGHT },
- { WLR_EDGE_TOP, XDG_TOPLEVEL_STATE_TILED_TOP },
- { WLR_EDGE_BOTTOM, XDG_TOPLEVEL_STATE_TILED_BOTTOM },
- };
-
- for (size_t i = 0; i < sizeof(tiled)/sizeof(tiled[0]); ++i) {
- if ((configure->tiled & tiled[i].edge) == 0) {
- continue;
- }
- states[nstates++] = tiled[i].state;
+ if (configure->tiled && version >= XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) {
+ const struct {
+ enum wlr_edges edge;
+ enum xdg_toplevel_state state;
+ } tiled[] = {
+ { WLR_EDGE_LEFT, XDG_TOPLEVEL_STATE_TILED_LEFT },
+ { WLR_EDGE_RIGHT, XDG_TOPLEVEL_STATE_TILED_RIGHT },
+ { WLR_EDGE_TOP, XDG_TOPLEVEL_STATE_TILED_TOP },
+ { WLR_EDGE_BOTTOM, XDG_TOPLEVEL_STATE_TILED_BOTTOM },
+ };
+
+ for (size_t i = 0; i < sizeof(tiled)/sizeof(tiled[0]); ++i) {
+ if ((configure->tiled & tiled[i].edge) == 0) {
+ continue;
}
- } else if (!configure->maximized) {
- states[nstates++] = XDG_TOPLEVEL_STATE_MAXIMIZED;
+ states[nstates++] = tiled[i].state;
}
}
-
- if (configure->suspended &&
- version >= XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION) {
+ if (configure->suspended && version >= XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION) {
states[nstates++] = XDG_TOPLEVEL_STATE_SUSPENDED;
}
assert(nstates <= sizeof(states) / sizeof(states[0]));