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/integration-api/debug.h>
20 #include <dali/public-api/adaptor-framework/key-grab.h>
21 #include <dali/devel-api/adaptor-framework/window-devel.h>
24 #include <Ecore_Wayland.h>
28 //#define LOG DALI_LOG_ERROR
36 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKeyTopmost(void * window, int daliKey)
38 Dali::Window *_win = (Dali::Window *)window;
41 LOG("CSharp_Dali_GrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
45 ret = Dali::KeyGrab::GrabKeyTopmost(*_win, (Dali::KEY)daliKey);
46 } catch (std::out_of_range& e) {
48 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
50 } catch (std::exception& e) {
52 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
56 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
61 LOG("CSharp_Dali_GrabKeyTopmost() [DP2] ret=%d", ret);
66 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKeyTopmost(void * window, int daliKey)
68 Dali::Window *_win = (Dali::Window *)window;
71 LOG("CSharp_Dali_UngrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
75 ret = Dali::KeyGrab::UngrabKeyTopmost(*_win, (Dali::KEY)daliKey);
76 } catch (std::out_of_range& e) {
78 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
80 } catch (std::exception& e) {
82 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
86 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
91 LOG("CSharp_Dali_UngrabKeyTopmost() [DP2] ret=%d", ret);
96 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKey(void * window, int daliKey, int grabMode)
98 Dali::Window *_win = (Dali::Window *)window;
101 LOG("CSharp_Dali_GrabKey() [DP1] window=%d, dalikey=%d, grabmode=%d", window, daliKey, grabMode);
105 ret = Dali::KeyGrab::GrabKey(*_win, (Dali::KEY)daliKey, (Dali::KeyGrab::KeyGrabMode)grabMode);
106 } catch (std::out_of_range& e) {
108 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
110 } catch (std::exception& e) {
112 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
116 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
121 DALI_LOG_ERROR("CSharp_Dali_GrabKey() [DP2] ret=%d", ret);
126 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKey(void * window, int daliKey)
128 Dali::Window *_win = (Dali::Window *)window;
131 LOG("CSharp_Dali_UngrabKey() [DP1] window=%d, dalikey=%d", window, daliKey);
135 ret = Dali::KeyGrab::UngrabKey(*_win, (Dali::KEY)daliKey);
136 } catch (std::out_of_range& e) {
138 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
140 } catch (std::exception& e) {
142 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
146 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
151 LOG("CSharp_Dali_UngrabKey() [DP2] ret=%d", ret);
156 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_GetNativeWindowHandler( void* window )
158 Dali::Window *_win = (Dali::Window *)window;
161 LOG("CSharp_Dali_GetNativeWindowHandler() [DP1] window=%d", window);
166 result = _win->GetNativeHandle();
168 Ecore_Wl_Window * ecore_win = Dali::AnyCast<Ecore_Wl_Window*>(result);
169 ret = (void*)ecore_win;
171 } catch (std::out_of_range& e) {
173 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return NULL;
175 } catch (std::exception& e) {
177 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return NULL;
181 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return NULL;
188 LOG("CSharp_Dali_GetNativeWindowHandler() [DP2] ret=%d", ret);