1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
19 #include <dali/dali.h>
20 #include <dali-toolkit/dali-toolkit.h>
21 #include <dali/public-api/common/dali-common.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/public-api/adaptor-framework/key-grab.h>
24 #include <dali/public-api/adaptor-framework/window.h>
31 #include <Ecore_Wayland.h>
35 //#define LOG DALI_LOG_ERROR
43 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKeyTopmost(void * window, int daliKey)
45 Dali::Window *_win = (Dali::Window *)window;
48 LOG("CSharp_Dali_GrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
52 ret = Dali::KeyGrab::GrabKeyTopmost(*_win, (Dali::KEY)daliKey);
53 } catch (std::out_of_range& e) {
55 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
57 } catch (std::exception& e) {
59 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
61 } catch (Dali::DaliException e) {
63 SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
67 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
73 LOG("CSharp_Dali_GrabKeyTopmost() [DP2] ret=%d", ret);
78 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKeyTopmost(void * window, int daliKey)
80 Dali::Window *_win = (Dali::Window *)window;
83 LOG("CSharp_Dali_UngrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
87 ret = Dali::KeyGrab::UngrabKeyTopmost(*_win, (Dali::KEY)daliKey);
88 } catch (std::out_of_range& e) {
90 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
92 } catch (std::exception& e) {
94 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
96 } catch (Dali::DaliException e) {
98 SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
102 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
108 LOG("CSharp_Dali_UngrabKeyTopmost() [DP2] ret=%d", ret);
113 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKey(void * window, int daliKey, int grabMode)
115 Dali::Window *_win = (Dali::Window *)window;
118 LOG("CSharp_Dali_GrabKey() [DP1] window=%d, dalikey=%d, grabmode=%d", window, daliKey, grabMode);
122 ret = Dali::KeyGrab::GrabKey(*_win, (Dali::KEY)daliKey, (Dali::KeyGrab::KeyGrabMode)grabMode);
123 } catch (std::out_of_range& e) {
125 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
127 } catch (std::exception& e) {
129 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
131 } catch (Dali::DaliException e) {
133 SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
137 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
143 DALI_LOG_ERROR("CSharp_Dali_GrabKey() [DP2] ret=%d", ret);
148 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKey(void * window, int daliKey)
150 Dali::Window *_win = (Dali::Window *)window;
153 LOG("CSharp_Dali_UngrabKey() [DP1] window=%d, dalikey=%d", window, daliKey);
157 ret = Dali::KeyGrab::UngrabKey(*_win, (Dali::KEY)daliKey);
158 } catch (std::out_of_range& e) {
160 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
162 } catch (std::exception& e) {
164 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
166 } catch (Dali::DaliException e) {
168 SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
172 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
178 LOG("CSharp_Dali_UngrabKey() [DP2] ret=%d", ret);
183 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_GetNativeWindowHandler( void* window )
185 Dali::Window *_win = (Dali::Window *)window;
188 LOG("CSharp_Dali_GetNativeWindowHandler() [DP1] window=%d", window);
193 result = _win->GetNativeHandle();
195 Ecore_Wl_Window * ecore_win = Dali::AnyCast<Ecore_Wl_Window*>(result);
196 ret = (void*)ecore_win;
198 } catch (std::out_of_range& e) {
200 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return NULL;
202 } catch (std::exception& e) {
204 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return NULL;
208 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return NULL;
215 LOG("CSharp_Dali_GetNativeWindowHandler() [DP2] ret=%d", ret);