[Xfce4-commits] [apps/xfce4-terminal] 01/01: Use async spawn method for VTE >= 0.48

noreply at xfce.org noreply at xfce.org
Sat Mar 10 01:10:47 CET 2018


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 48106cb37a9d904428e4082166cd87a55aee04e5
Author: Olivier Duchateau <duchateau.olivier at gmail.com>
Date:   Fri Mar 9 19:09:32 2018 -0500

    Use async spawn method for VTE >= 0.48
    
    Bug #14249
    
    Signed-off-by: Igor <f2404 at yandex.ru>
---
 terminal/terminal-screen.c | 49 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index bff96f2..c7be97e 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -61,6 +61,10 @@
 /* offset of saturation random value */
 #define SATURATION_WINDOW 0.20
 
+/* taken from gnome-terminal (terminal-screen.c) */
+#define SPAWN_TIMEOUT (30 * 1000 /* 30 s*/)
+
+
 
 enum
 {
@@ -1673,6 +1677,29 @@ terminal_screen_set_custom_command (TerminalScreen *screen,
 
 
 
+#if VTE_CHECK_VERSION (0, 48, 0)
+static void
+terminal_screen_spawn_async_cb (VteTerminal *terminal,
+                                GPid         pid,
+                                GError      *error,
+                                gpointer     user_data)
+{
+  TerminalScreen *screen = TERMINAL_SCREEN (user_data);
+
+  terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
+  terminal_return_if_fail (VTE_IS_TERMINAL (screen->terminal));
+
+  if (error)
+    {
+      xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (screen))),
+                              error, _("Failed to execute child"));
+      g_error_free (error);
+    }
+}
+#endif
+
+
+
 /**
  * terminal_screen_new:
  * @attr    : Terminal attributes.
@@ -1755,17 +1782,29 @@ terminal_screen_launch_child (TerminalScreen *screen)
           spawn_flags |= G_SPAWN_FILE_AND_ARGV_ZERO;
         }
 
+#if VTE_CHECK_VERSION (0, 48, 0)
+      vte_terminal_spawn_async (VTE_TERMINAL (screen->terminal),
+                                pty_flags,
+                                screen->working_directory, argv2, env,
+                                spawn_flags,
+                                NULL, NULL,
+                                NULL, SPAWN_TIMEOUT,
+                                NULL,
+                                terminal_screen_spawn_async_cb,
+                                screen);
+#else
       if (!vte_terminal_spawn_sync (VTE_TERMINAL (screen->terminal),
-                                           pty_flags,
-                                           screen->working_directory, argv2, env,
-                                           spawn_flags,
-                                           NULL, NULL,
-                                           &screen->pid, NULL, &error))
+                                    pty_flags,
+                                    screen->working_directory, argv2, env,
+                                    spawn_flags,
+                                    NULL, NULL,
+                                    &screen->pid, NULL, &error))
         {
           xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (screen))),
                                   error, _("Failed to execute child"));
           g_error_free (error);
         }
+#endif
 
 #ifdef HAVE_LIBUTEMPTER
       g_object_get (G_OBJECT (screen->preferences), "command-update-records", &update_records, NULL);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list