wayland: Phase 55 — window_get_rect returns real geometry; window_move tracks position
Add x,y position fields to wl_toplevel_view. wl_window_move now records the WM-assigned position in the view struct instead of discarding it. wl_window_get_rect previously returned 0 (invalid) for all synthetic IDs, causing wIconifyWindow and similar callers to treat every Wayland window as destroyed. Now returns 1 with real surface dimensions (from wlr_surface current.width/height) for valid toplevel views, 1 with output dimensions for other virtual windows, and 0 only for WNATIVE_NONE. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
54c1a3a181
commit
49246f80ca
|
|
@ -35,6 +35,8 @@
|
|||
* WL_SEAT_CAPABILITY_KEYBOARD and WL_SEAT_CAPABILITY_POINTER.
|
||||
* Phase 54: virtual pointer position tracking; pointer_warp/warp_to update
|
||||
* state; pointer_query/query_full return tracked coordinates.
|
||||
* Phase 55: window_get_rect returns real geometry for synthetic toplevel IDs;
|
||||
* window_move records WM-assigned x,y in the view struct.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
|
@ -85,6 +87,7 @@ struct wl_toplevel_view {
|
|||
struct wl_listener destroy_listener;
|
||||
struct wl_listener title_listener; /* Phase 46: xdg_toplevel set_title */
|
||||
WNativeWindow id; /* synthetic handle, >= 0x10000000 */
|
||||
int x, y; /* Phase 55: WM-assigned position */
|
||||
struct wl_list link; /* wl_state.toplevel_list */
|
||||
};
|
||||
|
||||
|
|
@ -877,8 +880,9 @@ static void wl_window_map_subwindows(WNativeWindow parent) { (void)parent; }
|
|||
static void wl_window_unmap(WNativeWindow win) { (void)win; }
|
||||
static void wl_window_move(WNativeWindow win, int x, int y)
|
||||
{
|
||||
/* Phase 44: position is tracked on the WM side; no server-side move needed. */
|
||||
(void)win; (void)x; (void)y;
|
||||
/* Phase 55: record the WM-assigned position in the view struct. */
|
||||
struct wl_toplevel_view *v = wl_find_view_by_id(win);
|
||||
if (v) { v->x = x; v->y = y; }
|
||||
}
|
||||
|
||||
static void wl_window_resize(WNativeWindow win, int w, int h)
|
||||
|
|
@ -899,9 +903,27 @@ static int
|
|||
wl_window_get_rect(WNativeWindow win,
|
||||
int *win_x, int *win_y, int *win_w, int *win_h)
|
||||
{
|
||||
(void)win;
|
||||
*win_x = *win_y = 0; *win_w = *win_h = 1;
|
||||
return 0;
|
||||
/* Phase 55: return real geometry for synthetic toplevel IDs. */
|
||||
if (win == WNATIVE_NONE) {
|
||||
if (win_x) { *win_x = 0; } if (win_y) { *win_y = 0; }
|
||||
if (win_w) { *win_w = 1; } if (win_h) { *win_h = 1; }
|
||||
return 0; /* invalid/none */
|
||||
}
|
||||
struct wl_toplevel_view *v = wl_find_view_by_id(win);
|
||||
if (v && v->xdg_surface && v->xdg_surface->surface) {
|
||||
int w = v->xdg_surface->surface->current.width;
|
||||
int h = v->xdg_surface->surface->current.height;
|
||||
if (win_x) { *win_x = v->x; }
|
||||
if (win_y) { *win_y = v->y; }
|
||||
if (win_w) { *win_w = w > 0 ? w : 1; }
|
||||
if (win_h) { *win_h = h > 0 ? h : 1; }
|
||||
return 1;
|
||||
}
|
||||
/* Non-synthetic virtual window (e.g. headless output root) — report
|
||||
* full output dimensions so callers see a valid non-empty window. */
|
||||
if (win_x) { *win_x = 0; } if (win_y) { *win_y = 0; }
|
||||
if (win_w) { *win_w = 1920; } if (win_h) { *win_h = 1080; }
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void wl_window_add_events(WNativeWindow win, unsigned long extra_mask) { (void)win; (void)extra_mask; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue