fix: resizebar missing corner grab indicators and bevel on Wayland

The Wayland backend wl_frame_paint rendered the resizebar texture but never drew the corner grab handles or top bevel lines that X11 includes. Added pixman-based rendering of: (1) top bevel lines (dim at y=0, light at y=1), (2) left corner grab handle (two vertical lines from y=2 to bottom), (3) right corner grab handle (two vertical lines from y=2 to bottom). Light/dim colors are derived from the rendered texture pixel at the resizebar center (+/- 40 per channel).
This commit is contained in:
Ollie 2026-05-30 11:50:38 +02:00
parent ae980e66e9
commit ae080d948c
1 changed files with 43 additions and 0 deletions

View File

@ -4990,6 +4990,49 @@ wl_frame_paint(struct WFrameWindow *fwin)
}
RReleaseImage(img);
}
/* Draw resizebar corner grab indicators */
int cw = fwin->resizebar_corner_width;
uint32_t *dst = pixman_image_get_data(fb->image);
int dst_stride = pixman_image_get_stride(fb->image) / 4;
int midx = (rb_w < 1) ? 0 : rb_w / 2;
int midy = (rb_h < 1) ? 0 : rb_h / 2;
uint32_t base_px = dst[(rb_y + midy) * dst_stride + midx];
unsigned char br = (base_px >> 16) & 0xFF;
unsigned char bg = (base_px >> 8) & 0xFF;
unsigned char bb = (base_px) & 0xFF;
uint32_t dim_px = 0xFF000000U |
(((unsigned)((br > 40) ? (br - 40) : 0) << 16)) |
(((unsigned)((bg > 40) ? (bg - 40) : 0) << 8)) |
((unsigned)((bb > 40) ? (bb - 40) : 0));
uint32_t light_px = 0xFF000000U |
(((unsigned)((br < 215) ? (br + 40) : 255) << 16)) |
(((unsigned)((bg < 215) ? (bg + 40) : 255) << 8)) |
((unsigned)((bb < 215) ? (bb + 40) : 255));
/* Top bevel: dim at y=0, light at y=1 */
for (int x = 0; x < rb_w; x++) {
dst[(rb_y + 0) * dst_stride + x] = dim_px;
dst[(rb_y + 1) * dst_stride + x] = light_px;
}
/* Left corner grab handle: vertical lines from y=2 to rb_h-1 */
int xl = (cw < rb_w) ? cw : rb_w - 1;
if (xl > 0) {
for (int y = 2; y < rb_h; y++) {
dst[(rb_y + y) * dst_stride + xl - 1] = dim_px;
dst[(rb_y + y) * dst_stride + xl] = light_px;
}
}
/* Right corner grab handle */
int xr = (rb_w - cw - 2 >= 0) ? (rb_w - cw - 2) : 0;
if (xr + 1 < rb_w) {
for (int y = 2; y < rb_h; y++) {
dst[(rb_y + y) * dst_stride + xr] = dim_px;
dst[(rb_y + y) * dst_stride + xr + 1] = light_px;
}
}
}
/* Hide the resizebar's own scene node when shaded. */