[vte/vte-0-34] emulation: Add support for DEC 1007 to set the alternate scroll mode



commit 9f8c1b88dcd880c2d9e78c93521ee755560a9275
Author: Christian Persch <chpe gnome org>
Date:   Mon Sep 30 23:00:09 2013 +0200

    emulation: Add support for DEC 1007 to set the alternate scroll mode
    
    By default, the mouse wheel sends cursor up/down keycodes in the
    alternate screen. This adds an escape sequence (DEC 1007) that allows
    turning this off (and on again).
    
    For compatibility with ubuntu's ******** patched vte, also add a
    (deprecated, skip) public API that has the expected name but does nothing.
    
    Based on patches from ubuntu, and Egmont Koblinger.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=518405
    https://bugzilla.gnome.org/show_bug.cgi?id=709060

 src/vte-private.h   |    1 +
 src/vte.c           |   24 ++++++++++++++++++++++--
 src/vtedeprecated.h |    3 +++
 src/vteseq.c        |    5 +++++
 4 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index f53c230..b7de21f 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -284,6 +284,7 @@ struct _VteTerminalPrivate {
        gboolean scroll_background;
        gboolean scroll_on_output;
        gboolean scroll_on_keystroke;
+       gboolean alternate_screen_scroll;
        long scrollback_lines;
 
        /* Cursor shape */
diff --git a/src/vte.c b/src/vte.c
index 57980a6..0ad759d 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -8495,6 +8495,7 @@ vte_terminal_init(VteTerminal *terminal)
 
        /* Scrolling options. */
        pvt->scroll_on_keystroke = TRUE;
+       pvt->alternate_screen_scroll = TRUE;
         pvt->scrollback_lines = -1; /* force update in vte_terminal_set_scrollback_lines */
        vte_terminal_set_scrollback_lines(terminal, VTE_SCROLLBACK_INIT);
 
@@ -8544,6 +8545,8 @@ vte_terminal_init(VteTerminal *terminal)
        pvt->has_fonts = FALSE;
        pvt->root_pixmap_changed_tag = 0;
 
+        pvt->alternate_screen_scroll = TRUE;
+
        /* Not all backends generate GdkVisibilityNotify, so mark the
         * window as unobscured initially. */
        pvt->visibility_state = GDK_VISIBILITY_UNOBSCURED;
@@ -11403,8 +11406,9 @@ vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
                return FALSE;
        }
 
-       if (terminal->pvt->screen == &terminal->pvt->alternate_screen ||
-               terminal->pvt->normal_screen.scrolling_restricted) {
+       if ((terminal->pvt->screen == &terminal->pvt->alternate_screen &&
+             terminal->pvt->alternate_screen_scroll) ||
+            terminal->pvt->normal_screen.scrolling_restricted) {
                char *normal;
                gssize normal_length;
                const gchar *special;
@@ -13153,6 +13157,20 @@ vte_terminal_set_scroll_on_keystroke(VteTerminal *terminal, gboolean scroll)
         g_object_notify (G_OBJECT (terminal), "scroll-on-keystroke");
 }
 
+/**
+ * vte_terminal_set_alternate_screen_scroll: (skip):
+ * @terminal: a #VteTerminal
+ * @scroll:
+ *
+ * Since: 0.36
+ * Deprecated: 0.36: This function does nothing.
+ */
+void
+vte_terminal_set_alternate_screen_scroll(VteTerminal *terminal, gboolean scroll)
+{
+        /* We just want to export this symbol for compatibility */
+}
+
 static void
 vte_terminal_real_copy_clipboard(VteTerminal *terminal)
 {
@@ -14174,6 +14192,8 @@ vte_terminal_reset(VteTerminal *terminal,
        pvt->alternate_screen.reverse_mode = FALSE;
        pvt->alternate_screen.bracketed_paste_mode = FALSE;
        pvt->cursor_visible = TRUE;
+        /* For some reason, xterm doesn't reset alternateScroll, but we do. */
+        pvt->alternate_screen_scroll = TRUE;
        /* Reset the encoding. */
        vte_terminal_set_encoding(terminal, NULL);
        g_assert(pvt->encoding != NULL);
diff --git a/src/vtedeprecated.h b/src/vtedeprecated.h
index a25652c..62f6691 100644
--- a/src/vtedeprecated.h
+++ b/src/vtedeprecated.h
@@ -116,6 +116,9 @@ void vte_terminal_set_opacity(VteTerminal *terminal, guint16 opacity) G_GNUC_DEP
 
 G_END_DECLS
 
+void vte_terminal_set_alternate_screen_scroll(VteTerminal *terminal,
+                                              gboolean scroll) G_GNUC_DEPRECATED;
+
 #endif /* !vte_deprecated_h_included */
 
 #endif /* !VTE_DISABLE_DEPRECATED */
diff --git a/src/vteseq.c b/src/vteseq.c
index 707bdbd..dc82792 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -737,6 +737,11 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
                 GINT_TO_POINTER(FALSE),
                 GINT_TO_POINTER(TRUE),
                 NULL, NULL,},
+               /* 1007: Alternate screen scroll. */
+               {1007, &terminal->pvt->alternate_screen_scroll, NULL, NULL,
+                GINT_TO_POINTER(FALSE),
+                GINT_TO_POINTER(TRUE),
+                NULL, NULL,},
                /* 1010/rxvt: disallowed, scroll-on-output is set by user. */
                {1010, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
                /* 1011/rxvt: disallowed, scroll-on-keypress is set by user. */


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