[vte/vte-next] Implement global reverse mode
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next] Implement global reverse mode
- Date: Fri, 27 May 2011 21:50:21 +0000 (UTC)
commit c894fe71ff9a12331f4cfaa88c3ed85018f83f15
Author: Christian Persch <chpe gnome org>
Date: Fri May 27 23:26:05 2011 +0200
Implement global reverse mode
src/vte-private.h | 1 +
src/vte.c | 34 ++++++++++++++++++++++++++++++++--
src/vteapp.c | 3 +++
3 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 100f4c6..19ba69c 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -336,6 +336,7 @@ struct _VteTerminalPrivate {
* when realizing. */
struct _vte_draw *draw;
+ gboolean reverse;
gboolean highlight_color_set;
gboolean cursor_color_set;
gboolean reverse_color_set;
diff --git a/src/vte.c b/src/vte.c
index 5ddd6a4..0422dbf 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -4269,7 +4269,7 @@ vte_terminal_update_style(VteTerminal *terminal)
{
VteTerminalPrivate *pvt = terminal->pvt;
GtkWidget *widget = &terminal->widget;
- gboolean allow_bold, scroll_background;
+ gboolean allow_bold, scroll_background, reverse;
PangoFontDescription *font_desc;
vte_terminal_set_padding(terminal);
@@ -4281,6 +4281,7 @@ vte_terminal_update_style(VteTerminal *terminal)
"allow-bold", &allow_bold,
"scroll-background", &scroll_background,
"font", &font_desc,
+ "reverse", &reverse,
NULL);
vte_terminal_set_font(terminal, font_desc /* adopted */);
@@ -4290,6 +4291,12 @@ vte_terminal_update_style(VteTerminal *terminal)
_vte_invalidate_all (terminal);
}
+ if (reverse != pvt->reverse) {
+ pvt->reverse = reverse;
+
+ _vte_invalidate_all(terminal);
+ }
+
if (scroll_background != pvt->scroll_background) {
pvt->scroll_background = scroll_background;
vte_terminal_queue_background_update(terminal);
@@ -7623,6 +7630,9 @@ vte_terminal_init(VteTerminal *terminal)
pvt->cursor_blinks = FALSE;
pvt->cursor_blink_mode = VTE_CURSOR_BLINK_SYSTEM;
+ /* Style properties */
+ pvt->reverse = FALSE;
+
/* Matching data. */
pvt->match_regexes = g_array_new(FALSE, TRUE,
sizeof(struct vte_match_regex));
@@ -8238,7 +8248,7 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
back = cell->attr.back;
/* Reverse-mode switches default fore and back colors */
- if (G_UNLIKELY (terminal->pvt->screen->reverse_mode)) {
+ if (G_UNLIKELY (terminal->pvt->screen->reverse_mode ^ terminal->pvt->reverse)) {
if (fore == VTE_DEF_FG)
fore = VTE_DEF_BG;
if (back == VTE_DEF_BG)
@@ -11560,6 +11570,26 @@ vte_terminal_class_init(VteTerminalClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * VteTerminal:reverse:
+ *
+ * In reverse mode, the terminal draws everything with foreground and
+ * background colours reversed.
+ *
+ * This is a global setting; the terminal application can still
+ * set reverse mode explicitly. In case both this style property and
+ * the application select reverse mode, the terminal draws in
+ * non-reverse mode.
+ *
+ * Since: 0.30
+ */
+ gtk_widget_class_install_style_property
+ (widget_class,
+ g_param_spec_boolean ("reverse", NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/* Colours */
#include "vtepalettedefs.h"
diff --git a/src/vteapp.c b/src/vteapp.c
index edc362b..66b991b 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -822,6 +822,9 @@ main(int argc, char **argv)
if (scroll) {
g_string_append (css_string, "-VteTerminal-scroll-background: true;\n");
}
+ if (reverse) {
+ g_string_append (css_string, "-VteTerminal-reverse: true;\n");
+ }
g_string_append (css_string, "}\n");
if (css_string->len > 14) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]