[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: Sun, 6 Dec 2015 18:49:49 +0000 (UTC)
commit 9d96d1473d6817b4fabd75d4a78aaea8244c99f8
Author: Christian Persch <chpe gnome org>
Date: Sun Dec 6 19:49:37 2015 +0100
widget: Move some methods to VteTerminalPrivate
src/vte.cc | 33 +++++++++++++++++----------------
src/vteinternal.hh | 1 +
2 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 96eb85c..69c4273 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -3639,20 +3639,20 @@ VteTerminalPrivate::pty_channel_eof()
}
/* Reset the input method context. */
-static void
-vte_terminal_im_reset(VteTerminal *terminal)
+void
+VteTerminalPrivate::im_reset()
{
- if (gtk_widget_get_realized (&terminal->widget)) {
- gtk_im_context_reset(terminal->pvt->im_context);
- if (terminal->pvt->im_preedit != NULL) {
- g_free(terminal->pvt->im_preedit);
- terminal->pvt->im_preedit = NULL;
- }
- if (terminal->pvt->im_preedit_attrs != NULL) {
- pango_attr_list_unref(terminal->pvt->im_preedit_attrs);
- terminal->pvt->im_preedit_attrs = NULL;
- }
- }
+ if (gtk_widget_get_realized(m_widget) && m_im_context)
+ gtk_im_context_reset(m_im_context);
+
+ if (m_im_preedit) {
+ g_free(m_im_preedit);
+ m_im_preedit = nullptr;
+ }
+ if (m_im_preedit_attrs) {
+ pango_attr_list_unref(m_im_preedit_attrs);
+ m_im_preedit_attrs = nullptr;
+ }
}
/* Process incoming data, first converting it to unicode characters, and then
@@ -8313,7 +8313,7 @@ VteTerminalPrivate::widget_unrealize()
g_signal_handlers_disconnect_matched(m_im_context, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL,
this);
- vte_terminal_im_reset(m_terminal);
+ im_reset();
gtk_im_context_set_client_window(m_im_context,
NULL);
g_object_unref(m_im_context);
@@ -8665,7 +8665,8 @@ VteTerminalPrivate::widget_realize()
g_signal_handlers_disconnect_matched(m_im_context, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL,
this);
- vte_terminal_im_reset(m_terminal);
+ im_reset();
+ gtk_im_context_set_client_window(m_im_context, nullptr);
g_object_unref(m_im_context);
m_im_context = nullptr;
}
@@ -11597,7 +11598,7 @@ VteTerminalPrivate::set_input_enabled (bool enabled)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_READ_ONLY);
} else {
- vte_terminal_im_reset(m_terminal);
+ im_reset();
if (gtk_widget_has_focus(m_widget))
gtk_im_context_focus_out(m_im_context);
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index a3acccb..8e38e48 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -563,6 +563,7 @@ public:
void im_preedit_start();
void im_preedit_end();
void im_preedit_changed();
+ void im_reset();
bool spawn_sync(VtePtyFlags pty_flags,
const char *working_directory,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]