diff options
author | Samuel G. Fadel <samuelfadel@gmail.com> | 2013-02-18 12:21:41 -0300 |
---|---|---|
committer | Samuel G. Fadel <samuelfadel@gmail.com> | 2013-02-18 12:21:41 -0300 |
commit | 11942d1266298d14054f4952a8959e0703664cff (patch) | |
tree | a7737ef1f3cd51ab0899374a1e98fd6b4a8470cb /src | |
parent | f967d6eee9d248fb42d37196d776c5ec210e2386 (diff) |
Deleted config.def.h. Chaged configuration constants to have a "CONFIG_" prefix. Added CONFIG_SCROLLBACK_LINES. Delegation of ctrl+shift+c and ctrl+shift+v to the default copy/paste shortcuts from VTE. Some minor comments all over the code.
Diffstat (limited to 'src')
-rw-r--r-- | src/T.c | 51 | ||||
-rw-r--r-- | src/config.def.h | 48 | ||||
-rw-r--r-- | src/config.h | 27 |
3 files changed, 50 insertions, 76 deletions
@@ -56,12 +56,26 @@ terminal_key_press_callback(GtkWidget *widget, GdkEvent *event, gpointer data) switch (key_event->keyval) { case GDK_KEY_C: case GDK_KEY_c: - vte_terminal_copy_clipboard(terminal); - break; + /* + * Before, this was: + * vte_terminal_copy_clipboard(terminal); + * break; + * But now we just turn this event into a Control+Insert and delegate it + */ + key_event->keyval = GDK_KEY_Insert; + key_event->state &= ~GDK_SHIFT_MASK; + return FALSE; case GDK_KEY_V: case GDK_KEY_v: - vte_terminal_paste_clipboard(terminal); - break; + /* + * Before, this was: + * vte_terminal_paste_clipboard(terminal); + * break; + * But now we just turn this event into a Shift+Insert and delegate it + */ + key_event->keyval = GDK_KEY_Insert; + key_event->state &= ~GDK_CONTROL_MASK; + return FALSE; case GDK_KEY_N: case GDK_KEY_n: spawn_window(); @@ -109,26 +123,31 @@ set_app_preferences(VteTerminal *terminal) * Options set here can (and should) be configured through config.h */ + /* + * These are static because this function is called every time a new window + * is created and we don't want to parse the colors all over again + */ static gboolean colors_parsed = FALSE; - static GdkColor palette[PALETTE_SIZE], bg_color, fg_color; + static GdkColor palette[CONFIG_PALETTE_SIZE], bg_color, fg_color; if (!colors_parsed) { int i; - gdk_color_parse(FOREGROUND_COLOR, &fg_color); - gdk_color_parse(BACKGROUND_COLOR, &bg_color); - for (i = 0; i < PALETTE_SIZE; ++i) - gdk_color_parse(COLOR_PALETTE[i], &palette[i]); + gdk_color_parse(CONFIG_FOREGROUND_COLOR, &fg_color); + gdk_color_parse(CONFIG_BACKGROUND_COLOR, &bg_color); + for (i = 0; i < CONFIG_PALETTE_SIZE; ++i) + gdk_color_parse(CONFIG_COLOR_PALETTE[i], &palette[i]); colors_parsed = TRUE; } /* Set preferences */ - vte_terminal_set_mouse_autohide(terminal, MOUSE_AUTOHIDE); - vte_terminal_set_visible_bell(terminal, VISIBLE_BELL); - vte_terminal_set_audible_bell(terminal, AUDIBLE_BELL); - vte_terminal_set_font_from_string(terminal, FONT_NAME); - vte_terminal_set_colors(terminal, &fg_color, &bg_color, palette, PALETTE_SIZE); + vte_terminal_set_audible_bell(terminal, CONFIG_AUDIBLE_BELL); + vte_terminal_set_colors(terminal, &fg_color, &bg_color, palette, CONFIG_PALETTE_SIZE); + vte_terminal_set_font_from_string(terminal, CONFIG_FONT_NAME); + vte_terminal_set_mouse_autohide(terminal, CONFIG_MOUSE_AUTOHIDE); + vte_terminal_set_scrollback_lines(terminal, CONFIG_SCROLLBACK_LINES); + vte_terminal_set_visible_bell(terminal, CONFIG_VISIBLE_BELL); } static void @@ -157,8 +176,8 @@ setup_window(GtkWindow *window) hints.base_width = vte_terminal_get_char_width(terminal); hints.base_height = vte_terminal_get_char_height(terminal); - hints.min_width = hints.base_width * MIN_WIDTH; - hints.min_height = hints.base_height * MIN_HEIGHT; + hints.min_width = hints.base_width * CONFIG_MIN_WIDTH; + hints.min_height = hints.base_height * CONFIG_MIN_HEIGHT; hints.width_inc = hints.base_width; hints.height_inc = hints.base_height; gtk_window_set_geometry_hints(window, GTK_WIDGET(terminal), &hints, GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); diff --git a/src/config.def.h b/src/config.def.h deleted file mode 100644 index 55b1cce..0000000 --- a/src/config.def.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * config.h - * - * Configuration file. Modify these to customize T. - */ - -/* Minimum width/height, in characters */ -#define MIN_WIDTH 20 -#define MIN_HEIGHT 5 - -/* Font name */ -#define FONT_NAME "Monospace 9" - -/* Color palette definition */ -/* PALETTE_SIZE must be 8, 16, 24 or between 25 and 255, inclusive */ -#define PALETTE_SIZE 16 - -static const char *COLOR_PALETTE[PALETTE_SIZE] = { - "#000000", /* 0 Black */ - "#a5372e", /* 1 Red */ - "#4a663c", /* 2 Green */ - "#7c5618", /* 3 Yellow */ - "#566060", /* 4 Blue */ - "#8e4948", /* 5 Magenta */ - "#6d5b42", /* 6 Cyan */ - "#8d8d8d", /* 7 White */ - "#2b2b2b", /* 8 Black */ - "#e06c5c", /* 9 Red */ - "#7b996c", /* 10 Green */ - "#b38849", /* 11 Yellow */ - "#889393", /* 12 Blue */ - "#c67c78", /* 13 Magenta */ - "#a28d73", /* 14 Cyan */ - "#c6c6c6", /* 15 White */ -}; - -/* Foreground and background. */ -#define FOREGROUND_COLOR "#757575" /* COLOR_PALETTE[7] */ -#define BACKGROUND_COLOR "#151515" /* COLOR_PALETTE[0] */ - -/* Mouse auto-hide (TRUE or FALSE) */ -#define MOUSE_AUTOHIDE TRUE - -/* Visible bell (TRUE or FALSE) */ -#define VISIBLE_BELL FALSE - -/* Audible bell (TRUE or FALSE) */ -#define AUDIBLE_BELL FALSE diff --git a/src/config.h b/src/config.h index ae9458f..39df06d 100644 --- a/src/config.h +++ b/src/config.h @@ -5,17 +5,17 @@ */ /* Minimum width/height, in characters */ -#define MIN_WIDTH 20 -#define MIN_HEIGHT 5 +#define CONFIG_MIN_WIDTH 20 +#define CONFIG_MIN_HEIGHT 5 /* Font name */ -#define FONT_NAME "Terminus 9" +#define CONFIG_FONT_NAME "Terminus 9" /* Color palette definition */ /* PALETTE_SIZE must be 8, 16, 24 or between 25 and 255, inclusive */ -#define PALETTE_SIZE 16 +#define CONFIG_PALETTE_SIZE 16 -static const char *COLOR_PALETTE[PALETTE_SIZE] = { +static const char *CONFIG_COLOR_PALETTE[CONFIG_PALETTE_SIZE] = { "#000000", /* 0 Black */ "#a5372e", /* 1 Red */ "#4a663c", /* 2 Green */ @@ -35,14 +35,17 @@ static const char *COLOR_PALETTE[PALETTE_SIZE] = { }; /* Foreground and background. */ -#define FOREGROUND_COLOR "#757575" /* COLOR_PALETTE[7] */ -#define BACKGROUND_COLOR "#151515" /* COLOR_PALETTE[0] */ +#define CONFIG_FOREGROUND_COLOR "#757575" /* COLOR_PALETTE[7] */ +#define CONFIG_BACKGROUND_COLOR "#151515" /* COLOR_PALETTE[0] */ -/* Mouse auto-hide (TRUE or FALSE) */ -#define MOUSE_AUTOHIDE TRUE +/* Scrollback lines (0 means disabled; negative means "infinite") */ +#define CONFIG_SCROLLBACK_LINES 2000 -/* Visible bell (TRUE or FALSE) */ -#define VISIBLE_BELL FALSE +/* Mouse auto-hide (TRUE or FALSE) */ +#define CONFIG_MOUSE_AUTOHIDE TRUE /* Audible bell (TRUE or FALSE) */ -#define AUDIBLE_BELL FALSE +#define CONFIG_AUDIBLE_BELL FALSE + +/* Visible bell (TRUE or FALSE) */ +#define CONFIG_VISIBLE_BELL FALSE |