diff mbox

[powerdebug] handle winch signal

Message ID 1366018610-17948-1-git-send-email-sanjay.rawat@linaro.org
State New
Headers show

Commit Message

Sanjay Singh Rawat April 15, 2013, 9:36 a.m. UTC
- 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>
---
 display.c    |    5 +++++
 powerdebug.c |    4 ++++
 2 files changed, 9 insertions(+)
diff mbox

Patch

diff --git a/display.c b/display.c
index 39a8e71..e9f4bf6 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 dd6ac04..4ee7f7d 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;
 }