Merge "(C#) Changed Rectangle to have float properties" into devel/master
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 29 Mar 2017 17:05:03 +0000 (10:05 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 29 Mar 2017 17:05:03 +0000 (10:05 -0700)
dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.h
plugins/dali-swig/Makefile.am
plugins/dali-swig/SWIG/events/application-event.i
plugins/dali-swig/manual/cpp/callbackbase_wrap.cpp [deleted file]
plugins/dali-swig/manual/cpp/event-thread-callback-wrap.cpp [new file with mode: 0644]
plugins/dali-swig/manual/csharp/DisposeQueue.cs
plugins/dali-swig/manual/csharp/EventThreadCallback.cs [new file with mode: 0644]
plugins/dali-swig/manual/csharp/ManualPINVOKE.cs

index 18885a8..36a78d7 100644 (file)
@@ -69,7 +69,7 @@ public:
  * @param[in] interface The user's implementation of CustomAlgorithmInterface
  * @see DevelKeyboardFocusManager::CustomAlgorithmInterface
  */
-void SetCustomAlgorithm(KeyboardFocusManager keyboardFocusManager, CustomAlgorithmInterface& interface);
+DALI_IMPORT_API void SetCustomAlgorithm(KeyboardFocusManager keyboardFocusManager, CustomAlgorithmInterface& interface);
 
 } // namespace DevelKeyboardFocusManager
 
index 2ed3252..526fc62 100755 (executable)
@@ -23,8 +23,8 @@ if BUILD_MCS
 
 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
@@ -35,8 +35,8 @@ manual/cpp/keyboard_focus_manager_wrap.o: $(BUILT_SOURCES)
 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
index 3db23f4..3050ae7 100644 (file)
     // 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
 
diff --git a/plugins/dali-swig/manual/cpp/callbackbase_wrap.cpp b/plugins/dali-swig/manual/cpp/callbackbase_wrap.cpp
deleted file mode 100644 (file)
index 6b925d4..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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
-
diff --git a/plugins/dali-swig/manual/cpp/event-thread-callback-wrap.cpp b/plugins/dali-swig/manual/cpp/event-thread-callback-wrap.cpp
new file mode 100644 (file)
index 0000000..736c697
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * 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
+
index a62843b..35acafd 100644 (file)
@@ -12,19 +12,16 @@ using System.Collections.Generic;
 
 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()
@@ -36,17 +33,25 @@ namespace Dali
             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)
                 {
@@ -54,7 +59,6 @@ namespace Dali
                 }
                 _disposables.Clear();
             }
-            return 0;
         }
     }
 }
diff --git a/plugins/dali-swig/manual/csharp/EventThreadCallback.cs b/plugins/dali-swig/manual/csharp/EventThreadCallback.cs
new file mode 100644 (file)
index 0000000..a9434a4
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * 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();
+        }
+
+    }
+
+}
index 6694174..a7ce0a2 100755 (executable)
@@ -184,8 +184,14 @@ namespace Dali
         [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();