[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:33 +0000 (UTC)
commit 050a5d1cc778c5d20c6c96380116f88d2edf7e49
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 | 1 -
src/vte.cc | 26 +++++++++++++-------------
src/vteinternal.hh | 1 +
src/vteseq.cc | 6 +++---
4 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 94e58af..5557ea0 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -77,7 +77,6 @@ void _vte_terminal_scroll_region(VteTerminal *terminal,
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_feed_focus_event(VteTerminal *terminal, gboolean in);
diff --git a/src/vte.cc b/src/vte.cc
index 3454435..c141c46 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2472,15 +2472,15 @@ VteTerminalPrivate::set_pointer_visible(bool visible)
* The return value can be NULL only if entry is one of VTE_CURSOR_BG,
* VTE_HIGHLIGHT_BG or VTE_HIGHLIGHT_FG.
*/
-PangoColor *
-_vte_terminal_get_color(const VteTerminal *terminal, int entry)
+PangoColor const*
+VteTerminalPrivate::get_color(int entry) const
{
- VtePaletteColor *palette_color = &terminal->pvt->palette[entry];
+ VtePaletteColor const* palette_color = &m_palette[entry];
guint source;
for (source = 0; source < G_N_ELEMENTS(palette_color->sources); source++)
if (palette_color->sources[source].is_set)
return &palette_color->sources[source].color;
- return NULL;
+ return nullptr;
}
/* Set up a palette entry with a more-or-less match for the requested color. */
@@ -2825,8 +2825,8 @@ _vte_terminal_set_colors(VteTerminal *terminal,
}
break;
case VTE_BOLD_FG:
- vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
- _vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
+ vte_terminal_generate_bold(terminal->pvt->get_color(VTE_DEFAULT_FG),
+ terminal->pvt->get_color(VTE_DEFAULT_BG),
1.8,
&color);
break;
@@ -2878,8 +2878,8 @@ VteTerminalPrivate::set_color_bold(GdkRGBA const* bold)
PangoColor color;
if (bold == nullptr) {
- vte_terminal_generate_bold(_vte_terminal_get_color(m_terminal, VTE_DEFAULT_FG),
- _vte_terminal_get_color(m_terminal, VTE_DEFAULT_BG),
+ vte_terminal_generate_bold(get_color(VTE_DEFAULT_FG),
+ get_color(VTE_DEFAULT_BG),
1.8,
&color);
} else {
@@ -6015,7 +6015,7 @@ vte_terminal_get_rgb_from_index(const VteTerminal *terminal, guint index, PangoC
if (index >= VTE_LEGACY_COLORS_OFFSET && index < VTE_LEGACY_COLORS_OFFSET +
VTE_LEGACY_FULL_COLOR_SET_SIZE)
index -= VTE_LEGACY_COLORS_OFFSET;
if (index < VTE_PALETTE_SIZE) {
- memcpy(color, _vte_terminal_get_color(terminal, index), sizeof(PangoColor));
+ memcpy(color, terminal->pvt->get_color(index), sizeof(PangoColor));
if (dim) {
/* magic formula taken from xterm */
color->red = color->red * 2 / 3;
@@ -8785,11 +8785,11 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
if (selected) {
/* XXX what if hightlight back is same color as current back? */
gboolean do_swap = TRUE;
- if (_vte_terminal_get_color(terminal, VTE_HIGHLIGHT_BG) != NULL) {
+ if (terminal->pvt->get_color(VTE_HIGHLIGHT_BG) != NULL) {
back = VTE_HIGHLIGHT_BG;
do_swap = FALSE;
}
- if (_vte_terminal_get_color(terminal, VTE_HIGHLIGHT_FG) != NULL) {
+ if (terminal->pvt->get_color(VTE_HIGHLIGHT_FG) != NULL) {
fore = VTE_HIGHLIGHT_FG;
do_swap = FALSE;
}
@@ -8800,7 +8800,7 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
/* Cursor: use cursor back, or inverse */
if (cursor) {
/* XXX what if cursor back is same color as current back? */
- if (_vte_terminal_get_color(terminal, VTE_CURSOR_BG) != NULL)
+ if (terminal->pvt->get_color(VTE_CURSOR_BG) != NULL)
back = VTE_CURSOR_BG;
else
swap (&fore, &back);
@@ -10134,7 +10134,7 @@ VteTerminalPrivate::widget_background_update()
_vte_debug_print(VTE_DEBUG_MISC|VTE_DEBUG_EVENTS,
"Updating background color.\n");
- entry = _vte_terminal_get_color(m_terminal, VTE_DEFAULT_BG);
+ entry = get_color(VTE_DEFAULT_BG);
_vte_debug_print(VTE_DEBUG_STYLE,
"Setting background color to (%d, %d, %d, %.3f).\n",
entry->red, entry->green, entry->blue,
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 73ffc88..d5d3ecf 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -730,6 +730,7 @@ public:
long get_char_height() { ensure_font(); return char_height; }
long get_char_width() { ensure_font(); return char_width; }
+ PangoColor const* get_color(int entry) const;
void set_color_internal(int entry,
int source,
PangoColor const* proposed);
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 7967182..2f71503 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -1656,7 +1656,7 @@ vte_sequence_handler_change_color_internal (VteTerminal *terminal, GValueArray *
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);
+ PangoColor const* c = terminal->pvt->get_color(idx);
g_assert(c != NULL);
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "4;%u;rgb:%04x/%04x/%04x%s",
@@ -3129,9 +3129,9 @@ vte_sequence_handler_change_special_color_internal (VteTerminal *terminal, GValu
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);
+ PangoColor const* c = terminal->pvt->get_color(index);
if (c == NULL && index_fallback != -1)
- c = _vte_terminal_get_color(terminal, index_fallback);
+ c = terminal->pvt->get_color(index_fallback);
g_assert(c != NULL);
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "%d;rgb:%04x/%04x/%04x%s",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]