http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333285

It would be nice if xrestop quit when 'q' is pressed (like top etc.).

The attached patch implements this behaviour.

-- 
Moray
--- ../xrestop-0.3/xrestop.c    2004-01-02 22:25:09.000000000 +0000
+++ xrestop-0.3/xrestop.c       2006-01-21 19:19:05.000000000 +0000
@@ -712,12 +712,32 @@
   if (!app->want_batch_mode) 
     initscr();
 
+  cbreak();
+  noecho();
+
   for (;;)
    {
+     int delay;
+
      xrestop_populate_client_data(app);
      xrestop_sort(app);
      xrestop_display(app);
-     sleep(app->delay);
+
+     for (delay = app->delay * 10; delay > 0; delay -= 255) {
+       int c;
+
+       if (delay > 255)
+        halfdelay(255);
+       else
+        halfdelay(delay);
+       
+       c = wgetch(stdscr);
+       
+       if (c == 'q') {
+        endwin();
+        exit(0);
+       }
+     }
    }
 }
 

Reply via email to