Beispiel #1
0
static VALUE
term_reset(VALUE self, VALUE full, VALUE clear_history)
{
    vte_terminal_reset(RVAL2TERM(self), RVAL2CBOOL(full),
                       RVAL2CBOOL(clear_history));
    return Qnil;
}
Beispiel #2
0
static VALUE
rg_reset(VALUE self, VALUE full, VALUE clear_history)
{
    vte_terminal_reset(_SELF(self), RVAL2CBOOL(full),
                       RVAL2CBOOL(clear_history));
    return self;
}
Beispiel #3
0
static void
state_reset_for_new_connection (HotSshTab                *self)
{
  HotSshTabPrivate *priv = hotssh_tab_get_instance_private (self);
  g_debug ("reset state");
  g_clear_pointer (&priv->connection_id, g_free);
  g_clear_object (&priv->address);
  g_clear_object (&priv->connection);
  g_clear_object (&priv->cancellable);
  if (!priv->indisposed)
    {
      g_object_notify ((GObject*)self, "hostname");
      vte_terminal_reset ((VteTerminal*)priv->terminal, TRUE, TRUE);
      gtk_entry_set_text ((GtkEntry*)priv->password_entry, "");
      gtk_label_set_text ((GtkLabel*)priv->connection_text, "");
      gtk_widget_set_sensitive (priv->password_container, TRUE);
      priv->awaiting_password_entry = priv->submitted_password = FALSE;
    }
  if (priv->queued_pty_size_id)
    {
      g_source_remove (priv->queued_pty_size_id);
      priv->queued_pty_size_id = 0;
    }
  g_debug ("reset state done");
}
Beispiel #4
0
static void
init_shell (TerminalPlugin *term_plugin, const char *uri)
{
	struct passwd *pw;
	const char *shell;
	const char *dir;
	static gboolean first_time = TRUE;
	VteTerminal *term = VTE_TERMINAL (term_plugin->shell);
	
	
	pw = getpwuid (getuid ());
	if (pw) {
		shell = pw->pw_shell;
		dir = pw->pw_dir;
	} else {
		shell = "/bin/sh";
		dir = "/";
	}
	
	if (uri)
		dir = uri;
	
	if (!first_time)
		vte_terminal_reset (term, FALSE, TRUE);
	else
		first_time = FALSE;
	
	vte_terminal_fork_command (term, shell, NULL, NULL, dir,
								term_plugin->lastlog,
								term_plugin->update_records,
								term_plugin->update_records);
}
Beispiel #5
0
static void term_eof_or_child_exited(VteTerminal *term, gpointer user_data) {
    vte_terminal_reset(VTE_TERMINAL(term), FALSE, TRUE);
    vte_terminal_fork_command(VTE_TERMINAL(term), conf_get_shell(), NULL, NULL,
            "", TRUE, TRUE, TRUE);

    gtk_widget_hide(GTK_WIDGET(mainwindow));
}
Beispiel #6
0
void lcrt_edit_on_clear_screen_and_scrollback_activate(GtkMenuItem *menuitem, gpointer user_data)
{
    struct lcrt_window *lwindow = (struct lcrt_window *)user_data;
    struct lcrt_terminal *lterminal = lwindow->w_notebook->current_terminal;

    if (lterminal)
        vte_terminal_reset(VTE_TERMINAL(lterminal->terminal), TRUE, TRUE);
}
static void
gb_terminal_respawn (GbTerminalView *self,
                     VteTerminal    *terminal)
{
  g_autoptr(GPtrArray) args = NULL;
  g_autofree gchar *workpath = NULL;
  GtkWidget *toplevel;
  GError *error = NULL;
  IdeContext *context;
  IdeVcs *vcs;
  GFile *workdir;
  GPid child_pid;
  gint64 now;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  vte_terminal_reset (terminal, TRUE, TRUE);

  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
  if (!IDE_IS_WORKBENCH (toplevel))
    return;

  /* Prevent flapping */
  now = g_get_monotonic_time ();
  if ((now - self->last_respawn) < (G_USEC_PER_SEC / 10))
    return;
  self->last_respawn = now;

  context = ide_workbench_get_context (IDE_WORKBENCH (toplevel));
  vcs = ide_context_get_vcs (context);
  workdir = ide_vcs_get_working_directory (vcs);
  workpath = g_file_get_path (workdir);

  args = g_ptr_array_new_with_free_func (g_free);
  g_ptr_array_add (args, vte_get_user_shell ());
  g_ptr_array_add (args, NULL);

  vte_terminal_spawn_sync (terminal,
                           VTE_PTY_DEFAULT | VTE_PTY_NO_LASTLOG | VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP,
                           workpath,
                           (gchar **)args->pdata,
                           NULL,
                           G_SPAWN_DEFAULT,
                           NULL,
                           NULL,
                           &child_pid,
                           NULL,
                           &error);

  if (error != NULL)
    {
      g_warning ("%s", error->message);
      g_clear_error (&error);
      return;
    }

  vte_terminal_watch_child (terminal, child_pid);
}
Beispiel #8
0
void lcrt_edit_on_clear_screen_activate(GtkMenuItem *menuitem, gpointer user_data)
{
    struct lcrt_window *lwindow = (struct lcrt_window *)user_data;
    struct lcrt_terminal *lterminal = lwindow->w_notebook->current_terminal;

    if (lterminal)
        //g_signal_emit_by_name(lterminal->terminal, "text-scrolled");
        vte_terminal_reset(VTE_TERMINAL(lterminal->terminal), TRUE, TRUE);
}
static void
ide_terminal_page_spawn_cb (GObject      *object,
                            GAsyncResult *result,
                            gpointer      user_data)
{
  IdeTerminalLauncher *launcher = (IdeTerminalLauncher *)object;
  g_autoptr(IdeTerminalPage) self = user_data;
  g_autoptr(GError) error = NULL;
  gint64 now;

  g_assert (IDE_IS_TERMINAL_LAUNCHER (launcher));
  g_assert (G_IS_ASYNC_RESULT (result));
  g_assert (IDE_IS_TERMINAL_PAGE (self));

  if (!ide_terminal_launcher_spawn_finish (launcher, result, &error))
    {
      g_autofree gchar *format = NULL;

      format = g_strdup_printf ("%s: %s", _("Subprocess launcher failed"), error->message);
      ide_terminal_page_feed (self, format);
    }

  if (gtk_widget_in_destruction (GTK_WIDGET (self)))
    return;

  now = g_get_monotonic_time ();

  if (ABS (now - self->last_respawn) < FLAPPING_DURATION_USEC)
    {
      ide_terminal_page_feed (self, _("Subprocess launcher failed too quickly, will not respawn."));
      return;
    }

  if (!self->respawn_on_exit)
    {
      if (self->close_on_exit)
        gdk_threads_add_idle_full (G_PRIORITY_LOW + 1000,
                                   (GSourceFunc) destroy_widget_in_idle,
                                   g_object_ref (self),
                                   g_object_unref);
      return;
    }

  g_clear_object (&self->pty);
  vte_terminal_reset (VTE_TERMINAL (self->terminal_top), TRUE, TRUE);
  self->pty = vte_pty_new_sync (VTE_PTY_DEFAULT, NULL, NULL);
  vte_terminal_set_pty (VTE_TERMINAL (self->terminal_top), self->pty);

  /* Spawn our terminal and wait for it to exit */
  self->last_respawn = now;
  ide_terminal_launcher_spawn_async (self->launcher,
                                     self->pty,
                                     NULL,
                                     ide_terminal_page_spawn_cb,
                                     g_object_ref (self));
}
Beispiel #10
0
/*
 * restarts debug process
 */
