2 * Copyright (c) 2014 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.
29 #include <ecore-x-types.h>
37 bool GrabKeyTopmost( Window window, Dali::KEY daliKey )
39 return GrabKey( window, daliKey, TOPMOST);
42 bool UngrabKeyTopmost( Window window, Dali::KEY daliKey )
44 return UngrabKey( window, daliKey );
47 bool GrabKey( Window window, Dali::KEY daliKey, KeyGrabMode grabMode )
50 if( grabMode == TOPMOST )
52 xGrabMode = TOP_POSITION_GRAB;
54 else if( grabMode == SHARED )
56 xGrabMode = SHARED_GRAB;
58 else if( grabMode == OVERRIDE_EXCLUSIVE )
60 xGrabMode = OR_EXCLUSIVE_GRAB;
62 else if( grabMode == EXCLUSIVE )
64 xGrabMode = EXCLUSIVE_GRAB;
71 int ret = utilx_grab_key ( static_cast<Display*>( ecore_x_display_get() ),
72 static_cast<XWindow>( AnyCast<Ecore_X_Window>( window.GetNativeHandle() ) ),
73 Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ), xGrabMode );
77 bool UngrabKey( Window window, Dali::KEY daliKey )
79 int ret = utilx_ungrab_key ( static_cast<Display*>( ecore_x_display_get() ),
80 static_cast<XWindow>( AnyCast<Ecore_X_Window>( window.GetNativeHandle() ) ),
81 Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ) );
85 } // namespace KeyGrab