From 95343b1e3fa239663e402ce0c602565fe59f18b1 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 21 Feb 2014 22:33:44 -0500 Subject: [PATCH] refactor button_press_cb callback --- termite.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/termite.cc b/termite.cc index e2ad185..f1b1849 100644 --- a/termite.cc +++ b/termite.cc @@ -917,16 +917,20 @@ gboolean position_overlay_cb(GtkBin *overlay, GtkWidget *widget, GdkRectangle *a } gboolean button_press_cb(VteTerminal *vte, GdkEventButton *event, const config_info *info) { - if (info->clickable_url) { + if (info->clickable_url && event->type == GDK_BUTTON_PRESS) { char *match = check_match(vte, (int)event->x, (int)event->y); - if (event->button == 1 && event->type == GDK_BUTTON_PRESS && match) { + if (!match) + return FALSE; + + if (event->button == 1) { launch_browser(info->browser, match); g_free(match); - return TRUE; - } else if(event->button == 3 && event->type == GDK_BUTTON_PRESS && match) { + } else if(event->button == 3) { GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_text(clipboard, match, -1); } + + return TRUE; } return FALSE; }