]> git.mdlowis.com Git - archive/afm.git/commitdiff
call endwin() only on resize
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 18 Jul 2014 23:08:12 +0000 (19:08 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 18 Jul 2014 23:08:12 +0000 (19:08 -0400)
source/main.c

index be61d222bd16459b8a5b5ffed832527f51863374..695be4de7d63ffa047f5fff8cfcd881eb513e0ba 100644 (file)
@@ -9,6 +9,7 @@ typedef struct {
 
 static bool Running = true;
 static bool Screen_Dirty = true;
+static bool Resized = true;
 static int Idx = 0; /* TODO: this should be per-window */
 
 void list_files(void) {
@@ -36,7 +37,10 @@ void list_files(void) {
 
 void update_screen(void) {
     /* Clear screen and update LINES and COLS */
-    endwin();
+    if(Resized) {
+        endwin();
+        Resized = false;
+    }
     clear();
     /* Draw the Contents */
     list_files();
@@ -74,6 +78,7 @@ void handle_input(char ch) {
 void handle_signal(int sig) {
     signal(SIGWINCH, handle_signal);
     Screen_Dirty = true;
+    Resized = true;
 }
 
 int main(int argc, char** argv) {