[gnome-builder] terminal: follow filename hyperlink on button press
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: follow filename hyperlink on button press
- Date: Tue, 3 Dec 2019 23:31:49 +0000 (UTC)
commit 8c952d03ff789ea11ecc65c38ab24b84039a5f7f
Author: Christian Hergert <chergert redhat com>
Date: Tue Dec 3 15:31:27 2019 -0800
terminal: follow filename hyperlink on button press
It doesn't really make sense to require CONTRO_MASK for following links
to files here. First off, people are already used to underlines for
hyperlinks in browsers, we show a hand, and control click isn't really
a pattern for browser links.
Since we're already going through all that work, just follow the link.
We do risk this colliding with interactive terminal sessions like curses
applications, but given our scope, I'm okay with that.
Reported-by: Lennart Poettering
Signed-off-by: Christian Hergert <chergert redhat com>
src/libide/terminal/ide-terminal.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/src/libide/terminal/ide-terminal.c b/src/libide/terminal/ide-terminal.c
index 52a1d34d5..3170a55a6 100644
--- a/src/libide/terminal/ide-terminal.c
+++ b/src/libide/terminal/ide-terminal.c
@@ -228,31 +228,34 @@ ide_terminal_button_press_event (GtkWidget *widget,
g_assert (IDE_IS_TERMINAL (self));
g_assert (button != NULL);
- if ((button->type == GDK_BUTTON_PRESS) && (button->button == GDK_BUTTON_SECONDARY))
+ if (button->type == GDK_BUTTON_PRESS)
{
- if (!gtk_widget_has_focus (GTK_WIDGET (self)))
- gtk_widget_grab_focus (GTK_WIDGET (self));
+ if (button->button == GDK_BUTTON_PRIMARY)
+ {
+ g_autofree gchar *pattern = NULL;
- ide_terminal_do_popup (self, (GdkEvent *)button);
+ pattern = vte_terminal_match_check_event (VTE_TERMINAL (self), (GdkEvent *)button, NULL);
- return GDK_EVENT_STOP;
- }
- else if ((button->type == GDK_BUTTON_PRESS) && (button->button == GDK_BUTTON_PRIMARY)
- && ((button->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK))
- {
- g_autofree gchar *pattern = NULL;
+ if (pattern != NULL)
+ {
+ gboolean ret = GDK_EVENT_PROPAGATE;
- pattern = vte_terminal_match_check_event (VTE_TERMINAL (self), (GdkEvent *)button, NULL);
+ g_free (priv->url);
+ priv->url = g_steal_pointer (&pattern);
- if (pattern != NULL)
+ g_signal_emit (self, signals [OPEN_LINK], 0, &ret);
+
+ return ret;
+ }
+ }
+ else if (button->button == GDK_BUTTON_SECONDARY)
{
- gboolean ret = FALSE;
+ if (!gtk_widget_has_focus (GTK_WIDGET (self)))
+ gtk_widget_grab_focus (GTK_WIDGET (self));
- g_free (priv->url);
- priv->url = g_steal_pointer (&pattern);
- g_signal_emit (self, signals [OPEN_LINK], 0, &ret);
+ ide_terminal_do_popup (self, (GdkEvent *)button);
- return ret;
+ return GDK_EVENT_STOP;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]