perf ui browser: Handle K_RESIZE in dialog windows

Just provide wrappers for things like ui__warning, ui__dialog_yesno and
if they return K_RESIZE, refresh dimensions, redraw the entries, etc.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-3ih7hyk9weryxaxb501sfq4u@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index ef9b793..45daa7c 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -121,43 +121,48 @@
 	return ui__question_window("Help", text, "Press any key...", 0);
 }
 
-bool ui__dialog_yesno(const char *msg)
+int ui__dialog_yesno(const char *msg)
 {
-	int answer = ui__question_window(NULL, msg, "Enter: Yes, ESC: No", 0);
-
-	return answer == K_ENTER;
+	return ui__question_window(NULL, msg, "Enter: Yes, ESC: No", 0);
 }
 
-static void __ui__warning(const char *title, const char *format, va_list args)
+int __ui__warning(const char *title, const char *format, va_list args)
 {
 	char *s;
 
 	if (use_browser > 0 && vasprintf(&s, format, args) > 0) {
+		int key;
+
 		pthread_mutex_lock(&ui__lock);
-		ui__question_window(title, s, "Press any key...", 0);
+		key = ui__question_window(title, s, "Press any key...", 0);
 		pthread_mutex_unlock(&ui__lock);
 		free(s);
-		return;
+		return key;
 	}
 
 	fprintf(stderr, "%s:\n", title);
 	vfprintf(stderr, format, args);
+	return K_ESC;
 }
 
-void ui__warning(const char *format, ...)
+int ui__warning(const char *format, ...)
 {
+	int key;
 	va_list args;
 
 	va_start(args, format);
-	__ui__warning("Warning", format, args);
+	key = __ui__warning("Warning", format, args);
 	va_end(args);
+	return key;
 }
 
-void ui__error(const char *format, ...)
+int ui__error(const char *format, ...)
 {
+	int key;
 	va_list args;
 
 	va_start(args, format);
-	__ui__warning("Error", format, args);
+	key = __ui__warning("Error", format, args);
 	va_end(args);
+	return key;
 }