bterm font reloading patch
Howdy,
The attached patch should make bterm reload the font when it
receives a SIGHUP. Would someone please test it?
--
Matt Kraai kraai@ftbfs.org
diff -ru bogl-0.1.14-old/bterm.c bogl-0.1.14/bterm.c
--- bogl-0.1.14-old/bterm.c 2004-01-18 15:53:53.000000000 -0800
+++ bogl-0.1.14/bterm.c 2004-01-18 16:15:41.000000000 -0800
@@ -153,6 +153,20 @@
ioctl(ttyfd, TIOCSWINSZ, &win);
}
+static char *font_name;
+static struct bogl_term *term;
+
+void reload_font(int sig)
+{
+ free(term->font);
+
+ if ((term->font = bogl_mmap_font(font_name)) == NULL)
+ fprintf(stderr, "Bad font\n");
+
+ term->xstep = bogl_font_glyph(term->font, ' ', 0);
+ term->ystep = bogl_font_height(term->font);
+}
+
/*
* The usage is very simple:
* bterm -f font.bgf [ -l locale ] [ program ]
@@ -165,9 +179,8 @@
char buf[8192];
struct timeval tv;
int ptyfd, ttyfd;
- struct bogl_term *term;
struct bogl_font *font;
- char *locale = "", *font_name = NULL, *command = NULL;
+ char *locale = "", *command = NULL;
int i;
char o = ' ';
int pending = 0;
@@ -234,6 +247,8 @@
spawn_shell(ptyfd, ttyfd, command == NULL ? "/bin/sh" : command);
+ signal(SIGHUP, reload_font);
+
ntio = ttysave;
ntio.c_lflag &= ~(ECHO|ISIG|ICANON|XCASE);
ntio.c_iflag = 0;
diff -ru bogl-0.1.14-old/debian/changelog bogl-0.1.14/debian/changelog
--- bogl-0.1.14-old/debian/changelog 2004-01-18 15:53:53.000000000 -0800
+++ bogl-0.1.14/debian/changelog 2004-01-18 16:12:26.000000000 -0800
@@ -1,3 +1,10 @@
+bogl (0.1.14-1.2) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Reload the font when SIGHUP is received (closes: #219333).
+
+ -- Matt Kraai <kraai@debian.org> Sun, 18 Jan 2004 16:12:25 -0800
+
bogl (0.1.14-1.1) unstable; urgency=high
* Non maintainer upload.
Reply to: