get rid of config.h

This commit is contained in:
Daniel Micay 2012-06-08 16:16:41 -04:00
parent 34930c19e0
commit 2df06c31a0
3 changed files with 11 additions and 25 deletions

View File

@ -25,7 +25,7 @@ endif
LDFLAGS := -s -Wl,--as-needed ${shell pkg-config --libs ${GTK} ${VTE}} ${LDFLAGS} LDFLAGS := -s -Wl,--as-needed ${shell pkg-config --libs ${GTK} ${VTE}} ${LDFLAGS}
termite: termite.c config.h termite: termite.c
${CC} ${CFLAGS} -o $@ $< ${LDFLAGS} ${CC} ${CFLAGS} -o $@ $< ${LDFLAGS}
install: termite install: termite

View File

@ -1,11 +0,0 @@
static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+()]*";
// keybindings
#define KEY_COPY c
#define KEY_PASTE v
#define KEY_PREV p
#define KEY_NEXT n
#define KEY_SEARCH f
#define KEY_RSEARCH r
#define KEY_URL j
#define KEY_RURL k

View File

@ -6,15 +6,12 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <vte/vte.h> #include <vte/vte.h>
#include "config.h"
#define CONCAT(X, Y) X ## Y
#define KEY(X) CONCAT(GDK_KEY_, X)
#ifndef __GNUC__ #ifndef __GNUC__
# define __attribute__(x) # define __attribute__(x)
#endif #endif
static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+()]*";
typedef enum overlay_mode { typedef enum overlay_mode {
OVERLAY_HIDDEN = 0, OVERLAY_HIDDEN = 0,
OVERLAY_SEARCH, OVERLAY_SEARCH,
@ -63,30 +60,30 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, search_panel_info *i
const guint modifiers = event->state & gtk_accelerator_get_default_mod_mask(); const guint modifiers = event->state & gtk_accelerator_get_default_mod_mask();
if (modifiers == (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) { if (modifiers == (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) {
switch (gdk_keyval_to_lower(event->keyval)) { switch (gdk_keyval_to_lower(event->keyval)) {
case KEY(KEY_COPY): case GDK_KEY_c:
vte_terminal_copy_clipboard(vte); vte_terminal_copy_clipboard(vte);
return TRUE; return TRUE;
case KEY(KEY_PASTE): case GDK_KEY_v:
vte_terminal_paste_clipboard(vte); vte_terminal_paste_clipboard(vte);
return TRUE; return TRUE;
case KEY(KEY_PREV): case GDK_KEY_p:
vte_terminal_search_find_previous(vte); vte_terminal_search_find_previous(vte);
vte_terminal_copy_primary(vte); vte_terminal_copy_primary(vte);
return TRUE; return TRUE;
case KEY(KEY_NEXT): case GDK_KEY_n:
vte_terminal_search_find_next(vte); vte_terminal_search_find_next(vte);
vte_terminal_copy_primary(vte); vte_terminal_copy_primary(vte);
return TRUE; return TRUE;
case KEY(KEY_SEARCH): case GDK_KEY_f:
overlay_show(info, OVERLAY_SEARCH, true); overlay_show(info, OVERLAY_SEARCH, true);
return TRUE; return TRUE;
case KEY(KEY_RSEARCH): case GDK_KEY_r:
overlay_show(info, OVERLAY_RSEARCH, true); overlay_show(info, OVERLAY_RSEARCH, true);
return TRUE; return TRUE;
case KEY(KEY_URL): case GDK_KEY_j:
search(vte, url_regex, false); search(vte, url_regex, false);
return TRUE; return TRUE;
case KEY(KEY_RURL): case GDK_KEY_k:
search(vte, url_regex, true); search(vte, url_regex, true);
return TRUE; return TRUE;
} }