diff --git a/src/icon.c b/src/icon.c index ff0024e..08659df 100644 --- a/src/icon.c +++ b/src/icon.c @@ -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 */