handle drag-and-drop events as ACTION_SEND Intents

This commit is contained in:
Julian Winkler
2025-07-14 12:25:04 +02:00
parent 0064677755
commit b7843665ef
5 changed files with 56 additions and 0 deletions

View File

@@ -99,6 +99,7 @@ void set_up_handle_cache(JNIEnv *env)
(*env)->ExceptionDescribe(env);
handle_cache.context.sendBroadcast = _METHOD(handle_cache.context.class, "sendBroadcast", "(Landroid/content/Intent;)V");
handle_cache.context.startActivity = _METHOD(handle_cache.context.class, "startActivity", "(Landroid/content/Intent;)V");
handle_cache.context.resolveActivityInternal = _STATIC_METHOD(handle_cache.context.class, "resolveActivityInternal", "(Landroid/content/Intent;)Landroid/app/Activity;");
handle_cache.context.startService = _METHOD(handle_cache.context.class, "startService", "(Landroid/content/Intent;)Landroid/content/ComponentName;");
handle_cache.application.class = _REF((*env)->FindClass(env, "android/app/Application"));

View File

@@ -97,6 +97,7 @@ struct handle_cache {
jmethodID get_package_name;
jmethodID sendBroadcast;
jmethodID startActivity;
jmethodID resolveActivityInternal;
jmethodID startService;
} context;
struct {

View File

@@ -158,6 +158,8 @@ static gboolean on_event(GtkEventControllerLegacy *event_controller, GdkEvent *e
}
uintptr_t id = (uintptr_t)gdk_event_get_event_sequence(event);
if (id > MAX_POINTERS-1) // sequence id is a real pointer for drag and drop events
return false;
/* FIXME: this will clash with touchscreen */
if(id == 0)