Commit 317b96e783d7edefc895d1f2bd6f8925d0f40cd5

Stefan Sperling 2018-09-02T13:49:45

remove redundant update_panels() calls in tog

diff --git a/tog/tog.c b/tog/tog.c
index 8df3d9c..a17d47c 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -200,6 +200,7 @@ struct tog_view {
 	PANEL *panel;
 	int nlines, ncols, begin_y, begin_x;
 	int lines, cols; /* copies of LINES and COLS */
+	int focussed;
 	struct tog_view *parent;
 	struct tog_view *child;
 
@@ -391,6 +392,8 @@ view_input(struct tog_view **new, struct tog_view **dead,
 				*focus = next;
 			else
 				*focus = TAILQ_FIRST(views);
+			view->focussed = 0;
+			(*focus)->focussed = 1;
 			break;
 		case KEY_BACKSPACE:
 			prev = TAILQ_PREV(view, tog_view_list_head, entry);
@@ -456,6 +459,7 @@ view_loop(struct tog_view *view)
 	TAILQ_INIT(&views);
 	TAILQ_INSERT_HEAD(&views, view, entry);
 
+	view->focussed = 1;
 	while (!TAILQ_EMPTY(&views) && !done) {
 		err = view_show(view);
 		if (err)
@@ -491,8 +495,10 @@ view_loop(struct tog_view *view)
 				err = view_set_child(new_view->parent, new_view);
 				if (err)
 					goto done;
+				new_view->parent->focussed = 0;
 			}
 			view = new_view;
+			view->focussed = 1;
 		}
 	}
 done:
@@ -987,7 +993,6 @@ draw_commits(struct tog_view *view, struct commit_queue_entry **last,
 	}
 
 	view_vborder(view);
-	update_panels();
 
 	return err;
 }
@@ -1522,7 +1527,6 @@ draw_file(struct tog_view *view, FILE *f, int *first_displayed_line,
 	*last_displayed_line = nlines;
 
 	view_vborder(view);
-	update_panels();
 
 	return NULL;
 }
@@ -1874,7 +1878,6 @@ draw_blame(struct tog_view *view, struct got_object_id *id, FILE *f,
 	*last_displayed_line = lineno;
 
 	view_vborder(view);
-	update_panels();
 
 	return NULL;
 }