Revision: 2841 http://geany.svn.sourceforge.net/geany/?rev=2841&view=rev Author: eht16 Date: 2008-07-30 18:20:58 +0000 (Wed, 30 Jul 2008)
Log Message: ----------- Start the shell in the VTE first when the VTE is actually realized to avoid strange display bugs on some systems (closes #1844985).
Modified Paths: -------------- trunk/ChangeLog trunk/src/vte.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-07-30 18:19:57 UTC (rev 2840) +++ trunk/ChangeLog 2008-07-30 18:20:58 UTC (rev 2841) @@ -1,9 +1,12 @@ -2008-07-29 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> +2008-07-30 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/notebook.c: Fix signature of focus_sci(). Double clicking on free space in the tab bar opens a new file (#2003291). + * src/vte.c: + Start the shell in the VTE first when the VTE is actually realized + to avoid strange display bugs on some systems (closes #1844985).
2008-07-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/vte.c =================================================================== --- trunk/src/vte.c 2008-07-30 18:19:57 UTC (rev 2840) +++ trunk/src/vte.c 2008-07-30 18:20:58 UTC (rev 2841) @@ -258,8 +258,7 @@ { GtkWidget *vte, *scrollbar, *hbox, *frame;
- vte = vf->vte_terminal_new(); - vc->vte = vte; + vc->vte = vte = vf->vte_terminal_new(); scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(vte)->adjustment)); GTK_WIDGET_UNSET_FLAGS(scrollbar, GTK_CAN_FOCUS);
@@ -289,13 +288,11 @@ g_signal_connect(vte, "motion-notify-event", G_CALLBACK(on_motion_event), NULL); g_signal_connect(vte, "drag-data-received", G_CALLBACK(vte_drag_data_received), NULL);
- vte_start(vte); - gtk_widget_show_all(frame); gtk_notebook_insert_page(GTK_NOTEBOOK(msgwindow.notebook), frame, gtk_label_new(_("Terminal")), MSG_VTE);
/* the vte widget has to be realised before color changes take effect */ - g_signal_connect(vte, "realize", G_CALLBACK(vte_apply_user_settings), NULL); + g_signal_connect_after(vte, "realize", G_CALLBACK(vte_apply_user_settings), NULL); }
@@ -362,7 +359,6 @@
static void vte_start(GtkWidget *widget) { - VteTerminal *vte = VTE_TERMINAL(widget); gchar **env; gchar **argv;
@@ -372,7 +368,7 @@ if (argv != NULL) { env = vte_get_child_environment(); - pid = vf->vte_terminal_fork_command(VTE_TERMINAL(vte), argv[0], argv, env, + pid = vf->vte_terminal_fork_command(VTE_TERMINAL(widget), argv[0], argv, env, vte_info.dir, TRUE, TRUE, TRUE); g_strfreev(env); g_strfreev(argv); @@ -441,8 +437,9 @@
void vte_apply_user_settings(void) { - if (! ui_prefs.msgwindow_visible) return; - /*if (! GTK_WIDGET_REALIZED(vc->vte)) gtk_widget_realize(vc->vte);*/ + if (! ui_prefs.msgwindow_visible) + return; + vf->vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->vte), vc->scrollback_lines); vf->vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(vc->vte), vc->scroll_on_key); vf->vte_terminal_set_scroll_on_output(VTE_TERMINAL(vc->vte), vc->scroll_on_out); @@ -452,6 +449,8 @@ vf->vte_terminal_set_color_background(VTE_TERMINAL(vc->vte), vc->colour_back);
override_menu_key(); + + vte_start(vc->vte); }
@@ -554,12 +553,37 @@ }
+static gboolean vte_send_cmd_cb(gpointer data) +{ + gchar *cmd = data; + if (! vte_send_cmd(cmd)) + { + ui_set_statusbar(FALSE, + _("Could not execute the command "%s" in the VTE because it probably contains a command."), + cmd); + } + g_free(data); + + return FALSE; +} + /* if the command could be executed, TRUE is returned, FALSE otherwise (i.e. there was some text * on the prompt). */ gboolean vte_send_cmd(const gchar *cmd) { if (clean) { + /* the shell is started once the widget is realized but it might happen we send commands + * before this happened, so start it manually */ + if (! GTK_WIDGET_REALIZED(vc->vte)) + { + gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_VTE); + /* wait until the notebook page has been switched which will realize the widget + * implicitly, after this has been done the idle function willsend the command */ + g_idle_add(vte_send_cmd_cb, g_strdup(cmd)); + return TRUE; + } + vf->vte_terminal_feed_child(VTE_TERMINAL(vc->vte), cmd, strlen(cmd)); clean = TRUE; /* vte_terminal_feed_child() also marks the vte as not clean */ return TRUE;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.