This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch wl/browser-all
in repository enlightenment.
View the commit online.
commit 78c9b2f0b7f06dc1f3eba0d0e81795e488cb4d54
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Aug 12 15:30:04 2026 -0600
wl_desktop_shell - raise xdg_wm_base to version 2, and say tiled when tiled
First of the version steps taking xdg_wm_base from 1 to 6. Two parts.
The plumbing: every child object is now created at the version its parent was
bound at rather than at a hardcoded 1, so the remaining steps only have to
move XDG_WM_BASE_SERVER_VERSION. Without this a client binding at 6 would
still get a version-1 positioner and never see the requests it asked for.
Then v2 itself, the tiled states. An edge is tiled when it is not the client's
to resize because something is already against it, and what a client does with
that is stop drawing a rounded corner and a drop shadow into a seam.
E's half-screen snaps are the case that matters, and until now they were
reported as MAXIMIZED. E_MAXIMIZE_LEFT and its siblings are a direction, not a
degree, so ec->maximized reads as true for a window filling half the screen -
and a browser told it is maximized lays itself out for a work area twice the
width it actually has. Only E_MAXIMIZE_BOTH is really maximized. The rest are
tiled, and v2 is the first version with the vocabulary to say so.
A client bound below 2 still hears MAXIMIZED for a snap, because before v2
there was nothing else to say.
The declared version moves in src/tests/wayland/globals.expected and in the
wlcs descriptor together - the driver checks both against the compositor's
real registry and fails if they disagree in either direction, which is the
point of having them.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FtoiXoSKUmZb6Aix6U3GZS
---
src/modules/wl_desktop_shell/xdg.c | 60 ++++++++++++++++++++++++++++++++++----
src/tests/wayland/globals.expected | 2 +-
src/tests/wlcs/e_wlcs.c | 2 +-
3 files changed, 57 insertions(+), 7 deletions(-)
diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index ddf7b4702..5df02c58c 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -4,6 +4,10 @@
#include "xdg-shell-server-protocol.h"
+/* Every child object is created at the version its parent was bound at,
+ * so this is the only number to move when a version is finished. */
+#define XDG_WM_BASE_SERVER_VERSION 2
+
typedef enum
{
STATE_MAXIMIZED = (1 << 0),
@@ -262,7 +266,8 @@ _e_xdg_shell_cb_positioner_create(struct wl_client *client, struct wl_resource *
Positioner *p;
v = wl_resource_get_user_data(resource);
- res = wl_resource_create(client, &xdg_positioner_interface, 1, id);
+ res = wl_resource_create(client, &xdg_positioner_interface,
+ wl_resource_get_version(resource), id);
p = E_NEW(Positioner, 1);
p->v = v;
p->res = res;
@@ -415,9 +420,47 @@ _e_xdg_surface_state_add(struct wl_resource *resource, struct wl_array *states,
wl_resource_post_no_memory(resource);
}
+/* xdg-shell v2 tiled states. An edge is tiled when it is not the client's to
+ * resize because something is already up against it, and what the client does
+ * with that is stop drawing a rounded corner and a drop shadow into a seam.
+ *
+ * E's half-screen snaps are the case that matters: E_MAXIMIZE_LEFT and its
+ * siblings are a direction, not a degree, so a left-snapped window is not
+ * maximized however much ec->maximized reads as true. Saying MAXIMIZED there
+ * tells a browser it is filling the work area and it lays itself out for a
+ * screen twice the width it has. Only E_MAXIMIZE_BOTH is really maximized;
+ * the rest are tiled, and this is the version that can finally say so. */
+static Eina_Bool
+_e_xdg_surface_is_tiled(struct wl_resource *resource, E_Client *ec)
+{
+ E_Maximize dir = ec->maximized & E_MAXIMIZE_DIRECTION;
+
+ if (wl_resource_get_version(resource) < XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION)
+ return EINA_FALSE;
+ return dir && (dir != E_MAXIMIZE_BOTH);
+}
+
+static void
+_e_xdg_surface_tiled_states_add(struct wl_resource *resource, struct wl_array *states, E_Client *ec)
+{
+ E_Maximize dir = ec->maximized & E_MAXIMIZE_DIRECTION;
+
+ if ((dir == E_MAXIMIZE_LEFT) || (dir == E_MAXIMIZE_HORIZONTAL))
+ _e_xdg_surface_state_add(resource, states, XDG_TOPLEVEL_STATE_TILED_LEFT);
+ if ((dir == E_MAXIMIZE_RIGHT) || (dir == E_MAXIMIZE_HORIZONTAL))
+ _e_xdg_surface_state_add(resource, states, XDG_TOPLEVEL_STATE_TILED_RIGHT);
+ if ((dir == E_MAXIMIZE_LEFT) || (dir == E_MAXIMIZE_RIGHT) ||
+ (dir == E_MAXIMIZE_VERTICAL))
+ {
+ _e_xdg_surface_state_add(resource, states, XDG_TOPLEVEL_STATE_TILED_TOP);
+ _e_xdg_surface_state_add(resource, states, XDG_TOPLEVEL_STATE_TILED_BOTTOM);
+ }
+}
+
static void
_xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullscreen, Eina_Bool maximized, uint32_t edges, int32_t width, int32_t height)
{
+ Eina_Bool tiled;
struct wl_array states;
uint32_t serial;
E_Client *focused, *ec;
@@ -479,8 +522,11 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
shd->activated = activated;
wl_array_init(&states);
+ tiled = maximized && _e_xdg_surface_is_tiled(resource, ec);
if (fullscreen)
_e_xdg_surface_state_add(resource, &states, XDG_TOPLEVEL_STATE_FULLSCREEN);
+ else if (tiled)
+ _e_xdg_surface_tiled_states_add(resource, &states, ec);
else if (maximized)
_e_xdg_surface_state_add(resource, &states, XDG_TOPLEVEL_STATE_MAXIMIZED);
if (edges)
@@ -1101,7 +1147,8 @@ _e_xdg_surface_cb_popup_get(struct wl_client *client, struct wl_resource *resour
/* try to create a shell surface */
if (!(cdata->shell.surface =
- wl_resource_create(client, &xdg_popup_interface, 1, id)))
+ wl_resource_create(client, &xdg_popup_interface,
+ wl_resource_get_version(resource), id)))
{
ERR("Could not create xdg shell surface");
wl_resource_post_no_memory(resource);
@@ -1423,7 +1470,8 @@ _e_xdg_surface_cb_toplevel_get(struct wl_client *client EINA_UNUSED, struct wl_r
}
if (!(cdata->shell.surface =
- wl_resource_create(client, &xdg_toplevel_interface, 1, id)))
+ wl_resource_create(client, &xdg_toplevel_interface,
+ wl_resource_get_version(resource), id)))
{
ERR("Could not create xdg shell surface");
wl_resource_post_no_memory(resource);
@@ -1565,7 +1613,8 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
/* try to create a shell surface */
if (!(shd->surface =
- wl_resource_create(client, &xdg_surface_interface, 1, id)))
+ wl_resource_create(client, &xdg_surface_interface,
+ wl_resource_get_version(resource), id)))
{
ERR("Could not create xdg shell surface");
wl_resource_post_no_memory(surface_resource);
@@ -1705,7 +1754,8 @@ EINTERN Eina_Bool
e_xdg_shell_init(void)
{
/* try to create global xdg_shell interface */
- if (!wl_global_create(e_comp_wl->wl.disp, &xdg_wm_base_interface, 1,
+ if (!wl_global_create(e_comp_wl->wl.disp, &xdg_wm_base_interface,
+ XDG_WM_BASE_SERVER_VERSION,
NULL, _e_xdg_shell_cb_bind))
{
ERR("Could not create xdg_shell global");
diff --git a/src/tests/wayland/globals.expected b/src/tests/wayland/globals.expected
index 1041a716f..8dd0e8140 100644
--- a/src/tests/wayland/globals.expected
+++ b/src/tests/wayland/globals.expected
@@ -7,7 +7,7 @@ wl_seat 5
wl_shell 1
wl_shm 1
wl_subcompositor 1
-xdg_wm_base 1
+xdg_wm_base 2
zwp_e_session_recovery 1
zwp_pointer_constraints_v1 1
zwp_relative_pointer_manager_v1 1
diff --git a/src/tests/wlcs/e_wlcs.c b/src/tests/wlcs/e_wlcs.c
index 2be87ee4d..0dfbbaf21 100644
--- a/src/tests/wlcs/e_wlcs.c
+++ b/src/tests/wlcs/e_wlcs.c
@@ -700,7 +700,7 @@ static const WlcsExtensionDescriptor _extensions[] =
{ "wl_seat", 5 },
{ "wl_output", 2 },
{ "wl_data_device_manager", 3 },
- { "xdg_wm_base", 1 },
+ { "xdg_wm_base", 2 },
{ "zxdg_shell_v6", 1 },
{ "wl_shell", 1 },
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.