wayland: fix dockapp positioning in dock tile

When reparenting the XWayland toplevel surface into the dock tile,
use (0,0) position and icon_size dimensions. The getSize call on
the non-existent icon_window returned garbage causing integer overflow
in the centering calculation.
This commit is contained in:
lkn 2026-06-28 01:58:33 +02:00
parent 3098a7c2f8
commit 77c1687f4a
1 changed files with 15 additions and 5 deletions

View File

@ -817,14 +817,24 @@ static void set_dockapp_in_icon(WIcon *icon)
* owner's main client_win instead so its surface appears in the tile. */
{
WNativeWindow reparent_win = (WNativeWindow)icon->icon_win;
int rx = (int)(wPreferences.icon_size - w) / 2;
int ry = (int)(wPreferences.icon_size - h) / 2;
if (icon->owner && icon->owner->client_win) {
reparent_win = icon->owner->client_win;
/* Resize the toplevel surface to fit the dock tile */
wm_backend->window_resize(reparent_win, w, h);
w = wPreferences.icon_size;
h = wPreferences.icon_size;
rx = 0; ry = 0;
} else {
WAppIcon *ai = (WAppIcon *)icon->core->descriptor.parent;
if (ai && ai->main_window != WM_NATIVE_NONE) {
reparent_win = ai->main_window;
w = wPreferences.icon_size;
h = wPreferences.icon_size;
rx = 0; ry = 0;
}
}
wm_backend->client_reparent(reparent_win, icon->core->window,
(wPreferences.icon_size - w) / 2,
(wPreferences.icon_size - h) / 2);
wm_backend->window_resize(reparent_win, w, h);
wm_backend->client_reparent(reparent_win, icon->core->window, rx, ry);
}
/* Show it and save */