terminal: Only reset title if we put the window size there
When resizing the terminal, it shows the grid size in the titlebar. We reset the title next time we get an enter event. This patch makes sure we only reset the title the first time we enter after a resize.
This commit is contained in:
@@ -465,6 +465,7 @@ struct terminal {
|
|||||||
double average_width;
|
double average_width;
|
||||||
cairo_scaled_font_t *font_normal, *font_bold;
|
cairo_scaled_font_t *font_normal, *font_bold;
|
||||||
uint32_t hide_cursor_serial;
|
uint32_t hide_cursor_serial;
|
||||||
|
int size_in_title;
|
||||||
|
|
||||||
struct wl_data_source *selection;
|
struct wl_data_source *selection;
|
||||||
uint32_t click_time;
|
uint32_t click_time;
|
||||||
@@ -850,6 +851,7 @@ resize_handler(struct widget *widget,
|
|||||||
widget_set_size(terminal->widget, width, height);
|
widget_set_size(terminal->widget, width, height);
|
||||||
if (asprintf(&p, "%s — [%dx%d]", terminal->title, columns, rows) > 0) {
|
if (asprintf(&p, "%s — [%dx%d]", terminal->title, columns, rows) > 0) {
|
||||||
window_set_title(terminal->window, p);
|
window_set_title(terminal->window, p);
|
||||||
|
terminal->size_in_title = 1;
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2740,7 +2742,10 @@ enter_handler(struct widget *widget,
|
|||||||
struct terminal *terminal = data;
|
struct terminal *terminal = data;
|
||||||
|
|
||||||
/* Reset title to get rid of resizing '[WxH]' in titlebar */
|
/* Reset title to get rid of resizing '[WxH]' in titlebar */
|
||||||
|
if (terminal->size_in_title) {
|
||||||
window_set_title(terminal->window, terminal->title);
|
window_set_title(terminal->window, terminal->title);
|
||||||
|
terminal->size_in_title = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return CURSOR_IBEAM;
|
return CURSOR_IBEAM;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user