mirror of https://gitee.com/openkylin/vte2.91.git
apply patches
This commit is contained in:
commit
572aaefe73
37
src/pty.cc
37
src/pty.cc
|
@ -249,6 +249,21 @@ Pty::child_setup() const noexcept
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keep_fd > 0) {
|
||||||
|
int i;
|
||||||
|
/* Close most descriptors. */
|
||||||
|
for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) {
|
||||||
|
if (i != keep_fd &&
|
||||||
|
i != fd &&
|
||||||
|
i != STDOUT_FILENO &&
|
||||||
|
i != STDIN_FILENO &&
|
||||||
|
i != STDERR_FILENO) {
|
||||||
|
close(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Now set the TERM environment variable */
|
/* Now set the TERM environment variable */
|
||||||
/* FIXME: Setting environment here seems to have no effect, the merged envp2 will override on exec.
|
/* FIXME: Setting environment here seems to have no effect, the merged envp2 will override on exec.
|
||||||
* By the way, we'd need to set the one from there, if any. */
|
* By the way, we'd need to set the one from there, if any. */
|
||||||
|
@ -347,6 +362,24 @@ pty_child_setup_cb(void* data)
|
||||||
pty->child_setup();
|
pty->child_setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_vte_pty_keep_fd(char **env_add)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const gchar *needle = "VTE_PTY_KEEP_FD=";
|
||||||
|
|
||||||
|
if (env_add == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for (i = 0; env_add[i] != NULL; i++) {
|
||||||
|
gchar *s = strstr(env_add[i], needle);
|
||||||
|
if (s != NULL)
|
||||||
|
return atoi(&s[strlen(needle)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pty::spawn:
|
* Pty::spawn:
|
||||||
* @directory: the name of a directory the command should start in, or %nullptr
|
* @directory: the name of a directory the command should start in, or %nullptr
|
||||||
|
@ -428,6 +461,10 @@ Pty::spawn(char const* directory,
|
||||||
/* add the given environment to the childs */
|
/* add the given environment to the childs */
|
||||||
envp2 = __vte_pty_merge_environ (envv, directory, inherit_envv);
|
envp2 = __vte_pty_merge_environ (envv, directory, inherit_envv);
|
||||||
|
|
||||||
|
keep_fd = _vte_pty_keep_fd(envp2);
|
||||||
|
if (keep_fd > 0)
|
||||||
|
spawn_flags |= G_SPAWN_LEAVE_DESCRIPTORS_OPEN;
|
||||||
|
|
||||||
_VTE_DEBUG_IF (VTE_DEBUG_MISC) {
|
_VTE_DEBUG_IF (VTE_DEBUG_MISC) {
|
||||||
g_printerr ("Spawning command:\n");
|
g_printerr ("Spawning command:\n");
|
||||||
for (i = 0; argv[i] != NULL; i++) {
|
for (i = 0; argv[i] != NULL; i++) {
|
||||||
|
|
|
@ -37,6 +37,8 @@ private:
|
||||||
|
|
||||||
VtePtyFlags m_flags{VTE_PTY_DEFAULT};
|
VtePtyFlags m_flags{VTE_PTY_DEFAULT};
|
||||||
|
|
||||||
|
int keep_fd{0};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr Pty(int fd = -1,
|
constexpr Pty(int fd = -1,
|
||||||
VtePtyFlags flags = VTE_PTY_DEFAULT) noexcept
|
VtePtyFlags flags = VTE_PTY_DEFAULT) noexcept
|
||||||
|
|
|
@ -9455,6 +9455,13 @@ Terminal::widget_scroll(GdkEventScroll *event)
|
||||||
|
|
||||||
read_modifiers(base_event);
|
read_modifiers(base_event);
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION (2, 90, 8)
|
||||||
|
/* Do not intercept Alt+scroll, let the GtkNotebook handle it to switch tabs.
|
||||||
|
Requires a fixed GTK+, see https://bugzilla.gnome.org/show_bug.cgi?id=145244 */
|
||||||
|
if (event->state & GDK_MOD1_MASK)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (event->direction) {
|
switch (event->direction) {
|
||||||
case GDK_SCROLL_UP:
|
case GDK_SCROLL_UP:
|
||||||
m_mouse_smooth_scroll_delta -= 1.;
|
m_mouse_smooth_scroll_delta -= 1.;
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
|
|
||||||
struct _VteTerminalClassPrivate {
|
struct _VteTerminalClassPrivate {
|
||||||
GtkStyleProvider *style_provider;
|
GtkStyleProvider *style_provider;
|
||||||
|
GtkStyleProvider *style_provider_padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef VTE_DEBUG
|
#ifdef VTE_DEBUG
|
||||||
|
@ -399,6 +400,9 @@ vte_terminal_init(VteTerminal *terminal)
|
||||||
context = gtk_widget_get_style_context(&terminal->widget);
|
context = gtk_widget_get_style_context(&terminal->widget);
|
||||||
gtk_style_context_add_provider (context,
|
gtk_style_context_add_provider (context,
|
||||||
VTE_TERMINAL_GET_CLASS (terminal)->priv->style_provider,
|
VTE_TERMINAL_GET_CLASS (terminal)->priv->style_provider,
|
||||||
|
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
|
||||||
|
gtk_style_context_add_provider (context,
|
||||||
|
VTE_TERMINAL_GET_CLASS (terminal)->priv->style_provider_padding,
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
|
||||||
/* Initialize private data. NOTE: place is zeroed */
|
/* Initialize private data. NOTE: place is zeroed */
|
||||||
|
@ -1813,6 +1817,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
|
||||||
klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, VTE_TYPE_TERMINAL, VteTerminalClassPrivate);
|
klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, VTE_TYPE_TERMINAL, VteTerminalClassPrivate);
|
||||||
|
|
||||||
klass->priv->style_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
klass->priv->style_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||||
|
klass->priv->style_provider_padding = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||||
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->style_provider),
|
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->style_provider),
|
||||||
"VteTerminal, " VTE_TERMINAL_CSS_NAME " {\n"
|
"VteTerminal, " VTE_TERMINAL_CSS_NAME " {\n"
|
||||||
"padding: 1px 1px 1px 1px;\n"
|
"padding: 1px 1px 1px 1px;\n"
|
||||||
|
@ -1821,6 +1826,11 @@ vte_terminal_class_init(VteTerminalClass *klass)
|
||||||
"}\n",
|
"}\n",
|
||||||
-1, NULL);
|
-1, NULL);
|
||||||
|
|
||||||
|
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->style_provider_padding),
|
||||||
|
"VteTerminal, " VTE_TERMINAL_CSS_NAME " {\n"
|
||||||
|
"padding: 1px 1px 1px 1px;\n"
|
||||||
|
"}\n",
|
||||||
|
-1, NULL);
|
||||||
#ifdef WITH_A11Y
|
#ifdef WITH_A11Y
|
||||||
/* a11y */
|
/* a11y */
|
||||||
gtk_widget_class_set_accessible_type(widget_class, VTE_TYPE_TERMINAL_ACCESSIBLE);
|
gtk_widget_class_set_accessible_type(widget_class, VTE_TYPE_TERMINAL_ACCESSIBLE);
|
||||||
|
|
Loading…
Reference in New Issue