Compare commits

...

2 Commits

Author SHA1 Message Date
c0eda1c23f liberty-xui: circumvent an Nvidia issue
All checks were successful
Alpine 3.22 Success
OpenBSD 7.8 Success
2025-11-29 00:16:49 +01:00
7566f9af82 liberty: comment on pthread_cancel
All checks were successful
Alpine 3.21 Success
OpenBSD 7.6 Success
2025-09-21 18:59:16 +02:00
2 changed files with 14 additions and 4 deletions

View File

@@ -1269,14 +1269,21 @@ x11_render_label (struct widget *self)
XRenderColor solid = *x11_fg (self), colors[3] = { solid, solid, solid }; XRenderColor solid = *x11_fg (self), colors[3] = { solid, solid, solid };
colors[2].alpha = 0; colors[2].alpha = 0;
double portion = MIN (1, 2.0 * font->list->font->height / space); // Nvidia's XRender appears to not add (x, y) to (srcx, srcy),
// and works correctly if we pass self->x as srcx further on.
//
// Instead of special-casing nvidia_drv.so, let's have the gradient
// also extend to the left, in order to make text legible at all.
//
// We could also detect the behaviour experimentally in run-time.
double portion = MIN (1, 2. * font->list->font->height / (self->x + space));
XFixed stops[3] = { 0, XDoubleToFixed (1 - portion), XDoubleToFixed (1) }; XFixed stops[3] = { 0, XDoubleToFixed (1 - portion), XDoubleToFixed (1) };
XLinearGradient gradient = { {}, { XDoubleToFixed (space), 0 } }; XLinearGradient gradient = { {}, { XDoubleToFixed (self->x + space), 0 } };
// Note that this masking is a very expensive operation. // Note that this masking is a very expensive operation.
Picture source = Picture source =
XRenderCreateLinearGradient (g_xui.dpy, &gradient, stops, colors, 3); XRenderCreateLinearGradient (g_xui.dpy, &gradient, stops, colors, 3);
x11_font_render (font, PictOpOver, source, -self->x, 0, self->x, self->y, x11_font_render (font, PictOpOver, source, 0, 0, self->x, self->y,
self->text); self->text);
XRenderFreePicture (g_xui.dpy, source); XRenderFreePicture (g_xui.dpy, source);
} }

View File

@@ -1209,7 +1209,10 @@ async_make (struct async_manager *manager)
} }
/// Only allowed from the main thread once the job has been started but before /// Only allowed from the main thread once the job has been started but before
/// the results have been dispatched /// the results have been dispatched.
///
/// Note that it may in practice lead to memory leakage, although that's
/// an implementation issue: https://eissing.org/icing/posts/rip_pthread_cancel/
static void static void
async_cancel (struct async *self) async_cancel (struct async *self)
{ {