all-local: libNDalic.so NDali.dll
-libNDalic.so: automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o manual/cpp/devel-property-wrap.o
- g++ -shared automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o manual/cpp/devel-property-wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
+libNDalic.so: automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/event-thread-callback-wrap.o manual/cpp/devel-property-wrap.o
+ g++ -shared automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/event-thread-callback-wrap.o manual/cpp/devel-property-wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
automatic/cpp/dali_wrap.o: $(BUILT_SOURCES)
g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) automatic/cpp/dali_wrap.cpp -o automatic/cpp/dali_wrap.o
manual/cpp/view-wrapper-impl-wrap.o: $(BUILT_SOURCES)
g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/view-wrapper-impl-wrap.cpp -o manual/cpp/view-wrapper-impl-wrap.o
-manual/cpp/callbackbase_wrap.o: $(BUILT_SOURCES)
- g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/callbackbase_wrap.cpp -o manual/cpp/callbackbase_wrap.o
+manual/cpp/event-thread-callback-wrap.o: $(BUILT_SOURCES)
+ g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/event-thread-callback-wrap.cpp -o manual/cpp/event-thread-callback-wrap.o
manual/cpp/devel-property-wrap.o: $(BUILT_SOURCES)
g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/devel-property-wrap.cpp -o manual/cpp/devel-property-wrap.o
// Callback for Application InitSignal
private void OnApplicationInit(IntPtr data)
{
+ // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
+ DisposeQueue.Instance.Initialize();
+
NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
// Populate all members of "e" (NUIApplicationInitEventArgs) with real data
return ret;
}
- public bool AddIdle(System.Delegate func) {
- System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
- System.IntPtr ip2 = NDalicManualPINVOKE.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
-
- bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
%}
%enddef
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef CSHARP_CALLBACK_BASE
-#define CSHARP_CALLBACK_BASE
-#endif
-
-#include "common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_MakeCallback(void * jarg1) {
- void * jresult ;
- void (*arg1)(void) = (void (*)(void)) 0 ;
- Dali::CallbackBase *result = 0 ;
-
- arg1 = (void (*)(void))jarg1;
- {
- try {
- result = (Dali::CallbackBase *)Dali::MakeCallback(arg1);
- } catch (std::out_of_range& e) {
- {
- SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
- };
- } catch (std::exception& e) {
- {
- SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
- };
- } catch (...) {
- {
- SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
- };
- }
- }
-
- jresult = (void *)result;
-
- return jresult;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef CSHARP_EVENT_THREAD_CALLBACK
+#define CSHARP_EVENT_THREAD_CALLBACK
+#endif
+
+#include "common.h"
+#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (SWIGSTDCALL* SWIG_CallbackMakeCallback)(void);
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_EventThreadCallback(SWIG_CallbackMakeCallback callbackOnMakeCallback) {
+ void * jresult ;
+ void (*arg1)(void) = (void (*)(void)) 0 ;
+ Dali::EventThreadCallback *result = 0 ;
+
+ arg1 = (void (*)(void))callbackOnMakeCallback;
+ {
+ try {
+ result = (Dali::EventThreadCallback *)new Dali::EventThreadCallback((Dali::CallbackBase *)Dali::MakeCallback(arg1));
+ } catch (std::out_of_range& e) {
+ {
+ SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (std::exception& e) {
+ {
+ SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (...) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+ };
+ }
+ }
+ jresult = (void *)result;
+ return jresult;
+}
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_EventThreadCallback(void * jarg1) {
+ Dali::EventThreadCallback *arg1 = (Dali::EventThreadCallback *) 0 ;
+
+ arg1 = (Dali::EventThreadCallback *)jarg1;
+ {
+ try {
+ delete arg1;
+ } catch (std::out_of_range& e) {
+ {
+ SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return ;
+ };
+ } catch (std::exception& e) {
+ {
+ SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return ;
+ };
+ } catch (...) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return ;
+ };
+ }
+ }
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_EventThreadCallback_Trigger(void * jarg1) {
+ Dali::EventThreadCallback *arg1 = (Dali::EventThreadCallback *) 0 ;
+
+ arg1 = (Dali::EventThreadCallback *)jarg1;
+ {
+ try {
+ (arg1)->Trigger();
+ } catch (std::out_of_range& e) {
+ {
+ SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return ;
+ };
+ } catch (std::exception& e) {
+ {
+ SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return ;
+ };
+ } catch (...) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return ;
+ };
+ }
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif //CSHARP_EVENT_THREAD_CALLBACK
+
namespace Dali
{
-
public class DisposeQueue
{
- private static DisposeQueue _disposableQueue = new DisposeQueue();
+ private static readonly DisposeQueue _disposableQueue = new DisposeQueue();
private List<IDisposable> _disposables = new List<IDisposable>();
private Object _listLock = new object();
- private delegate int ProcessDisposablesDelegate(IntPtr ptr);
- private ProcessDisposablesDelegate _disposequeueProcessDisposablesDelegate;
+ private EventThreadCallback _eventThreadCallback;
+ private EventThreadCallback.CallbackDelegate _disposeQueueProcessDisposablesDelegate;
private DisposeQueue()
{
- _disposequeueProcessDisposablesDelegate = new ProcessDisposablesDelegate(ProcessDisposables);
- Application.Instance.AddIdle(_disposequeueProcessDisposablesDelegate);
}
~DisposeQueue()
get { return _disposableQueue; }
}
+ public void Initialize()
+ {
+ _disposeQueueProcessDisposablesDelegate = new EventThreadCallback.CallbackDelegate(ProcessDisposables);
+ _eventThreadCallback = new EventThreadCallback(_disposeQueueProcessDisposablesDelegate);
+ }
+
public void Add(IDisposable disposable)
{
- lock(_listLock)
+ lock (_listLock)
{
_disposables.Add(disposable);
}
+
+ _eventThreadCallback.Trigger();
}
- private int ProcessDisposables(IntPtr ptr)
+ private void ProcessDisposables()
{
- lock(_listLock)
+ lock (_listLock)
{
foreach (IDisposable disposable in _disposables)
{
}
_disposables.Clear();
}
- return 0;
}
}
}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+ public class EventThreadCallback : global::System.IDisposable
+ {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ protected bool swigCMemOwn;
+ public delegate void CallbackDelegate();
+
+ internal EventThreadCallback(global::System.IntPtr cPtr, bool cMemoryOwn)
+ {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventThreadCallback obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ ~EventThreadCallback()
+ {
+ Dispose();
+ }
+
+ public virtual void Dispose()
+ {
+ lock (this)
+ {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero)
+ {
+ if (swigCMemOwn)
+ {
+ swigCMemOwn = false;
+ NDalicManualPINVOKE.delete_EventThreadCallback(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+
+ public EventThreadCallback(CallbackDelegate func) : this(NDalicManualPINVOKE.new_EventThreadCallback(func), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public void Trigger()
+ {
+ NDalicManualPINVOKE.EventThreadCallback_Trigger(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ }
+
+}
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_ViewWrapperImpl_ApplyThemeStyle")]
public static extern void ViewWrapperImpl_ApplyThemeStyle(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_MakeCallback")]
- public static extern global::System.IntPtr MakeCallback(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_new_EventThreadCallback")]
+ public static extern global::System.IntPtr new_EventThreadCallback(EventThreadCallback.CallbackDelegate delegate1);
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_delete_EventThreadCallback")]
+ public static extern void delete_EventThreadCallback(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_EventThreadCallback_Trigger")]
+ public static extern void EventThreadCallback_Trigger(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Actor_Property_SIBLING_ORDER_get")]
public static extern int Actor_Property_SIBLING_ORDER_get();