[Tizen] Support custom fonts registration
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl / window-base-ecore-wl.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // Ecore is littered with C style cast
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wold-style-cast"
21
22 // CLASS HEADER
23 #include <dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h>
24
25 // INTERNAL HEADERS
26 #include <dali/internal/window-system/common/window-impl.h>
27 #include <dali/internal/window-system/tizen-wayland/ecore-wl/window-render-surface-ecore-wl.h>
28 #include <dali/internal/input/common/key-impl.h>
29
30 // EXTERNAL_HEADERS
31 #include <dali/public-api/object/any.h>
32 #include <dali/integration-api/debug.h>
33
34 namespace Dali
35 {
36
37 namespace Internal
38 {
39
40 namespace Adaptor
41 {
42
43 namespace
44 {
45
46 #if defined(DEBUG_ENABLED)
47 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
48 #endif
49
50 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
51
52 /// Called when the window iconify state is changed.
53 static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
54 {
55   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
56   if( windowBase )
57   {
58     return windowBase->OnIconifyStateChanged( data, type, event );
59   }
60
61   return ECORE_CALLBACK_PASS_ON;
62 }
63
64 /// Called when the window gains focus
65 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
66 {
67   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
68   if( windowBase )
69   {
70     return windowBase->OnFocusIn( data, type, event );
71   }
72
73   return ECORE_CALLBACK_PASS_ON;
74 }
75
76 /// Called when the window loses focus
77 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
78 {
79   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
80   if( windowBase )
81   {
82     return windowBase->OnFocusOut( data, type, event );
83   }
84
85   return ECORE_CALLBACK_PASS_ON;
86 }
87
88 /// Called when the output is transformed
89 static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
90 {
91   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
92   if( windowBase )
93   {
94     return windowBase->OnOutputTransform( data, type, event );
95   }
96
97   return ECORE_CALLBACK_PASS_ON;
98 }
99
100 /// Called when the output transform should be ignored
101 static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
102 {
103   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
104   if( windowBase )
105   {
106     return windowBase->OnIgnoreOutputTransform( data, type, event );
107   }
108
109   return ECORE_CALLBACK_PASS_ON;
110 }
111
112 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
113 {
114   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
115   if( windowBase )
116   {
117     windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
118   }
119 }
120
121 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
122 {
123   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
124   if( windowBase )
125   {
126     windowBase->RegistryGlobalCallbackRemove( data, registry, id );
127   }
128 }
129
130 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
131 {
132 }
133
134 static void TizenPolicyConformantArea( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h )
135 {
136 }
137
138 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
139 {
140   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
141   if( windowBase )
142   {
143     windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
144   }
145 }
146
147 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
148 {
149 }
150
151 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
152 {
153   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
154   if( windowBase )
155   {
156     windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
157   }
158 }
159
160 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
161 {
162 }
163
164 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
165 {
166 }
167
168 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
169 {
170 }
171
172 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
173 {
174 }
175
176 static void TizenPolicyConformantRegion( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial )
177 {
178 }
179
180 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
181 {
182   WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
183   if( windowBase )
184   {
185     windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
186   }
187 }
188
189 const struct wl_registry_listener registryListener =
190 {
191    RegistryGlobalCallback,
192    RegistryGlobalCallbackRemove
193 };
194
195 const struct tizen_policy_listener tizenPolicyListener =
196 {
197    TizenPolicyConformant,
198    TizenPolicyConformantArea,
199    TizenPolicyNotificationChangeDone,
200    TizenPolicyTransientForDone,
201    TizenPolicyScreenModeChangeDone,
202    TizenPolicyIconifyStateChanged,
203    TizenPolicySupportedAuxiliaryHints,
204    TizenPolicyAllowedAuxiliaryHint,
205    TizenPolicyAuxiliaryMessage,
206    TizenPolicyConformantRegion
207 };
208
209 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
210 {
211   DisplayPolicyBrightnessChangeDone
212 };
213
214 } // unnamed namespace
215
216 WindowBaseEcoreWl::WindowBaseEcoreWl( Window* window, WindowRenderSurface* windowRenderSurface )
217 : mEcoreEventHandler(),
218   mWindow( window ),
219   mWindowSurface( NULL ),
220   mEcoreWindow( NULL ),
221   mDisplay( NULL ),
222   mEventQueue( NULL ),
223   mTizenPolicy( NULL ),
224   mTizenDisplayPolicy( NULL ),
225   mSupportedAuxiliaryHints(),
226   mAuxiliaryHints(),
227   mNotificationLevel( -1 ),
228   mNotificationChangeState( 0 ),
229   mNotificationLevelChangeDone( true ),
230   mScreenOffMode( 0 ),
231   mScreenOffModeChangeState( 0 ),
232   mScreenOffModeChangeDone( true ),
233   mBrightness( 0 ),
234   mBrightnessChangeState( 0 ),
235   mBrightnessChangeDone( true )
236 {
237   mWindowSurface = dynamic_cast< WindowRenderSurfaceEcoreWl* >( windowRenderSurface );
238 }
239
240 WindowBaseEcoreWl::~WindowBaseEcoreWl()
241 {
242   for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
243   {
244     ecore_event_handler_del( *iter );
245   }
246   mEcoreEventHandler.Clear();
247
248   if( mEventQueue )
249   {
250     wl_event_queue_destroy( mEventQueue );
251   }
252
253   mSupportedAuxiliaryHints.clear();
254   mAuxiliaryHints.clear();
255 }
256
257 void WindowBaseEcoreWl::Initialize()
258 {
259   if( !mWindowSurface )
260   {
261     DALI_ASSERT_ALWAYS( "Invalid window surface" );
262   }
263
264   mEcoreWindow = mWindowSurface->GetWlWindow();
265   DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no EcoreWl window" );
266
267   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
268   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
269   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
270   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this) );
271   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this) );
272
273   mDisplay = ecore_wl_display_get();
274
275   if( mDisplay )
276   {
277     wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
278     if( displayWrapper )
279     {
280       mEventQueue = wl_display_create_queue( mDisplay );
281       if( mEventQueue )
282       {
283         wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
284
285         wl_registry* registry = wl_display_get_registry( displayWrapper );
286         wl_registry_add_listener( registry, &registryListener, this );
287       }
288
289       wl_proxy_wrapper_destroy( displayWrapper );
290     }
291   }
292
293   // get auxiliary hint
294   Eina_List* hints = ecore_wl_window_aux_hints_supported_get( mEcoreWindow );
295   if( hints )
296   {
297     Eina_List* l = NULL;
298     char* hint = NULL;
299
300     for( l = hints, ( hint =  static_cast< char* >( eina_list_data_get(l) ) ); l; l = eina_list_next(l), ( hint = static_cast< char* >( eina_list_data_get(l) ) ) )
301     {
302       mSupportedAuxiliaryHints.push_back( hint );
303
304       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::Initialize: %s\n", hint );
305     }
306   }
307 }
308
309 Eina_Bool WindowBaseEcoreWl::OnIconifyStateChanged( void* data, int type, void* event )
310 {
311   Ecore_Wl_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl_Event_Window_Iconify_State_Change* >( event ) );
312   Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
313
314   if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl_window_id_get( mEcoreWindow ) ) )
315   {
316     if( iconifyChangedEvent->iconified == EINA_TRUE )
317     {
318       mWindow->OnIconifyChanged( true );
319     }
320     else
321     {
322       mWindow->OnIconifyChanged( false );
323     }
324     handled = ECORE_CALLBACK_DONE;
325   }
326
327   return handled;
328 }
329
330 Eina_Bool WindowBaseEcoreWl::OnFocusIn( void* data, int type, void* event )
331 {
332   Ecore_Wl_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl_Event_Focus_In* >( event ) );
333
334   if( focusInEvent->win == static_cast< unsigned int >( ecore_wl_window_id_get( mEcoreWindow ) ) )
335   {
336     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
337
338     mWindow->OnFocusChanged( true );
339   }
340
341   return ECORE_CALLBACK_PASS_ON;
342 }
343
344 Eina_Bool WindowBaseEcoreWl::OnFocusOut( void* data, int type, void* event )
345 {
346   Ecore_Wl_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl_Event_Focus_Out* >( event ) );
347
348   if( focusOutEvent->win == static_cast< unsigned int >( ecore_wl_window_id_get( mEcoreWindow ) ) )
349   {
350     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
351
352     mWindow->OnFocusChanged( false );
353   }
354
355   return ECORE_CALLBACK_PASS_ON;
356 }
357
358 Eina_Bool WindowBaseEcoreWl::OnOutputTransform( void* data, int type, void* event )
359 {
360   Ecore_Wl_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl_Event_Output_Transform* >( event ) );
361
362   if( transformEvent->output == ecore_wl_window_output_find( mEcoreWindow ) )
363   {
364     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
365
366     mWindowSurface->OutputTransformed();
367
368     mWindow->OnOutputTransformed();
369   }
370
371   return ECORE_CALLBACK_PASS_ON;
372 }
373
374 Eina_Bool WindowBaseEcoreWl::OnIgnoreOutputTransform( void* data, int type, void* event )
375 {
376   Ecore_Wl_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl_Event_Ignore_Output_Transform* >( event ) );
377
378   if( ignoreTransformEvent->win == mEcoreWindow )
379   {
380     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
381
382     mWindowSurface->OutputTransformed();
383
384     mWindow->OnOutputTransformed();
385   }
386
387   return ECORE_CALLBACK_PASS_ON;
388 }
389
390 void WindowBaseEcoreWl::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
391 {
392   if( strcmp( interface, tizen_policy_interface.name ) == 0 )
393   {
394     uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
395
396     mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
397     if( !mTizenPolicy )
398     {
399       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
400       return;
401     }
402
403     tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
404
405     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
406   }
407   else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
408   {
409     mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
410     if( !mTizenDisplayPolicy )
411     {
412       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
413       return;
414     }
415
416     tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
417
418     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
419   }
420 }
421
422 void WindowBaseEcoreWl::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
423 {
424   mTizenPolicy = NULL;
425   mTizenDisplayPolicy = NULL;
426 }
427
428 void WindowBaseEcoreWl::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
429 {
430   mNotificationLevel = level;
431   mNotificationChangeState = state;
432   mNotificationLevelChangeDone = true;
433
434   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
435 }
436
437 void WindowBaseEcoreWl::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
438 {
439   mScreenOffMode = mode;
440   mScreenOffModeChangeState = state;
441   mScreenOffModeChangeDone = true;
442
443   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
444 }
445
446 void WindowBaseEcoreWl::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
447 {
448   mBrightness = brightness;
449   mBrightnessChangeState = state;
450   mBrightnessChangeDone = true;
451
452   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
453 }
454
455 void WindowBaseEcoreWl::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
456 {
457   DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
458
459   if( visibleMode == Dali::Window::VISIBLE )
460   {
461     // when the indicator is visible, set proper mode for indicator server according to bg mode
462     if( opacityMode == Dali::Window::OPAQUE )
463     {
464       ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_OPAQUE );
465     }
466     else if( opacityMode == Dali::Window::TRANSLUCENT )
467     {
468       ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_TRANSLUCENT );
469     }
470     else if( opacityMode == Dali::Window::TRANSPARENT )
471     {
472       ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_OPAQUE );
473     }
474   }
475   else
476   {
477     // when the indicator is not visible, set TRANSPARENT mode for indicator server
478     ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_TRANSPARENT); // it means hidden indicator
479   }
480 }
481
482 void WindowBaseEcoreWl::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
483 {
484   if( isShow )
485   {
486     ecore_wl_window_indicator_state_set( mEcoreWindow, ECORE_WL_INDICATOR_STATE_ON );
487   }
488   else
489   {
490     ecore_wl_window_indicator_state_set( mEcoreWindow, ECORE_WL_INDICATOR_STATE_OFF );
491   }
492 }
493
494 void WindowBaseEcoreWl::IndicatorTypeChanged( IndicatorInterface::Type type )
495 {
496 #if defined(DALI_PROFILE_MOBILE)
497   switch( type )
498   {
499     case IndicatorInterface::INDICATOR_TYPE_1:
500     {
501       ecore_wl_indicator_visible_type_set( mEcoreWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN );
502       break;
503     }
504     case IndicatorInterface::INDICATOR_TYPE_2:
505     {
506       ecore_wl_indicator_visible_type_set( mEcoreWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN );
507       break;
508     }
509     case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
510     default:
511     {
512       break;
513     }
514   }
515 #endif //MOBILE
516 }
517
518 void WindowBaseEcoreWl::SetClass( std::string name, std::string className )
519 {
520   ecore_wl_window_title_set( mEcoreWindow, name.c_str() );
521   ecore_wl_window_class_name_set( mEcoreWindow, className.c_str() );
522 }
523
524 void WindowBaseEcoreWl::Raise()
525 {
526   // Use ecore_wl_window_activate to prevent the window shown without rendering
527   ecore_wl_window_activate( mEcoreWindow );
528 }
529
530 void WindowBaseEcoreWl::Lower()
531 {
532   ecore_wl_window_lower( mEcoreWindow );
533 }
534
535 void WindowBaseEcoreWl::Activate()
536 {
537   ecore_wl_window_activate( mEcoreWindow );
538 }
539
540 void WindowBaseEcoreWl::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
541 {
542   int rotations[4] = { 0 };
543   for( std::size_t i = 0; i < orientations.size(); ++i )
544   {
545     rotations[i] = static_cast< int >( orientations[i] );
546   }
547   ecore_wl_window_rotation_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
548 }
549
550 void WindowBaseEcoreWl::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
551 {
552   ecore_wl_window_rotation_preferred_rotation_set( mEcoreWindow, orientation );
553 }
554
555 void WindowBaseEcoreWl::SetAcceptFocus( bool accept )
556 {
557   ecore_wl_window_focus_skip_set( mEcoreWindow, !accept );
558 }
559
560 void WindowBaseEcoreWl::Show()
561 {
562   ecore_wl_window_show( mEcoreWindow );
563 }
564
565 void WindowBaseEcoreWl::Hide()
566 {
567   ecore_wl_window_hide( mEcoreWindow );
568 }
569
570 unsigned int WindowBaseEcoreWl::GetSupportedAuxiliaryHintCount() const
571 {
572   return mSupportedAuxiliaryHints.size();
573 }
574
575 std::string WindowBaseEcoreWl::GetSupportedAuxiliaryHint( unsigned int index ) const
576 {
577   if( index >= GetSupportedAuxiliaryHintCount() )
578   {
579     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
580   }
581
582   return mSupportedAuxiliaryHints[index];
583 }
584
585 unsigned int WindowBaseEcoreWl::AddAuxiliaryHint( const std::string& hint, const std::string& value )
586 {
587   bool supported = false;
588
589   // Check if the hint is suppported
590   for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
591   {
592     if( *iter == hint )
593     {
594       supported = true;
595       break;
596     }
597   }
598
599   if( !supported )
600   {
601     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
602     return 0;
603   }
604
605   // Check if the hint is already added
606   for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
607   {
608     if( mAuxiliaryHints[i].first == hint )
609     {
610       // Just change the value
611       mAuxiliaryHints[i].second = value;
612
613       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
614
615       return i + 1;   // id is index + 1
616     }
617   }
618
619   // Add the hint
620   mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
621
622   unsigned int id = mAuxiliaryHints.size();
623
624   ecore_wl_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
625
626   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
627
628   return id;
629 }
630
631 bool WindowBaseEcoreWl::RemoveAuxiliaryHint( unsigned int id )
632 {
633   if( id == 0 || id > mAuxiliaryHints.size() )
634   {
635     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
636     return false;
637   }
638
639   mAuxiliaryHints[id - 1].second = std::string();
640
641   ecore_wl_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
642
643   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
644
645   return true;
646 }
647
648 bool WindowBaseEcoreWl::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
649 {
650   if( id == 0 || id > mAuxiliaryHints.size() )
651   {
652     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
653     return false;
654   }
655
656   mAuxiliaryHints[id - 1].second = value;
657
658   ecore_wl_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
659
660   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
661
662   return true;
663 }
664
665 std::string WindowBaseEcoreWl::GetAuxiliaryHintValue( unsigned int id ) const
666 {
667   if( id == 0 || id > mAuxiliaryHints.size() )
668   {
669     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
670     return std::string();
671   }
672
673   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
674
675   return mAuxiliaryHints[id - 1].second;
676 }
677
678 unsigned int WindowBaseEcoreWl::GetAuxiliaryHintId( const std::string& hint ) const
679 {
680   for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
681   {
682     if( mAuxiliaryHints[i].first == hint )
683     {
684       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
685       return i + 1;
686     }
687   }
688
689   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
690
691   return 0;
692 }
693
694 void WindowBaseEcoreWl::SetInputRegion( const Rect< int >& inputRegion )
695 {
696   ecore_wl_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
697 }
698
699 void WindowBaseEcoreWl::SetType( Dali::Window::Type type )
700 {
701   Ecore_Wl_Window_Type windowType;
702
703   switch( type )
704   {
705     case Dali::Window::NORMAL:
706     {
707       windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
708       break;
709     }
710     case Dali::Window::NOTIFICATION:
711     {
712       windowType = ECORE_WL_WINDOW_TYPE_NOTIFICATION;
713       break;
714     }
715     case Dali::Window::UTILITY:
716     {
717       windowType = ECORE_WL_WINDOW_TYPE_UTILITY;
718       break;
719     }
720     case Dali::Window::DIALOG:
721     {
722       windowType = ECORE_WL_WINDOW_TYPE_DIALOG;
723       break;
724     }
725     default:
726     {
727       windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
728       break;
729     }
730   }
731
732   ecore_wl_window_type_set( mEcoreWindow, windowType );
733 }
734
735 bool WindowBaseEcoreWl::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
736 {
737   while( !mTizenPolicy )
738   {
739     wl_display_dispatch_queue( mDisplay, mEventQueue );
740   }
741
742   int notificationLevel;
743
744   switch( level )
745   {
746     case Dali::Window::NotificationLevel::NONE:
747     {
748       notificationLevel = TIZEN_POLICY_LEVEL_NONE;
749       break;
750     }
751     case Dali::Window::NotificationLevel::BASE:
752     {
753       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
754       break;
755     }
756     case Dali::Window::NotificationLevel::MEDIUM:
757     {
758       notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
759       break;
760     }
761     case Dali::Window::NotificationLevel::HIGH:
762     {
763       notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
764       break;
765     }
766     case Dali::Window::NotificationLevel::TOP:
767     {
768       notificationLevel = TIZEN_POLICY_LEVEL_TOP;
769       break;
770     }
771     default:
772     {
773       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: invalid level [%d]\n", level );
774       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
775       break;
776     }
777   }
778
779   mNotificationLevelChangeDone = false;
780   mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
781
782   tizen_policy_set_notification_level( mTizenPolicy, ecore_wl_window_surface_get( mEcoreWindow ), notificationLevel );
783
784   int count = 0;
785
786   while( !mNotificationLevelChangeDone && count < 3 )
787   {
788     ecore_wl_flush();
789     wl_display_dispatch_queue( mDisplay, mEventQueue );
790     count++;
791   }
792
793   if( !mNotificationLevelChangeDone )
794   {
795     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
796     return false;
797   }
798   else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
799   {
800     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Permission denied! [%d]\n", level );
801     return false;
802   }
803
804   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
805
806   return true;
807 }
808
809 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl::GetNotificationLevel() const
810 {
811   while( !mTizenPolicy )
812   {
813     wl_display_dispatch_queue( mDisplay, mEventQueue );
814   }
815
816   int count = 0;
817
818   while( !mNotificationLevelChangeDone && count < 3 )
819   {
820     ecore_wl_flush();
821     wl_display_dispatch_queue( mDisplay, mEventQueue );
822     count++;
823   }
824
825   if( !mNotificationLevelChangeDone )
826   {
827     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
828     return Dali::Window::NotificationLevel::NONE;
829   }
830
831   Dali::Window::NotificationLevel::Type level;
832
833   switch( mNotificationLevel )
834   {
835     case TIZEN_POLICY_LEVEL_NONE:
836     {
837       level = Dali::Window::NotificationLevel::NONE;
838       break;
839     }
840     case TIZEN_POLICY_LEVEL_DEFAULT:
841     {
842       level = Dali::Window::NotificationLevel::BASE;
843       break;
844     }
845     case TIZEN_POLICY_LEVEL_MEDIUM:
846     {
847       level = Dali::Window::NotificationLevel::MEDIUM;
848       break;
849     }
850     case TIZEN_POLICY_LEVEL_HIGH:
851     {
852       level = Dali::Window::NotificationLevel::HIGH;
853       break;
854     }
855     case TIZEN_POLICY_LEVEL_TOP:
856     {
857       level = Dali::Window::NotificationLevel::TOP;
858       break;
859     }
860     default:
861     {
862       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
863       level = Dali::Window::NotificationLevel::NONE;
864       break;
865     }
866   }
867
868   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetNotificationLevel: level [%d]\n", mNotificationLevel );
869
870   return level;
871 }
872
873 void WindowBaseEcoreWl::SetOpaqueState( bool opaque )
874 {
875   while( !mTizenPolicy )
876   {
877     wl_display_dispatch_queue( mDisplay, mEventQueue );
878   }
879
880   tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
881 }
882
883 bool WindowBaseEcoreWl::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
884 {
885   while( !mTizenPolicy )
886   {
887     wl_display_dispatch_queue( mDisplay, mEventQueue );
888   }
889
890   mScreenOffModeChangeDone = false;
891   mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
892
893   unsigned int mode = 0;
894
895   switch( screenOffMode )
896   {
897     case Dali::Window::ScreenOffMode::TIMEOUT:
898     {
899       mode = 0;
900       break;
901     }
902     case Dali::Window::ScreenOffMode::NEVER:
903     {
904       mode = 1;
905       break;
906     }
907   }
908
909   tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl_window_surface_get( mEcoreWindow ), mode );
910
911   int count = 0;
912
913   while( !mScreenOffModeChangeDone && count < 3 )
914   {
915     ecore_wl_flush();
916     wl_display_dispatch_queue( mDisplay, mEventQueue );
917     count++;
918   }
919
920   if( !mScreenOffModeChangeDone )
921   {
922     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
923     return false;
924   }
925   else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
926   {
927     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
928     return false;
929   }
930
931   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
932
933   return true;
934 }
935
936 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl::GetScreenOffMode() const
937 {
938   while( !mTizenPolicy )
939   {
940     wl_display_dispatch_queue( mDisplay, mEventQueue );
941   }
942
943   int count = 0;
944
945   while( !mScreenOffModeChangeDone && count < 3 )
946   {
947     ecore_wl_flush();
948     wl_display_dispatch_queue( mDisplay, mEventQueue );
949     count++;
950   }
951
952   if( !mScreenOffModeChangeDone )
953   {
954     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
955     return Dali::Window::ScreenOffMode::TIMEOUT;
956   }
957
958   Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
959
960   switch( mScreenOffMode )
961   {
962     case 0:
963     {
964       screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
965       break;
966     }
967     case 1:
968     {
969       screenMode = Dali::Window::ScreenOffMode::NEVER;
970       break;
971     }
972   }
973
974   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
975
976   return screenMode;
977 }
978
979 bool WindowBaseEcoreWl::SetBrightness( int brightness )
980 {
981   while( !mTizenDisplayPolicy )
982   {
983     wl_display_dispatch_queue( mDisplay, mEventQueue );
984   }
985
986   mBrightnessChangeDone = false;
987   mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
988
989   tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl_window_surface_get( mEcoreWindow ), brightness );
990
991   int count = 0;
992
993   while( !mBrightnessChangeDone && count < 3 )
994   {
995     ecore_wl_flush();
996     wl_display_dispatch_queue( mDisplay, mEventQueue );
997     count++;
998   }
999
1000   if( !mBrightnessChangeDone )
1001   {
1002     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
1003     return false;
1004   }
1005   else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1006   {
1007     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Permission denied! [%d]\n", brightness );
1008     return false;
1009   }
1010
1011   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Brightness is changed [%d]\n", mBrightness );
1012
1013   return true;
1014 }
1015
1016 int WindowBaseEcoreWl::GetBrightness() const
1017 {
1018   while( !mTizenDisplayPolicy )
1019   {
1020     wl_display_dispatch_queue( mDisplay, mEventQueue );
1021   }
1022
1023   int count = 0;
1024
1025   while( !mBrightnessChangeDone && count < 3 )
1026   {
1027     ecore_wl_flush();
1028     wl_display_dispatch_queue( mDisplay, mEventQueue );
1029     count++;
1030   }
1031
1032   if( !mBrightnessChangeDone )
1033   {
1034     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
1035     return 0;
1036   }
1037
1038   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetBrightness: Brightness [%d]\n", mBrightness );
1039
1040   return mBrightness;
1041 }
1042
1043 bool WindowBaseEcoreWl::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
1044 {
1045   Ecore_Wl_Window_Keygrab_Mode mode;
1046
1047   switch( grabMode )
1048   {
1049     case KeyGrab::TOPMOST:
1050     {
1051       mode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST;
1052       break;
1053     }
1054     case KeyGrab::SHARED:
1055     {
1056       mode = ECORE_WL_WINDOW_KEYGRAB_SHARED;
1057       break;
1058     }
1059     case KeyGrab::OVERRIDE_EXCLUSIVE:
1060     {
1061       mode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1062       break;
1063     }
1064     case KeyGrab::EXCLUSIVE:
1065     {
1066       mode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE;
1067       break;
1068     }
1069     default:
1070     {
1071       return false;
1072     }
1073   }
1074
1075   return ecore_wl_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
1076 }
1077
1078 bool WindowBaseEcoreWl::UngrabKey( Dali::KEY key )
1079 {
1080   return ecore_wl_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
1081 }
1082
1083 bool WindowBaseEcoreWl::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
1084 {
1085   int keyCount = key.Count();
1086   int keyGrabModeCount = grabMode.Count();
1087
1088   if( keyCount != keyGrabModeCount || keyCount == 0 )
1089   {
1090     return false;
1091   }
1092
1093   eina_init();
1094
1095   Eina_List* keyList = NULL;
1096   Ecore_Wl_Window_Keygrab_Info* info = new Ecore_Wl_Window_Keygrab_Info[keyCount];
1097
1098   for( int index = 0; index < keyCount; ++index )
1099   {
1100     info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
1101
1102     switch( grabMode[index] )
1103     {
1104       case KeyGrab::TOPMOST:
1105       {
1106         info[index].mode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST;
1107         break;
1108       }
1109       case KeyGrab::SHARED:
1110       {
1111         info[index].mode = ECORE_WL_WINDOW_KEYGRAB_SHARED;
1112         break;
1113       }
1114       case KeyGrab::OVERRIDE_EXCLUSIVE:
1115       {
1116         info[index].mode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1117         break;
1118       }
1119       case KeyGrab::EXCLUSIVE:
1120       {
1121         info[index].mode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE;
1122         break;
1123       }
1124       default:
1125       {
1126         info[index].mode = ECORE_WL_WINDOW_KEYGRAB_UNKNOWN;
1127         break;
1128       }
1129     }
1130
1131     keyList = eina_list_append( keyList, &info );
1132   }
1133
1134   Eina_List* grabList = ecore_wl_window_keygrab_list_set( mEcoreWindow, keyList );
1135
1136   result.Resize( keyCount, true );
1137
1138   Eina_List* l = NULL;
1139   Eina_List* m = NULL;
1140   void* listData = NULL;
1141   void* data = NULL;
1142   if( grabList != NULL )
1143   {
1144     EINA_LIST_FOREACH( grabList, m, data )
1145     {
1146       int index = 0;
1147       EINA_LIST_FOREACH( keyList, l, listData )
1148       {
1149         if( static_cast< Ecore_Wl_Window_Keygrab_Info* >( listData )->key == NULL )
1150         {
1151           DALI_LOG_ERROR( "input key list has null data!" );
1152           break;
1153         }
1154
1155         if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl_Window_Keygrab_Info* >( listData )->key ) == 0 )
1156         {
1157           result[index] = false;
1158         }
1159         ++index;
1160       }
1161     }
1162   }
1163
1164   delete [] info;
1165
1166   eina_list_free( keyList );
1167   eina_list_free( grabList );
1168   eina_shutdown();
1169
1170   return true;
1171 }
1172
1173 bool WindowBaseEcoreWl::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
1174 {
1175   int keyCount = key.Count();
1176   if( keyCount == 0 )
1177   {
1178     return false;
1179   }
1180
1181   eina_init();
1182
1183   Eina_List* keyList = NULL;
1184   Ecore_Wl_Window_Keygrab_Info* info = new Ecore_Wl_Window_Keygrab_Info[keyCount];
1185
1186   for( int index = 0; index < keyCount; ++index )
1187   {
1188     info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
1189     keyList = eina_list_append( keyList, &info );
1190   }
1191
1192   Eina_List* ungrabList = ecore_wl_window_keygrab_list_unset( mEcoreWindow, keyList );
1193
1194   result.Resize( keyCount, true );
1195
1196   Eina_List* l = NULL;
1197   Eina_List* m = NULL;
1198   void *listData = NULL;
1199   void *data = NULL;
1200
1201   if( ungrabList != NULL )
1202   {
1203     EINA_LIST_FOREACH( ungrabList, m, data )
1204     {
1205       int index = 0;
1206       EINA_LIST_FOREACH( keyList, l, listData )
1207       {
1208         if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl_Window_Keygrab_Info* >( listData )->key ) == 0 )
1209         {
1210           result[index] = false;
1211         }
1212         ++index;
1213       }
1214     }
1215   }
1216
1217   delete [] info;
1218
1219   eina_list_free( keyList );
1220   eina_list_free( ungrabList );
1221   eina_shutdown();
1222
1223   return true;
1224 }
1225
1226 } // namespace Adaptor
1227
1228 } // namespace Internal
1229
1230 } // namespace Dali
1231
1232 #pragma GCC diagnostic pop