aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Singh Rawat <sanjay.rawat@linaro.org>2013-04-17 14:57:07 +0530
committerSanjay Singh Rawat <sanjay.rawat@linaro.org>2013-04-17 16:06:23 +0530
commit83b37c3c2e20fffcdf53c546b6f0e287889cd451 (patch)
tree4abb885a4a8d096360c40bd230e45e9872923ba2
parent9fe0c0521fd74387c4ca00b9c1b768762273502f (diff)
handle winch signal
- handle winch to display window properly - bug: https://bugs.launchpad.net/linaro-powerdebug/+bug/827828 Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
-rw-r--r--display.c5
-rw-r--r--powerdebug.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/display.c b/display.c
index f06387c..94ff2de 100644
--- a/display.c
+++ b/display.c
@@ -137,6 +137,11 @@ int display_refresh_pad(int win)
0, 2, 0, maxy - 2, maxx);
}
+void sigwinch_handler(int signo)
+{
+ display_refresh(current_win, true);
+}
+
static int display_show_unselection(int win, int line, bool bold)
{
if (mvwchgat(windata[win].pad, line, 0, -1,
diff --git a/powerdebug.c b/powerdebug.c
index 073fd42..098c5da 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <errno.h>
#include <ncurses.h>
+#include <signal.h>
#include "regulator.h"
#include "display.h"
#include "clocks.h"
@@ -28,6 +29,8 @@
#include "mainloop.h"
#include "powerdebug.h"
+extern void sigwinch_handler(int);
+
void usage(void)
{
printf("Usage: powerdebug [OPTIONS]\n");
@@ -207,6 +210,7 @@ static struct powerdebug_options *powerdebug_init(void)
return NULL;
memset(options, 0, sizeof(*options));
+ signal(SIGWINCH, sigwinch_handler);
return options;
}