tFix crash with pango renderer - ltk - Socket-based GUI for X11 (WIP)
HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
HTML git clone https://lumidify.org/git/ltk.git (encrypted, but very slow)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit f452a00a4143a913e61a395cf9e4b8728fa0a7a6
DIR parent b411a0c6e0d45f347be63ffb40dc62092ab8c3c1
HTML Author: lumidify <nobody@lumidify.org>
Date: Wed, 17 Feb 2021 19:36:41 +0100
Fix crash with pango renderer
Diffstat:
M testbox.sh | 2 +-
M text_pango.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
---
DIR diff --git a/testbox.sh b/testbox.sh
t@@ -22,4 +22,4 @@ do
printf "%s\n" "$cmd" >&2
;;
esac
-done | ./ltkc $ltk_id
+done | ./ltkc $ltk_id > /dev/null
DIR diff --git a/text_pango.c b/text_pango.c
t@@ -82,6 +82,8 @@ ltk_text_line_create(Window window, uint16_t font_size, char *text, int width) {
pango_layout_get_size(line->layout, &line->w, &line->h);
line->w /= PANGO_SCALE;
line->h /= PANGO_SCALE;
+ line->w = line->w == 0 ? 1 : line->w;
+ line->h = line->h == 0 ? 1 : line->h;
XWindowAttributes attrs;
XGetWindowAttributes(tm.dpy, window, &attrs);
line->pixmap = XCreatePixmap(tm.dpy, window, line->w, line->h, attrs.depth);