-
Notifications
You must be signed in to change notification settings - Fork 297
/
alternate-screen.patch
167 lines (145 loc) · 5.1 KB
/
alternate-screen.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
From eee603b537de69b778095059c78de771f16f49af Mon Sep 17 00:00:00 2001
From: gnunn1 <gerald.b.nunn@gmail.com>
Date: Sat, 20 Aug 2016 14:25:54 -0400
Subject: [PATCH 1/2] Add terminal-screen-changed signal
---
src/vte/vteterminal.h | 2 ++
src/vtegtk.cc | 19 +++++++++++++++++++
src/vtegtk.hh | 1 +
src/vteinternal.hh | 2 ++
src/vteseq.cc | 12 ++++++++++++
5 files changed, 36 insertions(+)
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index 7836271..5741f47 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -104,6 +104,8 @@ struct _VteTerminalClass {
void (*bell)(VteTerminal* terminal);
+ void (*terminal_screen_changed)(VteTerminal* terminal);
+
/* Padding for future expansion. */
gpointer padding[16];
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index c9dbddc..cacf6e5 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -687,6 +687,8 @@ vte_terminal_class_init(VteTerminalClass *klass)
klass->bell = NULL;
+ klass->terminal_screen_changed = NULL;
+
/* GtkScrollable interface properties */
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
@@ -1206,6 +1208,23 @@ vte_terminal_class_init(VteTerminalClass *klass)
G_TYPE_NONE, 0);
/**
+ * VteTerminal::screen-changed:
+ * @vteterminal: the object which received the signal
+ *
+ * This signal is emitted when the terminal screen changes between
+ * normal and alternate screen.
+ */
+ signals[SIGNAL_TERMINAL_SCREEN_CHANGED] =
+ g_signal_new(I_("terminal-screen-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, bell),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
+ /**
* VteTerminal:allow-bold:
*
* Controls whether or not the terminal will attempt to draw bold text.
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
index 5340725..118f38c 100644
--- a/src/vtegtk.hh
+++ b/src/vtegtk.hh
@@ -51,6 +51,7 @@ enum {
SIGNAL_RESIZE_WINDOW,
SIGNAL_RESTORE_WINDOW,
SIGNAL_SELECTION_CHANGED,
+ SIGNAL_TERMINAL_SCREEN_CHANGED,
SIGNAL_TEXT_DELETED,
SIGNAL_TEXT_INSERTED,
SIGNAL_TEXT_MODIFIED,
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index cff2157..8b6e7cc 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -1181,6 +1181,8 @@ public:
vte::grid::row_t end_row);
void select_empty(vte::grid::column_t col,
vte::grid::row_t row);
+
+ void emit_terminal_screen_changed(int screen);
};
extern GTimer *process_timer;
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 2330939..09eb648 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -202,6 +202,12 @@ VteTerminalPrivate::emit_resize_window(guint columns,
g_signal_emit(m_terminal, signals[SIGNAL_RESIZE_WINDOW], 0, columns, rows);
}
+void
+VteTerminalPrivate::emit_terminal_screen_changed(int screen)
+{
+ _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `terminal_screen_changed'.\n");
+ g_signal_emit(m_terminal, signals[SIGNAL_TERMINAL_SCREEN_CHANGED], 0, screen);
+}
/* Some common functions */
@@ -380,6 +386,9 @@ void
VteTerminalPrivate::seq_normal_screen()
{
seq_switch_screen(&m_normal_screen);
+
+ /* Emit signal */
+ emit_terminal_screen_changed(0);
}
void
@@ -407,6 +416,9 @@ void
VteTerminalPrivate::seq_alternate_screen()
{
seq_switch_screen(&m_alternate_screen);
+
+ /* Emit signal */
+ emit_terminal_screen_changed(1);
}
/* Switch to normal screen and restore cursor (in this order). */
--
2.9.3
From 17864fdc08cde1b767f5af78386d1566ab33e515 Mon Sep 17 00:00:00 2001
From: gnunn1 <gerald.b.nunn@gmail.com>
Date: Sat, 20 Aug 2016 19:12:13 -0400
Subject: [PATCH 2/2] Fix padding
---
src/vte/vteterminal.h | 2 +-
src/vteseq.cc | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index 5741f47..7f93e85 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -107,7 +107,7 @@ struct _VteTerminalClass {
void (*terminal_screen_changed)(VteTerminal* terminal);
/* Padding for future expansion. */
- gpointer padding[16];
+ gpointer padding[15];
VteTerminalClassPrivate *priv;
};
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 09eb648..eb741e1 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -202,6 +202,7 @@ VteTerminalPrivate::emit_resize_window(guint columns,
g_signal_emit(m_terminal, signals[SIGNAL_RESIZE_WINDOW], 0, columns, rows);
}
+/* Emit a "terminal-screen-changed" signal */
void
VteTerminalPrivate::emit_terminal_screen_changed(int screen)
{
--
2.9.3