Drag and drop events do not work with GTK

Hi, I’m working on a cross-platform tool using GTK.

It works fine on Linux distros and BSD variants.
But on Haiku (R1/beta4), drag-drop events (drag-data-received) are ignored with the following message.

BHandler w>Tuw: MessageReceived() couldn't understand the message:
BMessage('DATA') {
    src_window = (type = 'PNTR')(size = 8)
    click_pt = BPoint(x:74, y:368)
    TrackerViewToken = (type = 'MSNG')(size = 24)
    refs = entry_ref(device=3, directory=2097309, name="license.txt", path="/boot/home/git/tuw/license.txt")
    buttons = int32(0x1 or 1)
    _drop_point_ = BPoint(x:305, y:163)
    _drop_offset_ = BPoint(x:72, y:7)

Anyone know how to fix this?

To reproduce the situation, you can run the following commands.

pkgman install meson ninja gtk3_devel
git clone -b unix_support https://github.com/matyalatte/tuw.git
cd tuw
bash shell_scripts/build.sh Debug
cp examples/all_keys/gui_definition.json build/Debug

Then, you can drop a file on the first textbox in the tool’s window.
It should copy the file path into the textbox but it doesn’t.

You can also try libui-ng (a GUI library using GTK.)

The PR has the same issue on Haiku.
To reproduce the situation, you can run the following command.

pkgman install meson ninja gtk3_devel
git clone -b control-drag-destination https://github.com/szanni/libui-ng.git
cd libui-ng
meson setup build
meson compile -C build

Then, you can do the qa test for drag-drop events.(uiDragDestination > 7.Drag Context Drag Data > Step 1)
The qa test fails with the message about BMessage.

1 Like

I don’t know if the Wayland compatibility layer that GTK is running on understands drag-and-drop at all. CC @X512.

I have experimental drag & drop support for Haiku Wayland, but I feel it is currently not ready for everyday use. There are various difference between Haiku and Wayland drag&drop behavior.


Thanks for the replies. I didn’t know the wayland layer is WIP. I’ll add a note about it to the document of my tool.