diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2013-09-11 17:38:58 -0400 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2013-09-11 17:38:58 -0400 |
commit | 6afe2c27b1de059a21294b5831ebe22247265e81 (patch) | |
tree | 1a9b7f5cc448f75fae1ee78c87585a29432db6a2 | |
parent | 65a018a190ed68181de73defe0841c0caa50c8dc (diff) |
add font size increase and decrease, kind of crappy because we are just increasing the size by the '2000' metric since PangoFontDescription isn't a set size, but is dynamic based on dpi and other crap
-rw-r--r-- | svte.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -76,6 +76,7 @@ static void tab_focus(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, struct window *w); static void set_window_title(term *t); static void launch_url(char *url); +static void zoom(gboolean b, struct term *t); static inline term* get_current_term(window *w); static inline term* get_nth_term(window *w, guint page); @@ -122,6 +123,17 @@ static void launch_url(char *url) { g_spawn_command_line_async(g_strconcat(config->browser_command, " ", url, NULL), NULL); } +static void zoom(gboolean b, struct term *t) { + + int size = -2000; + if(b) + size = 2000; + PangoFontDescription *font = vte_terminal_get_font(VTE_TERMINAL(t->vte)); + pango_font_description_set_size(font, pango_font_description_get_size(font) + size); + vte_terminal_set_font(VTE_TERMINAL(t->vte), font); + +} + /* key event handler */ gboolean event_key(GtkWidget *widget, GdkEventKey *event, window *w) { @@ -148,6 +160,14 @@ gboolean event_key(GtkWidget *widget, GdkEventKey *event, window *w) { vte_terminal_paste_clipboard(VTE_TERMINAL(get_current_term(w)->vte)); return TRUE; } + if (g == GDK_plus) { + zoom(TRUE, get_current_term(w)); + return TRUE; + } + if (g == GDK_underscore) { + zoom(FALSE, get_current_term(w)); + return TRUE; + } if (g == GDK_C) { vte_terminal_copy_clipboard(VTE_TERMINAL(get_current_term(w)->vte)); return TRUE; @@ -173,7 +193,7 @@ gboolean event_key(GtkWidget *widget, GdkEventKey *event, window *w) { return TRUE; } } - + if(g == GDK_KEY_Forward) { tab_switch(TRUE, w); return TRUE; |