[vte] widget: Move some public API to its own file



commit d7ead63ba5748f6423ac38dcc47c494985d65cfa
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 18 21:15:43 2015 +0100

    widget: Move some public API to its own file

 src/vte.cc         |   49 +++++++------------------------------------------
 src/vtegtk.cc      |   37 +++++++++++++++++++++++++++++++++++++
 src/vteinternal.hh |    1 +
 3 files changed, 45 insertions(+), 42 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 2a28475..0a1b6c0 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -11455,50 +11455,15 @@ vte_terminal_set_delete_binding(VteTerminal *terminal,
         g_object_notify(G_OBJECT(terminal), "delete-binding");
 }
 
-/**
- * vte_terminal_set_mouse_autohide:
- * @terminal: a #VteTerminal
- * @setting: whether the mouse pointer should autohide
- *
- * Changes the value of the terminal's mouse autohide setting.  When autohiding
- * is enabled, the mouse cursor will be hidden when the user presses a key and
- * shown when the user moves the mouse.  This setting can be read using
- * vte_terminal_get_mouse_autohide().
- */
-void
-vte_terminal_set_mouse_autohide(VteTerminal *terminal, gboolean setting)
+bool
+VteTerminalPrivate::set_mouse_autohide(bool autohide)
 {
-        VteTerminalPrivate *pvt;
-
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-        pvt = terminal->pvt;
-
-        setting = setting != FALSE;
-        if (setting == pvt->mouse_autohide)
-                return;
-
-       pvt->mouse_autohide = setting;
-
-        g_object_notify(G_OBJECT(terminal), "pointer-autohide");
-}
+        if (autohide == m_mouse_autohide)
+                return false;
 
-/**
- * vte_terminal_get_mouse_autohide:
- * @terminal: a #VteTerminal
- *
- * Determines the value of the terminal's mouse autohide setting.  When
- * autohiding is enabled, the mouse cursor will be hidden when the user presses
- * a key and shown when the user moves the mouse.  This setting can be changed
- * using vte_terminal_set_mouse_autohide().
- *
- * Returns: %TRUE if autohiding is enabled, %FALSE if not
- */
-gboolean
-vte_terminal_get_mouse_autohide(VteTerminal *terminal)
-{
-       g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-       return terminal->pvt->mouse_autohide;
+       m_mouse_autohide = autohide;
+        /* FIXME: show mouse now if autohide=false! */
+        return true;
 }
 
 /**
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index edc2332..6bf9c76 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1846,6 +1846,43 @@ vte_terminal_set_input_enabled (VteTerminal *terminal,
 }
 
 /**
+ * vte_terminal_get_mouse_autohide:
+ * @terminal: a #VteTerminal
+ *
+ * Determines the value of the terminal's mouse autohide setting.  When
+ * autohiding is enabled, the mouse cursor will be hidden when the user presses
+ * a key and shown when the user moves the mouse.  This setting can be changed
+ * using vte_terminal_set_mouse_autohide().
+ *
+ * Returns: %TRUE if autohiding is enabled, %FALSE if not
+ */
+gboolean
+vte_terminal_get_mouse_autohide(VteTerminal *terminal)
+{
+       g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+       return terminal->pvt->mouse_autohide;
+}
+
+/**
+ * vte_terminal_set_mouse_autohide:
+ * @terminal: a #VteTerminal
+ * @setting: whether the mouse pointer should autohide
+ *
+ * Changes the value of the terminal's mouse autohide setting.  When autohiding
+ * is enabled, the mouse cursor will be hidden when the user presses a key and
+ * shown when the user moves the mouse.  This setting can be read using
+ * vte_terminal_get_mouse_autohide().
+ */
+void
+vte_terminal_set_mouse_autohide(VteTerminal *terminal, gboolean setting)
+{
+       g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+        if (terminal->pvt->set_mouse_autohide(setting != FALSE))
+                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_MOUSE_POINTER_AUTOHIDE]);
+}
+
+/**
  * vte_terminal_set_pty:
  * @terminal: a #VteTerminal
  * @pty: (allow-none): a #VtePty, or %NULL
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 00499cc..7ab5867 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -609,6 +609,7 @@ public:
         long get_char_width()  { ensure_font(); return char_width;  }
 
         bool set_input_enabled(bool enabled);
+        bool set_mouse_autohide(bool autohide);
         bool set_pty(VtePty *pty);
         bool set_word_char_exceptions(char const* exceptions);
 


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