diff --git a/src/dlangui/core/events.d b/src/dlangui/core/events.d index e96a6cdc..2713e9b5 100644 --- a/src/dlangui/core/events.d +++ b/src/dlangui/core/events.d @@ -1437,6 +1437,13 @@ class RunnableEvent : CustomEvent { } } +interface CustomEventTarget { + /// post event to handle in UI thread (this method can be used from background thread) + void postEvent(CustomEvent event); + + /// post task to execute in UI thread (this method can be used from background thread) + void executeInUiThread(void delegate() runnable); +} private static __gshared string[int] actionIdToNameMap; private static __gshared int[string] actionNameToIdMap; diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d index b06e8307..128790fa 100644 --- a/src/dlangui/platforms/common/platform.d +++ b/src/dlangui/platforms/common/platform.d @@ -158,7 +158,7 @@ class TimerInfo { * Window abstraction layer. Widgets can be shown only inside window. * */ -class Window { +class Window : CustomEventTarget { protected int _dx; protected int _dy; protected uint _keyboardModifiers;