* [matchbox-terminal][PATCH 0/1] Upgrade to Gtk+ 3 and current Vte @ 2016-04-29 10:41 Jussi Kukkonen 2016-04-29 10:41 ` [matchbox-terminal][PATCH 1/1] Upgrade to current Vte and Gtk+ versions Jussi Kukkonen 0 siblings, 1 reply; 3+ messages in thread From: Jussi Kukkonen @ 2016-04-29 10:41 UTC (permalink / raw) To: yocto The big change is that spawning a shell is now done "manually" as vte_terminal_fork_*() have been removed. This patchset is part of the quest to make Sato compatible with GTK+3. Complete WIP collection of patches can be found in jku/matchbox-wip branch at git://git.yoctoproject.org/poky-contrib The following changes since commit 452bca253492a97a587f440289b9ab27d217353e: INSTALL: remove, this is a dangling symlink (2013-02-04 10:13:06 +0000) are available in the git repository at: git://github.com/jku/matchbox-terminal gtk3 https://github.com/jku/matchbox-terminal/tree/gtk3 Jussi Kukkonen (1): Upgrade to current Vte and Gtk+ versions Makefile.am | 4 ++-- configure.ac | 2 +- main.c | 49 +++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 42 insertions(+), 13 deletions(-) -- 2.8.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [matchbox-terminal][PATCH 1/1] Upgrade to current Vte and Gtk+ versions 2016-04-29 10:41 [matchbox-terminal][PATCH 0/1] Upgrade to Gtk+ 3 and current Vte Jussi Kukkonen @ 2016-04-29 10:41 ` Jussi Kukkonen 2016-04-29 15:23 ` Burton, Ross 0 siblings, 1 reply; 3+ messages in thread From: Jussi Kukkonen @ 2016-04-29 10:41 UTC (permalink / raw) To: yocto Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> --- Makefile.am | 4 ++-- configure.ac | 2 +- main.c | 49 +++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index 480fbc0..ef2125c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ -AM_CPPFLAGS = $(VTE_CFLAGS) +AM_CPPFLAGS = $(MBTERM_CFLAGS) AM_CFLAGS = -Wall -LDADD = $(VTE_LIBS) +LDADD = $(MBTERM_LIBS) bin_PROGRAMS = matchbox-terminal matchbox_terminal_SOURCES = main.c diff --git a/configure.ac b/configure.ac index d46da3d..0257274 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ AM_CONFIG_HEADER(config.h) AC_PROG_CPP AC_PROG_CC -PKG_CHECK_MODULES(VTE, vte) +PKG_CHECK_MODULES(MBTERM, glib-2.0 gtk+-3.0 vte-2.91) AC_OUTPUT([ Makefile diff --git a/main.c b/main.c index bda26d1..0d4597c 100644 --- a/main.c +++ b/main.c @@ -18,13 +18,15 @@ #include <gtk/gtk.h> #include <vte/vte.h> +#include <glib.h> static void on_window_title_changed (VteTerminal *terminal, GtkWindow *window) { char *title; - title = g_strdup_printf ("%s - Terminal", terminal->window_title); + title = g_strdup_printf ("%s - Terminal", + vte_terminal_get_window_title (terminal)); gtk_window_set_title (window, title); g_free (title); } @@ -38,16 +40,22 @@ on_eof (VteTerminal *terminal, gpointer user_data) int main (int argc, char **argv) { - GtkWidget *window, *box, *terminal, *scrollbar; - + GtkWidget *window, *terminal, *scrolled_win; + GError *err = NULL; + char *cmd; + char **cmd_argv = NULL; + int cmd_argc; + gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", gtk_main_quit, NULL); gtk_window_set_title (GTK_WINDOW (window), "Terminal"); - box = gtk_hbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (window), box); + scrolled_win = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_win), + GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_container_add (GTK_CONTAINER (window), scrolled_win); terminal = g_object_connect (vte_terminal_new (), @@ -57,17 +65,38 @@ main (int argc, char **argv) /* Child is trying to control the terminal */ "signal::window-title-changed", on_window_title_changed, window, NULL); - gtk_box_pack_start (GTK_BOX (box), terminal, TRUE, TRUE, 0); + gtk_container_add (GTK_CONTAINER (scrolled_win), terminal); + + cmd = vte_get_user_shell (); + if (!cmd) + cmd = g_strdup (g_getenv ("SHELL")); + if (!cmd) + cmd = g_strdup ("/bin/sh"); + + if (!g_shell_parse_argv(cmd, &cmd_argc, &cmd_argv, &err)) { + g_printerr ("Failed to parse shell command line '%s'\n", cmd); + } else if (!vte_terminal_spawn_sync (VTE_TERMINAL (terminal), + VTE_PTY_DEFAULT, + NULL, + cmd_argv, + NULL, + G_SPAWN_SEARCH_PATH, + NULL, + NULL, + NULL, + NULL, + &err)) { + g_printerr ("Failed to spawn shell: %s\n", err->message); + g_error_free (err); + } - scrollbar = gtk_vscrollbar_new (VTE_TERMINAL (terminal)->adjustment); - gtk_box_pack_start (GTK_BOX (box), scrollbar, FALSE, FALSE, 0); - vte_terminal_fork_command (VTE_TERMINAL (terminal), - NULL, NULL, NULL, NULL, TRUE, TRUE, TRUE); + gtk_window_set_default_size (GTK_WINDOW (window), 640, 480); gtk_widget_show_all (window); gtk_main (); + g_free (cmd); return 0; } -- 2.8.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [matchbox-terminal][PATCH 1/1] Upgrade to current Vte and Gtk+ versions 2016-04-29 10:41 ` [matchbox-terminal][PATCH 1/1] Upgrade to current Vte and Gtk+ versions Jussi Kukkonen @ 2016-04-29 15:23 ` Burton, Ross 0 siblings, 0 replies; 3+ messages in thread From: Burton, Ross @ 2016-04-29 15:23 UTC (permalink / raw) To: Jussi Kukkonen; +Cc: yocto [-- Attachment #1: Type: text/plain, Size: 4619 bytes --] Merged and pushed, thanks Jussi. I've started tagging the last GTK+ 2 commit with 'GTK+2'. Ross On 29 April 2016 at 11:41, Jussi Kukkonen <jussi.kukkonen@intel.com> wrote: > Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> > --- > Makefile.am | 4 ++-- > configure.ac | 2 +- > main.c | 49 +++++++++++++++++++++++++++++++++++++++---------- > 3 files changed, 42 insertions(+), 13 deletions(-) > > diff --git a/Makefile.am b/Makefile.am > index 480fbc0..ef2125c 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -1,6 +1,6 @@ > -AM_CPPFLAGS = $(VTE_CFLAGS) > +AM_CPPFLAGS = $(MBTERM_CFLAGS) > AM_CFLAGS = -Wall > -LDADD = $(VTE_LIBS) > +LDADD = $(MBTERM_LIBS) > > bin_PROGRAMS = matchbox-terminal > matchbox_terminal_SOURCES = main.c > diff --git a/configure.ac b/configure.ac > index d46da3d..0257274 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -7,7 +7,7 @@ AM_CONFIG_HEADER(config.h) > AC_PROG_CPP > AC_PROG_CC > > -PKG_CHECK_MODULES(VTE, vte) > +PKG_CHECK_MODULES(MBTERM, glib-2.0 gtk+-3.0 vte-2.91) > > AC_OUTPUT([ > Makefile > diff --git a/main.c b/main.c > index bda26d1..0d4597c 100644 > --- a/main.c > +++ b/main.c > @@ -18,13 +18,15 @@ > > #include <gtk/gtk.h> > #include <vte/vte.h> > +#include <glib.h> > > static void > on_window_title_changed (VteTerminal *terminal, GtkWindow *window) > { > char *title; > > - title = g_strdup_printf ("%s - Terminal", terminal->window_title); > + title = g_strdup_printf ("%s - Terminal", > + vte_terminal_get_window_title (terminal)); > gtk_window_set_title (window, title); > g_free (title); > } > @@ -38,16 +40,22 @@ on_eof (VteTerminal *terminal, gpointer user_data) > int > main (int argc, char **argv) > { > - GtkWidget *window, *box, *terminal, *scrollbar; > - > + GtkWidget *window, *terminal, *scrolled_win; > + GError *err = NULL; > + char *cmd; > + char **cmd_argv = NULL; > + int cmd_argc; > + > gtk_init (&argc, &argv); > > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > g_signal_connect (window, "destroy", gtk_main_quit, NULL); > gtk_window_set_title (GTK_WINDOW (window), "Terminal"); > > - box = gtk_hbox_new (FALSE, 0); > - gtk_container_add (GTK_CONTAINER (window), box); > + scrolled_win = gtk_scrolled_window_new (NULL, NULL); > + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_win), > + GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); > + gtk_container_add (GTK_CONTAINER (window), scrolled_win); > > terminal = g_object_connect > (vte_terminal_new (), > @@ -57,17 +65,38 @@ main (int argc, char **argv) > /* Child is trying to control the terminal */ > "signal::window-title-changed", on_window_title_changed, window, > NULL); > - gtk_box_pack_start (GTK_BOX (box), terminal, TRUE, TRUE, 0); > + gtk_container_add (GTK_CONTAINER (scrolled_win), terminal); > + > + cmd = vte_get_user_shell (); > + if (!cmd) > + cmd = g_strdup (g_getenv ("SHELL")); > + if (!cmd) > + cmd = g_strdup ("/bin/sh"); > + > + if (!g_shell_parse_argv(cmd, &cmd_argc, &cmd_argv, &err)) { > + g_printerr ("Failed to parse shell command line '%s'\n", cmd); > + } else if (!vte_terminal_spawn_sync (VTE_TERMINAL (terminal), > + VTE_PTY_DEFAULT, > + NULL, > + cmd_argv, > + NULL, > + G_SPAWN_SEARCH_PATH, > + NULL, > + NULL, > + NULL, > + NULL, > + &err)) { > + g_printerr ("Failed to spawn shell: %s\n", err->message); > + g_error_free (err); > + } > > - scrollbar = gtk_vscrollbar_new (VTE_TERMINAL (terminal)->adjustment); > - gtk_box_pack_start (GTK_BOX (box), scrollbar, FALSE, FALSE, 0); > > - vte_terminal_fork_command (VTE_TERMINAL (terminal), > - NULL, NULL, NULL, NULL, TRUE, TRUE, TRUE); > + gtk_window_set_default_size (GTK_WINDOW (window), 640, 480); > > gtk_widget_show_all (window); > > gtk_main (); > > + g_free (cmd); > return 0; > } > -- > 2.8.1 > > -- > _______________________________________________ > yocto mailing list > yocto@yoctoproject.org > https://lists.yoctoproject.org/listinfo/yocto > [-- Attachment #2: Type: text/html, Size: 6301 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-29 15:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-04-29 10:41 [matchbox-terminal][PATCH 0/1] Upgrade to Gtk+ 3 and current Vte Jussi Kukkonen 2016-04-29 10:41 ` [matchbox-terminal][PATCH 1/1] Upgrade to current Vte and Gtk+ versions Jussi Kukkonen 2016-04-29 15:23 ` Burton, Ross
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.