B5: drawer icon renders directional arrow on Wayland
Replace the one-liner wl_drawer_icon_paint with a full implementation that draws a filled triangle arrow pointing toward the drawer expansion direction (left when on_right_side, right otherwise), matching X11.
This commit is contained in:
parent
3687ff0533
commit
9ed1c19d6b
|
|
@ -8096,7 +8096,64 @@ static void wl_clip_icon_paint(WAppIcon *aicon)
|
|||
/* 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)
|
||||
{
|
||||
if (!aicon || !aicon->icon || !aicon->icon->core)
|
||||
return;
|
||||
|
||||
wl_appicon_paint(aicon);
|
||||
|
||||
struct wl_frame_buf *fb = frame_buf_find((WNativeWindow)aicon->icon->core->window);
|
||||
if (!fb || !fb->image)
|
||||
return;
|
||||
|
||||
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||
WMColor *color;
|
||||
if (!aicon->dock->collapsed)
|
||||
color = scr->clip_title_color[CLIP_NORMAL];
|
||||
else
|
||||
color = scr->clip_title_color[CLIP_COLLAPSED];
|
||||
if (!color)
|
||||
return;
|
||||
|
||||
int size = wPreferences.icon_size;
|
||||
uint32_t pixel = ((uint32_t)0xFF << 24) |
|
||||
((uint32_t)WMRedComponentOfColor(color) >> 8 << 16) |
|
||||
((uint32_t)WMGreenComponentOfColor(color) >> 8 << 8) |
|
||||
((uint32_t)WMBlueComponentOfColor(color) >> 8);
|
||||
uint32_t *data = (uint32_t *)pixman_image_get_data(fb->image);
|
||||
int stride = pixman_image_get_stride(fb->image) / 4;
|
||||
|
||||
/* Draw directional arrow (triangle) */
|
||||
int cx, cy = size / 2;
|
||||
if (aicon->dock->on_right_side) {
|
||||
/* Arrow pointing left: tip at x=5, base at x=10 */
|
||||
for (int dy = -5; dy <= 5; dy++) {
|
||||
int row = cy + dy;
|
||||
if (row < 0 || row >= size) continue;
|
||||
int width = 5 - abs(dy);
|
||||
for (int dx = 0; dx <= width; dx++) {
|
||||
cx = 10 - dx;
|
||||
if (cx >= 0 && cx < size)
|
||||
data[row * stride + cx] = pixel;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Arrow pointing right: tip at x=size-6, base at x=size-11 */
|
||||
for (int dy = -5; dy <= 5; dy++) {
|
||||
int row = cy + dy;
|
||||
if (row < 0 || row >= size) continue;
|
||||
int width = 5 - abs(dy);
|
||||
for (int dx = 0; dx <= width; dx++) {
|
||||
cx = size - 11 + dx;
|
||||
if (cx >= 0 && cx < size)
|
||||
data[row * stride + cx] = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wlr_scene_buffer_set_buffer(fb->scene_buf, &fb->base);
|
||||
}
|
||||
static void wl_balloon_init(WScreen *scr)
|
||||
{
|
||||
scr->balloon = wmalloc(sizeof(WBalloon));
|
||||
|
|
|
|||
Loading…
Reference in New Issue