[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.2-testing] xentop.c: Change curses painting behavior to avoid flicker


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-4.2-testing <patchbot@xxxxxxx>
  • Date: Fri, 02 Nov 2012 05:11:11 +0000
  • Delivery-date: Fri, 02 Nov 2012 05:11:20 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jason McCarver <slam@xxxxxxxxxxx>
# Date 1351266038 -3600
# Node ID 747c216a612cedf011f641ac7290a68a61238a14
# Parent  27312134166b0596f5de8ce0b9e7dd7c094fad68
xentop.c: Change curses painting behavior to avoid flicker

Currently, xentop calls clear() before drawing the screen and calling
refresh().  This causes the entire screen to be repainted from scratch
on each call to refresh().  It is inefficient and causes visible flicker
when using xentop.

This patch fixes this by calling erase() instead of clear() which overwrites
the current screen with blanks instead.  The screen is then drawn as usual
in the top() function and refresh() is called.  This method allows curses
to only repaint the characters that have changed since the last call
to refresh(), thus avoiding the flicker and sending fewer characters to
the terminal.

In the event the screen becomes corrupted, this patch accepts a CTRL-L
keystroke from the user which will call clear() and force a repaint of
the entire screen.

Signed-off-by: Jason McCarver <slam@xxxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

xen-unstable changeset: 25899:116f5c34354b
Backport-requested-by: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 27312134166b -r 747c216a612c tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c     Fri Oct 26 16:40:32 2012 +0100
+++ b/tools/xenstat/xentop/xentop.c     Fri Oct 26 16:40:38 2012 +0100
@@ -57,6 +57,7 @@
 #endif
 
 #define KEY_ESCAPE '\x1B'
+#define KEY_REPAINT '\x0C'
 
 #ifdef HOST_SunOS
 /* Old curses library on Solaris takes non-const strings. Also, ERR interferes
@@ -383,6 +384,9 @@ static int handle_key(int ch)
                case 'd': case 'D':
                        set_prompt("Delay(sec)", set_delay);
                        break;
+               case KEY_REPAINT:
+                       clear();
+                       break;
                case 'q': case 'Q': case KEY_ESCAPE:
                        return 0;
                }
@@ -1201,7 +1205,7 @@ int main(int argc, char **argv)
                do {
                        gettimeofday(&curtime, NULL);
                        if(ch != ERR || (curtime.tv_sec - oldtime.tv_sec) >= 
delay) {
-                               clear();
+                               erase();
                                top();
                                oldtime = curtime;
                                refresh();

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.