Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes for gtk+3 / vte-2.91
Had to remove support for "background-tint-color" and
"dim-foreground-color" because these were removed in vte 0.38

I do not claim to understand why vte-2.91.pc = Version: 0.48.4

Running './configure --enable-gtk3'
requires a newer version of vte than the default in Artful.
Running the following commands first will force using vte-2.91

export VTE_CFLAGS=`pkg-config --cflags "vte-2.91"`
export VTE_LIBS=`pkg-config --libs "vte-2.91"`

Should fix puppylinux-woof-CE#50
  • Loading branch information
woodenshoe-wi committed Mar 18, 2018
1 parent b6bf239 commit d8b84a4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/automaton.c
Expand Up @@ -722,7 +722,7 @@ static GtkWidget *put_in_the_scrolled_window(GtkWidget *widget,
glong char_height;
glong char_width;
#if HAVE_VTE
#if 0 //#if VTE_CHECK_VERSION(0,26,0)
#if VTE_CHECK_VERSION(0,26,0)
GtkBorder inner_border;
#endif
#endif
Expand Down Expand Up @@ -777,7 +777,7 @@ static GtkWidget *put_in_the_scrolled_window(GtkWidget *widget,
* but GLib is telling me that 'VteTerminal' has no property
* named 'inner-border' so I have to go with the deprecated
* vte_terminal_get_padding() */
#if 0 //#if VTE_CHECK_VERSION(0,26,0)
#if VTE_CHECK_VERSION(0,26,0)
g_object_get(G_OBJECT(widget), "inner-border", &inner_border, NULL);
#ifdef DEBUG_CONTENT
fprintf(stderr, "%s(): inner_border.left=%i inner_border.right=%i \
Expand All @@ -801,7 +801,12 @@ inner_border.top=%i inner_border.bottom=%i\n", __func__, inner_border.left,
if (width == -1) width = 80 * char_width + xpad;
if (height == -1) height = 25 * char_height + ypad;
/* Set the size */
#if GTK_CHECK_VERSION(2,2,0)
gtk_widget_set_size_request(scrolledwindow, width, height);
#else
gtk_widget_set_usize(scrolledwindow, width, height);
#endif

/* Pack the widget */
gtk_container_add(GTK_CONTAINER(scrolledwindow), widget);
break;
Expand Down
35 changes: 35 additions & 0 deletions src/widget_terminal.c
Expand Up @@ -84,6 +84,10 @@ GtkWidget *widget_terminal_create(
gint width = -1, height = -1;
#endif

#if VTE_CHECK_VERSION(0,38,0)
PangoFontDescription *fontdesc;
#endif

#ifdef DEBUG_TRANSITS
fprintf(stderr, "%s(): Entering.\n", __func__);
#endif
Expand All @@ -110,10 +114,16 @@ GtkWidget *widget_terminal_create(
* widget_set_tag_attributes() will try to set it later */
strcpy(tagattribute, "font-desc");
if ((value = get_tag_attribute(attr, tagattribute))) {
#if VTE_CHECK_VERSION(0,38,0)
fontdesc = pango_font_description_from_string (value);
vte_terminal_set_font(VTE_TERMINAL(widget), fontdesc);
#else
vte_terminal_set_font_from_string(VTE_TERMINAL(widget), value);
#endif
kill_tag_attribute(attr, tagattribute);
}

#if ! VTE_CHECK_VERSION(0,38,0)
/* Again, "background-tint-color" requires a pointer to a
* GdkColor struct but we can convert a string like "#ff00ff" */
strcpy(tagattribute, "background-tint-color");
Expand All @@ -129,10 +139,16 @@ GtkWidget *widget_terminal_create(
}
kill_tag_attribute(attr, tagattribute);
}
#endif

/* Get custom tag attribute "font-name" */
if ((value = get_tag_attribute(attr, "font-name"))) {
#if VTE_CHECK_VERSION(0,38,0)
fontdesc = pango_font_description_from_string (value);
vte_terminal_set_font(VTE_TERMINAL(widget), fontdesc);
#else
vte_terminal_set_font_from_string(VTE_TERMINAL(widget), value);
#endif
}

/* Get custom tag attribute "text-background-color" */
Expand Down Expand Up @@ -174,6 +190,7 @@ GtkWidget *widget_terminal_create(
}
}

#if ! VTE_CHECK_VERSION(0,38,0)
/* Get custom tag attribute "dim-foreground-color" */
if ((value = get_tag_attribute(attr, "dim-foreground-color"))) {
/* Parse the RGB value to create the necessary GdkColor.
Expand All @@ -186,6 +203,7 @@ GtkWidget *widget_terminal_create(
vte_terminal_set_color_dim(VTE_TERMINAL(widget), &color);
}
}
#endif

/* Get custom tag attribute "cursor-background-color" */
if ((value = get_tag_attribute(attr, "cursor-background-color"))) {
Expand Down Expand Up @@ -298,6 +316,22 @@ void widget_terminal_fork_command(GtkWidget *widget, tag_attr *attr)
#endif

#if VTE_CHECK_VERSION(0,26,0)
#if VTE_CHECK_VERSION(0,38,0)
retval = (vte_terminal_spawn_sync(VTE_TERMINAL(widget),
VTE_PTY_DEFAULT,
working_directory,
argv,
envv,
G_SPAWN_SEARCH_PATH,
NULL,
NULL,
&pid,
NULL,
&error));
if (!retval)
fprintf(stderr, "%s(): vte_terminal_spawn_sync(): %s\n",
__func__, error->message);
#else
retval = (vte_terminal_fork_command_full(VTE_TERMINAL(widget),
VTE_PTY_DEFAULT,
working_directory,
Expand All @@ -311,6 +345,7 @@ void widget_terminal_fork_command(GtkWidget *widget, tag_attr *attr)
if (!retval)
fprintf(stderr, "%s(): vte_terminal_fork_command_full(): %s\n",
__func__, error->message);
#endif
#else
pid = (vte_terminal_fork_command(VTE_TERMINAL(widget),
argv[0],
Expand Down

0 comments on commit d8b84a4

Please sign in to comment.