2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <Ecore_Wayland.h>
23 #include <dali/integration-api/debug.h>
38 bool GrabKeyTopmost( Window window, Dali::KEY daliKey )
40 return GrabKey( window, daliKey, TOPMOST);
43 bool UngrabKeyTopmost( Window window, Dali::KEY daliKey )
45 return UngrabKey( window, daliKey );
48 bool GrabKey( Window window, Dali::KEY daliKey, KeyGrabMode grabMode )
50 Ecore_Wl_Window_Keygrab_Mode wlGrabMode;
51 if( grabMode == TOPMOST )
53 wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST;
55 else if( grabMode == SHARED )
57 wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_SHARED;
59 else if( grabMode == OVERRIDE_EXCLUSIVE )
61 wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE;
63 else if( grabMode == EXCLUSIVE )
65 wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
72 return ecore_wl_window_keygrab_set( AnyCast<Ecore_Wl_Window*>( window.GetNativeHandle() ),
73 Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ),
74 0, 0, 0, wlGrabMode );
77 bool UngrabKey( Window window, Dali::KEY daliKey )
79 return ecore_wl_window_keygrab_unset( AnyCast<Ecore_Wl_Window*>( window.GetNativeHandle() ),
80 Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ),
84 } // namespace KeyGrab