How to change the mouse cursor on the object of class Gtk.TextView

Hi
I try to change the mouse cursor on the object of class Gtk.TextView.
I used function gtk_widget_set_cursor_from_name(GTK_WIDGET (tv), “wait”),
but cursor remains unchanged.
Can anyone help me?

Hi,

That works on my side.
Which gtk version are you using? what environment?

Hi thanks you for interest.

I use Gtk4 and environment openSUSE Leap 15.6 gnome Wayland. But i think, the problem is in inside the class gtktextview. in other classes isn’t problem to change mouse cursor. the class gtktextview set mouse cursor on “text” itself. I looking for way how to change course mouse easily for the object this class.

Yes, it depends on when you request the cursor change.
GtkTextView will for example force the cursor to text when mapped, so if you set wait at init then it will be overridden later when displayed.

On which event do you set the cursor?

Yes i have tried via event. It works.

static void harb(GtkTextView *text_view){
5 gtk_widget_set_cursor_from_name(GTK_WIDGET(text_view), “wait”);
6
}

g_signal_connect(tv, “map”, G_CALLBACK(harb),NULL);

I would like to know if it it’s possible to change without using event.
I think, there are any others ways.

There are various places where the TextView sets its cursor, so I don’t think there is a reliable way to force the wait one.

On a side note, cursors won’t show when using touchscreens, so modern application usually prefer to display a spinner or a progress bar instead.

The nuclear option is to use Gio.Application.mark_busy , that will display the whole app locked and waiting. I don’t recommend though, as the user won’t be able to move or close the windows while busy.