keygrab & ecore-wl-window-handle c# binding 03/126403/3
authordongsug.song <dongsug.song@samsung.com>
Fri, 21 Apr 2017 08:22:31 +0000 (17:22 +0900)
committerdongsug song <dongsug.song@samsung.com>
Fri, 21 Apr 2017 08:25:16 +0000 (01:25 -0700)
- this is a pair with dali-adaptor patch of https://review.tizen.org/gerrit/#/c/126398/

Change-Id: I77fe333676946936b02fd4fafcf5c909a6d14e6a
Signed-off-by: dongsug.song <dongsug.song@samsung.com>
dali-csharp-binder/file.list
dali-csharp-binder/src/key-grab.cpp [new file with mode: 0755]

index e601e4a..c0a8a33 100755 (executable)
@@ -9,7 +9,8 @@ dali_csharp_binder_src_files = \
   src/devel-property-wrap.cpp \
   src/version-check.cpp \
   src/view-wrapper-impl-wrap.cpp \
-  src/event-thread-callback-wrap.cpp
+  src/event-thread-callback-wrap.cpp \
+  src/key-grab.cpp
 
 dali_csharp_binder_header_files = \
   src/common.h
diff --git a/dali-csharp-binder/src/key-grab.cpp b/dali-csharp-binder/src/key-grab.cpp
new file mode 100755 (executable)
index 0000000..433bcb0
--- /dev/null
@@ -0,0 +1,201 @@
+/** 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.
+*
+*/
+
+#include "common.h"
+
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/adaptor-framework/key-grab.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
+
+
+#undef LOG
+//#define LOG DALI_LOG_ERROR
+#define LOG(a...)
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKeyTopmost(void * window, int daliKey)
+{
+  Dali::Window *_win = (Dali::Window *)window;
+  bool ret;
+
+  LOG("CSharp_Dali_GrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
+
+  {
+    try {
+
+    ret = Dali::KeyGrab::GrabKeyTopmost(*_win, (Dali::KEY)daliKey);
+
+    } catch (std::out_of_range& e) {
+    {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (std::exception& e) {
+    {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (...) {
+    {
+      SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
+    };
+    }
+  }
+
+  LOG("CSharp_Dali_GrabKeyTopmost() [DP2] ret=%d", ret);
+
+  return ret;
+}
+
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKeyTopmost(void * window, int daliKey)
+{
+  Dali::Window *_win = (Dali::Window *)window;
+  bool ret;
+
+  LOG("CSharp_Dali_UngrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
+
+  {
+    try {
+
+    ret = Dali::KeyGrab::UngrabKeyTopmost(*_win, (Dali::KEY)daliKey);
+
+    } catch (std::out_of_range& e) {
+    {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (std::exception& e) {
+    {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (...) {
+    {
+      SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
+    };
+    }
+  }
+
+  LOG("CSharp_Dali_UngrabKeyTopmost() [DP2] ret=%d", ret);
+
+  return ret;
+}
+
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKey(void * window, int daliKey, int grabMode)
+{
+  Dali::Window *_win = (Dali::Window *)window;
+  bool ret;
+
+  LOG("CSharp_Dali_GrabKey() [DP1] window=%d, dalikey=%d, grabmode=%d", window, daliKey, grabMode);
+
+  {
+    try {
+
+    ret = Dali::KeyGrab::GrabKey(*_win, (Dali::KEY)daliKey, (Dali::KeyGrab::KeyGrabMode)grabMode);
+
+    } catch (std::out_of_range& e) {
+    {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (std::exception& e) {
+    {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (...) {
+    {
+      SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
+    };
+    }
+  }
+
+  DALI_LOG_ERROR("CSharp_Dali_GrabKey() [DP2] ret=%d", ret);
+
+  return ret;
+}
+
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKey(void * window, int daliKey)
+{
+  Dali::Window *_win = (Dali::Window *)window;
+  bool ret;
+
+  LOG("CSharp_Dali_UngrabKey() [DP1] window=%d, dalikey=%d", window, daliKey);
+
+  {
+    try {
+
+    ret = Dali::KeyGrab::UngrabKey(*_win, (Dali::KEY)daliKey);
+
+    } catch (std::out_of_range& e) {
+    {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (std::exception& e) {
+    {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (...) {
+    {
+      SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
+    };
+    }
+  }
+
+  LOG("CSharp_Dali_UngrabKey() [DP2] ret=%d", ret);
+
+  return ret;
+}
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_GetNativeWindowHandler( void* window )
+{
+  Dali::Window *_win = (Dali::Window *)window;
+  void * ret;
+
+  LOG("CSharp_Dali_GetNativeWindowHandler() [DP1] window=%d", window);
+
+  {
+    try {
+
+    ret = Dali::DevelWindow::GetNativeWindowHandler(*_win);
+
+    } catch (std::out_of_range& e) {
+    {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (std::exception& e) {
+    {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (...) {
+    {
+      SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
+    };
+    }
+  }
+
+  if(ret != NULL)
+  {
+    LOG("CSharp_Dali_GetNativeWindowHandler() [DP2] ret=%d", ret);
+  }
+
+  return ret;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+