Remove/replace Forbidden Mouse CursorShape by system default arrow

Godot Version

Godot 4.4

Question

Does anyone know how to get rid of the CURSOR_FORBIDDEN shape?
This drag & drop cursor change is so annoying.

I want to set the forbidden cursorshape to be the same as the arrow one.
But the set_custom_mouse_cursor only accepts a png image.
and I want to keep the user OS default cursors.

Control.get_cursor_shape only returns the enum index, so that doesn’t work.

Here it is working with custom cursors, but I want to keep the user default one.

func _ready() -> void:
	Input.set_custom_mouse_cursor(HAND_POINT,Input.CURSOR_ARROW)
	Input.set_custom_mouse_cursor(HAND_CLOSED,Input.CURSOR_FORBIDDEN)
	Input.set_custom_mouse_cursor(HAND_CLOSED,Input.CURSOR_CAN_DROP)

The other solution I’ve found is to just make all panels “accept” drops so the forbidden cursor is never set… But that is very hacky and annoying.

func _can_drop_data(at_position: Vector2, data: Variant) -> bool:
	return true

The cursor change is hard-coded in the engine godot/scene/main/viewport.cpp at 71a9948157dc2d5cc71fcb456c9d96656678757d · godotengine/godot · GitHub

I’m not sure if doing something like this will work:

func _process(delta):
    if dragging:
        DisplayServer.cursor_set_shape(DisplayServer.CURSOR_ARROW)

I think your only option is the one you already found.

1 Like

Your solution worked quite well.
Didn’t know the DisplayServer had that function.
Thanks!

I’m using this which seems to work great to remove the Forbidden cursor.

func _process(_delta: float) -> void:
	if Input.get_current_cursor_shape() == CURSOR_FORBIDDEN:
		DisplayServer.cursor_set_shape(DisplayServer.CURSOR_ARROW)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.