void debug_restart()
{
	if (DBS_STOPPED == debug_state)
	{
		/* stop instantly if not running */
		vte_terminal_reset(VTE_TERMINAL(terminal), TRUE, TRUE);
		active_module->restart();
		debug_state = DBS_RUN_REQUESTED;
	}
}
Beispiel #11
0
void dc_clear(void)
{
#ifdef G_OS_UNIX
	if (debug_console)
		vte_terminal_reset(debug_console, TRUE, TRUE);
	else
#endif
	{
		gtk_text_buffer_set_text(context, "", -1);
		dc_chars = 0;
	}
}
Beispiel #12
0
void
ide_terminal_page_set_pty (IdeTerminalPage *self,
                           VtePty          *pty)
{
  g_return_if_fail (IDE_IS_TERMINAL_PAGE (self));
  g_return_if_fail (VTE_IS_PTY (pty));

  if (g_set_object (&self->pty, pty))
    {
      vte_terminal_reset (VTE_TERMINAL (self->terminal_top), TRUE, TRUE);
      vte_terminal_set_pty (VTE_TERMINAL (self->terminal_top), pty);
    }
}
Beispiel #13
0
static void term_eof_or_child_exited(VteTerminal *term, gpointer user_data)
{
    if(vte_terminal_get_child_exit_status(term) != 0)
    {
        /* restart the terminal if it crashed */
        vte_terminal_reset(VTE_TERMINAL(term), FALSE, TRUE);
        term_fork_command(VTE_TERMINAL(term), conf_get_shell());
    }
    else
    {
        /* else close the tab */
        mainwindow_close_tab(GTK_WIDGET(term));
    }
//    gtk_widget_hide(GTK_WIDGET(mainwindow));
}
Beispiel #14
0
void
gb_terminal_view_set_pty (GbTerminalView *self,
                          VtePty         *pty)
{
  g_return_if_fail (GB_IS_TERMINAL_VIEW (self));
  g_return_if_fail (VTE_IS_PTY (pty));

  if (self->manage_spawn)
    {
      g_warning ("Cannot set pty when GbTerminalView manages tty");
      return;
    }

  if (self->terminal_top)
    {
      vte_terminal_reset (self->terminal_top, TRUE, TRUE);
      vte_terminal_set_pty (self->terminal_top, pty);
    }
}
Beispiel #15
0
/*
 * Class:     com_randomwalking_swt_terminal_internal_Vte
 * Method:    _vte_terminal_reset
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_com_randomwalking_swt_terminal_internal_Vte__1vte_1terminal_1reset
  (JNIEnv * env, jclass obj, jint terminal, jboolean clear_tabstops, jboolean clear_history) {
	vte_terminal_reset(VTE_TERMINAL(terminal), clear_tabstops, clear_history);
}
Beispiel #16
0
static void
gb_terminal_respawn (GbTerminalView *self,
                     VteTerminal    *terminal)
{
  g_autoptr(GPtrArray) args = NULL;
  g_autoptr(IdeSubprocess) subprocess = NULL;
  g_autoptr(IdeSubprocessLauncher) launcher = NULL;
  g_autofree gchar *workpath = NULL;
  g_autofree gchar *shell = NULL;
  GtkWidget *toplevel;
  GError *error = NULL;
  IdeContext *context;
  IdeVcs *vcs;
  VtePty *pty = NULL;
  GFile *workdir;
  gint64 now;
  int tty_fd = -1;
  gint stdout_fd = -1;
  gint stderr_fd = -1;

  IDE_ENTRY;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  vte_terminal_reset (terminal, TRUE, TRUE);

  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
  if (!IDE_IS_WORKBENCH (toplevel))
    IDE_EXIT;

  /* Prevent flapping */
  now = g_get_monotonic_time ();
  if ((now - self->last_respawn) < (G_USEC_PER_SEC / 10))
    IDE_EXIT;
  self->last_respawn = now;

  context = ide_workbench_get_context (IDE_WORKBENCH (toplevel));
  vcs = ide_context_get_vcs (context);
  workdir = ide_vcs_get_working_directory (vcs);
  workpath = g_file_get_path (workdir);

  shell = gb_terminal_view_discover_shell (NULL, &error);

  if (shell == NULL)
    {
      g_warning ("Failed to discover user shell: %s", error->message);

      /* We prefer bash in flatpak over sh */
      if (ide_is_flatpak ())
        shell = g_strdup ("/bin/bash");
      else
        shell = vte_get_user_shell ();

      g_clear_error (&error);
    }

  args = g_ptr_array_new ();
  g_ptr_array_add (args, (gchar *)shell);
  g_ptr_array_add (args, NULL);

  pty = vte_terminal_pty_new_sync (terminal,
                                   VTE_PTY_DEFAULT | VTE_PTY_NO_LASTLOG | VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP,
                                   NULL,
                                   &error);
  if (pty == NULL)
    IDE_GOTO (failure);

  vte_terminal_set_pty (terminal, pty);

  if (-1 == (tty_fd = gb_vte_pty_create_slave (pty)))
    IDE_GOTO (failure);

  /* dup() is safe as it will inherit O_CLOEXEC */
  if (-1 == (stdout_fd = dup (tty_fd)) || -1 == (stderr_fd = dup (tty_fd)))
    IDE_GOTO (failure);

  /* XXX: It would be nice to allow using the runtimes launcher */
  launcher = ide_subprocess_launcher_new (0);
  ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
  ide_subprocess_launcher_set_clear_env (launcher, FALSE);
  ide_subprocess_launcher_set_cwd (launcher, workpath);
  ide_subprocess_launcher_push_args (launcher, (const gchar * const *)args->pdata);
  ide_subprocess_launcher_take_stdin_fd (launcher, tty_fd);
  ide_subprocess_launcher_take_stdout_fd (launcher, stdout_fd);
  ide_subprocess_launcher_take_stderr_fd (launcher, stderr_fd);
  ide_subprocess_launcher_setenv (launcher, "TERM", "xterm-256color", TRUE);
  ide_subprocess_launcher_setenv (launcher, "INSIDE_GNOME_BUILDER", PACKAGE_VERSION, TRUE);
  ide_subprocess_launcher_setenv (launcher, "SHELL", shell, TRUE);

  tty_fd = -1;
  stdout_fd = -1;
  stderr_fd = -1;

  if (NULL == (subprocess = ide_subprocess_launcher_spawn (launcher, NULL, &error)))
    IDE_GOTO (failure);

  ide_subprocess_wait_async (subprocess,
                             NULL,
                             gb_terminal_view_wait_cb,
                             g_object_ref (terminal));

