Skip to content

Commit

Permalink
tabbar: Don't recreate the tabbar every time
Browse files Browse the repository at this point in the history
The height calculation in win_toggle_tabbar() was wrong. So, when the
function was called, the tabbar was recreated every time.

Because of this, changing the title sometimes took very long time.
(With the default installation of Cygwin, the current directory is shown
as the title. Thus, on my slow machine, executing a `cd` command
sometimes took more than one second.)

Fix the height calculation and remove an unused variable.
  • Loading branch information
k-takata committed Oct 15, 2020
1 parent 55aa305 commit 4022d5b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/wintab.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <string.h>

int TABBAR_HEIGHT = 0;
static int prev_height = 0;
static HWND tab_wnd, bar_wnd;

static HFONT tabbar_font;
Expand Down Expand Up @@ -286,22 +285,21 @@ win_toggle_tabbar(bool show)

int margin = cell_width / 6 + 1;
int padding = margin * 2;
int height = cell_height + margin * 2;
int height = cell_height + margin * 2 + padding * 2;
if (height != TABBAR_HEIGHT && initialized) {
tabbar_destroy();
}
if (!initialized) {
tabbar_init();
}
prev_height = height;
tabbar_update();
if (show) {
show = show;
TABBAR_HEIGHT = height + padding * 2;
TABBAR_HEIGHT = height;
//printf("nweheight");
SetWindowPos(bar_wnd, 0,
cr.left, 0,
width, height + padding * 2,
width, height,
SWP_NOZORDER);
ShowWindow(bar_wnd, SW_SHOW);
} else {
Expand Down

0 comments on commit 4022d5b

Please sign in to comment.