wayland: Phase 42 — window_get_client_attrs returns real map/geometry
Implement wl_window_get_client_attrs: look up the toplevel view, return WCLIENT_VIEWABLE with width/height from wlr_surface.current for mapped surfaces; WCLIENT_UNMAPPED for unknown IDs. Extend the wManageWindow success log to include geo=WxH so the smoke test can verify the geometry is non-zero after the client commits a frame. Smoke test: add Phase 42 check — grep geo= and verify it is logged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0ea33dc830
commit
d9a70e9177
|
|
@ -19,6 +19,8 @@
|
|||
* Wayland surfaces appear in scr->focused_window list.
|
||||
* Phase 40: handle_toplevel_unmap wires XDG toplevel unmap to wUnmanageWindow.
|
||||
* Phase 41: prop_get_wm_class and window_fetch_name return XDG app_id/title.
|
||||
* Phase 42: window_get_client_attrs returns WCLIENT_VIEWABLE + surface
|
||||
* geometry for mapped XDG toplevels.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
|
@ -165,10 +167,12 @@ handle_toplevel_map(struct wl_listener *listener, void *data)
|
|||
if (scr) {
|
||||
WWindow *wwin = wManageWindow(scr, view->id);
|
||||
if (wwin)
|
||||
wwarning("wl_backend: wManageWindow succeeded id=0x%lx class=%s name=%s",
|
||||
wwarning("wl_backend: wManageWindow succeeded id=0x%lx "
|
||||
"class=%s name=%s geo=%dx%d",
|
||||
view->id,
|
||||
wwin->wm_class ? wwin->wm_class : "(none)",
|
||||
wwin->wm_instance ? wwin->wm_instance : "(none)");
|
||||
wwin->wm_instance ? wwin->wm_instance : "(none)",
|
||||
wwin->client.width, wwin->client.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -763,9 +767,16 @@ static int wl_overlay_text_width(WScreen *scr, const char *str, int n) { (void)
|
|||
static int
|
||||
wl_window_get_client_attrs(WNativeWindow win, WClientAttributes *out)
|
||||
{
|
||||
(void)win;
|
||||
/* Phase 42: return real map_state and geometry from XDG surface. */
|
||||
struct wl_toplevel_view *v = wl_find_view_by_id(win);
|
||||
memset(out, 0, sizeof(*out));
|
||||
out->map_state = WCLIENT_UNMAPPED;
|
||||
if (v && v->xdg_surface && v->xdg_surface->surface) {
|
||||
out->map_state = WCLIENT_VIEWABLE;
|
||||
out->width = v->xdg_surface->surface->current.width;
|
||||
out->height = v->xdg_surface->surface->current.height;
|
||||
} else {
|
||||
out->map_state = WCLIENT_UNMAPPED;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
# logs "toplevel unmapped" and exits cleanly after cleanup
|
||||
# 11. (Phase 41) prop_get_wm_class returns XDG app_id: "wManageWindow
|
||||
# succeeded" log includes class=org.freedesktop.weston.simple-shm
|
||||
# 12. (Phase 42) window_get_client_attrs returns WCLIENT_VIEWABLE + geometry:
|
||||
# "wManageWindow succeeded" log includes geo= with non-zero size
|
||||
#
|
||||
# This test grows as wl_backend vtable slots are implemented.
|
||||
#
|
||||
|
|
@ -169,6 +171,12 @@ if command -v weston-simple-shm >/dev/null 2>&1; then
|
|||
grep -q 'class=org.freedesktop.weston.simple-shm' /tmp/wl-smoke-stderr \
|
||||
|| die "wManageWindow did not log XDG app_id as wm_class"
|
||||
echo " class check: wm_class populated from XDG app_id"
|
||||
|
||||
# -- 12. Phase 42: geometry from XDG surface -------------------------
|
||||
# geo= must appear and be non-zero (weston-simple-shm commits a frame)
|
||||
GEO=$(grep -o 'geo=[0-9]*x[0-9]*' /tmp/wl-smoke-stderr | head -1)
|
||||
[ -n "$GEO" ] || die "wManageWindow did not log geo= geometry"
|
||||
echo " geometry check: client geometry logged as $GEO"
|
||||
else
|
||||
echo " client check: skipped (weston-simple-shm not installed)"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue