When dragging, cursor always shows "cannot drag here" with GTK 2 widgetset (on WinAPI widgetset it is OK)
- Lazarus/FPC Version: Lazarus 2.3.0 (rev main-2_3-2321-g0ddb329d) FPC 3.3.1 x86_64-linux-gtk2
- Also reproduced with Lazarus 2.2.0 / FPC 3.2.2.
- Operating System: Linux (reproduced on both Ubuntu 2022.04 and fresh Debian testing)
- CPU / Bitness: x86_64
When dragging, cursor always shows "cannot drag here" with GTK 2 widgetset.
The attached example project implements OnDragOver
event, to set
-
Accept=true if you try to drag-and-drop from
ListBox1
-
Accept=false otherwise (like if you drag from
ListBox2
)
However with GTK 2 widgetset, the cursor when dragging always shows "cannot drag here" on ListBoxTarget (see the screenshot), regardless if your source is ListBox1 or ListBox2.
The drag-and-drop actually works, that is: OnDragDrop
gets executed OK if the Source was ListBox1 (and only then), so the Accept
value set by OnDragOver
is meaningful. But the situation is confusing for the user, as the cursor always communicates that this is not a valid target for drag-and-drop, so user may easily think that ListBox1
and ListBox2
are both invalid sources for drag-and-drop.
It works OK with WinAPI widgetset. The cursor correctly changes to communicate that "drag-and-drop is OK" when source is ListBox1
with WinAPI.
I experience this problem also in larger application: Castle Game Engine editor (where you can drag-and-drop from the "files panel" to "hierarchy tree" or "design area" in the center), with Lazarus stable 2.2 based on FPC 3.2.2 too. It doesn't seem related to the source/target control classes (it's not just about TListBox
), the drag-and-drop cursor seems to always show "cannot drag here" with GTK 2 widgetset.
I found 2 related issues about drag-and-drop cursor on GTK 2, though none of them seem to report that cursor is just always "cannot drag here" with GTK 2: #36117 , #39522 (closed) . I also found possibly-related forum threads, though without a resolution: https://forum.lazarus.freepascal.org/index.php?topic=49822.0 , https://forum.lazarus.freepascal.org/index.php?topic=19422.0 .