dev-lua/lua-spawn: bump to support lua 5.4
[sgilles-overlay.git] / app-text / fbpdf / files / 0004-redraw-on-SIGUSR1.patch
blob3dd7b97f45339c3ff75f4f73e5c5fd5fa88f70fc
1 From ffde3048b9c7291172ffc98b47dc8abe644f9cd6 Mon Sep 17 00:00:00 2001
2 From: "S. Gilles" <sgilles@math.umd.edu>
3 Date: Mon, 4 Feb 2019 09:41:13 -0500
4 Subject: [PATCH 4/5] redraw on SIGUSR1
6 ---
7 fbpdf.c | 16 ++++++++++++++--
8 1 file changed, 14 insertions(+), 2 deletions(-)
10 diff --git a/fbpdf.c b/fbpdf.c
11 index b006af0..e50b045 100644
12 --- a/fbpdf.c
13 +++ b/fbpdf.c
14 @@ -51,6 +51,7 @@ static int zoom = 15;
15 static int zoom_def = 15; /* default zoom */
16 static int rotate;
17 static int count;
18 +static sig_atomic_t should_redraw;
20 static void draw(void)
22 @@ -116,8 +117,13 @@ static int readkey(void)
24 unsigned char b;
25 again:
26 - if (read(0, &b, 1) <= 0)
27 + if (read(0, &b, 1) <= 0) {
28 + if (should_redraw) {
29 + should_redraw = 0;
30 + return 'e';
31 + }
32 return -1;
33 + }
35 if (b != 27)
36 return b;
37 @@ -173,6 +179,11 @@ static void sigcont(int sig)
38 term_setup();
41 +static void sigreload(int sig)
43 + should_redraw = 1;
46 static int reload(void)
48 doc_close(doc);
49 @@ -220,7 +231,8 @@ static void mainloop(void)
50 int hstep = scols / PAGESTEPS;
51 int c;
52 term_setup();
53 - signal(SIGCONT, sigcont);
54 + sigaction(SIGCONT, &(struct sigaction){.sa_handler = sigcont}, 0);
55 + sigaction(SIGUSR1, &(struct sigaction){.sa_handler = sigreload}, 0);
56 loadpage(num);
57 srow = prow;
58 scol = -scols / 2;
59 --
60 2.20.1