Menu

#2439 Gdk-Message: Unable to load right_ptr from the cursor theme

Bug
open
nobody
None
5
2024-05-26
2024-05-20
Chris Mayo
No

GTK+ 3.24 on Gentoo Linux with adwaita-icon-theme-46.0

GNOME's adwaita-icon-theme-46.0 is only providing icons for cursors named in css-ui-4, i.e. dropping the X-only cursors (but providing symlinks for now for the X names for cursors that exist in CSS).

right_ptr is one of those cursors that no longer exists. This means that when moving the cursor over the line numbers in SciTE 5.5.0, with GTK+ < 3.24.42 a critical error is output:

(scite:19066): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

and for any version of GTK+:

Gdk-Message: Unable to load right_ptr from the cursor theme

gdk_cursor_new_for_display() is no longer recommended (and removed in GTK 4). I've resolved with:

--- a/scintilla/gtk/PlatGTK.cxx
+++ b/scintilla/gtk/PlatGTK.cxx
@@ -1343,7 +1343,7 @@ void Window::SetCursor(Cursor curs) {
        gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_HAND2);
        break;
    case Cursor::reverseArrow:

-       gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_RIGHT_PTR);
+       gdkCurs = gdk_cursor_new_from_name(pdisplay, "pointer");
        break;
    default:
        gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_LEFT_PTR);

https://docs.gtk.org/gdk3/ctor.Cursor.new_from_name.html

Although not 100% sure pointer is the best choice.

Related

Bugs: #2460

Discussion

  • Neil Hodgson

    Neil Hodgson - 2024-05-20

    That breaks the feature by showing the wrong cursor. Isn't this GTK's responsibility since it specifies the GDK_RIGHT_PTR enumeration.

     
  • Chris Mayo

    Chris Mayo - 2024-05-21

    It's up to the icon theme to provide the cursor icon.

     
    • Neil Hodgson

      Neil Hodgson - 2024-05-21

      Why did you install an icon theme without needed cursors? You should install one that includes all the standard cursors. If this is due to your distribution being broken then request that they fix the problem.

       
  • Chris Mayo

    Chris Mayo - 2024-05-23

    Scintilla is the only software I have installed that uses right_ptr, I choose to patch it.

     
    • Neil Hodgson

      Neil Hodgson - 2024-05-23

      Your patch doesn't fix anything as the cursor appears like a hand (edited) after the patch. It just stops some warnings appearing in the log.

       

      Last edit: Neil Hodgson 2024-05-23
    • Neil Hodgson

      Neil Hodgson - 2024-05-23

      Added a change that avoids the g_object_unref warning [855623] by not unreferencing NULL.

       

      Related

      Commit: [855623]

  • Neil Hodgson

    Neil Hodgson - 2024-05-24

    Cursors can be installed into the theme by copying their files into a specific directory. On a current Fedora 40 installation which uses Adwaita for icons, this directory is /usr/share/icons/Adwaita/cursors/. I uploaded a right_ptr cursor from the Yaru theme on current Ubuntu as https://www.scintilla.org/right_ptr .

    Download this then sudo cp right_ptr /usr/share/icons/Adwaita/cursors/ will make it available. There is probably a more correct way of doing this so the cursor is installed locally or just for one application instead of to a system directory but this worked.

     
  • Chris Mayo

    Chris Mayo - 2024-05-26

    Yes that works.

    The last sighting of the Adwaita X cursors is at:
    https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/tree/9a4eedfc60c04ad0b0fc50100c96646f2f161888/Adwaita/cursors

    In the short term sticking with adwaita-icon-theme-45.0 is an option (there's even more going on with icons) to see how things develop.

    Potentially an application-level solution in the long term is gdk_cursor_new_from_pixbuf() (GTK 4 gdk_cursor_new_from_texture()). Although I guess that would only be for cases where there wasn't a theme cursor, for consistency. But it remains to be seen how things go.

     

    Last edit: Chris Mayo 2024-05-26

Log in to post a comment.

MongoDB Logo MongoDB