[vte] widget: Use RefPtr for the cursors
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Use RefPtr for the cursors
- Date: Mon, 23 Apr 2018 18:53:14 +0000 (UTC)
commit 8b72b407f01055a7780d5b6e48c4e6fd15502e66
Author: Christian Persch <chpe src gnome org>
Date: Mon Apr 23 20:51:18 2018 +0200
widget: Use RefPtr for the cursors
src/vte.cc | 22 +++++++++-------------
src/vteinternal.hh | 9 +++++----
2 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 6062e9d..2a76632 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2228,7 +2228,7 @@ VteTerminalPrivate::apply_mouse_cursor()
if (m_hyperlink_hover_idx != 0) {
_vte_debug_print(VTE_DEBUG_CURSOR,
"Setting hyperlink mouse cursor.\n");
- gdk_window_set_cursor(m_event_window, m_mouse_hyperlink_cursor);
+ gdk_window_set_cursor(m_event_window, m_mouse_hyperlink_cursor.get());
} else if ((guint)m_match_tag < m_match_regexes->len) {
struct vte_match_regex *regex =
&g_array_index(m_match_regexes,
@@ -2238,16 +2238,16 @@ VteTerminalPrivate::apply_mouse_cursor()
} else if (m_mouse_tracking_mode) {
_vte_debug_print(VTE_DEBUG_CURSOR,
"Setting mousing cursor.\n");
- gdk_window_set_cursor(m_event_window, m_mouse_mousing_cursor);
+ gdk_window_set_cursor(m_event_window, m_mouse_mousing_cursor.get());
} else {
_vte_debug_print(VTE_DEBUG_CURSOR,
"Setting default mouse cursor.\n");
- gdk_window_set_cursor(m_event_window, m_mouse_default_cursor);
+ gdk_window_set_cursor(m_event_window, m_mouse_default_cursor.get());
}
} else {
_vte_debug_print(VTE_DEBUG_CURSOR,
"Setting to invisible cursor.\n");
- gdk_window_set_cursor(m_event_window, m_mouse_inviso_cursor);
+ gdk_window_set_cursor(m_event_window, m_mouse_inviso_cursor.get());
}
}
@@ -8284,14 +8284,10 @@ VteTerminalPrivate::widget_unrealize()
/* Deallocate the cursors. */
m_mouse_cursor_over_widget = FALSE;
- g_object_unref(m_mouse_default_cursor);
- m_mouse_default_cursor = NULL;
- g_object_unref(m_mouse_mousing_cursor);
- m_mouse_mousing_cursor = NULL;
- g_object_unref(m_mouse_hyperlink_cursor);
- m_mouse_hyperlink_cursor = NULL;
- g_object_unref(m_mouse_inviso_cursor);
- m_mouse_inviso_cursor = NULL;
+ m_mouse_default_cursor.reset();
+ m_mouse_mousing_cursor.reset();
+ m_mouse_hyperlink_cursor.reset();
+ m_mouse_inviso_cursor.reset();
match_hilite_clear();
@@ -8594,7 +8590,7 @@ VteTerminalPrivate::widget_realize()
GDK_LEAVE_NOTIFY_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK;
- attributes.cursor = m_mouse_default_cursor;
+ attributes.cursor = m_mouse_default_cursor.get();
guint attributes_mask = GDK_WA_X |
GDK_WA_Y |
(attributes.visual ? GDK_WA_VISUAL : 0) |
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index a2c525a..737678a 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -551,10 +551,11 @@ public:
gboolean m_mouse_cursor_over_widget; /* as per enter and leave events */
gboolean m_mouse_autohide; /* the API setting */
gboolean m_mouse_cursor_autohidden; /* whether the autohiding logic wants to hide it; even if
autohiding is disabled via API */
- GdkCursor* m_mouse_default_cursor;
- GdkCursor* m_mouse_mousing_cursor;
- GdkCursor* m_mouse_hyperlink_cursor;
- GdkCursor* m_mouse_inviso_cursor;
+
+ vte::glib::RefPtr<GdkCursor> m_mouse_default_cursor;
+ vte::glib::RefPtr<GdkCursor> m_mouse_mousing_cursor;
+ vte::glib::RefPtr<GdkCursor> m_mouse_hyperlink_cursor;
+ vte::glib::RefPtr<GdkCursor> m_mouse_inviso_cursor;
/* Input method support. */
GtkIMContext *m_im_context;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]