remove redundant update_panels() calls in tog
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
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;
}