I have a strange issue and look for hints if I can do anything on my app side as it seam strange and some what functional.
All works fine when running my app within X11/Gnome Shell or Wayland.
Any file browser, Nautilus or Thunar works.
But once I am in Hyprland simply nothing happens and I do not receive the drop event.
BUT: I noted when I use the regular file dialog to open a file I can drop the file in there and get the path/file pre-selected just fine.
Thus I wonder if I miss anything to make it work everywhere?
Any hints?
I do use a pretty the basic reference setup and configure Gtk4 widgets to accept drops of file(s) like this:
GType types[1] = { G_TYPE_FILE }; // file type only
GtkDropTarget *target = gtk_drop_target_new (G_TYPE_INVALID, GDK_ACTION_COPY);
gtk_drop_target_set_gtypes (target, types, G_N_ELEMENTS (types));
g_signal_connect (target, "drop", G_CALLBACK (AppBase::gapp_load_on_drop_files), GINT_TO_POINTER (999)); // <= auto open in free channel
gtk_widget_add_controller (GTK_WIDGET (app_window), GTK_EVENT_CONTROLLER (target));
And here is the Callback:
void AppBase::drop_list_file_open_gfunc (GFile \*gf, gpointer \*data){
gchar \*fn = g_file_get_parse_name (gf);
g_message ("Loading File %s, ", fn);
main_get_gapp () → xsm->load (fn);
g_free (fn);
}
gboolean AppBase::gapp_load_on_drop_files (GtkDropTarget *target, const GValue *value, double x, double y, gpointer data){
if (G_VALUE_HOLDS (value, G_TYPE_BOXED)){
g_message ("FILE LIST DROPPED... ");
g_slist_foreach (g_value_get_boxed (value), AppBase::drop_list_file_open_gfunc, GINT_TO_POINTER (channel));
} else if (G_VALUE_HOLDS (value, G_TYPE_FILE)){
gchar *fn = g_file_get_parse_name (g_value_get_object (value));
g_message ("FILE DROPPED %s", fn);
main_get_gapp () -> xsm->load (fn);
g_free (fn);
}
else
return FALSE;
return TRUE;
}