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 15d593a824efc52c385801d6bd6c248a029eb161
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Aug 14 23:46:30 2026 -0600
e_comp_wl - scale window geometry, positioners and subsurface offsets
The rest of the surface-local values that get mixed with canvas geometry.
xdg_positioner and wl_region are both shared objects - one can be used for
several popups, and xdg_popup.reposition hands the same one back - so neither
can be scaled where its values are set. The positioner is converted into a
copy at _apply_positioner(), the single point where it meets ec->parent->x,
the zone and ec->w/h. Scaling the client's own object in place would compound
the factor on every reuse.
set_window_geometry is not shared, so it converts at the setter and is stored
in canvas units, which is what the frame geometry it drives is worked out in.
A subsurface offset is measured in its PARENT's coordinate space, so it takes
the parent's scale rather than its own.
xdg6 gets the same treatment as xdg.c: it is a different shell speaking the
same coordinates, and leaving it out would have made zxdg_shell_v6 clients the
one place where the conversion silently did not happen.
Still an identity while the scale is 1.
wlcs 1.8.1: 754 passed, 15 failed, failure set unchanged.
---
src/bin/e_comp_wl.c | 19 ++++++++++++++---
src/modules/wl_desktop_shell/xdg.c | 36 ++++++++++++++++++++++++++++++-
src/modules/wl_desktop_shell/xdg6.c | 42 ++++++++++++++++++++++++++++++++++---
3 files changed, 90 insertions(+), 7 deletions(-)
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 42a14c629..c8bdabee1 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -1506,6 +1506,10 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou
* Advertising the one as the other is what makes a client size itself against
* a screen half the size of the real one, which is the bug E-00 works around.
*
+ * Taken from the output the client is on. A surface can straddle two of them;
+ * this follows the zone, which is the one E already considers the client to
+ * be on, rather than inventing a second answer to that question.
+ *
* Returns 1 for now, so every conversion below is an identity and nothing
* changes. Turning it on is a separate commit from teaching the code to ask.
*/
@@ -3137,9 +3141,18 @@ _e_comp_wl_subsurface_cb_position_set(struct wl_client *client EINA_UNUSED, stru
if (!(sdata = ec->comp_data->sub.data)) return;
/* Pending, not scheduled: these coordinates belong to the parent's state,
- * so it is the parent's next commit that latches them. */
- sdata->pending_position.x = x;
- sdata->pending_position.y = y;
+ * so it is the parent's next commit that latches them.
+ *
+ * Surface-local, and relative to the parent - stored in canvas units
+ * because that is what they are eventually added to the parent's position
+ * as. The parent's scale is the one that counts, since the offset is
+ * measured in the parent's coordinate space, not this surface's. */
+ {
+ int scale = e_comp_wl_client_scale_get(sdata->parent ?: ec);
+
+ sdata->pending_position.x = x * scale;
+ sdata->pending_position.y = y * scale;
+ }
sdata->pending_position.set = EINA_TRUE;
}
diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index cd6dc5970..f8b0c37aa 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -877,7 +877,17 @@ _e_xdg_surface_cb_window_geometry_set(struct wl_client *client EINA_UNUSED, stru
return;
}
if (e_object_is_del(E_OBJECT(ec))) return;
- EINA_RECTANGLE_SET(&ec->comp_data->shell.window, x, y, w, h);
+
+ /* Surface-local on the wire; stored in canvas units, because the frame
+ * geometry it ends up driving is worked out against state->bw/bh. Unlike a
+ * wl_region or an xdg_positioner this belongs to exactly one surface, so
+ * converting it here rather than where it is used is safe. */
+ {
+ int scale = e_comp_wl_client_scale_get(ec);
+
+ EINA_RECTANGLE_SET(&ec->comp_data->shell.window,
+ x * scale, y * scale, w * scale, h * scale);
+ }
//DBG("XDG_SHELL: Window Geom Set: %d \t%d %d, %d %d", wl_resource_get_id(resource), x, y, w, h);
}
@@ -1197,6 +1207,30 @@ _apply_positioner(E_Client *ec, Positioner *p)
{
int x, y;
int zx, zy, zw, zh;
+ Positioner scaled;
+ int scale = e_comp_wl_client_scale_get(ec);
+
+ /* An xdg_positioner is surface-local, and everything below mixes it with
+ * canvas geometry - the parent's position, the zone, ec->w/h. Convert it
+ * once, here, into a copy.
+ *
+ * A copy rather than in place because a positioner is a shared object: the
+ * same one can be used for several popups, and xdg_popup.reposition hands
+ * it back again. Scaling the client's own object would compound the factor
+ * every time it was reused. */
+ if (scale != 1)
+ {
+ scaled = *p;
+ scaled.offset.x *= scale;
+ scaled.offset.y *= scale;
+ scaled.size.w *= scale;
+ scaled.size.h *= scale;
+ scaled.anchor_rect.x *= scale;
+ scaled.anchor_rect.y *= scale;
+ scaled.anchor_rect.w *= scale;
+ scaled.anchor_rect.h *= scale;
+ p = &scaled;
+ }
/* apply base geometry:
* coords are relative to parent
diff --git a/src/modules/wl_desktop_shell/xdg6.c b/src/modules/wl_desktop_shell/xdg6.c
index 43b81a6eb..4751e8668 100644
--- a/src/modules/wl_desktop_shell/xdg6.c
+++ b/src/modules/wl_desktop_shell/xdg6.c
@@ -392,6 +392,7 @@ static void
_e_xdg_shell_surface_configure_send(struct wl_resource *resource, uint32_t edges, int32_t width, int32_t height)
{
E_Client *ec;
+ int scale;
/* get the client for this resource */
if (!(ec = wl_resource_get_user_data(resource)))
@@ -402,6 +403,11 @@ _e_xdg_shell_surface_configure_send(struct wl_resource *resource, uint32_t edges
return;
}
if (e_object_is_del(E_OBJECT(ec))) return;
+
+ /* Canvas geometry in, surface-local units out - the same conversion as in
+ * xdg.c. A zero size means "you choose" and divides to zero unchanged. */
+ scale = e_comp_wl_client_scale_get(ec);
+
if (e_client_util_is_popup(ec))
{
E_Shell_Data *shd;
@@ -409,13 +415,17 @@ _e_xdg_shell_surface_configure_send(struct wl_resource *resource, uint32_t edges
shd = ec->comp_data->shell.data;
serial = wl_display_next_serial(e_comp_wl->wl.disp);
- zxdg_popup_v6_send_configure(resource, ec->x - ec->parent->x, ec->y - ec->parent->y, width ?: ec->w, height ?: ec->h);
+ zxdg_popup_v6_send_configure(resource,
+ (ec->x - ec->parent->x) / scale,
+ (ec->y - ec->parent->y) / scale,
+ (width ?: ec->w) / scale,
+ (height ?: ec->h) / scale);
zxdg_surface_v6_send_configure(shd->surface, serial);
ec->comp_data->need_xdg_configure = 0;
return;
}
- _xdg_shell_surface_send_configure(resource, ec->fullscreen, !!ec->maximized || ec->comp_data->max, edges, width, height);
+ _xdg_shell_surface_send_configure(resource, ec->fullscreen, !!ec->maximized || ec->comp_data->max, edges, width / scale, height / scale);
}
static void
@@ -531,7 +541,14 @@ _e_xdg_surface_cb_window_geometry_set(struct wl_client *client EINA_UNUSED, stru
return;
}
if (e_object_is_del(E_OBJECT(ec))) return;
- EINA_RECTANGLE_SET(&ec->comp_data->shell.window, x, y, w, h);
+
+ /* Surface-local on the wire, canvas units in store - as in xdg.c. */
+ {
+ int scale = e_comp_wl_client_scale_get(ec);
+
+ EINA_RECTANGLE_SET(&ec->comp_data->shell.window,
+ x * scale, y * scale, w * scale, h * scale);
+ }
//DBG("XDG_SHELL: Window Geom Set: %d \t%d %d, %d %d", wl_resource_get_id(resource), x, y, w, h);
}
@@ -808,6 +825,25 @@ _apply_positioner(E_Client *ec, Positioner *p)
{
int x, y;
int zx, zy, zw, zh;
+ Positioner scaled;
+ int scale = e_comp_wl_client_scale_get(ec);
+
+ /* Surface-local positioner mixed with canvas geometry below; convert once
+ * into a copy, because a positioner is a shared object that can be reused
+ * for several popups. See the same conversion in xdg.c. */
+ if (scale != 1)
+ {
+ scaled = *p;
+ scaled.offset.x *= scale;
+ scaled.offset.y *= scale;
+ scaled.size.w *= scale;
+ scaled.size.h *= scale;
+ scaled.anchor_rect.x *= scale;
+ scaled.anchor_rect.y *= scale;
+ scaled.anchor_rect.w *= scale;
+ scaled.anchor_rect.h *= scale;
+ p = &scaled;
+ }
/* apply base geometry:
* coords are relative to parent
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.