summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2016-11-18 01:21:04 +0100
committermonsta <[email protected]>2017-01-23 14:15:08 +0300
commit82b97e200aaf4854dd7e60de6b063492176da840 (patch)
treed439fcaa4d149a9df1f288fc72f14d3442c5ded9
parent39588e6dcb53ef711b207e0a3939b15af1c4e000 (diff)
downloadmate-terminal-82b97e200aaf4854dd7e60de6b063492176da840.tar.bz2
mate-terminal-82b97e200aaf4854dd7e60de6b063492176da840.tar.xz
screen: Update for vte API
Fixes partially #149 https://git.gnome.org/browse/gnome-terminal/commit/?id=b9cf035874e06951ff8425760cf978ca412b2032
-rw-r--r--src/terminal-screen.c23
1 files 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;