failure:
  if (tty_fd != -1)
    close (tty_fd);

  if (stdout_fd != -1)
    close (stdout_fd);

  g_clear_object (&pty);

  if (error != NULL)
    {
      g_warning ("%s", error->message);
      g_clear_error (&error);
    }

  IDE_EXIT;
}
Beispiel #17
0
static void
warning_hide ()
{
  gtk_widget_hide ((GtkWidget *) warning_label1);
  vte_terminal_reset (VTE_TERMINAL ((GtkWidget *) terminal), TRUE, FALSE);
}
Beispiel #18
0
void terminal_clear(void)
{
	vte_terminal_reset(program_terminal, TRUE, TRUE);
}
Beispiel #19
0
static void on_terminal_clear(G_GNUC_UNUSED const MenuItem *menu_item)
{
	vte_terminal_reset(program_terminal, TRUE, TRUE);
}
Beispiel #20
0
/* 
 * called when debugger exits 
 */
static void on_debugger_exited (int code)
{
	/* remove marker for current instruction if was set */
	if (stack)
	{
		remove_stack_markers();
		g_list_foreach(stack, (GFunc)frame_free, NULL);
		g_list_free(stack);
		stack = NULL;
	}
	
	/* clear watch page */
	clear_watch_values(GTK_TREE_VIEW(wtree));
	
	/* clear autos page */
	gtk_tree_store_clear(GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(atree))));

	/* clear stack trace tree */
	stree_clear();

	/* clear debug terminal */
	vte_terminal_reset(VTE_TERMINAL(terminal), TRUE, TRUE);

	/* clear debug messages window */
	GtkTextIter start, end;
	GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(debugger_messages_textview));
	gtk_text_buffer_get_bounds(buffer, &start, &end);
	gtk_text_buffer_delete(buffer, &start, &end);

	/* enable target page */
	tpage_set_readonly(FALSE);

	/* remove breaks readonly if current module doesn't support run-time breaks operation */
	if (!(active_module->features & MF_ASYNC_BREAKS))
		bptree_set_readonly(FALSE);
	
	/* set files that was readonly during debug writable */
	GList *iter = read_only_pages;
	while (iter)
	{
		GeanyDocument *doc = document_find_by_real_path((const gchar*)iter->data);
		if (doc)
			scintilla_send_message(doc->editor->sci, SCI_SETREADONLY, 0, 0);

		/* free file name */
		g_free(iter->data);

		iter = iter->next;
	}
	g_list_free(read_only_pages);
	read_only_pages = NULL;

	/* clear and destroy calltips cache */
	g_hash_table_destroy(calltips);
	calltips = NULL;

	/* enable widgets */
	enable_sensitive_widgets(TRUE);

	/* update buttons panel state */
	btnpanel_set_debug_state(DBS_IDLE);
	
	/* update debug state */
	debug_state = DBS_IDLE;
}
Beispiel #21
0
 void terminal::reset_terminal(gboolean i_full) {
   if ( m_terminal != NULL )
     vte_terminal_reset(m_terminal, i_full, i_full);
 }