[vte] pty: Set size on creation



commit 07aad3e0d5e75bead37f94964907aee59dc9b12c
Author: Christian Persch <chpe src gnome org>
Date:   Sun Nov 3 22:38:24 2019 +0100

    pty: Set size on creation
    
    The size needs to be set before spawning the child process, so that
    the child process has the correct size from the start, instead of
    starting with a default size and then shortly afterwards receiving a
    SIGWINCH signal.
    
    https://gitlab.gnome.org/GNOME/vte/issues/188#note_635057

 src/vtegtk.cc | 7 +++++--
 src/vtepty.cc | 6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 8b8e640c..c23b9fdb 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2553,8 +2553,9 @@ vte_terminal_get_cursor_position(VteTerminal *terminal,
  * @cancellable: (allow-none): a #GCancellable, or %NULL
  * @error: (allow-none): return location for a #GError, or %NULL
  *
- * Creates a new #VtePty, and sets the emulation property
- * from #VteTerminal:emulation.
+ * Creates a new #VtePty, sets the emulation property
+ * from #VteTerminal:emulation, and sets the size using
+ * @terminal's size.
  *
  * See vte_pty_new() for more information.
  *
@@ -2572,6 +2573,8 @@ vte_terminal_pty_new_sync(VteTerminal *terminal,
         if (pty == NULL)
                 return NULL;
 
+        vte_pty_set_size(pty, IMPL(terminal)->m_row_count, IMPL(terminal)->m_column_count, NULL);
+
         return pty;
 }
 
diff --git a/src/vtepty.cc b/src/vtepty.cc
index 78f89c44..3c0d53e8 100644
--- a/src/vtepty.cc
+++ b/src/vtepty.cc
@@ -480,6 +480,12 @@ vte_pty_error_quark(void)
  *
  * Also, you MUST pass the %G_SPAWN_DO_NOT_REAP_CHILD flag.
  *
+ * Note that you should set the PTY's size using vte_pty_set_size() before
+ * spawning the child process, so that the child process has the correct
+ * size from the start instead of starting with a default size and then
+ * shortly afterwards receiving a SIGWINCH signal. You should prefer
+ * using vte_terminal_pty_new_sync() which does this automatically.
+ *
  * Returns: (transfer full): a new #VtePty, or %NULL on error with @error filled in
  */
 VtePty *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]