B4: clip icon renders workspace number and name on Wayland
Replace the one-liner wl_clip_icon_paint (which only painted the base tile) with a full implementation that overlays the workspace number at top-center and workspace name at bottom, matching the X11 behavior. Also adds workspace.h and dock.h includes for WWorkspace/WDock types.
This commit is contained in:
parent
3d1008529b
commit
3687ff0533
|
|
@ -194,6 +194,8 @@
|
||||||
#include "../../event.h" /* Phase 78: wWaylandKeyPress */
|
#include "../../event.h" /* Phase 78: wWaylandKeyPress */
|
||||||
#include "../../wmspec.h" /* Phase 30+: get_window_image_from_x11 */
|
#include "../../wmspec.h" /* Phase 30+: get_window_image_from_x11 */
|
||||||
#include "../../icon.h" /* WIcon, TILE_* */
|
#include "../../icon.h" /* WIcon, TILE_* */
|
||||||
|
#include "../../workspace.h" /* WWorkspace */
|
||||||
|
#include "../../dock.h" /* WDock (for clip->collapsed) */
|
||||||
#include "../../appicon.h" /* WAppIcon */
|
#include "../../appicon.h" /* WAppIcon */
|
||||||
#include "../../menu.h" /* WMenu, WMenuEntry */
|
#include "../../menu.h" /* WMenu, WMenuEntry */
|
||||||
#include "../../balloon.h" /* WBalloon */
|
#include "../../balloon.h" /* WBalloon */
|
||||||
|
|
@ -8048,7 +8050,52 @@ static void wl_event_handle_signal_exit(void)
|
||||||
|
|
||||||
static void wl_noop_icon_select(WIcon *icon) { (void)icon; }
|
static void wl_noop_icon_select(WIcon *icon) { (void)icon; }
|
||||||
static void wl_noop_icon_change_title(WIcon *icon, WWindow *wwin) { (void)icon; (void)wwin; }
|
static void wl_noop_icon_change_title(WIcon *icon, WWindow *wwin) { (void)icon; (void)wwin; }
|
||||||
static void wl_clip_icon_paint(WAppIcon *aicon) { wl_appicon_paint(aicon); }
|
static void wl_clip_icon_paint(WAppIcon *aicon)
|
||||||
|
{
|
||||||
|
if (!aicon || !aicon->icon || !aicon->icon->core)
|
||||||
|
return;
|
||||||
|
|
||||||
|
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||||
|
if (!scr->workspaces || !scr->workspaces[scr->current_workspace])
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Paint base tile + icon image */
|
||||||
|
wl_appicon_paint(aicon);
|
||||||
|
|
||||||
|
struct wl_frame_buf *fb = frame_buf_find((WNativeWindow)aicon->icon->core->window);
|
||||||
|
if (!fb || !fb->image)
|
||||||
|
return;
|
||||||
|
|
||||||
|
WWorkspace *workspace = scr->workspaces[scr->current_workspace];
|
||||||
|
WMColor *color;
|
||||||
|
if (wPreferences.flags.noclip || !workspace->clip->collapsed)
|
||||||
|
color = scr->clip_title_color[CLIP_NORMAL];
|
||||||
|
else
|
||||||
|
color = scr->clip_title_color[CLIP_COLLAPSED];
|
||||||
|
if (!color || !scr->clip_title_font)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int size = wPreferences.icon_size;
|
||||||
|
WMDrawable d = (WMDrawable)(uintptr_t)fb->image;
|
||||||
|
|
||||||
|
/* Draw workspace number at top center */
|
||||||
|
char ws_number[20];
|
||||||
|
snprintf(ws_number, sizeof ws_number, "%u", scr->current_workspace + 1);
|
||||||
|
int nlength = strlen(ws_number);
|
||||||
|
int tx = (size / 2 - WMWidthOfString(scr->clip_title_font, ws_number, nlength)) / 2;
|
||||||
|
WMDrawString(scr->wmscreen, d, color, scr->clip_title_font, tx, 2, ws_number, nlength);
|
||||||
|
|
||||||
|
/* Draw workspace name at bottom */
|
||||||
|
if (wPreferences.show_clip_title) {
|
||||||
|
int length = strlen(workspace->name);
|
||||||
|
int ty = size - WMFontHeight(scr->clip_title_font) - 3;
|
||||||
|
tx = CLIP_BUTTON_SIZE * size / 64;
|
||||||
|
WMDrawString(scr->wmscreen, d, color, scr->clip_title_font, tx, ty, workspace->name, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Commit updated buffer */
|
||||||
|
wlr_scene_buffer_set_buffer(fb->scene_buf, &fb->base);
|
||||||
|
}
|
||||||
static void wl_drawer_icon_paint(WAppIcon *aicon) { wl_appicon_paint(aicon); }
|
static void wl_drawer_icon_paint(WAppIcon *aicon) { wl_appicon_paint(aicon); }
|
||||||
static void wl_balloon_init(WScreen *scr)
|
static void wl_balloon_init(WScreen *scr)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue