Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
1 /*
2  * Copyright (c) 2019 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-wl2/window-base-ecore-wl2.h>
24
25 // INTERNAL HEADERS
26 #include <dali/internal/window-system/common/window-impl.h>
27 #include <dali/internal/window-system/common/window-system.h>
28 #include <dali/internal/window-system/common/window-render-surface.h>
29 #include <dali/internal/input/common/key-impl.h>
30
31 // EXTERNAL_HEADERS
32 #include <dali/public-api/object/any.h>
33 #include <dali/public-api/events/mouse-button.h>
34 #include <dali/integration-api/debug.h>
35 #include <Ecore_Input.h>
36 #include <vconf.h>
37 #include <vconf-keys.h>
38 #include <wayland-egl-tizen.h>
39
40 namespace Dali
41 {
42
43 namespace Internal
44 {
45
46 namespace Adaptor
47 {
48
49 namespace
50 {
51
52 #if defined(DEBUG_ENABLED)
53 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
54 #endif
55
56 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
57 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
58
59 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name";  // It will be update at vconf-key.h and replaced.
60
61 // DBUS accessibility
62 const char* BUS = "org.enlightenment.wm-screen-reader";
63 const char* INTERFACE = "org.tizen.GestureNavigation";
64 const char* PATH = "/org/tizen/GestureNavigation";
65
66 struct KeyCodeMap
67 {
68   xkb_keysym_t keySym;
69   xkb_keycode_t keyCode;
70   bool isKeyCode;
71 };
72
73 /**
74  * Get the device name from the provided ecore key event
75  */
76 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
77 {
78   const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
79
80   if( ecoreDeviceName )
81   {
82     result = ecoreDeviceName;
83   }
84 }
85
86 /**
87  * Get the device class from the provided ecore event
88  */
89 void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass )
90 {
91   switch( ecoreDeviceClass )
92   {
93     case ECORE_DEVICE_CLASS_SEAT:
94     {
95       deviceClass = Device::Class::USER;
96       break;
97     }
98     case ECORE_DEVICE_CLASS_KEYBOARD:
99     {
100       deviceClass = Device::Class::KEYBOARD;
101       break;
102     }
103     case ECORE_DEVICE_CLASS_MOUSE:
104     {
105       deviceClass = Device::Class::MOUSE;
106       break;
107     }
108     case ECORE_DEVICE_CLASS_TOUCH:
109     {
110       deviceClass = Device::Class::TOUCH;
111       break;
112     }
113     case ECORE_DEVICE_CLASS_PEN:
114     {
115       deviceClass = Device::Class::PEN;
116       break;
117     }
118     case ECORE_DEVICE_CLASS_POINTER:
119     {
120       deviceClass = Device::Class::POINTER;
121       break;
122     }
123     case ECORE_DEVICE_CLASS_GAMEPAD:
124     {
125       deviceClass = Device::Class::GAMEPAD;
126       break;
127     }
128     default:
129     {
130       deviceClass = Device::Class::NONE;
131       break;
132     }
133   }
134 }
135
136 void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass )
137 {
138   switch( ecoreDeviceSubclass )
139   {
140     case ECORE_DEVICE_SUBCLASS_FINGER:
141     {
142       deviceSubclass = Device::Subclass::FINGER;
143       break;
144     }
145     case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
146     {
147       deviceSubclass = Device::Subclass::FINGERNAIL;
148       break;
149     }
150     case ECORE_DEVICE_SUBCLASS_KNUCKLE:
151     {
152       deviceSubclass = Device::Subclass::KNUCKLE;
153       break;
154     }
155     case ECORE_DEVICE_SUBCLASS_PALM:
156     {
157       deviceSubclass = Device::Subclass::PALM;
158       break;
159     }
160     case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
161     {
162       deviceSubclass = Device::Subclass::HAND_SIDE;
163       break;
164     }
165     case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
166     {
167       deviceSubclass = Device::Subclass::HAND_FLAT;
168       break;
169     }
170     case ECORE_DEVICE_SUBCLASS_PEN_TIP:
171     {
172       deviceSubclass = Device::Subclass::PEN_TIP;
173       break;
174     }
175     case ECORE_DEVICE_SUBCLASS_TRACKPAD:
176     {
177       deviceSubclass = Device::Subclass::TRACKPAD;
178       break;
179     }
180     case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
181     {
182       deviceSubclass = Device::Subclass::TRACKPOINT;
183       break;
184     }
185     case ECORE_DEVICE_SUBCLASS_TRACKBALL:
186     {
187       deviceSubclass = Device::Subclass::TRACKBALL;
188       break;
189     }
190     case ECORE_DEVICE_SUBCLASS_REMOCON:
191     {
192       deviceSubclass = Device::Subclass::REMOCON;
193       break;
194     }
195     case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
196     {
197       deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
198       break;
199     }
200     default:
201     {
202       deviceSubclass = Device::Subclass::NONE;
203       break;
204     }
205   }
206 }
207
208
209 void FindKeyCode( struct xkb_keymap* keyMap, xkb_keycode_t key, void* data )
210 {
211   KeyCodeMap* foundKeyCode = static_cast< KeyCodeMap* >( data );
212   if( foundKeyCode->isKeyCode )
213   {
214     return;
215   }
216
217   xkb_keysym_t keySym = foundKeyCode->keySym;
218   int nsyms = 0;
219   const xkb_keysym_t* symsOut = NULL;
220
221   nsyms = xkb_keymap_key_get_syms_by_level( keyMap, key, 0, 0, &symsOut );
222
223   if( nsyms && symsOut )
224   {
225     if( *symsOut == keySym )
226     {
227       foundKeyCode->keyCode = key;
228       foundKeyCode->isKeyCode = true;
229     }
230   }
231 }
232
233 /////////////////////////////////////////////////////////////////////////////////////////////////
234 // Window Callbacks
235 /////////////////////////////////////////////////////////////////////////////////////////////////
236
237 /// Called when the window iconify state is changed.
238 static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
239 {
240   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
241   if( windowBase )
242   {
243     return windowBase->OnIconifyStateChanged( data, type, event );
244   }
245
246   return ECORE_CALLBACK_PASS_ON;
247 }
248
249 /// Called when the window gains focus
250 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
251 {
252   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
253   if( windowBase )
254   {
255     return windowBase->OnFocusIn( data, type, event );
256   }
257
258   return ECORE_CALLBACK_PASS_ON;
259 }
260
261 /// Called when the window loses focus
262 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
263 {
264   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
265   if( windowBase )
266   {
267     return windowBase->OnFocusOut( data, type, event );
268   }
269
270   return ECORE_CALLBACK_PASS_ON;
271 }
272
273 /// Called when the output is transformed
274 static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
275 {
276   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
277   if( windowBase )
278   {
279     return windowBase->OnOutputTransform( data, type, event );
280   }
281
282   return ECORE_CALLBACK_PASS_ON;
283 }
284
285 /// Called when the output transform should be ignored
286 static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
287 {
288   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
289   if( windowBase )
290   {
291     return windowBase->OnIgnoreOutputTransform( data, type, event );
292   }
293
294   return ECORE_CALLBACK_PASS_ON;
295 }
296
297 /**
298  * Called when rotate event is recevied.
299  */
300 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
301 {
302   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
303   if( windowBase )
304   {
305     DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::EcoreEventRotate\n" );
306     windowBase->OnRotation( data, type, event );
307   }
308   return ECORE_CALLBACK_PASS_ON;
309 }
310
311 /**
312  * Called when configure event is recevied.
313  */
314 static Eina_Bool EcoreEventConfigure( void* data, int type, void* event )
315 {
316   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
317   if( windowBase )
318   {
319     windowBase->OnConfiguration( data, type, event );
320   }
321   return ECORE_CALLBACK_PASS_ON;
322 }
323
324 /////////////////////////////////////////////////////////////////////////////////////////////////
325 // Touch Callbacks
326 /////////////////////////////////////////////////////////////////////////////////////////////////
327
328 /**
329  * Called when a touch down is received.
330  */
331 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
332 {
333   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
334   if( windowBase )
335   {
336     windowBase->OnMouseButtonDown( data, type, event );
337   }
338   return ECORE_CALLBACK_PASS_ON;
339 }
340
341 /**
342  * Called when a touch up is received.
343  */
344 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
345 {
346   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
347   if( windowBase )
348   {
349     windowBase->OnMouseButtonUp( data, type, event );
350   }
351   return ECORE_CALLBACK_PASS_ON;
352 }
353
354 /**
355  * Called when a touch motion is received.
356  */
357 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
358 {
359   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
360   if( windowBase )
361   {
362     windowBase->OnMouseButtonMove( data, type, event );
363   }
364   return ECORE_CALLBACK_PASS_ON;
365 }
366
367 /**
368  * Called when a touch is canceled.
369  */
370 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
371 {
372   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
373   if( windowBase )
374   {
375     windowBase->OnMouseButtonCancel( data, type, event );
376   }
377   return ECORE_CALLBACK_PASS_ON;
378 }
379
380 /**
381  * Called when a mouse wheel is received.
382  */
383 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
384 {
385   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
386   if( windowBase )
387   {
388     windowBase->OnMouseWheel( data, type, event );
389   }
390   return ECORE_CALLBACK_PASS_ON;
391 }
392
393 /**
394  * Called when a detent rotation event is recevied.
395  */
396 static Eina_Bool EcoreEventDetentRotation( void* data, int type, void* event )
397 {
398   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
399   if( windowBase )
400   {
401     windowBase->OnDetentRotation( data, type, event );
402   }
403   return ECORE_CALLBACK_PASS_ON;
404 }
405
406 /////////////////////////////////////////////////////////////////////////////////////////////////
407 // Key Callbacks
408 /////////////////////////////////////////////////////////////////////////////////////////////////
409
410 /**
411  * Called when a key down is received.
412  */
413 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
414 {
415   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
416   if( windowBase )
417   {
418     windowBase->OnKeyDown( data, type, event );
419   }
420   return ECORE_CALLBACK_PASS_ON;
421 }
422
423 /**
424  * Called when a key up is received.
425  */
426 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
427 {
428   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
429   if( windowBase )
430   {
431     windowBase->OnKeyUp( data, type, event );
432   }
433   return ECORE_CALLBACK_PASS_ON;
434 }
435
436 /////////////////////////////////////////////////////////////////////////////////////////////////
437 // Selection Callbacks
438 /////////////////////////////////////////////////////////////////////////////////////////////////
439
440 /**
441  * Called when the source window notifies us the content in clipboard is selected.
442  */
443 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
444 {
445   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
446   if( windowBase )
447   {
448     windowBase->OnDataSend( data, type, event );
449   }
450   return ECORE_CALLBACK_PASS_ON;
451 }
452
453 /**
454 * Called when the source window sends us about the selected content.
455 * For example, when item is selected in the clipboard.
456 */
457 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
458 {
459   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
460   if( windowBase )
461   {
462     windowBase->OnDataReceive( data, type, event );
463   }
464   return ECORE_CALLBACK_PASS_ON;
465 }
466
467 /////////////////////////////////////////////////////////////////////////////////////////////////
468 // Effect Start/End Callbacks
469 /////////////////////////////////////////////////////////////////////////////////////////////////
470
471 /**
472  * Called when transition animation of the window's shown/hidden is started by window manager.
473  */
474 static Eina_Bool EcoreEventEffectStart(void *data, int type, void *event)
475 {
476   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
477   Ecore_Wl2_Event_Effect_Start *effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
478   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type );
479   if( windowBase )
480   {
481     if( effectStart->type < 3 ) // only under restack
482     {
483       windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::START, static_cast<DevelWindow::EffectType>( effectStart->type ) );
484     }
485   }
486   return ECORE_CALLBACK_PASS_ON;
487 }
488
489 /**
490  * Called when transition animation of the window's shown/hidden is ended by window manager.
491  */
492 static Eina_Bool EcoreEventEffectEnd(void *data, int type, void *event)
493 {
494   Ecore_Wl2_Event_Effect_Start *effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
495   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
496   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type );
497   if( windowBase )
498   {
499     if( effectEnd->type < 3 ) // only under restack
500     {
501       windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::END, static_cast<DevelWindow::EffectType>( effectEnd->type ) );
502     }
503   }
504   return ECORE_CALLBACK_PASS_ON;
505 }
506
507 /////////////////////////////////////////////////////////////////////////////////////////////////
508 // Keymap Changed Callbacks
509 /////////////////////////////////////////////////////////////////////////////////////////////////
510
511 static Eina_Bool EcoreEventSeatKeymapChanged(void *data, int type, void *event)
512 {
513   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
514   if( windowBase )
515   {
516     windowBase->KeymapChanged( data, type, event );
517   }
518
519   return ECORE_CALLBACK_RENEW;
520 }
521
522 /////////////////////////////////////////////////////////////////////////////////////////////////
523 // Font Callbacks
524 /////////////////////////////////////////////////////////////////////////////////////////////////
525
526 /**
527  * Called when a font name is changed.
528  */
529 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
530 {
531   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
532   if( windowBase )
533   {
534     windowBase->OnFontNameChanged();
535   }
536 }
537
538 /**
539  * Called when a font size is changed.
540  */
541 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
542 {
543   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
544   if( windowBase )
545   {
546     windowBase->OnFontSizeChanged();
547   }
548 }
549
550 /////////////////////////////////////////////////////////////////////////////////////////////////
551 // ElDBus Accessibility Callbacks
552 /////////////////////////////////////////////////////////////////////////////////////////////////
553
554 #ifdef DALI_ELDBUS_AVAILABLE
555 // Callback for Ecore ElDBus accessibility events.
556 static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
557 {
558   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
559   if( windowBase )
560   {
561     windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
562   }
563 }
564 #endif // DALI_ELDBUS_AVAILABLE
565
566 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
567 {
568   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
569   if( windowBase )
570   {
571     windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
572   }
573 }
574
575 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
576 {
577   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
578   if( windowBase )
579   {
580     windowBase->RegistryGlobalCallbackRemove( data, registry, id );
581   }
582 }
583
584 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
585 {
586 }
587
588 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 )
589 {
590 }
591
592 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
593 {
594   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
595   if( windowBase )
596   {
597     windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
598   }
599 }
600
601 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
602 {
603 }
604
605 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
606 {
607   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
608   if( windowBase )
609   {
610     windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
611   }
612 }
613
614 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
615 {
616 }
617
618 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
619 {
620 }
621
622 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
623 {
624 }
625
626 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
627 {
628 }
629
630 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 )
631 {
632 }
633
634 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
635 {
636   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
637   if( windowBase )
638   {
639     windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
640   }
641 }
642
643 const struct wl_registry_listener registryListener =
644 {
645    RegistryGlobalCallback,
646    RegistryGlobalCallbackRemove
647 };
648
649 const struct tizen_policy_listener tizenPolicyListener =
650 {
651    TizenPolicyConformant,
652    TizenPolicyConformantArea,
653    TizenPolicyNotificationChangeDone,
654    TizenPolicyTransientForDone,
655    TizenPolicyScreenModeChangeDone,
656    TizenPolicyIconifyStateChanged,
657    TizenPolicySupportedAuxiliaryHints,
658    TizenPolicyAllowedAuxiliaryHint,
659    TizenPolicyAuxiliaryMessage,
660    TizenPolicyConformantRegion
661 };
662
663 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
664 {
665   DisplayPolicyBrightnessChangeDone
666 };
667
668 } // unnamed namespace
669
670 WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
671 : mEcoreEventHandler(),
672   mEcoreWindow( NULL ),
673   mWlSurface( NULL ),
674   mEglWindow( NULL ),
675   mDisplay( NULL ),
676   mEventQueue( NULL ),
677   mTizenPolicy( NULL ),
678   mTizenDisplayPolicy( NULL ),
679   mKeyMap( NULL ),
680   mSupportedAuxiliaryHints(),
681   mAuxiliaryHints(),
682   mNotificationLevel( -1 ),
683   mNotificationChangeState( 0 ),
684   mNotificationLevelChangeDone( true ),
685   mScreenOffMode( 0 ),
686   mScreenOffModeChangeState( 0 ),
687   mScreenOffModeChangeDone( true ),
688   mBrightness( 0 ),
689   mBrightnessChangeState( 0 ),
690   mBrightnessChangeDone( true ),
691   mOwnSurface( false ),
692   mMoveResizeSerial( 0 ),
693   mLastSubmittedMoveResizeSerial( 0 )
694 #ifdef DALI_ELDBUS_AVAILABLE
695   , mSystemConnection( NULL )
696 #endif
697 {
698   Initialize( positionSize, surface, isTransparent );
699 }
700
701 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
702 {
703 #ifdef DALI_ELDBUS_AVAILABLE
704     // Close down ElDBus connections.
705     if( mSystemConnection )
706     {
707       eldbus_connection_unref( mSystemConnection );
708     }
709 #endif // DALI_ELDBUS_AVAILABLE
710
711   vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
712   vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
713
714   for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
715   {
716     ecore_event_handler_del( *iter );
717   }
718   mEcoreEventHandler.Clear();
719
720   if( mEventQueue )
721   {
722     wl_event_queue_destroy( mEventQueue );
723   }
724
725   mSupportedAuxiliaryHints.clear();
726   mAuxiliaryHints.clear();
727
728   if( mEglWindow != NULL )
729   {
730     wl_egl_window_destroy( mEglWindow );
731     mEglWindow = NULL;
732   }
733
734   if( mOwnSurface )
735   {
736     ecore_wl2_window_free( mEcoreWindow );
737
738     WindowSystem::Shutdown();
739   }
740 }
741
742 void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
743 {
744   if( surface.Empty() == false )
745   {
746     // check we have a valid type
747     DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
748
749     mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
750   }
751   else
752   {
753     // we own the surface about to created
754     WindowSystem::Initialize();
755
756     mOwnSurface = true;
757     CreateWindow( positionSize );
758   }
759
760   mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
761
762   SetTransparency( isTransparent );
763
764   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
765   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN,                    EcoreEventWindowFocusIn,             this ) );
766   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT,                   EcoreEventWindowFocusOut,            this ) );
767   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM,            EcoreEventOutputTransform,           this ) );
768   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM,     EcoreEventIgnoreOutputTransform,     this ) );
769
770   // Register Rotate event
771   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE,               EcoreEventRotate,                    this ) );
772
773   // Register Configure event
774   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_CONFIGURE,            EcoreEventConfigure,                 this ) );
775
776   // Register Touch events
777   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN,               EcoreEventMouseButtonDown,           this ) );
778   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP,                 EcoreEventMouseButtonUp,             this ) );
779   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE,                      EcoreEventMouseButtonMove,           this ) );
780   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL,             EcoreEventMouseButtonCancel,         this ) );
781
782   // Register Mouse wheel events
783   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL,                     EcoreEventMouseWheel,                this ) );
784
785   // Register Detent event
786   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE,                   EcoreEventDetentRotation,            this ) );
787
788   // Register Key events
789   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN,                        EcoreEventKeyDown,                   this ) );
790   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP,                          EcoreEventKeyUp,                     this ) );
791
792   // Register Selection event - clipboard selection
793   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND,            EcoreEventDataSend,                  this ) );
794   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY,        EcoreEventDataReceive,               this ) );
795
796   // Register Effect Start/End event
797   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_START,                EcoreEventEffectStart,               this ) );
798   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_END,                  EcoreEventEffectEnd,                 this ) );
799
800   // Register Vconf notify - font name and size
801   vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
802   vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
803
804   InitializeEcoreElDBus();
805
806   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
807   mDisplay = ecore_wl2_display_get( display );
808
809   if( mDisplay )
810   {
811     wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
812     if( displayWrapper )
813     {
814       mEventQueue = wl_display_create_queue( mDisplay );
815       if( mEventQueue )
816       {
817         wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
818
819         wl_registry* registry = wl_display_get_registry( displayWrapper );
820         wl_registry_add_listener( registry, &registryListener, this );
821       }
822
823       wl_proxy_wrapper_destroy( displayWrapper );
824     }
825   }
826
827   Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get( display );
828
829   if( ecoreWlInput )
830   {
831     mKeyMap = ecore_wl2_input_keymap_get( ecoreWlInput );
832
833     mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this ) );
834   }
835
836   // get auxiliary hint
837   Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
838   if( hints )
839   {
840     Eina_List* l = NULL;
841     char* hint = NULL;
842
843     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) ) ) )
844     {
845       mSupportedAuxiliaryHints.push_back( hint );
846
847       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
848     }
849   }
850 }
851
852 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
853 {
854   Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
855   Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
856
857   if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
858   {
859     if( iconifyChangedEvent->iconified == EINA_TRUE )
860     {
861       mIconifyChangedSignal.Emit( true );
862     }
863     else
864     {
865       mIconifyChangedSignal.Emit( false );
866     }
867     handled = ECORE_CALLBACK_DONE;
868   }
869
870   return handled;
871 }
872
873 Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
874 {
875   Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
876
877   if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
878   {
879     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
880
881     mFocusChangedSignal.Emit( true );
882   }
883
884   return ECORE_CALLBACK_PASS_ON;
885 }
886
887 Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
888 {
889   Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
890
891   if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
892   {
893     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
894
895     mFocusChangedSignal.Emit( false );
896   }
897
898   return ECORE_CALLBACK_PASS_ON;
899 }
900
901 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
902 {
903   Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
904
905   if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
906   {
907     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
908
909     mOutputTransformedSignal.Emit();
910   }
911
912   return ECORE_CALLBACK_PASS_ON;
913 }
914
915 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
916 {
917   Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
918
919   if( ignoreTransformEvent->win == mEcoreWindow )
920   {
921     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
922
923     mOutputTransformedSignal.Emit();
924   }
925
926   return ECORE_CALLBACK_PASS_ON;
927 }
928
929 void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
930 {
931   Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
932
933   if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
934   {
935     DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h );
936
937     RotationEvent rotationEvent;
938     rotationEvent.angle = ev->angle;
939     rotationEvent.winResize = 0;
940
941     if( ev->angle == 0 || ev->angle == 180 )
942     {
943       rotationEvent.width = ev->w;
944       rotationEvent.height = ev->h;
945     }
946     else
947     {
948       rotationEvent.width = ev->h;
949       rotationEvent.height = ev->w;
950     }
951
952     mRotationSignal.Emit( rotationEvent );
953   }
954 }
955
956 void WindowBaseEcoreWl2::OnConfiguration( void* data, int type, void* event )
957 {
958   Ecore_Wl2_Event_Window_Configure* ev( static_cast< Ecore_Wl2_Event_Window_Configure* >( event ) );
959
960   if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
961   {
962     // Note: To comply with the wayland protocol, Dali should make an ack_configure
963     // by calling ecore_wl2_window_commit
964     ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
965   }
966 }
967
968 void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
969 {
970   Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
971
972   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
973   {
974     Device::Class::Type deviceClass;
975     Device::Subclass::Type deviceSubclass;
976
977     GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
978     GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
979
980     PointState::Type state ( PointState::DOWN );
981
982     if( deviceClass != Device::Class::Type::MOUSE )
983     {
984       // Check if the buttons field is set and ensure it's the primary touch button.
985       // If this event was triggered by buttons other than the primary button (used for touch), then
986       // just send an interrupted event to Core.
987       if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
988       {
989         state = PointState::INTERRUPTED;
990       }
991     }
992
993     Integration::Point point;
994     point.SetDeviceId( touchEvent->multi.device );
995     point.SetState( state );
996     point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
997     point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
998     point.SetPressure( touchEvent->multi.pressure );
999     point.SetAngle( Degree( touchEvent->multi.angle ) );
1000     point.SetDeviceClass( deviceClass );
1001     point.SetDeviceSubclass( deviceSubclass );
1002     point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
1003
1004     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1005   }
1006 }
1007
1008 void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
1009 {
1010   Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
1011
1012   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1013   {
1014     Device::Class::Type deviceClass;
1015     Device::Subclass::Type deviceSubclass;
1016
1017     GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
1018     GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
1019
1020     Integration::Point point;
1021     point.SetDeviceId( touchEvent->multi.device );
1022     point.SetState( PointState::UP );
1023     point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
1024     point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
1025     point.SetPressure( touchEvent->multi.pressure );
1026     point.SetAngle( Degree( touchEvent->multi.angle ) );
1027     point.SetDeviceClass( deviceClass );
1028     point.SetDeviceSubclass( deviceSubclass );
1029     point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
1030
1031     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1032   }
1033 }
1034
1035 void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
1036 {
1037   Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
1038
1039   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1040   {
1041     Device::Class::Type deviceClass;
1042     Device::Subclass::Type deviceSubclass;
1043
1044     GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
1045     GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
1046
1047     Integration::Point point;
1048     point.SetDeviceId( touchEvent->multi.device );
1049     point.SetState( PointState::MOTION );
1050     point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
1051     point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
1052     point.SetPressure( touchEvent->multi.pressure );
1053     point.SetAngle( Degree( touchEvent->multi.angle ) );
1054     point.SetDeviceClass( deviceClass );
1055     point.SetDeviceSubclass( deviceSubclass );
1056
1057     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1058   }
1059 }
1060
1061 void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
1062 {
1063   Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
1064
1065   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1066   {
1067     Integration::Point point;
1068     point.SetDeviceId( touchEvent->multi.device );
1069     point.SetState( PointState::INTERRUPTED );
1070     point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
1071
1072     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1073
1074     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
1075   }
1076 }
1077
1078 void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
1079 {
1080   Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
1081
1082   if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1083   {
1084     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z );
1085
1086     WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
1087
1088     mWheelEventSignal.Emit( wheelEvent );
1089   }
1090 }
1091
1092 void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
1093 {
1094   Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
1095
1096   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnDetentRotation\n" );
1097
1098   int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
1099   int timeStamp = detentEvent->timestamp;
1100
1101   WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, direction, 0, Vector2( 0.0f, 0.0f ), 0, timeStamp );
1102
1103   mWheelEventSignal.Emit( wheelEvent );
1104 }
1105
1106 void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
1107 {
1108   Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1109
1110   if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1111   {
1112     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyDown\n" );
1113
1114     std::string keyName( keyEvent->keyname );
1115     std::string logicalKey( "" );
1116     std::string keyString( "" );
1117     std::string compose( "" );
1118
1119     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1120     if( keyEvent->compose )
1121     {
1122       compose = keyEvent->compose;
1123     }
1124
1125     // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1126     if( keyEvent->key )
1127     {
1128       logicalKey = keyEvent->key;
1129     }
1130
1131     int keyCode = 0;
1132     GetKeyCode( keyName, keyCode ); // Get key code dynamically.
1133
1134     if( keyCode == 0 )
1135     {
1136       // Get a specific key code from dali key look up table.
1137       keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1138     }
1139
1140     keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1141     int modifier( keyEvent->modifiers );
1142     unsigned long time = keyEvent->timestamp;
1143     if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1144     {
1145       keyCode = atoi( keyEvent->keyname + 8 );
1146     }
1147
1148     // Ensure key event string is not NULL as keys like SHIFT have a null string.
1149     if( keyEvent->string )
1150     {
1151       keyString = keyEvent->string;
1152     }
1153
1154     std::string deviceName;
1155     Device::Class::Type deviceClass;
1156     Device::Subclass::Type deviceSubclass;
1157
1158     GetDeviceName( keyEvent, deviceName );
1159     GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1160     GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1161
1162     Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
1163
1164      mKeyEventSignal.Emit( keyEvent );
1165   }
1166 }
1167
1168 void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
1169 {
1170   Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1171
1172   if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1173   {
1174     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyUp\n" );
1175
1176     std::string keyName( keyEvent->keyname );
1177     std::string logicalKey( "" );
1178     std::string keyString( "" );
1179     std::string compose( "" );
1180
1181     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1182     if( keyEvent->compose )
1183     {
1184       compose = keyEvent->compose;
1185     }
1186
1187     // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1188     if( keyEvent->key )
1189     {
1190       logicalKey = keyEvent->key;
1191     }
1192
1193     int keyCode = 0;
1194     GetKeyCode( keyName, keyCode ); // Get key code dynamically.
1195
1196     if( keyCode == 0 )
1197     {
1198       // Get a specific key code from dali key look up table.
1199       keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1200     }
1201
1202     keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1203     int modifier( keyEvent->modifiers );
1204     unsigned long time = keyEvent->timestamp;
1205     if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1206     {
1207       keyCode = atoi( keyEvent->keyname + 8 );
1208     }
1209
1210     // Ensure key event string is not NULL as keys like SHIFT have a null string.
1211     if( keyEvent->string )
1212     {
1213       keyString = keyEvent->string;
1214     }
1215
1216     std::string deviceName;
1217     Device::Class::Type deviceClass;
1218     Device::Subclass::Type deviceSubclass;
1219
1220     GetDeviceName( keyEvent, deviceName );
1221     GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1222     GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1223
1224     Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
1225
1226      mKeyEventSignal.Emit( keyEvent );
1227   }
1228 }
1229
1230 void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
1231 {
1232   mSelectionDataSendSignal.Emit( event );
1233 }
1234
1235 void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
1236 {
1237   mSelectionDataReceivedSignal.Emit( event  );
1238 }
1239
1240 void WindowBaseEcoreWl2::OnFontNameChanged()
1241 {
1242   mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
1243 }
1244
1245 void WindowBaseEcoreWl2::OnFontSizeChanged()
1246 {
1247   mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1248 }
1249
1250 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
1251 {
1252 #ifdef DALI_ELDBUS_AVAILABLE
1253   AccessibilityInfo info;
1254
1255   // The string defines the arg-list's respective types.
1256   if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
1257   {
1258     DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
1259   }
1260
1261   mAccessibilitySignal.Emit( info );
1262 #endif
1263 }
1264
1265 void WindowBaseEcoreWl2::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
1266 {
1267   mTransitionEffectEventSignal.Emit( state, type );
1268 }
1269
1270 void WindowBaseEcoreWl2::KeymapChanged(void *data, int type, void *event)
1271 {
1272   Ecore_Wl2_Event_Seat_Keymap_Changed *changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>( event );
1273   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id );
1274   Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get( changed->display );
1275   if( ecoreWlInput )
1276   {
1277     mKeyMap = ecore_wl2_input_keymap_get( ecoreWlInput );
1278   }
1279 }
1280
1281 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
1282 {
1283   if( strcmp( interface, tizen_policy_interface.name ) == 0 )
1284   {
1285     uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
1286
1287     mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
1288     if( !mTizenPolicy )
1289     {
1290       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
1291       return;
1292     }
1293
1294     tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
1295
1296     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
1297   }
1298   else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
1299   {
1300     mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
1301     if( !mTizenDisplayPolicy )
1302     {
1303       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
1304       return;
1305     }
1306
1307     tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
1308
1309     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
1310   }
1311 }
1312
1313 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
1314 {
1315   mTizenPolicy = NULL;
1316   mTizenDisplayPolicy = NULL;
1317 }
1318
1319 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
1320 {
1321   mNotificationLevel = level;
1322   mNotificationChangeState = state;
1323   mNotificationLevelChangeDone = true;
1324
1325   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
1326 }
1327
1328 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
1329 {
1330   mScreenOffMode = mode;
1331   mScreenOffModeChangeState = state;
1332   mScreenOffModeChangeDone = true;
1333
1334   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
1335 }
1336
1337 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
1338 {
1339   mBrightness = brightness;
1340   mBrightnessChangeState = state;
1341   mBrightnessChangeDone = true;
1342
1343   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
1344 }
1345
1346 void WindowBaseEcoreWl2::GetKeyCode( std::string keyName, int32_t& keyCode )
1347 {
1348   xkb_keysym_t sym = XKB_KEY_NoSymbol;
1349   KeyCodeMap foundKeyCode;
1350
1351   sym = xkb_keysym_from_name( keyName.c_str(), XKB_KEYSYM_NO_FLAGS );
1352   if( sym == XKB_KEY_NoSymbol )
1353   {
1354     DALI_LOG_ERROR( "Failed to get keysym in WindowBaseEcoreWl2\n" );
1355     return;
1356   }
1357
1358   foundKeyCode.keySym = sym;
1359   foundKeyCode.isKeyCode = false;
1360   xkb_keymap_key_for_each( mKeyMap, FindKeyCode, &foundKeyCode );
1361   keyCode = static_cast< int32_t >( foundKeyCode.keyCode );
1362 }
1363
1364 Any WindowBaseEcoreWl2::GetNativeWindow()
1365 {
1366   return mEcoreWindow;
1367 }
1368
1369 int WindowBaseEcoreWl2::GetNativeWindowId()
1370 {
1371   return ecore_wl2_window_id_get( mEcoreWindow );
1372 }
1373
1374 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
1375 {
1376   mEglWindow = wl_egl_window_create( mWlSurface, width, height );
1377
1378   return static_cast< EGLNativeWindowType >( mEglWindow );
1379 }
1380
1381 void WindowBaseEcoreWl2::DestroyEglWindow()
1382 {
1383   if( mEglWindow != NULL )
1384   {
1385     wl_egl_window_destroy( mEglWindow );
1386     mEglWindow = NULL;
1387   }
1388 }
1389
1390 void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
1391 {
1392   wl_egl_window_tizen_rotation rotation;
1393
1394   switch( angle )
1395   {
1396     case 0:
1397     {
1398       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1399       break;
1400     }
1401     case 90:
1402     {
1403       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1404       break;
1405     }
1406     case 180:
1407     {
1408       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1409       break;
1410     }
1411     case 270:
1412     {
1413       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1414       break;
1415     }
1416     default:
1417     {
1418       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1419       break;
1420     }
1421   }
1422
1423   wl_egl_window_tizen_set_rotation( mEglWindow, rotation );
1424 }
1425
1426 void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
1427 {
1428   wl_output_transform bufferTransform;
1429
1430   switch( angle )
1431   {
1432     case 0:
1433     {
1434       bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1435       break;
1436     }
1437     case 90:
1438     {
1439       bufferTransform = WL_OUTPUT_TRANSFORM_90;
1440       break;
1441     }
1442     case 180:
1443     {
1444       bufferTransform = WL_OUTPUT_TRANSFORM_180;
1445       break;
1446     }
1447     case 270:
1448     {
1449       bufferTransform = WL_OUTPUT_TRANSFORM_270;
1450       break;
1451     }
1452     default:
1453     {
1454       bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1455       break;
1456     }
1457   }
1458
1459   wl_egl_window_tizen_set_buffer_transform( mEglWindow, bufferTransform );
1460 }
1461
1462 void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
1463 {
1464   wl_output_transform windowTransform;
1465
1466   switch( angle )
1467   {
1468     case 0:
1469     {
1470       windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1471       break;
1472     }
1473     case 90:
1474     {
1475       windowTransform = WL_OUTPUT_TRANSFORM_90;
1476       break;
1477     }
1478     case 180:
1479     {
1480       windowTransform = WL_OUTPUT_TRANSFORM_180;
1481       break;
1482     }
1483     case 270:
1484     {
1485       windowTransform = WL_OUTPUT_TRANSFORM_270;
1486       break;
1487     }
1488     default:
1489     {
1490       windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1491       break;
1492     }
1493   }
1494
1495   wl_egl_window_tizen_set_window_transform( mEglWindow, windowTransform );
1496 }
1497
1498 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
1499 {
1500   wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
1501
1502   // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1503   if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
1504   {
1505     wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
1506     mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1507   }
1508 }
1509
1510 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1511 {
1512   // Check capability
1513   wl_egl_window_tizen_capability capability = static_cast< wl_egl_window_tizen_capability >( wl_egl_window_tizen_get_capabilities( mEglWindow ) );
1514   if( capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED )
1515   {
1516     return true;
1517   }
1518
1519   return false;
1520 }
1521
1522 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
1523 {
1524   ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1525 }
1526
1527 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
1528 {
1529   ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1530 }
1531
1532 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
1533 {
1534   ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1535 }
1536
1537 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1538 {
1539   ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1540   ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1541 }
1542
1543 void WindowBaseEcoreWl2::Raise()
1544 {
1545   // Use ecore_wl2_window_activate to prevent the window shown without rendering
1546   ecore_wl2_window_activate( mEcoreWindow );
1547 }
1548
1549 void WindowBaseEcoreWl2::Lower()
1550 {
1551   ecore_wl2_window_lower( mEcoreWindow );
1552 }
1553
1554 void WindowBaseEcoreWl2::Activate()
1555 {
1556   ecore_wl2_window_activate( mEcoreWindow );
1557 }
1558
1559 void WindowBaseEcoreWl2::SetAvailableAnlges( const std::vector< int >& angles )
1560 {
1561   int rotations[4] = { 0 };
1562   DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size() );
1563   for( std::size_t i = 0; i < angles.size(); ++i )
1564   {
1565     rotations[i] = static_cast< int >( angles[i] );
1566     DALI_LOG_RELEASE_INFO( "%d ", rotations[i] );
1567   }
1568   ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, angles.size() );
1569 }
1570
1571 void WindowBaseEcoreWl2::SetPreferredAngle( int angle )
1572 {
1573   ecore_wl2_window_preferred_rotation_set( mEcoreWindow, angle );
1574 }
1575
1576 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1577 {
1578   ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1579 }
1580
1581 void WindowBaseEcoreWl2::Show()
1582 {
1583   ecore_wl2_window_show( mEcoreWindow );
1584 }
1585
1586 void WindowBaseEcoreWl2::Hide()
1587 {
1588   ecore_wl2_window_hide( mEcoreWindow );
1589 }
1590
1591 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1592 {
1593   return mSupportedAuxiliaryHints.size();
1594 }
1595
1596 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1597 {
1598   if( index >= GetSupportedAuxiliaryHintCount() )
1599   {
1600     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1601   }
1602
1603   return mSupportedAuxiliaryHints[index];
1604 }
1605
1606 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1607 {
1608   bool supported = false;
1609
1610   // Check if the hint is suppported
1611   for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1612   {
1613     if( *iter == hint )
1614     {
1615       supported = true;
1616       break;
1617     }
1618   }
1619
1620   if( !supported )
1621   {
1622     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1623     return 0;
1624   }
1625
1626   // Check if the hint is already added
1627   for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1628   {
1629     if( mAuxiliaryHints[i].first == hint )
1630     {
1631       // Just change the value
1632       mAuxiliaryHints[i].second = value;
1633
1634       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1635
1636       return i + 1;   // id is index + 1
1637     }
1638   }
1639
1640   // Add the hint
1641   mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1642
1643   unsigned int id = mAuxiliaryHints.size();
1644
1645   ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1646
1647   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1648
1649   return id;
1650 }
1651
1652 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1653 {
1654   if( id == 0 || id > mAuxiliaryHints.size() )
1655   {
1656     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1657     return false;
1658   }
1659
1660   mAuxiliaryHints[id - 1].second = std::string();
1661
1662   ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1663
1664   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1665
1666   return true;
1667 }
1668
1669 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1670 {
1671   if( id == 0 || id > mAuxiliaryHints.size() )
1672   {
1673     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1674     return false;
1675   }
1676
1677   mAuxiliaryHints[id - 1].second = value;
1678
1679   ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1680
1681   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
1682
1683   return true;
1684 }
1685
1686 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1687 {
1688   if( id == 0 || id > mAuxiliaryHints.size() )
1689   {
1690     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1691     return std::string();
1692   }
1693
1694   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
1695
1696   return mAuxiliaryHints[id - 1].second;
1697 }
1698
1699 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1700 {
1701   for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1702   {
1703     if( mAuxiliaryHints[i].first == hint )
1704     {
1705       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1706       return i + 1;
1707     }
1708   }
1709
1710   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1711
1712   return 0;
1713 }
1714
1715 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1716 {
1717   ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1718 }
1719
1720 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1721 {
1722   Ecore_Wl2_Window_Type windowType;
1723
1724   switch( type )
1725   {
1726     case Dali::Window::NORMAL:
1727     {
1728       windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1729       break;
1730     }
1731     case Dali::Window::NOTIFICATION:
1732     {
1733       windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1734       break;
1735     }
1736     case Dali::Window::UTILITY:
1737     {
1738       windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1739       break;
1740     }
1741     case Dali::Window::DIALOG:
1742     {
1743       windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1744       break;
1745     }
1746     default:
1747     {
1748       windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1749       break;
1750     }
1751   }
1752
1753   ecore_wl2_window_type_set( mEcoreWindow, windowType );
1754 }
1755
1756 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1757 {
1758   while( !mTizenPolicy )
1759   {
1760     wl_display_dispatch_queue( mDisplay, mEventQueue );
1761   }
1762
1763   int notificationLevel;
1764
1765   switch( level )
1766   {
1767     case Dali::Window::NotificationLevel::NONE:
1768     {
1769       notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1770       break;
1771     }
1772     case Dali::Window::NotificationLevel::BASE:
1773     {
1774       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1775       break;
1776     }
1777     case Dali::Window::NotificationLevel::MEDIUM:
1778     {
1779       notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1780       break;
1781     }
1782     case Dali::Window::NotificationLevel::HIGH:
1783     {
1784       notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1785       break;
1786     }
1787     case Dali::Window::NotificationLevel::TOP:
1788     {
1789       notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1790       break;
1791     }
1792     default:
1793     {
1794       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1795       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1796       break;
1797     }
1798   }
1799
1800   mNotificationLevelChangeDone = false;
1801   mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1802
1803   tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1804
1805   int count = 0;
1806
1807   while( !mNotificationLevelChangeDone && count < 3 )
1808   {
1809     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1810     wl_display_dispatch_queue( mDisplay, mEventQueue );
1811     count++;
1812   }
1813
1814   if( !mNotificationLevelChangeDone )
1815   {
1816     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1817     return false;
1818   }
1819   else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1820   {
1821     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1822     return false;
1823   }
1824
1825   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1826
1827   return true;
1828 }
1829
1830 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1831 {
1832   while( !mTizenPolicy )
1833   {
1834     wl_display_dispatch_queue( mDisplay, mEventQueue );
1835   }
1836
1837   int count = 0;
1838
1839   while( !mNotificationLevelChangeDone && count < 3 )
1840   {
1841     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1842     wl_display_dispatch_queue( mDisplay, mEventQueue );
1843     count++;
1844   }
1845
1846   if( !mNotificationLevelChangeDone )
1847   {
1848     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1849     return Dali::Window::NotificationLevel::NONE;
1850   }
1851
1852   Dali::Window::NotificationLevel::Type level;
1853
1854   switch( mNotificationLevel )
1855   {
1856     case TIZEN_POLICY_LEVEL_NONE:
1857     {
1858       level = Dali::Window::NotificationLevel::NONE;
1859       break;
1860     }
1861     case TIZEN_POLICY_LEVEL_DEFAULT:
1862     {
1863       level = Dali::Window::NotificationLevel::BASE;
1864       break;
1865     }
1866     case TIZEN_POLICY_LEVEL_MEDIUM:
1867     {
1868       level = Dali::Window::NotificationLevel::MEDIUM;
1869       break;
1870     }
1871     case TIZEN_POLICY_LEVEL_HIGH:
1872     {
1873       level = Dali::Window::NotificationLevel::HIGH;
1874       break;
1875     }
1876     case TIZEN_POLICY_LEVEL_TOP:
1877     {
1878       level = Dali::Window::NotificationLevel::TOP;
1879       break;
1880     }
1881     default:
1882     {
1883       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1884       level = Dali::Window::NotificationLevel::NONE;
1885       break;
1886     }
1887   }
1888
1889   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1890
1891   return level;
1892 }
1893
1894 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1895 {
1896   while( !mTizenPolicy )
1897   {
1898     wl_display_dispatch_queue( mDisplay, mEventQueue );
1899   }
1900
1901   tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1902 }
1903
1904 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1905 {
1906   while( !mTizenPolicy )
1907   {
1908     wl_display_dispatch_queue( mDisplay, mEventQueue );
1909   }
1910
1911   mScreenOffModeChangeDone = false;
1912   mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1913
1914   unsigned int mode = 0;
1915
1916   switch( screenOffMode )
1917   {
1918     case Dali::Window::ScreenOffMode::TIMEOUT:
1919     {
1920       mode = 0;
1921       break;
1922     }
1923     case Dali::Window::ScreenOffMode::NEVER:
1924     {
1925       mode = 1;
1926       break;
1927     }
1928   }
1929
1930   tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1931
1932   int count = 0;
1933
1934   while( !mScreenOffModeChangeDone && count < 3 )
1935   {
1936     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1937     wl_display_dispatch_queue( mDisplay, mEventQueue );
1938     count++;
1939   }
1940
1941   if( !mScreenOffModeChangeDone )
1942   {
1943     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1944     return false;
1945   }
1946   else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1947   {
1948     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1949     return false;
1950   }
1951
1952   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
1953
1954   return true;
1955 }
1956
1957 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
1958 {
1959   while( !mTizenPolicy )
1960   {
1961     wl_display_dispatch_queue( mDisplay, mEventQueue );
1962   }
1963
1964   int count = 0;
1965
1966   while( !mScreenOffModeChangeDone && count < 3 )
1967   {
1968     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1969     wl_display_dispatch_queue( mDisplay, mEventQueue );
1970     count++;
1971   }
1972
1973   if( !mScreenOffModeChangeDone )
1974   {
1975     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
1976     return Dali::Window::ScreenOffMode::TIMEOUT;
1977   }
1978
1979   Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1980
1981   switch( mScreenOffMode )
1982   {
1983     case 0:
1984     {
1985       screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1986       break;
1987     }
1988     case 1:
1989     {
1990       screenMode = Dali::Window::ScreenOffMode::NEVER;
1991       break;
1992     }
1993   }
1994
1995   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
1996
1997   return screenMode;
1998 }
1999
2000 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
2001 {
2002   while( !mTizenDisplayPolicy )
2003   {
2004     wl_display_dispatch_queue( mDisplay, mEventQueue );
2005   }
2006
2007   mBrightnessChangeDone = false;
2008   mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2009
2010   tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
2011
2012   int count = 0;
2013
2014   while( !mBrightnessChangeDone && count < 3 )
2015   {
2016     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
2017     wl_display_dispatch_queue( mDisplay, mEventQueue );
2018     count++;
2019   }
2020
2021   if( !mBrightnessChangeDone )
2022   {
2023     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
2024     return false;
2025   }
2026   else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
2027   {
2028     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
2029     return false;
2030   }
2031
2032   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
2033
2034   return true;
2035 }
2036
2037 int WindowBaseEcoreWl2::GetBrightness() const
2038 {
2039   while( !mTizenDisplayPolicy )
2040   {
2041     wl_display_dispatch_queue( mDisplay, mEventQueue );
2042   }
2043
2044   int count = 0;
2045
2046   while( !mBrightnessChangeDone && count < 3 )
2047   {
2048     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
2049     wl_display_dispatch_queue( mDisplay, mEventQueue );
2050     count++;
2051   }
2052
2053   if( !mBrightnessChangeDone )
2054   {
2055     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
2056     return 0;
2057   }
2058
2059   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
2060
2061   return mBrightness;
2062 }
2063
2064 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
2065 {
2066   Ecore_Wl2_Window_Keygrab_Mode mode;
2067
2068   switch( grabMode )
2069   {
2070     case KeyGrab::TOPMOST:
2071     {
2072       mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2073       break;
2074     }
2075     case KeyGrab::SHARED:
2076     {
2077       mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2078       break;
2079     }
2080     case KeyGrab::OVERRIDE_EXCLUSIVE:
2081     {
2082       mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2083       break;
2084     }
2085     case KeyGrab::EXCLUSIVE:
2086     {
2087       mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2088       break;
2089     }
2090     default:
2091     {
2092       return false;
2093     }
2094   }
2095
2096   return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
2097 }
2098
2099 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
2100 {
2101   return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
2102 }
2103
2104 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
2105 {
2106   int keyCount = key.Count();
2107   int keyGrabModeCount = grabMode.Count();
2108
2109   if( keyCount != keyGrabModeCount || keyCount == 0 )
2110   {
2111     return false;
2112   }
2113
2114   eina_init();
2115
2116   Eina_List* keyList = NULL;
2117   Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2118
2119   for( int index = 0; index < keyCount; ++index )
2120   {
2121     info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2122
2123     switch( grabMode[index] )
2124     {
2125       case KeyGrab::TOPMOST:
2126       {
2127         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2128         break;
2129       }
2130       case KeyGrab::SHARED:
2131       {
2132         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2133         break;
2134       }
2135       case KeyGrab::OVERRIDE_EXCLUSIVE:
2136       {
2137         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2138         break;
2139       }
2140       case KeyGrab::EXCLUSIVE:
2141       {
2142         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2143         break;
2144       }
2145       default:
2146       {
2147         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2148         break;
2149       }
2150     }
2151
2152     keyList = eina_list_append( keyList, &info );
2153   }
2154
2155   Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2156
2157   result.Resize( keyCount, true );
2158
2159   Eina_List* l = NULL;
2160   Eina_List* m = NULL;
2161   void* listData = NULL;
2162   void* data = NULL;
2163   if( grabList != NULL )
2164   {
2165     EINA_LIST_FOREACH( grabList, m, data )
2166     {
2167       int index = 0;
2168       EINA_LIST_FOREACH( keyList, l, listData )
2169       {
2170         if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2171         {
2172           DALI_LOG_ERROR( "input key list has null data!" );
2173           break;
2174         }
2175
2176         if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2177         {
2178           result[index] = false;
2179         }
2180         ++index;
2181       }
2182     }
2183   }
2184
2185   delete [] info;
2186
2187   eina_list_free( keyList );
2188   eina_list_free( grabList );
2189   eina_shutdown();
2190
2191   return true;
2192 }
2193
2194 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2195 {
2196   int keyCount = key.Count();
2197   if( keyCount == 0 )
2198   {
2199     return false;
2200   }
2201
2202   eina_init();
2203
2204   Eina_List* keyList = NULL;
2205   Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2206
2207   for( int index = 0; index < keyCount; ++index )
2208   {
2209     info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2210     keyList = eina_list_append( keyList, &info );
2211   }
2212
2213   Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2214
2215   result.Resize( keyCount, true );
2216
2217   Eina_List* l = NULL;
2218   Eina_List* m = NULL;
2219   void *listData = NULL;
2220   void *data = NULL;
2221
2222   if( ungrabList != NULL )
2223   {
2224     EINA_LIST_FOREACH( ungrabList, m, data )
2225     {
2226       int index = 0;
2227       EINA_LIST_FOREACH( keyList, l, listData )
2228       {
2229         if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2230         {
2231           result[index] = false;
2232         }
2233         ++index;
2234       }
2235     }
2236   }
2237
2238   delete [] info;
2239
2240   eina_list_free( keyList );
2241   eina_list_free( ungrabList );
2242   eina_shutdown();
2243
2244   return true;
2245 }
2246
2247 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2248 {
2249   // calculate DPI
2250   float xres, yres;
2251
2252   Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2253
2254   // 1 inch = 25.4 millimeters
2255   xres = ecore_wl2_output_dpi_get( output );
2256   yres = ecore_wl2_output_dpi_get( output );
2257
2258   dpiHorizontal = int( xres + 0.5f );  // rounding
2259   dpiVertical   = int( yres + 0.5f );
2260 }
2261
2262 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2263 {
2264   int transform = 0;
2265
2266   if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2267   {
2268     transform = 0;
2269   }
2270   else
2271   {
2272     transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2273   }
2274
2275   return transform * 90;
2276 }
2277
2278 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2279 {
2280   ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2281 }
2282
2283 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2284 {
2285   ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2286 }
2287
2288 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2289 {
2290   ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2291 }
2292
2293 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2294 {
2295 #ifdef DALI_ELDBUS_AVAILABLE
2296   Eldbus_Object* object;
2297   Eldbus_Proxy* manager;
2298
2299   if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2300   {
2301     DALI_LOG_ERROR( "Unable to get system bus\n" );
2302   }
2303
2304   object = eldbus_object_get( mSystemConnection, BUS, PATH );
2305   if( !object )
2306   {
2307     DALI_LOG_ERROR( "Getting object failed\n" );
2308     return;
2309   }
2310
2311   manager = eldbus_proxy_get( object, INTERFACE );
2312   if( !manager )
2313   {
2314     DALI_LOG_ERROR( "Getting proxy failed\n" );
2315     return;
2316   }
2317
2318   if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2319   {
2320     DALI_LOG_ERROR( "No signal handler returned\n" );
2321   }
2322 #endif
2323 }
2324
2325 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2326 {
2327   Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2328   if( !display )
2329   {
2330     DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2331   }
2332
2333   mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2334
2335   if ( mEcoreWindow == 0 )
2336   {
2337     DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2338   }
2339
2340   // Set default type
2341   ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2342 }
2343
2344 void WindowBaseEcoreWl2::SetParent( WindowBase* parentWinBase )
2345 {
2346   Ecore_Wl2_Window* ecoreParent = NULL;
2347   if( parentWinBase )
2348   {
2349     WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>( parentWinBase );
2350     ecoreParent = winBaseEcore2->mEcoreWindow;
2351   }
2352   ecore_wl2_window_parent_set( mEcoreWindow, ecoreParent );
2353 }
2354
2355 } // namespace Adaptor
2356
2357 } // namespace Internal
2358
2359 } // namespace Dali
2360
2361 #pragma GCC diagnostic pop