Changed 'virtual' function override declarations to 'override' in automated-tests.
[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 // Keyboard Repeat Settings Changed Callbacks
509 /////////////////////////////////////////////////////////////////////////////////////////////////
510
511 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void *data, int type, void *event)
512 {
513    Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed *keyboardRepeat = static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>( event );
514    WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
515    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", keyboardRepeat->id );
516    if( windowBase )
517    {
518      windowBase->OnKeyboardRepeatSettingsChanged();
519    }
520
521   return ECORE_CALLBACK_RENEW;
522 }
523
524 /////////////////////////////////////////////////////////////////////////////////////////////////
525 // Keymap Changed Callbacks
526 /////////////////////////////////////////////////////////////////////////////////////////////////
527
528 static Eina_Bool EcoreEventSeatKeymapChanged(void *data, int type, void *event)
529 {
530   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
531   if( windowBase )
532   {
533     windowBase->KeymapChanged( data, type, event );
534   }
535
536   return ECORE_CALLBACK_RENEW;
537 }
538
539 /////////////////////////////////////////////////////////////////////////////////////////////////
540 // Font Callbacks
541 /////////////////////////////////////////////////////////////////////////////////////////////////
542
543 /**
544  * Called when a font name is changed.
545  */
546 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
547 {
548   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
549   if( windowBase )
550   {
551     windowBase->OnFontNameChanged();
552   }
553 }
554
555 /**
556  * Called when a font size is changed.
557  */
558 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
559 {
560   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
561   if( windowBase )
562   {
563     windowBase->OnFontSizeChanged();
564   }
565 }
566
567 /////////////////////////////////////////////////////////////////////////////////////////////////
568 // ElDBus Accessibility Callbacks
569 /////////////////////////////////////////////////////////////////////////////////////////////////
570
571 #ifdef DALI_ELDBUS_AVAILABLE
572 // Callback for Ecore ElDBus accessibility events.
573 static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
574 {
575   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
576   if( windowBase )
577   {
578     windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
579   }
580 }
581 #endif // DALI_ELDBUS_AVAILABLE
582
583 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
584 {
585   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
586   if( windowBase )
587   {
588     windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
589   }
590 }
591
592 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
593 {
594   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
595   if( windowBase )
596   {
597     windowBase->RegistryGlobalCallbackRemove( data, registry, id );
598   }
599 }
600
601 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
602 {
603 }
604
605 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 )
606 {
607 }
608
609 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
610 {
611   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
612   if( windowBase )
613   {
614     windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
615   }
616 }
617
618 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
619 {
620 }
621
622 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
623 {
624   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
625   if( windowBase )
626   {
627     windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
628   }
629 }
630
631 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
632 {
633 }
634
635 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
636 {
637 }
638
639 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
640 {
641 }
642
643 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
644 {
645 }
646
647 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 )
648 {
649 }
650
651 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
652 {
653   WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
654   if( windowBase )
655   {
656     windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
657   }
658 }
659
660 const struct wl_registry_listener registryListener =
661 {
662    RegistryGlobalCallback,
663    RegistryGlobalCallbackRemove
664 };
665
666 const struct tizen_policy_listener tizenPolicyListener =
667 {
668    TizenPolicyConformant,
669    TizenPolicyConformantArea,
670    TizenPolicyNotificationChangeDone,
671    TizenPolicyTransientForDone,
672    TizenPolicyScreenModeChangeDone,
673    TizenPolicyIconifyStateChanged,
674    TizenPolicySupportedAuxiliaryHints,
675    TizenPolicyAllowedAuxiliaryHint,
676    TizenPolicyAuxiliaryMessage,
677    TizenPolicyConformantRegion
678 };
679
680 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
681 {
682   DisplayPolicyBrightnessChangeDone
683 };
684
685 } // unnamed namespace
686
687 WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
688 : mEcoreEventHandler(),
689   mEcoreWindow( NULL ),
690   mWlSurface( NULL ),
691   mEglWindow( NULL ),
692   mDisplay( NULL ),
693   mEventQueue( NULL ),
694   mTizenPolicy( NULL ),
695   mTizenDisplayPolicy( NULL ),
696   mKeyMap( NULL ),
697   mSupportedAuxiliaryHints(),
698   mAuxiliaryHints(),
699   mNotificationLevel( -1 ),
700   mNotificationChangeState( 0 ),
701   mNotificationLevelChangeDone( true ),
702   mScreenOffMode( 0 ),
703   mScreenOffModeChangeState( 0 ),
704   mScreenOffModeChangeDone( true ),
705   mBrightness( 0 ),
706   mBrightnessChangeState( 0 ),
707   mBrightnessChangeDone( true ),
708   mVisible( true ),
709   mWindowPositionSize( positionSize ),
710   mOwnSurface( false ),
711   mMoveResizeSerial( 0 ),
712   mLastSubmittedMoveResizeSerial( 0 )
713 #ifdef DALI_ELDBUS_AVAILABLE
714   , mSystemConnection( NULL )
715 #endif
716 {
717   Initialize( positionSize, surface, isTransparent );
718 }
719
720 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
721 {
722 #ifdef DALI_ELDBUS_AVAILABLE
723     // Close down ElDBus connections.
724     if( mSystemConnection )
725     {
726       eldbus_connection_unref( mSystemConnection );
727     }
728 #endif // DALI_ELDBUS_AVAILABLE
729
730   vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
731   vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
732
733   for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
734   {
735     ecore_event_handler_del( *iter );
736   }
737   mEcoreEventHandler.Clear();
738
739   if( mEventQueue )
740   {
741     wl_event_queue_destroy( mEventQueue );
742   }
743
744   mSupportedAuxiliaryHints.clear();
745   mAuxiliaryHints.clear();
746
747   if( mEglWindow != NULL )
748   {
749     wl_egl_window_destroy( mEglWindow );
750     mEglWindow = NULL;
751   }
752
753   if( mOwnSurface )
754   {
755     ecore_wl2_window_free( mEcoreWindow );
756
757     WindowSystem::Shutdown();
758   }
759 }
760
761 void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
762 {
763   if( surface.Empty() == false )
764   {
765     // check we have a valid type
766     DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
767
768     mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
769   }
770   else
771   {
772     // we own the surface about to created
773     WindowSystem::Initialize();
774
775     mOwnSurface = true;
776     CreateWindow( positionSize );
777   }
778
779   mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
780
781   SetTransparency( isTransparent );
782
783   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,  EcoreEventWindowIconifyStateChanged, this ) );
784   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN,                     EcoreEventWindowFocusIn,             this ) );
785   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT,                    EcoreEventWindowFocusOut,            this ) );
786   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM,             EcoreEventOutputTransform,           this ) );
787   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM,      EcoreEventIgnoreOutputTransform,     this ) );
788
789   // Register Rotate event
790   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE,                EcoreEventRotate,                    this ) );
791
792   // Register Configure event
793   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_CONFIGURE,             EcoreEventConfigure,                 this ) );
794
795   // Register Touch events
796   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN,                EcoreEventMouseButtonDown,           this ) );
797   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP,                  EcoreEventMouseButtonUp,             this ) );
798   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE,                       EcoreEventMouseButtonMove,           this ) );
799   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL,              EcoreEventMouseButtonCancel,         this ) );
800
801   // Register Mouse wheel events
802   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL,                      EcoreEventMouseWheel,                this ) );
803
804   // Register Detent event
805   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE,                    EcoreEventDetentRotation,            this ) );
806
807   // Register Key events
808   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN,                         EcoreEventKeyDown,                   this ) );
809   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP,                           EcoreEventKeyUp,                     this ) );
810
811   // Register Selection event - clipboard selection
812   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND,             EcoreEventDataSend,                  this ) );
813   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY,         EcoreEventDataReceive,               this ) );
814
815   // Register Effect Start/End event
816   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_START,                 EcoreEventEffectStart,               this ) );
817   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_END,                   EcoreEventEffectEnd,                 this ) );
818
819   // Register Keyboard repeat event
820   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this ) );
821
822   // Register Vconf notify - font name and size
823   vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
824   vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
825
826   InitializeEcoreElDBus();
827
828   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
829   mDisplay = ecore_wl2_display_get( display );
830
831   if( mDisplay )
832   {
833     wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
834     if( displayWrapper )
835     {
836       mEventQueue = wl_display_create_queue( mDisplay );
837       if( mEventQueue )
838       {
839         wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
840
841         wl_registry* registry = wl_display_get_registry( displayWrapper );
842         wl_registry_add_listener( registry, &registryListener, this );
843       }
844
845       wl_proxy_wrapper_destroy( displayWrapper );
846     }
847   }
848
849   Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get( display );
850
851   if( ecoreWlInput )
852   {
853     mKeyMap = ecore_wl2_input_keymap_get( ecoreWlInput );
854
855     mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this ) );
856   }
857
858   // get auxiliary hint
859   Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
860   if( hints )
861   {
862     Eina_List* l = NULL;
863     char* hint = NULL;
864
865     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) ) ) )
866     {
867       mSupportedAuxiliaryHints.push_back( hint );
868
869       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
870     }
871   }
872 }
873
874 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
875 {
876   Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
877   Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
878
879   if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
880   {
881     if( iconifyChangedEvent->iconified == EINA_TRUE )
882     {
883       mIconifyChangedSignal.Emit( true );
884     }
885     else
886     {
887       mIconifyChangedSignal.Emit( false );
888     }
889     handled = ECORE_CALLBACK_DONE;
890   }
891
892   return handled;
893 }
894
895 Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
896 {
897   Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
898
899   if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
900   {
901     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
902
903     mFocusChangedSignal.Emit( true );
904   }
905
906   return ECORE_CALLBACK_PASS_ON;
907 }
908
909 Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
910 {
911   Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
912
913   if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
914   {
915     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
916
917     mFocusChangedSignal.Emit( false );
918   }
919
920   return ECORE_CALLBACK_PASS_ON;
921 }
922
923 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
924 {
925   Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
926
927   if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
928   {
929     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
930
931     mOutputTransformedSignal.Emit();
932   }
933
934   return ECORE_CALLBACK_PASS_ON;
935 }
936
937 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
938 {
939   Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
940
941   if( ignoreTransformEvent->win == mEcoreWindow )
942   {
943     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
944
945     mOutputTransformedSignal.Emit();
946   }
947
948   return ECORE_CALLBACK_PASS_ON;
949 }
950
951 void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
952 {
953   Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
954
955   if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
956   {
957     DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h );
958
959     RotationEvent rotationEvent;
960     rotationEvent.angle = ev->angle;
961     rotationEvent.winResize = 0;
962
963     if( ev->angle == 0 || ev->angle == 180 )
964     {
965       rotationEvent.width = ev->w;
966       rotationEvent.height = ev->h;
967     }
968     else
969     {
970       rotationEvent.width = ev->h;
971       rotationEvent.height = ev->w;
972     }
973
974     mWindowPositionSize.width = rotationEvent.width;
975     mWindowPositionSize.height = rotationEvent.height;
976
977     mRotationSignal.Emit( rotationEvent );
978   }
979 }
980
981 void WindowBaseEcoreWl2::OnConfiguration( void* data, int type, void* event )
982 {
983   Ecore_Wl2_Event_Window_Configure* ev( static_cast< Ecore_Wl2_Event_Window_Configure* >( event ) );
984
985   if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
986   {
987     // Note: To comply with the wayland protocol, Dali should make an ack_configure
988     // by calling ecore_wl2_window_commit
989     ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
990   }
991 }
992
993 void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
994 {
995   Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
996
997   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
998   {
999     Device::Class::Type deviceClass;
1000     Device::Subclass::Type deviceSubclass;
1001
1002     GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
1003     GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
1004
1005     PointState::Type state ( PointState::DOWN );
1006
1007     if( deviceClass != Device::Class::Type::MOUSE )
1008     {
1009       // Check if the buttons field is set and ensure it's the primary touch button.
1010       // If this event was triggered by buttons other than the primary button (used for touch), then
1011       // just send an interrupted event to Core.
1012       if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
1013       {
1014         state = PointState::INTERRUPTED;
1015       }
1016     }
1017
1018     Integration::Point point;
1019     point.SetDeviceId( touchEvent->multi.device );
1020     point.SetState( state );
1021     point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
1022     point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
1023     point.SetPressure( touchEvent->multi.pressure );
1024     point.SetAngle( Degree( touchEvent->multi.angle ) );
1025     point.SetDeviceClass( deviceClass );
1026     point.SetDeviceSubclass( deviceSubclass );
1027     point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
1028
1029     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1030   }
1031 }
1032
1033 void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
1034 {
1035   Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
1036
1037   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1038   {
1039     Device::Class::Type deviceClass;
1040     Device::Subclass::Type deviceSubclass;
1041
1042     GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
1043     GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
1044
1045     Integration::Point point;
1046     point.SetDeviceId( touchEvent->multi.device );
1047     point.SetState( PointState::UP );
1048     point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
1049     point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
1050     point.SetPressure( touchEvent->multi.pressure );
1051     point.SetAngle( Degree( touchEvent->multi.angle ) );
1052     point.SetDeviceClass( deviceClass );
1053     point.SetDeviceSubclass( deviceSubclass );
1054     point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
1055
1056     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1057   }
1058 }
1059
1060 void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
1061 {
1062   Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
1063
1064   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1065   {
1066     Device::Class::Type deviceClass;
1067     Device::Subclass::Type deviceSubclass;
1068
1069     GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
1070     GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
1071
1072     Integration::Point point;
1073     point.SetDeviceId( touchEvent->multi.device );
1074     point.SetState( PointState::MOTION );
1075     point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
1076     point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
1077     point.SetPressure( touchEvent->multi.pressure );
1078     point.SetAngle( Degree( touchEvent->multi.angle ) );
1079     point.SetDeviceClass( deviceClass );
1080     point.SetDeviceSubclass( deviceSubclass );
1081
1082     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1083   }
1084 }
1085
1086 void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
1087 {
1088   Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
1089
1090   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1091   {
1092     Integration::Point point;
1093     point.SetDeviceId( touchEvent->multi.device );
1094     point.SetState( PointState::INTERRUPTED );
1095     point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
1096
1097     mTouchEventSignal.Emit( point, touchEvent->timestamp );
1098
1099     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
1100   }
1101 }
1102
1103 void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
1104 {
1105   Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
1106
1107   if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1108   {
1109     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 );
1110
1111     Integration::WheelEvent wheelEvent( Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
1112
1113     mWheelEventSignal.Emit( wheelEvent );
1114   }
1115 }
1116
1117 void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
1118 {
1119   Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
1120
1121   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnDetentRotation\n" );
1122
1123   int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
1124   int timeStamp = detentEvent->timestamp;
1125
1126   Integration::WheelEvent wheelEvent( Integration::WheelEvent::CUSTOM_WHEEL, direction, 0, Vector2( 0.0f, 0.0f ), 0, timeStamp );
1127
1128   mWheelEventSignal.Emit( wheelEvent );
1129 }
1130
1131 void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
1132 {
1133   Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1134
1135   if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1136   {
1137     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyDown\n" );
1138
1139     std::string keyName( keyEvent->keyname );
1140     std::string logicalKey( "" );
1141     std::string keyString( "" );
1142     std::string compose( "" );
1143
1144     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1145     if( keyEvent->compose )
1146     {
1147       compose = keyEvent->compose;
1148     }
1149
1150     // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1151     if( keyEvent->key )
1152     {
1153       logicalKey = keyEvent->key;
1154     }
1155
1156     int keyCode = 0;
1157     GetKeyCode( keyName, keyCode ); // Get key code dynamically.
1158
1159     if( keyCode == 0 )
1160     {
1161       // Get a specific key code from dali key look up table.
1162       keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1163     }
1164
1165     keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1166     int modifier( keyEvent->modifiers );
1167     unsigned long time = keyEvent->timestamp;
1168     if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1169     {
1170       keyCode = atoi( keyEvent->keyname + 8 );
1171     }
1172
1173     // Ensure key event string is not NULL as keys like SHIFT have a null string.
1174     if( keyEvent->string )
1175     {
1176       keyString = keyEvent->string;
1177     }
1178
1179     std::string deviceName;
1180     Device::Class::Type deviceClass;
1181     Device::Subclass::Type deviceSubclass;
1182
1183     GetDeviceName( keyEvent, deviceName );
1184     GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1185     GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1186
1187     Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass );
1188
1189      mKeyEventSignal.Emit( keyEvent );
1190   }
1191 }
1192
1193 void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
1194 {
1195   Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1196
1197   if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1198   {
1199     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyUp\n" );
1200
1201 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1202     // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1203     if( keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL )
1204     {
1205       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n" );
1206       return;
1207     }
1208 #endif // Since ecore 1.23 version
1209
1210     std::string keyName( keyEvent->keyname );
1211     std::string logicalKey( "" );
1212     std::string keyString( "" );
1213     std::string compose( "" );
1214
1215     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1216     if( keyEvent->compose )
1217     {
1218       compose = keyEvent->compose;
1219     }
1220
1221     // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1222     if( keyEvent->key )
1223     {
1224       logicalKey = keyEvent->key;
1225     }
1226
1227     int keyCode = 0;
1228     GetKeyCode( keyName, keyCode ); // Get key code dynamically.
1229
1230     if( keyCode == 0 )
1231     {
1232       // Get a specific key code from dali key look up table.
1233       keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1234     }
1235
1236     keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1237     int modifier( keyEvent->modifiers );
1238     unsigned long time = keyEvent->timestamp;
1239     if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1240     {
1241       keyCode = atoi( keyEvent->keyname + 8 );
1242     }
1243
1244     // Ensure key event string is not NULL as keys like SHIFT have a null string.
1245     if( keyEvent->string )
1246     {
1247       keyString = keyEvent->string;
1248     }
1249
1250     std::string deviceName;
1251     Device::Class::Type deviceClass;
1252     Device::Subclass::Type deviceSubclass;
1253
1254     GetDeviceName( keyEvent, deviceName );
1255     GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1256     GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1257
1258     Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass );
1259
1260      mKeyEventSignal.Emit( keyEvent );
1261   }
1262 }
1263
1264 void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
1265 {
1266   mSelectionDataSendSignal.Emit( event );
1267 }
1268
1269 void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
1270 {
1271   mSelectionDataReceivedSignal.Emit( event  );
1272 }
1273
1274 void WindowBaseEcoreWl2::OnFontNameChanged()
1275 {
1276   mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
1277 }
1278
1279 void WindowBaseEcoreWl2::OnFontSizeChanged()
1280 {
1281   mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1282 }
1283
1284 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
1285 {
1286 #ifdef DALI_ELDBUS_AVAILABLE
1287   AccessibilityInfo info;
1288
1289   // The string defines the arg-list's respective types.
1290   if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
1291   {
1292     DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
1293   }
1294
1295   mAccessibilitySignal.Emit( info );
1296 #endif
1297 }
1298
1299 void WindowBaseEcoreWl2::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
1300 {
1301   mTransitionEffectEventSignal.Emit( state, type );
1302 }
1303
1304 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1305 {
1306   mKeyboardRepeatSettingsChangedSignal.Emit();
1307 }
1308
1309 void WindowBaseEcoreWl2::KeymapChanged(void *data, int type, void *event)
1310 {
1311   Ecore_Wl2_Event_Seat_Keymap_Changed *changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>( event );
1312   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id );
1313   Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get( changed->display );
1314   if( ecoreWlInput )
1315   {
1316     mKeyMap = ecore_wl2_input_keymap_get( ecoreWlInput );
1317   }
1318 }
1319
1320 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
1321 {
1322   if( strcmp( interface, tizen_policy_interface.name ) == 0 )
1323   {
1324     uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
1325
1326     mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
1327     if( !mTizenPolicy )
1328     {
1329       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
1330       return;
1331     }
1332
1333     tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
1334
1335     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
1336   }
1337   else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
1338   {
1339     mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
1340     if( !mTizenDisplayPolicy )
1341     {
1342       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
1343       return;
1344     }
1345
1346     tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
1347
1348     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
1349   }
1350 }
1351
1352 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
1353 {
1354   mTizenPolicy = NULL;
1355   mTizenDisplayPolicy = NULL;
1356 }
1357
1358 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
1359 {
1360   mNotificationLevel = level;
1361   mNotificationChangeState = state;
1362   mNotificationLevelChangeDone = true;
1363
1364   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
1365 }
1366
1367 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
1368 {
1369   mScreenOffMode = mode;
1370   mScreenOffModeChangeState = state;
1371   mScreenOffModeChangeDone = true;
1372
1373   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
1374 }
1375
1376 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
1377 {
1378   mBrightness = brightness;
1379   mBrightnessChangeState = state;
1380   mBrightnessChangeDone = true;
1381
1382   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
1383 }
1384
1385 void WindowBaseEcoreWl2::GetKeyCode( std::string keyName, int32_t& keyCode )
1386 {
1387   xkb_keysym_t sym = XKB_KEY_NoSymbol;
1388   KeyCodeMap foundKeyCode;
1389
1390   sym = xkb_keysym_from_name( keyName.c_str(), XKB_KEYSYM_NO_FLAGS );
1391   if( sym == XKB_KEY_NoSymbol )
1392   {
1393     DALI_LOG_ERROR( "Failed to get keysym in WindowBaseEcoreWl2\n" );
1394     return;
1395   }
1396
1397   foundKeyCode.keySym = sym;
1398   foundKeyCode.isKeyCode = false;
1399   xkb_keymap_key_for_each( mKeyMap, FindKeyCode, &foundKeyCode );
1400   keyCode = static_cast< int32_t >( foundKeyCode.keyCode );
1401 }
1402
1403 Any WindowBaseEcoreWl2::GetNativeWindow()
1404 {
1405   return mEcoreWindow;
1406 }
1407
1408 int WindowBaseEcoreWl2::GetNativeWindowId()
1409 {
1410   return ecore_wl2_window_id_get( mEcoreWindow );
1411 }
1412
1413 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
1414 {
1415   mEglWindow = wl_egl_window_create( mWlSurface, width, height );
1416
1417   return static_cast< EGLNativeWindowType >( mEglWindow );
1418 }
1419
1420 void WindowBaseEcoreWl2::DestroyEglWindow()
1421 {
1422   if( mEglWindow != NULL )
1423   {
1424     wl_egl_window_destroy( mEglWindow );
1425     mEglWindow = NULL;
1426   }
1427 }
1428
1429 void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
1430 {
1431   wl_egl_window_tizen_rotation rotation;
1432
1433   switch( angle )
1434   {
1435     case 0:
1436     {
1437       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1438       break;
1439     }
1440     case 90:
1441     {
1442       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1443       break;
1444     }
1445     case 180:
1446     {
1447       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1448       break;
1449     }
1450     case 270:
1451     {
1452       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1453       break;
1454     }
1455     default:
1456     {
1457       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1458       break;
1459     }
1460   }
1461
1462   wl_egl_window_tizen_set_rotation( mEglWindow, rotation );
1463 }
1464
1465 void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
1466 {
1467   wl_output_transform bufferTransform;
1468
1469   switch( angle )
1470   {
1471     case 0:
1472     {
1473       bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1474       break;
1475     }
1476     case 90:
1477     {
1478       bufferTransform = WL_OUTPUT_TRANSFORM_90;
1479       break;
1480     }
1481     case 180:
1482     {
1483       bufferTransform = WL_OUTPUT_TRANSFORM_180;
1484       break;
1485     }
1486     case 270:
1487     {
1488       bufferTransform = WL_OUTPUT_TRANSFORM_270;
1489       break;
1490     }
1491     default:
1492     {
1493       bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1494       break;
1495     }
1496   }
1497
1498   wl_egl_window_tizen_set_buffer_transform( mEglWindow, bufferTransform );
1499 }
1500
1501 void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
1502 {
1503   wl_output_transform windowTransform;
1504
1505   switch( angle )
1506   {
1507     case 0:
1508     {
1509       windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1510       break;
1511     }
1512     case 90:
1513     {
1514       windowTransform = WL_OUTPUT_TRANSFORM_90;
1515       break;
1516     }
1517     case 180:
1518     {
1519       windowTransform = WL_OUTPUT_TRANSFORM_180;
1520       break;
1521     }
1522     case 270:
1523     {
1524       windowTransform = WL_OUTPUT_TRANSFORM_270;
1525       break;
1526     }
1527     default:
1528     {
1529       windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1530       break;
1531     }
1532   }
1533
1534   wl_egl_window_tizen_set_window_transform( mEglWindow, windowTransform );
1535 }
1536
1537 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
1538 {
1539   wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
1540
1541   // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1542   if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
1543   {
1544     wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
1545     mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1546   }
1547 }
1548
1549 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1550 {
1551   // Check capability
1552   wl_egl_window_tizen_capability capability = static_cast< wl_egl_window_tizen_capability >( wl_egl_window_tizen_get_capabilities( mEglWindow ) );
1553   if( capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED )
1554   {
1555     return true;
1556   }
1557
1558   return false;
1559 }
1560
1561 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
1562 {
1563   mWindowPositionSize = positionSize;
1564   ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1565 }
1566
1567 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
1568 {
1569   mWindowPositionSize = positionSize;
1570   ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1571 }
1572
1573 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
1574 {
1575   mWindowPositionSize = positionSize;
1576   ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1577 }
1578
1579 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1580 {
1581   ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1582   ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1583 }
1584
1585 void WindowBaseEcoreWl2::Raise()
1586 {
1587   // Use ecore_wl2_window_activate to prevent the window shown without rendering
1588   ecore_wl2_window_activate( mEcoreWindow );
1589 }
1590
1591 void WindowBaseEcoreWl2::Lower()
1592 {
1593   ecore_wl2_window_lower( mEcoreWindow );
1594 }
1595
1596 void WindowBaseEcoreWl2::Activate()
1597 {
1598   ecore_wl2_window_activate( mEcoreWindow );
1599 }
1600
1601 void WindowBaseEcoreWl2::SetAvailableAnlges( const std::vector< int >& angles )
1602 {
1603   int rotations[4] = { 0 };
1604   DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size() );
1605   for( std::size_t i = 0; i < angles.size(); ++i )
1606   {
1607     rotations[i] = static_cast< int >( angles[i] );
1608     DALI_LOG_RELEASE_INFO( "%d ", rotations[i] );
1609   }
1610   ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, angles.size() );
1611 }
1612
1613 void WindowBaseEcoreWl2::SetPreferredAngle( int angle )
1614 {
1615   ecore_wl2_window_preferred_rotation_set( mEcoreWindow, angle );
1616 }
1617
1618 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1619 {
1620   ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1621 }
1622
1623 void WindowBaseEcoreWl2::Show()
1624 {
1625   if( !mVisible )
1626   {
1627     ecore_wl2_window_geometry_set( mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height );
1628   }
1629   mVisible = true;
1630
1631   ecore_wl2_window_show( mEcoreWindow );
1632 }
1633
1634 void WindowBaseEcoreWl2::Hide()
1635 {
1636   mVisible = false;
1637   ecore_wl2_window_hide( mEcoreWindow );
1638 }
1639
1640 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1641 {
1642   return mSupportedAuxiliaryHints.size();
1643 }
1644
1645 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1646 {
1647   if( index >= GetSupportedAuxiliaryHintCount() )
1648   {
1649     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1650   }
1651
1652   return mSupportedAuxiliaryHints[index];
1653 }
1654
1655 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1656 {
1657   bool supported = false;
1658
1659   // Check if the hint is suppported
1660   for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1661   {
1662     if( *iter == hint )
1663     {
1664       supported = true;
1665       break;
1666     }
1667   }
1668
1669   if( !supported )
1670   {
1671     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1672     return 0;
1673   }
1674
1675   // Check if the hint is already added
1676   for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1677   {
1678     if( mAuxiliaryHints[i].first == hint )
1679     {
1680       // Just change the value
1681       mAuxiliaryHints[i].second = value;
1682
1683       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1684
1685       return i + 1;   // id is index + 1
1686     }
1687   }
1688
1689   // Add the hint
1690   mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1691
1692   unsigned int id = mAuxiliaryHints.size();
1693
1694   ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1695
1696   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1697
1698   return id;
1699 }
1700
1701 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1702 {
1703   if( id == 0 || id > mAuxiliaryHints.size() )
1704   {
1705     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1706     return false;
1707   }
1708
1709   mAuxiliaryHints[id - 1].second = std::string();
1710
1711   ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1712
1713   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1714
1715   return true;
1716 }
1717
1718 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1719 {
1720   if( id == 0 || id > mAuxiliaryHints.size() )
1721   {
1722     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1723     return false;
1724   }
1725
1726   mAuxiliaryHints[id - 1].second = value;
1727
1728   ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1729
1730   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() );
1731
1732   return true;
1733 }
1734
1735 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1736 {
1737   if( id == 0 || id > mAuxiliaryHints.size() )
1738   {
1739     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1740     return std::string();
1741   }
1742
1743   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() );
1744
1745   return mAuxiliaryHints[id - 1].second;
1746 }
1747
1748 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1749 {
1750   for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1751   {
1752     if( mAuxiliaryHints[i].first == hint )
1753     {
1754       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1755       return i + 1;
1756     }
1757   }
1758
1759   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1760
1761   return 0;
1762 }
1763
1764 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1765 {
1766   ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1767 }
1768
1769 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1770 {
1771   Ecore_Wl2_Window_Type windowType;
1772
1773   switch( type )
1774   {
1775     case Dali::Window::NORMAL:
1776     {
1777       windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1778       break;
1779     }
1780     case Dali::Window::NOTIFICATION:
1781     {
1782       windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1783       break;
1784     }
1785     case Dali::Window::UTILITY:
1786     {
1787       windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1788       break;
1789     }
1790     case Dali::Window::DIALOG:
1791     {
1792       windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1793       break;
1794     }
1795     default:
1796     {
1797       windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1798       break;
1799     }
1800   }
1801
1802   ecore_wl2_window_type_set( mEcoreWindow, windowType );
1803 }
1804
1805 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1806 {
1807   while( !mTizenPolicy )
1808   {
1809     wl_display_dispatch_queue( mDisplay, mEventQueue );
1810   }
1811
1812   int notificationLevel;
1813
1814   switch( level )
1815   {
1816     case Dali::Window::NotificationLevel::NONE:
1817     {
1818       notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1819       break;
1820     }
1821     case Dali::Window::NotificationLevel::BASE:
1822     {
1823       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1824       break;
1825     }
1826     case Dali::Window::NotificationLevel::MEDIUM:
1827     {
1828       notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1829       break;
1830     }
1831     case Dali::Window::NotificationLevel::HIGH:
1832     {
1833       notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1834       break;
1835     }
1836     case Dali::Window::NotificationLevel::TOP:
1837     {
1838       notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1839       break;
1840     }
1841     default:
1842     {
1843       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1844       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1845       break;
1846     }
1847   }
1848
1849   mNotificationLevelChangeDone = false;
1850   mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1851
1852   tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1853
1854   int count = 0;
1855
1856   while( !mNotificationLevelChangeDone && count < 3 )
1857   {
1858     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1859     wl_display_dispatch_queue( mDisplay, mEventQueue );
1860     count++;
1861   }
1862
1863   if( !mNotificationLevelChangeDone )
1864   {
1865     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1866     return false;
1867   }
1868   else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1869   {
1870     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1871     return false;
1872   }
1873
1874   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1875
1876   return true;
1877 }
1878
1879 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1880 {
1881   while( !mTizenPolicy )
1882   {
1883     wl_display_dispatch_queue( mDisplay, mEventQueue );
1884   }
1885
1886   int count = 0;
1887
1888   while( !mNotificationLevelChangeDone && count < 3 )
1889   {
1890     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1891     wl_display_dispatch_queue( mDisplay, mEventQueue );
1892     count++;
1893   }
1894
1895   if( !mNotificationLevelChangeDone )
1896   {
1897     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1898     return Dali::Window::NotificationLevel::NONE;
1899   }
1900
1901   Dali::Window::NotificationLevel::Type level;
1902
1903   switch( mNotificationLevel )
1904   {
1905     case TIZEN_POLICY_LEVEL_NONE:
1906     {
1907       level = Dali::Window::NotificationLevel::NONE;
1908       break;
1909     }
1910     case TIZEN_POLICY_LEVEL_DEFAULT:
1911     {
1912       level = Dali::Window::NotificationLevel::BASE;
1913       break;
1914     }
1915     case TIZEN_POLICY_LEVEL_MEDIUM:
1916     {
1917       level = Dali::Window::NotificationLevel::MEDIUM;
1918       break;
1919     }
1920     case TIZEN_POLICY_LEVEL_HIGH:
1921     {
1922       level = Dali::Window::NotificationLevel::HIGH;
1923       break;
1924     }
1925     case TIZEN_POLICY_LEVEL_TOP:
1926     {
1927       level = Dali::Window::NotificationLevel::TOP;
1928       break;
1929     }
1930     default:
1931     {
1932       DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1933       level = Dali::Window::NotificationLevel::NONE;
1934       break;
1935     }
1936   }
1937
1938   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1939
1940   return level;
1941 }
1942
1943 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1944 {
1945   while( !mTizenPolicy )
1946   {
1947     wl_display_dispatch_queue( mDisplay, mEventQueue );
1948   }
1949
1950   tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1951 }
1952
1953 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1954 {
1955   while( !mTizenPolicy )
1956   {
1957     wl_display_dispatch_queue( mDisplay, mEventQueue );
1958   }
1959
1960   mScreenOffModeChangeDone = false;
1961   mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1962
1963   unsigned int mode = 0;
1964
1965   switch( screenOffMode )
1966   {
1967     case Dali::Window::ScreenOffMode::TIMEOUT:
1968     {
1969       mode = 0;
1970       break;
1971     }
1972     case Dali::Window::ScreenOffMode::NEVER:
1973     {
1974       mode = 1;
1975       break;
1976     }
1977   }
1978
1979   tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1980
1981   int count = 0;
1982
1983   while( !mScreenOffModeChangeDone && count < 3 )
1984   {
1985     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1986     wl_display_dispatch_queue( mDisplay, mEventQueue );
1987     count++;
1988   }
1989
1990   if( !mScreenOffModeChangeDone )
1991   {
1992     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1993     return false;
1994   }
1995   else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1996   {
1997     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1998     return false;
1999   }
2000
2001   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
2002
2003   return true;
2004 }
2005
2006 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
2007 {
2008   while( !mTizenPolicy )
2009   {
2010     wl_display_dispatch_queue( mDisplay, mEventQueue );
2011   }
2012
2013   int count = 0;
2014
2015   while( !mScreenOffModeChangeDone && count < 3 )
2016   {
2017     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
2018     wl_display_dispatch_queue( mDisplay, mEventQueue );
2019     count++;
2020   }
2021
2022   if( !mScreenOffModeChangeDone )
2023   {
2024     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
2025     return Dali::Window::ScreenOffMode::TIMEOUT;
2026   }
2027
2028   Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
2029
2030   switch( mScreenOffMode )
2031   {
2032     case 0:
2033     {
2034       screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
2035       break;
2036     }
2037     case 1:
2038     {
2039       screenMode = Dali::Window::ScreenOffMode::NEVER;
2040       break;
2041     }
2042   }
2043
2044   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
2045
2046   return screenMode;
2047 }
2048
2049 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
2050 {
2051   while( !mTizenDisplayPolicy )
2052   {
2053     wl_display_dispatch_queue( mDisplay, mEventQueue );
2054   }
2055
2056   mBrightnessChangeDone = false;
2057   mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2058
2059   tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
2060
2061   int count = 0;
2062
2063   while( !mBrightnessChangeDone && count < 3 )
2064   {
2065     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
2066     wl_display_dispatch_queue( mDisplay, mEventQueue );
2067     count++;
2068   }
2069
2070   if( !mBrightnessChangeDone )
2071   {
2072     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
2073     return false;
2074   }
2075   else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
2076   {
2077     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
2078     return false;
2079   }
2080
2081   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
2082
2083   return true;
2084 }
2085
2086 int WindowBaseEcoreWl2::GetBrightness() const
2087 {
2088   while( !mTizenDisplayPolicy )
2089   {
2090     wl_display_dispatch_queue( mDisplay, mEventQueue );
2091   }
2092
2093   int count = 0;
2094
2095   while( !mBrightnessChangeDone && count < 3 )
2096   {
2097     ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
2098     wl_display_dispatch_queue( mDisplay, mEventQueue );
2099     count++;
2100   }
2101
2102   if( !mBrightnessChangeDone )
2103   {
2104     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
2105     return 0;
2106   }
2107
2108   DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
2109
2110   return mBrightness;
2111 }
2112
2113 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
2114 {
2115   Ecore_Wl2_Window_Keygrab_Mode mode;
2116
2117   switch( grabMode )
2118   {
2119     case KeyGrab::TOPMOST:
2120     {
2121       mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2122       break;
2123     }
2124     case KeyGrab::SHARED:
2125     {
2126       mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2127       break;
2128     }
2129     case KeyGrab::OVERRIDE_EXCLUSIVE:
2130     {
2131       mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2132       break;
2133     }
2134     case KeyGrab::EXCLUSIVE:
2135     {
2136       mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2137       break;
2138     }
2139     default:
2140     {
2141       return false;
2142     }
2143   }
2144
2145   return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
2146 }
2147
2148 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
2149 {
2150   return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
2151 }
2152
2153 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
2154 {
2155   int keyCount = key.Count();
2156   int keyGrabModeCount = grabMode.Count();
2157
2158   if( keyCount != keyGrabModeCount || keyCount == 0 )
2159   {
2160     return false;
2161   }
2162
2163   eina_init();
2164
2165   Eina_List* keyList = NULL;
2166   Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2167
2168   for( int index = 0; index < keyCount; ++index )
2169   {
2170     info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2171
2172     switch( grabMode[index] )
2173     {
2174       case KeyGrab::TOPMOST:
2175       {
2176         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2177         break;
2178       }
2179       case KeyGrab::SHARED:
2180       {
2181         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2182         break;
2183       }
2184       case KeyGrab::OVERRIDE_EXCLUSIVE:
2185       {
2186         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2187         break;
2188       }
2189       case KeyGrab::EXCLUSIVE:
2190       {
2191         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2192         break;
2193       }
2194       default:
2195       {
2196         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2197         break;
2198       }
2199     }
2200
2201     keyList = eina_list_append( keyList, &info );
2202   }
2203
2204   Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2205
2206   result.Resize( keyCount, true );
2207
2208   Eina_List* l = NULL;
2209   Eina_List* m = NULL;
2210   void* listData = NULL;
2211   void* data = NULL;
2212   if( grabList != NULL )
2213   {
2214     EINA_LIST_FOREACH( grabList, m, data )
2215     {
2216       int index = 0;
2217       EINA_LIST_FOREACH( keyList, l, listData )
2218       {
2219         if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2220         {
2221           DALI_LOG_ERROR( "input key list has null data!" );
2222           break;
2223         }
2224
2225         if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2226         {
2227           result[index] = false;
2228         }
2229         ++index;
2230       }
2231     }
2232   }
2233
2234   delete [] info;
2235
2236   eina_list_free( keyList );
2237   eina_list_free( grabList );
2238   eina_shutdown();
2239
2240   return true;
2241 }
2242
2243 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2244 {
2245   int keyCount = key.Count();
2246   if( keyCount == 0 )
2247   {
2248     return false;
2249   }
2250
2251   eina_init();
2252
2253   Eina_List* keyList = NULL;
2254   Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2255
2256   for( int index = 0; index < keyCount; ++index )
2257   {
2258     info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2259     keyList = eina_list_append( keyList, &info );
2260   }
2261
2262   Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2263
2264   result.Resize( keyCount, true );
2265
2266   Eina_List* l = NULL;
2267   Eina_List* m = NULL;
2268   void *listData = NULL;
2269   void *data = NULL;
2270
2271   if( ungrabList != NULL )
2272   {
2273     EINA_LIST_FOREACH( ungrabList, m, data )
2274     {
2275       int index = 0;
2276       EINA_LIST_FOREACH( keyList, l, listData )
2277       {
2278         if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2279         {
2280           result[index] = false;
2281         }
2282         ++index;
2283       }
2284     }
2285   }
2286
2287   delete [] info;
2288
2289   eina_list_free( keyList );
2290   eina_list_free( ungrabList );
2291   eina_shutdown();
2292
2293   return true;
2294 }
2295
2296 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2297 {
2298   // calculate DPI
2299   float xres, yres;
2300
2301   Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2302
2303   // 1 inch = 25.4 millimeters
2304   xres = ecore_wl2_output_dpi_get( output );
2305   yres = ecore_wl2_output_dpi_get( output );
2306
2307   dpiHorizontal = int( xres + 0.5f );  // rounding
2308   dpiVertical   = int( yres + 0.5f );
2309 }
2310
2311 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2312 {
2313   int transform = 0;
2314
2315   if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2316   {
2317     transform = 0;
2318   }
2319   else
2320   {
2321     transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2322   }
2323
2324   return transform * 90;
2325 }
2326
2327 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2328 {
2329   ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2330 }
2331
2332 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2333 {
2334   ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2335 }
2336
2337 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2338 {
2339   ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2340 }
2341
2342 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2343 {
2344 #ifdef DALI_ELDBUS_AVAILABLE
2345   Eldbus_Object* object;
2346   Eldbus_Proxy* manager;
2347
2348   if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2349   {
2350     DALI_LOG_ERROR( "Unable to get system bus\n" );
2351   }
2352
2353   object = eldbus_object_get( mSystemConnection, BUS, PATH );
2354   if( !object )
2355   {
2356     DALI_LOG_ERROR( "Getting object failed\n" );
2357     return;
2358   }
2359
2360   manager = eldbus_proxy_get( object, INTERFACE );
2361   if( !manager )
2362   {
2363     DALI_LOG_ERROR( "Getting proxy failed\n" );
2364     return;
2365   }
2366
2367   if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2368   {
2369     DALI_LOG_ERROR( "No signal handler returned\n" );
2370   }
2371 #endif
2372 }
2373
2374 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2375 {
2376   Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2377   if( !display )
2378   {
2379     DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2380   }
2381
2382   ecore_wl2_display_sync( display );
2383
2384   mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2385
2386   if ( mEcoreWindow == 0 )
2387   {
2388     DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2389   }
2390
2391   // Set default type
2392   ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2393 }
2394
2395 void WindowBaseEcoreWl2::SetParent( WindowBase* parentWinBase )
2396 {
2397   Ecore_Wl2_Window* ecoreParent = NULL;
2398   if( parentWinBase )
2399   {
2400     WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>( parentWinBase );
2401     ecoreParent = winBaseEcore2->mEcoreWindow;
2402   }
2403   ecore_wl2_window_parent_set( mEcoreWindow, ecoreParent );
2404 }
2405
2406 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
2407 {
2408   return wl_egl_window_tizen_create_commit_sync_fd( mEglWindow );
2409 }
2410
2411 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
2412 {
2413   return wl_egl_window_tizen_create_presentation_sync_fd( mEglWindow );
2414 }
2415
2416 } // namespace Adaptor
2417
2418 } // namespace Internal
2419
2420 } // namespace Dali
2421
2422 #pragma GCC diagnostic pop