[vte] widget: Move some public API to its own file
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Move some public API to its own file
- Date: Wed, 18 Nov 2015 20:19:51 +0000 (UTC)
commit 12c085fc5786070decf0d36d8627d61a3bc5f188
Author: Christian Persch <chpe gnome org>
Date: Wed Nov 18 21:15:42 2015 +0100
widget: Move some public API to its own file
src/vte.cc | 60 +++++++++++++++------------------------------------
src/vtegtk.cc | 33 ++++++++++++++++++++++++++++
src/vteinternal.hh | 2 +
3 files changed, 53 insertions(+), 42 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index c17b418..d7025e2 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -13001,69 +13001,45 @@ vte_terminal_search_find_next (VteTerminal *terminal)
return vte_terminal_search_find (terminal, FALSE);
}
-/**
- * vte_terminal_set_input_enabled:
- * @terminal: a #VteTerminal
+/*
+ * VteTerminalPrivate::set_input_enabled:
* @enabled: whether to enable user input
*
* Enables or disables user input. When user input is disabled,
* the terminal's child will not receive any key press, or mouse button
* press or motion events sent to it.
+ *
+ * Returns: %true iff the setting changed
*/
-void
-vte_terminal_set_input_enabled (VteTerminal *terminal,
- gboolean enabled)
+bool
+VteTerminalPrivate::set_input_enabled (bool enabled)
{
- VteTerminalPrivate *pvt;
- GtkWidget *widget;
- GtkStyleContext *context;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- pvt = terminal->pvt;
- widget = &terminal->widget;
-
- enabled = enabled != FALSE;
- if (enabled == terminal->pvt->input_enabled)
- return;
+ if (enabled == m_input_enabled)
+ return false;
- pvt->input_enabled = enabled;
+ m_input_enabled = enabled;
- context = gtk_widget_get_style_context (widget);
+ auto context = gtk_widget_get_style_context(m_widget);
/* FIXME: maybe hide cursor when input disabled, too? */
if (enabled) {
- if (gtk_widget_has_focus(widget))
- gtk_im_context_focus_in(pvt->im_context);
+ if (gtk_widget_has_focus(m_widget))
+ gtk_im_context_focus_in(m_im_context);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_READ_ONLY);
} else {
- vte_terminal_im_reset(terminal);
- if (gtk_widget_has_focus(widget))
- gtk_im_context_focus_out(pvt->im_context);
+ vte_terminal_im_reset(m_terminal);
+ if (gtk_widget_has_focus(m_widget))
+ gtk_im_context_focus_out(m_im_context);
- _vte_terminal_disconnect_pty_write(terminal);
- _vte_byte_array_clear(pvt->outgoing);
+ _vte_terminal_disconnect_pty_write(m_terminal);
+ _vte_byte_array_clear(m_outgoing);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_READ_ONLY);
}
- g_object_notify(G_OBJECT(terminal), "input-enabled");
-}
-
-/**
- * vte_terminal_get_input_enabled:
- * @terminal: a #VteTerminal
- *
- * Returns whether the terminal allow user input.
- */
-gboolean
-vte_terminal_get_input_enabled (VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-
- return terminal->pvt->input_enabled;
+ return true;
}
bool
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 9efa53c..90e1b5b 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1589,6 +1589,39 @@ vte_terminal_set_geometry_hints_for_window(VteTerminal *terminal,
}
/**
+ * vte_terminal_get_input_enabled:
+ * @terminal: a #VteTerminal
+ *
+ * Returns whether the terminal allow user input.
+ */
+gboolean
+vte_terminal_get_input_enabled (VteTerminal *terminal)
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+
+ return terminal->pvt->input_enabled;
+}
+
+/**
+ * vte_terminal_set_input_enabled:
+ * @terminal: a #VteTerminal
+ * @enabled: whether to enable user input
+ *
+ * Enables or disables user input. When user input is disabled,
+ * the terminal's child will not receive any key press, or mouse button
+ * press or motion events sent to it.
+ */
+void
+vte_terminal_set_input_enabled (VteTerminal *terminal,
+ gboolean enabled)
+{
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+ if (terminal->pvt->set_input_enabled(enabled != FALSE))
+ g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_INPUT_ENABLED]);
+}
+
+/**
* vte_terminal_get_word_char_exceptions:
* @terminal: a #VteTerminal
*
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 75d4c50..2095338 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -576,6 +576,8 @@ public:
bool process_word_char_exceptions(char const *str,
gunichar **arrayp,
gsize *lenp);
+
+ bool set_input_enabled(bool enabled);
bool set_word_char_exceptions(char const* exceptions);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]