[vte] widget: Move some methods to VteTerminalPrivate
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Move some methods to VteTerminalPrivate
- Date: Tue, 24 Nov 2015 22:10:28 +0000 (UTC)
commit 49b2d891e48c18a1a2f1cb025d544cc5651c8812
Author: Christian Persch <chpe gnome org>
Date: Tue Nov 24 23:09:59 2015 +0100
widget: Move some methods to VteTerminalPrivate
src/vte-private.h | 4 ----
src/vte.cc | 35 ++++++++++++++++++-----------------
src/vteinternal.hh | 4 ++++
src/vteseq.cc | 18 +++++++++---------
4 files changed, 31 insertions(+), 30 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 346096f..94e58af 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -78,10 +78,6 @@ void _vte_terminal_set_default_attributes(VteTerminal *terminal);
void _vte_terminal_update_insert_delta(VteTerminal *terminal);
void _vte_terminal_cleanup_fragments(VteTerminal *terminal, long start, long end);
PangoColor *_vte_terminal_get_color(const VteTerminal *terminal, int idx);
-void _vte_terminal_set_color_internal(VteTerminal *terminal,
- int idx,
- int source,
- const PangoColor *color);
void _vte_terminal_feed_focus_event(VteTerminal *terminal, gboolean in);
diff --git a/src/vte.cc b/src/vte.cc
index 37d39a6..3454435 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2485,12 +2485,14 @@ _vte_terminal_get_color(const VteTerminal *terminal, int entry)
/* Set up a palette entry with a more-or-less match for the requested color. */
void
-_vte_terminal_set_color_internal(VteTerminal *terminal,
- int entry,
- int source,
- const PangoColor *proposed)
+VteTerminalPrivate::set_color_internal(int entry,
+ int source,
+ PangoColor const* proposed)
{
- VtePaletteColor *palette_color = &terminal->pvt->palette[entry];
+ if (entry < 0 || entry >= VTE_PALETTE_SIZE)
+ return;
+
+ VtePaletteColor *palette_color = &m_palette[entry];
/* Save the requested color. */
if (proposed != NULL) {
@@ -2522,21 +2524,20 @@ _vte_terminal_set_color_internal(VteTerminal *terminal,
}
/* If we're not realized yet, there's nothing else to do. */
- if (! gtk_widget_get_realized (&terminal->widget)) {
+ if (!gtk_widget_get_realized(m_widget))
return;
- }
/* If we're setting the background color, set the background color
* on the widget as well. */
if (entry == VTE_DEFAULT_BG) {
- terminal->pvt->widget_background_update();
+ widget_background_update();
}
/* and redraw */
if (entry == VTE_CURSOR_BG)
- terminal->pvt->invalidate_cursor_once();
+ invalidate_cursor_once();
else
- terminal->pvt->invalidate_all();
+ invalidate_all();
}
static void
@@ -2599,7 +2600,7 @@ _vte_terminal_set_color_bold(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Set bold color to (%04x,%04x,%04x).\n",
bold->red, bold->green, bold->blue);
- _vte_terminal_set_color_internal(terminal, VTE_BOLD_FG, VTE_COLOR_SOURCE_API, bold);
+ terminal->pvt->set_color_internal(VTE_BOLD_FG, VTE_COLOR_SOURCE_API, bold);
}
/*
@@ -2616,7 +2617,7 @@ _vte_terminal_set_color_foreground(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Set foreground color to (%04x,%04x,%04x).\n",
foreground->red, foreground->green, foreground->blue);
- _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_FG, VTE_COLOR_SOURCE_API, foreground);
+ terminal->pvt->set_color_internal(VTE_DEFAULT_FG, VTE_COLOR_SOURCE_API, foreground);
}
/*
@@ -2634,7 +2635,7 @@ _vte_terminal_set_color_background(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Set background color to (%04x,%04x,%04x).\n",
background->red, background->green, background->blue);
- _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_BG, VTE_COLOR_SOURCE_API, background);
+ terminal->pvt->set_color_internal(VTE_DEFAULT_BG, VTE_COLOR_SOURCE_API, background);
}
bool
@@ -2676,7 +2677,7 @@ _vte_terminal_set_color_cursor(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Reset cursor color.\n");
}
- _vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_API, cursor_background);
+ terminal->pvt->set_color_internal(VTE_CURSOR_BG, VTE_COLOR_SOURCE_API, cursor_background);
}
/*
@@ -2703,7 +2704,7 @@ _vte_terminal_set_color_highlight(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Reset highlight background color.\n");
}
- _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_API,
highlight_background);
+ terminal->pvt->set_color_internal(VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_API, highlight_background);
}
/*
@@ -2730,7 +2731,7 @@ _vte_terminal_set_color_highlight_foreground(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Reset highlight foreground color.\n");
}
- _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_API,
highlight_foreground);
+ terminal->pvt->set_color_internal(VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_API, highlight_foreground);
}
/*
@@ -2846,7 +2847,7 @@ _vte_terminal_set_colors(VteTerminal *terminal,
}
/* Set up the color entry. */
- _vte_terminal_set_color_internal(terminal, i, VTE_COLOR_SOURCE_API, unset ? NULL : &color);
+ terminal->pvt->set_color_internal(i, VTE_COLOR_SOURCE_API, unset ? NULL : &color);
}
}
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 9b70440..73ffc88 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -730,6 +730,10 @@ public:
long get_char_height() { ensure_font(); return char_height; }
long get_char_width() { ensure_font(); return char_width; }
+ void set_color_internal(int entry,
+ int source,
+ PangoColor const* proposed);
+
bool set_audible_bell(bool setting);
bool set_allow_bold(bool setting);
bool set_backspace_binding(VteEraseBinding binding);
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 5c96c06..7967182 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -1653,7 +1653,7 @@ vte_sequence_handler_change_color_internal (VteTerminal *terminal, GValueArray *
continue;
if (vte_parse_color (pairs[i + 1], &color)) {
- _vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE,
&color);
+ terminal->pvt->set_color_internal(idx, VTE_COLOR_SOURCE_ESCAPE, &color);
} else if (strcmp (pairs[i + 1], "?") == 0) {
gchar buf[128];
PangoColor *c = _vte_terminal_get_color(terminal, idx);
@@ -1706,11 +1706,11 @@ vte_sequence_handler_reset_color (VteTerminal *terminal, GValueArray *params)
if (idx < 0 || idx >= VTE_DEFAULT_FG)
continue;
- _vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ terminal->pvt->set_color_internal(idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
} else {
for (idx = 0; idx < VTE_DEFAULT_FG; idx++) {
- _vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ terminal->pvt->set_color_internal(idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
}
}
@@ -3126,7 +3126,7 @@ vte_sequence_handler_change_special_color_internal (VteTerminal *terminal, GValu
return;
if (vte_parse_color (name, &color))
- _vte_terminal_set_color_internal(terminal, index, VTE_COLOR_SOURCE_ESCAPE, &color);
+ terminal->pvt->set_color_internal(index, VTE_COLOR_SOURCE_ESCAPE, &color);
else if (strcmp (name, "?") == 0) {
gchar buf[128];
PangoColor *c = _vte_terminal_get_color(terminal, index);
@@ -3163,7 +3163,7 @@ vte_sequence_handler_change_foreground_color_st (VteTerminal *terminal, GValueAr
static void
vte_sequence_handler_reset_foreground_color (VteTerminal *terminal, GValueArray *params)
{
- _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ terminal->pvt->set_color_internal(VTE_DEFAULT_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
/* Change the default background cursor, BEL terminated */
@@ -3186,7 +3186,7 @@ vte_sequence_handler_change_background_color_st (VteTerminal *terminal, GValueAr
static void
vte_sequence_handler_reset_background_color (VteTerminal *terminal, GValueArray *params)
{
- _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ terminal->pvt->set_color_internal(VTE_DEFAULT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
/* Change the color of the cursor, BEL terminated */
@@ -3209,7 +3209,7 @@ vte_sequence_handler_change_cursor_color_st (VteTerminal *terminal, GValueArray
static void
vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *params)
{
- _vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ terminal->pvt->set_color_internal(VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
/* Change the highlight background color, BEL terminated */
@@ -3232,7 +3232,7 @@ vte_sequence_handler_change_highlight_background_color_st (VteTerminal *terminal
static void
vte_sequence_handler_reset_highlight_background_color (VteTerminal *terminal, GValueArray *params)
{
- _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ terminal->pvt->set_color_internal(VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
/* Change the highlight foreground color, BEL terminated */
@@ -3255,7 +3255,7 @@ vte_sequence_handler_change_highlight_foreground_color_st (VteTerminal *terminal
static void
vte_sequence_handler_reset_highlight_foreground_color (VteTerminal *terminal, GValueArray *params)
{
- _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ terminal->pvt->set_color_internal(VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]