From f0329ad04461b6e961f8a031fca966eea4802c26 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Sat, 13 Dec 2025 11:20:17 +0000 Subject: [PATCH 1/3] Fix eventloop usage for haxe 5 --- src/lime/_internal/backend/native/NativeApplication.hx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lime/_internal/backend/native/NativeApplication.hx b/src/lime/_internal/backend/native/NativeApplication.hx index 7998723bd0..bba6dce0dd 100644 --- a/src/lime/_internal/backend/native/NativeApplication.hx +++ b/src/lime/_internal/backend/native/NativeApplication.hx @@ -652,7 +652,11 @@ class NativeApplication #if (haxe_ver >= 4.2) #if target.threaded + #if haxe5 + sys.thread.Thread.current().events.loopOnce(); + #else sys.thread.Thread.current().events.progress(); + #end #else // Duplicate code required because Haxe 3 can't handle // #if (haxe_ver >= 4.2 && target.threaded) From e55c2fbea901195da1cafbd5db6f08e92ac2a060 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Sat, 13 Dec 2025 14:39:08 +0000 Subject: [PATCH 2/3] Fix haxe.MainLoop use for haxe 5 --- src/lime/system/JNI.hx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lime/system/JNI.hx b/src/lime/system/JNI.hx index b1a052022b..ce223c9926 100644 --- a/src/lime/system/JNI.hx +++ b/src/lime/system/JNI.hx @@ -466,9 +466,13 @@ class JNISafetyTools // Check the thread before running the function. f.expr = macro - if (!lime.system.JNI.JNISafetyTools.onMainThread()) - haxe.MainLoop.runInMainThread($i{field.name}.bind($a{args})) - else + if (!lime.system.JNI.JNISafetyTools.onMainThread()) { + #if haxe5 + haxe.EventLoop.main.run($i{field.name}.bind($a{args})); + #else + haxe.MainLoop.runInMainThread($i{field.name}.bind($a{args})); + #end + } else ${f.expr}; default: } From 8f03833d0c17a0f78e337c218a51f9d37c2ef126 Mon Sep 17 00:00:00 2001 From: Joseph Cloutier Date: Tue, 2 Jun 2026 13:11:47 -0400 Subject: [PATCH 3/3] Fix `haxe.MainLoop` use for Haxe 5. --- src/lime/app/Promise.hx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lime/app/Promise.hx b/src/lime/app/Promise.hx index 96b59fdc7e..fa3b095be8 100644 --- a/src/lime/app/Promise.hx +++ b/src/lime/app/Promise.hx @@ -105,7 +105,11 @@ class Promise { if (!ThreadPool.isMainThread()) { + #if haxe5 + haxe.EventLoop.main.run(complete.bind(data)); + #else haxe.MainLoop.runInMainThread(complete.bind(data)); + #end return this; } @@ -197,7 +201,11 @@ class Promise { if (!ThreadPool.isMainThread()) { + #if haxe5 + haxe.EventLoop.main.run(error.bind(msg)); + #else haxe.MainLoop.runInMainThread(error.bind(msg)); + #end return this; } @@ -236,7 +244,11 @@ class Promise { if (!ThreadPool.isMainThread()) { + #if haxe5 + haxe.EventLoop.main.run(this.progress.bind(progress, total)); + #else haxe.MainLoop.runInMainThread(this.progress.bind(progress, total)); + #end return this; }