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.
28 #include <ecore-x-types.h>
36 bool GrabKeyTopmost( Window window, Dali::KEY daliKey )
38 return GrabKey( window, daliKey, TOPMOST);
41 bool UngrabKeyTopmost( Window window, Dali::KEY daliKey )
43 return UngrabKey( window, daliKey );
46 bool GrabKey( Window window, Dali::KEY daliKey, KeyGrabMode grabMode )
49 if( grabMode == TOPMOST )
51 xGrabMode = TOP_POSITION_GRAB;
53 else if( grabMode == SHARED )
55 xGrabMode = SHARED_GRAB;
57 else if( grabMode == OVERRIDE_EXCLUSIVE )
59 xGrabMode = OR_EXCLUSIVE_GRAB;
61 else if( grabMode == EXCLUSIVE )
63 xGrabMode = EXCLUSIVE_GRAB;
70 int ret = utilx_grab_key ( static_cast<Display*>( ecore_x_display_get() ),
71 static_cast<XWindow>( AnyCast<Ecore_X_Window>( window.GetNativeHandle() ) ),
72 Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ), xGrabMode );
76 bool UngrabKey( Window window, Dali::KEY daliKey )
78 int ret = utilx_ungrab_key ( static_cast<Display*>( ecore_x_display_get() ),
79 static_cast<XWindow>( AnyCast<Ecore_X_Window>( window.GetNativeHandle() ) ),
80 Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ) );
84 } // namespace KeyGrab