From d4234710b56581f862c9f0286055028237235ea1 Mon Sep 17 00:00:00 2001 From: ZenWalker Date: Fri, 18 Nov 2016 01:21:04 +0100 Subject: screen: Update for vte API Fixes partially #149 https://git.gnome.org/browse/gnome-terminal/commit/?id=b9cf035874e06951ff8425760cf978ca412b2032 --- src/terminal-screen.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/terminal-screen.c b/src/terminal-screen.c index 69ede6f..0f7f33d 100644 --- a/src/terminal-screen.c +++ b/src/terminal-screen.c @@ -65,7 +65,6 @@ struct _TerminalScreenPrivate char **initial_env; char **override_command; int child_pid; - int pty_fd; double font_scale; gboolean user_title; /* title was manually set */ GSList *match_tags; @@ -341,7 +340,6 @@ terminal_screen_init (TerminalScreen *screen) vte_terminal_set_mouse_autohide (VTE_TERMINAL (screen), TRUE); priv->child_pid = -1; - priv->pty_fd = -1; priv->font_scale = PANGO_SCALE_MEDIUM; @@ -1480,7 +1478,6 @@ terminal_screen_launch_child_cb (TerminalScreen *screen) } priv->child_pid = pid; - priv->pty_fd = vte_terminal_get_pty (terminal); g_free (shell); g_strfreev (argv); @@ -1714,8 +1711,10 @@ terminal_screen_get_current_dir (TerminalScreen *screen) { TerminalScreenPrivate *priv = screen->priv; char *cwd; + VtePty *pty; - if (priv->pty_fd != -1) + pty = vte_terminal_get_pty (VTE_TERMINAL (screen)); + if (pty != NULL) { #if 0 /* Get the foreground process ID */ @@ -1747,9 +1746,11 @@ terminal_screen_get_current_dir (TerminalScreen *screen) char* terminal_screen_get_current_dir_with_fallback (TerminalScreen *screen) { + VtePty *pty; TerminalScreenPrivate *priv = screen->priv; - if (priv->pty_fd == -1) + pty = vte_terminal_get_pty (VTE_TERMINAL (screen)); + if (pty == NULL) return g_strdup (priv->initial_working_directory); return terminal_screen_get_current_dir (screen); @@ -1817,7 +1818,6 @@ terminal_screen_child_exited (VteTerminal *terminal, int status) screen); priv->child_pid = -1; - priv->pty_fd = -1; action = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_EXIT_ACTION); @@ -2271,12 +2271,19 @@ gboolean terminal_screen_has_foreground_process (TerminalScreen *screen) { TerminalScreenPrivate *priv = screen->priv; + VtePty *pty; + int fd; int fgpid; - if (priv->pty_fd == -1) + pty = vte_terminal_get_pty (VTE_TERMINAL (screen)); + if (pty == NULL) return FALSE; - fgpid = tcgetpgrp (priv->pty_fd); + fd = vte_pty_get_fd (pty); + if (fd == -1) + return FALSE; + + fgpid = tcgetpgrp (fd); if (fgpid == -1 || fgpid == priv->child_pid) return FALSE; -- cgit v1.2.1