Skip to content

[ui] Make ui_choose_file threadsafe - #993

Merged
yuxiaomao merged 1 commit into
HaxeFoundation:masterfrom
EspeuteClement:master
Oct 6, 2026
Merged

yuxiaomao merged 1 commit into
HaxeFoundation:masterfrom
EspeuteClement:master

Conversation

@EspeuteClement

@EspeuteClement EspeuteClement commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This allows using the hl.UI.loadFile/saveFile from another thread, which allow async dialog from haxe code. Async dialog code is needed for hide_hl as it fixes performance on GSync monitors while a dialog is open, because it allows the main app loop to not block. The api of the UI functions has not changed.

example code to use the dialog in an async way, that code can be implemented in the projects :

	public function chooseFileAsync(opts: hl.UI.FileOptions, onSelect: Null<String> -> Void, save = false) {
		var events = sys.thread.Thread.current().events;
		sys.thread.Thread.create(() -> {
			var path = save ? hl.UI.saveFile(opts) : hl.UI.loadFile(opts);
			events.run(() -> onSelect(path));
		});
	}

@EspeuteClement EspeuteClement changed the title [ui] Make chooseFolder initialization threadsafe [ui] Make ui_choose_file threadsafe Oct 5, 2026
@yuxiaomao
yuxiaomao merged commit b5b67a1 into HaxeFoundation:master Oct 6, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants