parent
f9f285e5ba
commit
bed98f83e8
27
termite.cc
27
termite.cc
|
@ -640,26 +640,9 @@ void window_title_cb(VteTerminal *vte, gboolean *dynamic_title) {
|
|||
title ? title : "termite");
|
||||
}
|
||||
|
||||
static void update_font_size(VteTerminal *vte, int update, GtkWindow *window) {
|
||||
const PangoFontDescription *desc = vte_terminal_get_font(vte);
|
||||
int size = pango_font_description_get_size(desc);
|
||||
|
||||
if (!pango_font_description_get_size_is_absolute(desc))
|
||||
update *= PANGO_SCALE;
|
||||
|
||||
size += update;
|
||||
if (size > 0) {
|
||||
PangoFontDescription *new_desc = pango_font_description_copy(desc);
|
||||
|
||||
pango_font_description_set_size(new_desc, size);
|
||||
vte_terminal_set_font(vte, new_desc);
|
||||
pango_font_description_free(new_desc);
|
||||
|
||||
if (window) {
|
||||
set_size_hints(window, (int)vte_terminal_get_char_width(vte),
|
||||
(int)vte_terminal_get_char_height(vte));
|
||||
}
|
||||
}
|
||||
static void update_font_scale(VteTerminal *vte, gdouble update) {
|
||||
gdouble scale = vte_terminal_get_font_scale(vte);
|
||||
vte_terminal_set_font_scale(vte, scale + update);
|
||||
}
|
||||
|
||||
gboolean window_state_cb(GtkWindow *, GdkEventWindowState *event, keybind_info *info) {
|
||||
|
@ -814,10 +797,10 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info)
|
|||
overlay_show(&info->panel, overlay_mode::urlselect, nullptr);
|
||||
break;
|
||||
case GDK_KEY_plus:
|
||||
update_font_size(vte, 1, info->config.size_hints ? info->window : nullptr);
|
||||
update_font_scale(vte, 0.1);
|
||||
break;
|
||||
case GDK_KEY_minus:
|
||||
update_font_size(vte, -1, info->config.size_hints ? info->window : nullptr);
|
||||
update_font_scale(vte, -0.1);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue