[gnome-builder/gnome-builder-43] libide/terminal: use vte_terminal_check_match_at()



commit 6315cc5329d6645117c2223d96af0ae717d014fa
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 7 09:20:26 2022 -0700

    libide/terminal: use vte_terminal_check_match_at()
    
    This was added in response to our having to use a hack previously, so we
    should stop doing the hack.
    
    Fixes #1849

 src/libide/terminal/ide-terminal.c | 34 ++--------------------------------
 1 file changed, 2 insertions(+), 32 deletions(-)
---
diff --git a/src/libide/terminal/ide-terminal.c b/src/libide/terminal/ide-terminal.c
index c3f8bd359..6ee97f450 100644
--- a/src/libide/terminal/ide-terminal.c
+++ b/src/libide/terminal/ide-terminal.c
@@ -146,37 +146,6 @@ ide_terminal_update_clipboard_actions (IdeTerminal *self)
   gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.paste", can_paste);
 }
 
-static char *
-ide_terminal_get_pattern_at_coords (IdeTerminal *self,
-                                    double       x,
-                                    double       y)
-{
-  g_autofree gchar *pattern = NULL;
-  glong cell_width;
-  glong cell_height;
-  glong column, row;
-  int tag = 0;
-
-  g_assert (IDE_IS_TERMINAL (self));
-
-  cell_width = vte_terminal_get_char_width (VTE_TERMINAL (self));
-  cell_height = vte_terminal_get_char_height (VTE_TERMINAL (self));
-
-  /* crappy way to do this, but i dont see another option right
-   * now given we have to go through deprecated APIs in Vte
-   * until it gets things together for GTK 4.
-   */
-  column = x / cell_width;
-  row = y / cell_height;
-
-  /* no other option in VTE for GTK 4 right now */
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  pattern = vte_terminal_match_check (VTE_TERMINAL (self), column, row, &tag);
-  G_GNUC_END_IGNORE_DEPRECATIONS
-
-  return g_steal_pointer (&pattern);
-}
-
 static void
 ide_terminal_update_url_actions (IdeTerminal *self,
                                  double       x,
@@ -184,10 +153,11 @@ ide_terminal_update_url_actions (IdeTerminal *self,
 {
   IdeTerminalPrivate *priv = ide_terminal_get_instance_private (self);
   g_autofree char *pattern = NULL;
+  int tag = 0;
 
   g_assert (IDE_IS_TERMINAL (self));
 
-  pattern = ide_terminal_get_pattern_at_coords (self, x, y);
+  pattern = vte_terminal_check_match_at (VTE_TERMINAL (self), x, y, &tag);
 
   gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.copy-link", pattern != NULL);
   gtk_widget_action_set_enabled (GTK_WIDGET (self), "terminal.open-link", pattern != NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]