nik012003 / ripdrag

Drag and Drop utilty written in Rust and GTK4
GNU General Public License v3.0
496 stars 17 forks source link

`--target` doesn't work, gives `gdk_drop_set_actions: assertion 'priv->state == GDK_DROP_STATE_NONE' failed` error #24

Open xfzv opened 1 year ago

xfzv commented 1 year ago
❯ ripdrag --version
ripdrag 0.3.2

After trying to drag an image or an URL with --target, this error is printed and nothing happens:

❯ ripdrag --target
(ripdrag:3732518): Gdk-CRITICAL **: 08:20:24.687: gdk_drop_set_actions: assertion 'priv->state == GDK_DROP_STATE_NONE' failed

ripdrag "$file" works fine. Note that dragon --target works fine too.

nik012003 commented 1 year ago

Hi, thank you for reporting this. Unfortunately, I won't be able to work on it till next week. In the meanwhile, can you share more info about the enviroment you running it on? Which Desktop Environment/WM are you using?

xfzv commented 1 year ago

Hi, thank you for reporting this. Unfortunately, I won't be able to work on it till next week.

No worries!

In the meanwhile, can you share more info about the enviroment you running it on? Which Desktop Environment/WM are you using?

Sure.

huanie commented 1 year ago

@xfzv This is a GTK/portal bug, https://gitlab.gnome.org/GNOME/gtk/-/issues/5348. I am currently looking if there is a hack for this since GTK3 applications handle this just fine.

huanie commented 1 year ago

@xfzv This is a GTK/portal bug, https://gitlab.gnome.org/GNOME/gtk/-/issues/5348. I am currently looking if there is a hack for this since GTK3 applications handle this just fine.

The only thing I managed to do is to be able to drop multiple files. So you'd need to open your directory and select everything there to drop it.

xfzv commented 1 year ago

@xfzv This is a GTK/portal bug, https://gitlab.gnome.org/GNOME/gtk/-/issues/5348. I am currently looking if there is a hack for this since GTK3 applications handle this just fine.

The only thing I managed to do is to be able to drop multiple files. So you'd need to open your directory and select everything there to drop it.

Do you mean after doing some changes on your end? For now, when I try to drop multiple files from let's say Dolphin with ripdrag -t, I get these errors (multiple times):

