[vte] widget: Move some methods to VteTerminalPrivate



commit 1493f89653b3722970a60c29074efd85b47342a6
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 18 21:15:40 2015 +0100

    widget: Move some methods to VteTerminalPrivate

 src/vte-private.h  |    1 -
 src/vte.cc         |   40 +++++++++++++++++++---------------------
 src/vteinternal.hh |    6 ++++++
 src/vteseq.cc      |    2 +-
 4 files changed, 26 insertions(+), 23 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 9b389fc..43be713 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -58,7 +58,6 @@ struct _VteTerminalClassPrivate {
 };
 
 VteRowData *_vte_terminal_ensure_row(VteTerminal *terminal);
-void _vte_terminal_set_pointer_visible(VteTerminal *terminal, gboolean visible);
 void _vte_invalidate_all(VteTerminal *terminal);
 void _vte_invalidate_cells(VteTerminal *terminal,
                           glong column_start, gint column_count,
diff --git a/src/vte.cc b/src/vte.cc
index 580ed59..76d372e 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2918,38 +2918,36 @@ _vte_terminal_update_insert_delta(VteTerminal *terminal)
 
 /* Show or hide the pointer. */
 void
-_vte_terminal_set_pointer_visible(VteTerminal *terminal, gboolean visible)
+VteTerminalPrivate::set_pointer_visible(bool visible)
 {
-       GdkWindow *window;
-       struct vte_match_regex *regex = NULL;
-
-       terminal->pvt->mouse_cursor_visible = visible;
+       m_mouse_cursor_visible = visible;
 
-        if (! gtk_widget_get_realized (&terminal->widget))
+        if (!gtk_widget_get_realized(m_widget))
                 return;
 
-       window = gtk_widget_get_window (&terminal->widget);
+       GdkWindow *window = gtk_widget_get_window(m_widget);
 
-       if (visible || !terminal->pvt->mouse_autohide) {
-               if (terminal->pvt->mouse_tracking_mode) {
+       if (visible || !m_mouse_autohide) {
+               if (m_mouse_tracking_mode) {
                        _vte_debug_print(VTE_DEBUG_CURSOR,
                                        "Setting mousing cursor.\n");
-                       gdk_window_set_cursor (window, terminal->pvt->mouse_mousing_cursor);
+                       gdk_window_set_cursor(window, m_mouse_mousing_cursor);
                } else
-               if ( (guint)terminal->pvt->match_tag < terminal->pvt->match_regexes->len) {
-                       regex = &g_array_index(terminal->pvt->match_regexes,
+               if ( (guint)m_match_tag < m_match_regexes->len) {
+                        struct vte_match_regex *regex =
+                                &g_array_index(m_match_regexes,
                                               struct vte_match_regex,
-                                              terminal->pvt->match_tag);
-                        terminal->pvt->set_cursor_from_regex_match(regex);
+                                              m_match_tag);
+                        set_cursor_from_regex_match(regex);
                } else {
                        _vte_debug_print(VTE_DEBUG_CURSOR,
                                        "Setting default mouse cursor.\n");
-                       gdk_window_set_cursor (window, terminal->pvt->mouse_default_cursor);
+                       gdk_window_set_cursor(window, m_mouse_default_cursor);
                }
        } else {
                _vte_debug_print(VTE_DEBUG_CURSOR,
                                "Setting to invisible cursor.\n");
-               gdk_window_set_cursor (window, terminal->pvt->mouse_inviso_cursor);
+               gdk_window_set_cursor (window, m_mouse_inviso_cursor);
        }
 }
 
@@ -5583,7 +5581,7 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
 
                /* Unless it's a modifier key, hide the pointer. */
                if (!modifier) {
-                       _vte_terminal_set_pointer_visible(terminal, FALSE);
+                       terminal->pvt->set_pointer_visible(false);
                }
 
                _vte_debug_print(VTE_DEBUG_EVENTS,
@@ -8055,7 +8053,7 @@ vte_terminal_motion_notify(GtkWidget *widget, GdkEventMotion *event)
                /* Hilite any matches. */
                terminal->pvt->match_hilite(x, y);
                /* Show the cursor. */
-               _vte_terminal_set_pointer_visible(terminal, TRUE);
+               terminal->pvt->set_pointer_visible(true);
        }
 
        switch (event->type) {
@@ -8129,7 +8127,7 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
 
        terminal->pvt->match_hilite(x, y);
 
-       _vte_terminal_set_pointer_visible(terminal, TRUE);
+       terminal->pvt->set_pointer_visible(true);
 
        vte_terminal_read_modifiers (terminal, (GdkEvent*) event);
 
@@ -8299,7 +8297,7 @@ vte_terminal_button_release(GtkWidget *widget, GdkEventButton *event)
 
        terminal->pvt->match_hilite(x, y);
 
-       _vte_terminal_set_pointer_visible(terminal, TRUE);
+       terminal->pvt->set_pointer_visible(true);
 
        vte_terminal_stop_autoscroll(terminal);
 
@@ -8374,7 +8372,7 @@ VteTerminalPrivate::widget_focus_in(GdkEventFocus *event)
 
                gtk_im_context_focus_in(m_im_context);
                invalidate_cursor_once();
-               _vte_terminal_set_pointer_visible(m_terminal, TRUE);
+               set_pointer_visible(true);
                 maybe_feed_focus_event(true);
        }
 }
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 09d3ee8..8456533 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -453,6 +453,8 @@ public:
         void widget_focus_in(GdkEventFocus *event);
         void widget_focus_out(GdkEventFocus *event);
 
+        void set_pointer_visible(bool visible);
+
         void match_contents_clear();
         void match_contents_refresh();
         void set_cursor_from_regex_match(struct vte_match_regex *regex);
@@ -580,3 +582,7 @@ public:
 #define m_im_context im_context
 #define m_mouse_cursor_visible mouse_cursor_visible
 #define m_mouse_handled_buttons mouse_handled_buttons
+#define m_mouse_autohide mouse_autohide
+#define m_mouse_mousing_cursor mouse_mousing_cursor
+#define m_mouse_default_cursor mouse_default_cursor
+#define m_mouse_inviso_cursor mouse_inviso_cursor
diff --git a/src/vteseq.cc b/src/vteseq.cc
index c5b469c..93312b2 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -940,7 +940,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
        case 1002:
        case 1003:
                /* Make the pointer visible. */
-               _vte_terminal_set_pointer_visible(terminal, TRUE);
+               terminal->pvt->set_pointer_visible(true);
                break;
        case 66:
                _vte_debug_print(VTE_DEBUG_KEYBOARD, set ?


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