[vte] widget: Use named cursors by default



commit 8d8243b2e431c58b0dddb2a556fbe0189cb4d830
Author: Christian Persch <chpe src gnome org>
Date:   Tue Oct 6 20:21:56 2020 +0200

    widget: Use named cursors by default
    
    [gtk4 preparation]

 src/vtedefines.hh | 8 ++++----
 src/widget.cc     | 6 +++---
 src/widget.hh     | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/vtedefines.hh b/src/vtedefines.hh
index 2de3a626..44371d6d 100644
--- a/src/vtedefines.hh
+++ b/src/vtedefines.hh
@@ -75,10 +75,10 @@
 #define VTE_PALETTE_SIZE               263
 
 #define VTE_SCROLLBACK_INIT            512
-#define VTE_DEFAULT_CURSOR             GDK_XTERM
-#define VTE_MOUSING_CURSOR             GDK_LEFT_PTR
-#define VTE_HYPERLINK_CURSOR           GDK_HAND2
-#define VTE_HYPERLINK_CURSOR_DEBUG     GDK_SPIDER
+#define VTE_DEFAULT_CURSOR             std::string{"text"}
+#define VTE_MOUSING_CURSOR             std::string{"default"}
+#define VTE_HYPERLINK_CURSOR           std::string{"pointer"}
+#define VTE_HYPERLINK_CURSOR_DEBUG     std::string{"crosshair"}
 #define VTE_CHILD_INPUT_PRIORITY       G_PRIORITY_DEFAULT_IDLE
 #define VTE_CHILD_OUTPUT_PRIORITY      G_PRIORITY_HIGH
 #define VTE_MAX_INPUT_READ             0x1000
diff --git a/src/widget.cc b/src/widget.cc
index 86337055..98aa942b 100644
--- a/src/widget.cc
+++ b/src/widget.cc
@@ -178,9 +178,9 @@ Widget::beep() noexcept
 }
 
 vte::glib::RefPtr<GdkCursor>
-Widget::create_cursor(GdkCursorType cursor_type) const noexcept
+Widget::create_cursor(std::string const& name) const noexcept
 {
-       return vte::glib::take_ref(gdk_cursor_new_for_display(gtk_widget_get_display(m_widget), cursor_type));
+       return vte::glib::take_ref(gdk_cursor_new_from_name(gtk_widget_get_display(m_widget), name.c_str()));
 }
 
 void
@@ -433,7 +433,7 @@ Widget::realize() noexcept
 
        /* Create stock cursors */
        m_default_cursor = create_cursor(VTE_DEFAULT_CURSOR);
-       m_invisible_cursor = create_cursor(GDK_BLANK_CURSOR);
+       m_invisible_cursor = create_cursor("none"s);
        m_mousing_cursor = create_cursor(VTE_MOUSING_CURSOR);
         if (_vte_debug_on(VTE_DEBUG_HYPERLINK))
                 /* Differ from the standard regex match cursor in debug mode. */
diff --git a/src/widget.hh b/src/widget.hh
index 5defe310..cda682b9 100644
--- a/src/widget.hh
+++ b/src/widget.hh
@@ -407,7 +407,7 @@ protected:
                 return gtk_widget_get_realized(m_widget);
         }
 
-        vte::glib::RefPtr<GdkCursor> create_cursor(GdkCursorType cursor_type) const noexcept;
+        vte::glib::RefPtr<GdkCursor> create_cursor(std::string const& name) const noexcept;
 
         void set_cursor(CursorType type) noexcept;
         void set_cursor(GdkCursor* cursor) noexcept;


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