(ripdrag:215842): Gtk-WARNING **: 17:04:13.478: (../gtk-4.10.4/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

(ripdrag:215842): Gtk-CRITICAL **: 17:04:13.478: gtk_drop_target_handle_event: assertion 'self->drop == gdk_dnd_event_get_drop (event)' failed
huanie commented 1 year ago

@xfzv This is a GTK/portal bug, https://gitlab.gnome.org/GNOME/gtk/-/issues/5348. I am currently looking if there is a hack for this since GTK3 applications handle this just fine.

The only thing I managed to do is to be able to drop multiple files. So you'd need to open your directory and select everything there to drop it.

Do you mean after doing some changes on your end? For now, when I try to drop multiple files from let's say Dolphin with ripdrag -t, I get these errors (multiple times):

(ripdrag:215842): Gtk-WARNING **: 17:04:13.478: (../gtk-4.10.4/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

(ripdrag:215842): Gtk-CRITICAL **: 17:04:13.478: gtk_drop_target_handle_event: assertion 'self->drop == gdk_dnd_event_get_drop (event)' failed

Yes, from my changes. https://github.com/huanie/ripdrag/tree/huan/listview

xfzv commented 1 year ago

Still somewhat broken for me after updating to 4.0.0.

❯ ripdrag --version
ripdrag 0.4.0

❯ ripdrag --target --and-exit
# Trying to drop some images from Dolphin
(ripdrag:2778028): Gtk-WARNING **: 14:57:29.574: (../gtk-4.10.5/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

(ripdrag:2778028): Gtk-CRITICAL **: 14:57:29.574: gtk_drop_target_handle_event: assertion 'self->drop == gdk_dnd_event_get_drop (event)' failed

[..]
(ripdrag:2778028): Gtk-WARNING **: 14:57:30.398: (../gtk-4.10.5/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

The second error is printed many times. Plus, it seems that --and-exit no longer works, even without --target. After dragging a file, I have to manually close the ripdrag window

--target now works from Firefox though.

Also noticed that the ripdrag window is completely blank now with --target. Wasn't there a text in it before? Without --target, I can still see the "X elements" text in the ripdrag window.

huanie commented 1 year ago

Still somewhat broken for me after updating to 4.0.0.

❯ ripdrag --version
ripdrag 0.4.0

❯ ripdrag --target --and-exit
# Trying to drop some images from Dolphin
(ripdrag:2778028): Gtk-WARNING **: 14:57:29.574: (../gtk-4.10.5/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

(ripdrag:2778028): Gtk-CRITICAL **: 14:57:29.574: gtk_drop_target_handle_event: assertion 'self->drop == gdk_dnd_event_get_drop (event)' failed

[..]
(ripdrag:2778028): Gtk-WARNING **: 14:57:30.398: (../gtk-4.10.5/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

The second error is printed many times. Plus, it seems that --and-exit no longer works, even without --target. After dragging a file, I have to manually close the ripdrag window

--target now works from Firefox though.

Also noticed that the ripdrag window is completely blank now with --target. Wasn't there a text in it before? Without --target, I can still see the "X elements" text in the ripdrag window.

must have forgotten to add the --and-exit functionality. would you mind sharing some files (edit: I will test it on someone's wallpaper repo) and the commandline invocation to reproduce it. There is no text if there are no files and "X elements" text should only appear when you do -A (compact view)

huanie commented 1 year ago

Still somewhat broken for me after updating to 4.0.0.

❯ ripdrag --version
ripdrag 0.4.0

❯ ripdrag --target --and-exit
# Trying to drop some images from Dolphin
(ripdrag:2778028): Gtk-WARNING **: 14:57:29.574: (../gtk-4.10.5/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

(ripdrag:2778028): Gtk-CRITICAL **: 14:57:29.574: gtk_drop_target_handle_event: assertion 'self->drop == gdk_dnd_event_get_drop (event)' failed

[..]
(ripdrag:2778028): Gtk-WARNING **: 14:57:30.398: (../gtk-4.10.5/gtk/gtkdroptarget.c:486):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

The second error is printed many times. Plus, it seems that --and-exit no longer works, even without --target. After dragging a file, I have to manually close the ripdrag window --target now works from Firefox though. Also noticed that the ripdrag window is completely blank now with --target. Wasn't there a text in it before? Without --target, I can still see the "X elements" text in the ripdrag window.

must have forgotten to add the --and-exit functionality. would you mind sharing some files (edit: I will test it on someone's wallpaper repo) and the commandline invocation to reproduce it. There is no text if there are no files and "X elements" text should only appear when you do -A (compact view)

I fixed the --and-exit. A also downloaded dolphin, set GNOME to X11 but can't reproduce your error messages, I've only found this https://discourse.gnome.org/t/file-drag-and-drop-in-gtkmm4/10548/3 about it. So it might be a KDE bug.

About the directory problem, when any of the drop elements are directories, the drop is cancelled. @nik012003 Should there be a button to open a file picker? I know that picking directories with the file picker works.

xfzv commented 1 year ago

There is no text if there are no files and "X elements" text should only appear when you do -A (compact view)

OK, my bad.

A also downloaded dolphin, set GNOME to X11 but can't reproduce your error messages, I've only found this https://discourse.gnome.org/t/file-drag-and-drop-in-gtkmm4/10548/3 about it. So it might be a KDE bug.

It works just fine with dragon here (with Dolphin).

--target now works from Firefox though.

Spoke too soon. Dragging URLs from Firefox (from the URL bar or from any web page) doesn't work with ripdrag while it does with dragon. Dragging an image from Firefox (opened in a new tab) works, but dragging the image's URL doesn't. Likewise, works fine with dragon.

huanie commented 1 year ago

There is no text if there are no files and "X elements" text should only appear when you do -A (compact view)

OK, my bad.

A also downloaded dolphin, set GNOME to X11 but can't reproduce your error messages, I've only found this https://discourse.gnome.org/t/file-drag-and-drop-in-gtkmm4/10548/3 about it. So it might be a KDE bug.

It works just fine with dragon here (with Dolphin).

--target now works from Firefox though.

Spoke too soon. Dragging URLs from Firefox (from the URL bar or from any web page) doesn't work with ripdrag while it does with dragon. Dragging an image from Firefox (opened in a new tab) works, but dragging the image's URL doesn't. Likewise, works fine with dragon.

Alright I will take a look at implementing dragging URLs during weekend, with the the errors I cannot help.

nik012003 commented 1 year ago

About the directory problem, when any of the drop elements are directories, the drop is cancelled. @nik012003 Should there be a button to open a file picker? I know that picking directories with the file picker works.

Mh, maybe we should have a button that is both a drag target (at the top of the list) and that by clicking it , it opens the file picker.

For the URLs, I think I know how to implement it, will try doing it later today

huanie commented 1 year ago

There is a pull request (https://github.com/nik012003/ripdrag/pull/28) for dropping files from the web but dropping URLs can't work at the moment because of a regression in GTK (tracked here https://gitlab.gnome.org/GNOME/gtk/-/issues/6020).

xfzv commented 1 year ago

Trying out #28 after updating to 4.0.1 (dragging some URLs from Firefox):

❯ ripdrag --target --and-exit
https://trisquel.info/files/screenshots/t10-office_0.jpg
Operation not supported

(ripdrag:1976395): Gdk-CRITICAL **: 21:48:05.611: gdk_drop_set_actions: assertion 'priv->state == GDK_DROP_STATE_NONE' failed
https://trisquel.info/files/screenshots/t10-office_0.jpg
Operation not supported

(ripdrag:1976395): Gdk-CRITICAL **: 21:48:46.566: gdk_drop_set_actions: assertion 'priv->state == GDK_DROP_STATE_NONE' failed
https://github.com/nik012003/ripdrag/issues/24
Operation not supported

Despite the two errors, it works I guess? However, the ripdrag window stays open despite using --and-exit. Does it mean none of the drops was considered successful?

--and-exit without --target works fine on my end.

nik012003 commented 1 year ago

Uh, that's rather strange. I never got it work with firefox, I always received a blank string when I was testing it... I'll try tomorrow on another enviroment to try and reproduce it

On August 14, 2023 10:03:11 PM GMT+02:00, xfzv @.***> wrote:

Trying out #28 after updating to 4.0.1 (dragging some URLs from Firefox):

❯ ripdrag --target --and-exit
https://trisquel.info/files/screenshots/t10-office_0.jpg
Operation not supported

(ripdrag:1976395): Gdk-CRITICAL **: 21:48:05.611: gdk_drop_set_actions: assertion 'priv->state == GDK_DROP_STATE_NONE' failed
https://trisquel.info/files/screenshots/t10-office_0.jpg
Operation not supported

(ripdrag:1976395): Gdk-CRITICAL **: 21:48:46.566: gdk_drop_set_actions: assertion 'priv->state == GDK_DROP_STATE_NONE' failed
https://github.com/nik012003/ripdrag/issues/24
Operation not supported

Despite the two errors, it works I guess? However, the ripdrag window stays open despite using --and-exit. Does it mean none of the drops was considered successful?

--and-exit without --target works fine on my end.

-- Reply to this email directly or view it on GitHub: https://github.com/nik012003/ripdrag/issues/24#issuecomment-1677980662 You are receiving this because you were mentioned.

Message ID: @.***>

nik012003 commented 1 year ago

Okay, fixed the --and-exit behaviour. I noticed that most things work on firefox running on X, while dragging urls is mostly broken on firefox on Wayland :/ I compared the code to the nautilus' drop_target implementation but couldn't find any meaningful differences. But it does work on nautilus, so there's gotta be something going on there...

xfzv commented 1 year ago

Can confirm --and-exit works fine with --target now after updating to 4.0.2 (still dragging from Firefox). I'm using X11, cannot comment on Wayland.

❯ ripdrag --target --and-exit
https://www.gnu.org/
Operation not supported

It seems very erratic indeed, it doesn't work at all with Tor Browser for me.