[Tizen] Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
1 /*
2  * Copyright (c) 2022 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/input/common/key-impl.h>
27 #include <dali/internal/window-system/common/window-impl.h>
28 #include <dali/internal/window-system/common/window-render-surface.h>
29 #include <dali/internal/window-system/common/window-system.h>
30
31 // EXTERNAL_HEADERS
32 #include <Ecore_Input.h>
33 #include <dali/integration-api/debug.h>
34 #include <dali/integration-api/trace.h>
35 #include <dali/public-api/adaptor-framework/window-enumerations.h>
36 #include <dali/public-api/events/mouse-button.h>
37 #include <dali/public-api/object/any.h>
38
39 #if defined(VCONF_ENABLED)
40 #include <vconf-keys.h>
41 #include <vconf.h>
42 #endif
43
44 #include <wayland-egl-tizen.h>
45
46 namespace Dali
47 {
48 namespace Internal
49 {
50 namespace Adaptor
51 {
52 namespace
53 {
54 #if defined(DEBUG_ENABLED)
55 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
56 #endif
57
58 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
59
60 /**
61  * @brief Enumeration of location for window resized by display server.
62  */
63 enum class ResizeLocation
64 {
65   INVALID      = 0,  ///< Invalid value
66   TOP_LEFT     = 5,  ///< Start resizing window to the top-left edge.
67   LEFT         = 4,  ///< Start resizing window to the left side.
68   BOTTOM_LEFT  = 6,  ///< Start resizing window to the bottom-left edge.
69   BOTTOM       = 2,  ///< Start resizing window to the bottom side.
70   BOTTOM_RIGHT = 10, ///< Start resizing window to the bottom-right edge.
71   RIGHT        = 8,  ///< Start resizing window to the right side.
72   TOP_RIGHT    = 9,  ///< Start resizing window to the top-right edge.
73   TOP          = 1   ///< Start resizing window to the top side.
74 };
75
76 const uint32_t       MAX_TIZEN_CLIENT_VERSION = 7;
77 const unsigned int   PRIMARY_TOUCH_BUTTON_ID  = 1;
78 const ResizeLocation RESIZE_LOCATIONS[]       = {ResizeLocation::TOP_LEFT, ResizeLocation::LEFT, ResizeLocation::BOTTOM_LEFT, ResizeLocation::BOTTOM, ResizeLocation::BOTTOM_RIGHT, ResizeLocation::RIGHT, ResizeLocation::TOP_RIGHT, ResizeLocation::TOP, ResizeLocation::INVALID};
79
80 #if defined(VCONF_ENABLED)
81 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
82 #endif
83
84 struct KeyCodeMap
85 {
86   xkb_keysym_t  keySym;
87   xkb_keycode_t keyCode;
88   bool          isKeyCode;
89 };
90
91 /**
92  * Get the device name from the provided ecore key event
93  */
94 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
95 {
96   const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
97
98   if(ecoreDeviceName)
99   {
100     result = ecoreDeviceName;
101   }
102 }
103
104 /**
105  * Get the device class from the provided ecore event
106  */
107 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
108 {
109   switch(ecoreDeviceClass)
110   {
111     case ECORE_DEVICE_CLASS_SEAT:
112     {
113       deviceClass = Device::Class::USER;
114       break;
115     }
116     case ECORE_DEVICE_CLASS_KEYBOARD:
117     {
118       deviceClass = Device::Class::KEYBOARD;
119       break;
120     }
121     case ECORE_DEVICE_CLASS_MOUSE:
122     {
123       deviceClass = Device::Class::MOUSE;
124       break;
125     }
126     case ECORE_DEVICE_CLASS_TOUCH:
127     {
128       deviceClass = Device::Class::TOUCH;
129       break;
130     }
131     case ECORE_DEVICE_CLASS_PEN:
132     {
133       deviceClass = Device::Class::PEN;
134       break;
135     }
136     case ECORE_DEVICE_CLASS_POINTER:
137     {
138       deviceClass = Device::Class::POINTER;
139       break;
140     }
141     case ECORE_DEVICE_CLASS_GAMEPAD:
142     {
143       deviceClass = Device::Class::GAMEPAD;
144       break;
145     }
146     default:
147     {
148       deviceClass = Device::Class::NONE;
149       break;
150     }
151   }
152 }
153
154 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
155 {
156   switch(ecoreDeviceSubclass)
157   {
158     case ECORE_DEVICE_SUBCLASS_FINGER:
159     {
160       deviceSubclass = Device::Subclass::FINGER;
161       break;
162     }
163     case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
164     {
165       deviceSubclass = Device::Subclass::FINGERNAIL;
166       break;
167     }
168     case ECORE_DEVICE_SUBCLASS_KNUCKLE:
169     {
170       deviceSubclass = Device::Subclass::KNUCKLE;
171       break;
172     }
173     case ECORE_DEVICE_SUBCLASS_PALM:
174     {
175       deviceSubclass = Device::Subclass::PALM;
176       break;
177     }
178     case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
179     {
180       deviceSubclass = Device::Subclass::HAND_SIDE;
181       break;
182     }
183     case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
184     {
185       deviceSubclass = Device::Subclass::HAND_FLAT;
186       break;
187     }
188     case ECORE_DEVICE_SUBCLASS_PEN_TIP:
189     {
190       deviceSubclass = Device::Subclass::PEN_TIP;
191       break;
192     }
193     case ECORE_DEVICE_SUBCLASS_TRACKPAD:
194     {
195       deviceSubclass = Device::Subclass::TRACKPAD;
196       break;
197     }
198     case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
199     {
200       deviceSubclass = Device::Subclass::TRACKPOINT;
201       break;
202     }
203     case ECORE_DEVICE_SUBCLASS_TRACKBALL:
204     {
205       deviceSubclass = Device::Subclass::TRACKBALL;
206       break;
207     }
208     case ECORE_DEVICE_SUBCLASS_REMOCON:
209     {
210       deviceSubclass = Device::Subclass::REMOCON;
211       break;
212     }
213     case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
214     {
215       deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
216       break;
217     }
218     default:
219     {
220       deviceSubclass = Device::Subclass::NONE;
221       break;
222     }
223   }
224 }
225
226 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
227 {
228   KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
229   if(foundKeyCode->isKeyCode)
230   {
231     return;
232   }
233
234   xkb_keysym_t        keySym  = foundKeyCode->keySym;
235   int                 nsyms   = 0;
236   const xkb_keysym_t* symsOut = NULL;
237
238   nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
239
240   if(nsyms && symsOut)
241   {
242     if(*symsOut == keySym)
243     {
244       foundKeyCode->keyCode   = key;
245       foundKeyCode->isKeyCode = true;
246     }
247   }
248 }
249
250 /**
251  * Return the recalculated window resizing location according to the current orientation.
252  */
253 ResizeLocation RecalculateLocationToCurrentOrientation(WindowResizeDirection direction, int windowRotationAngle)
254 {
255   int index = 8;
256   switch(direction)
257   {
258     case WindowResizeDirection::TOP_LEFT:
259     {
260       index = 0;
261       break;
262     }
263     case WindowResizeDirection::LEFT:
264     {
265       index = 1;
266       break;
267     }
268     case WindowResizeDirection::BOTTOM_LEFT:
269     {
270       index = 2;
271       break;
272     }
273     case WindowResizeDirection::BOTTOM:
274     {
275       index = 3;
276       break;
277     }
278     case WindowResizeDirection::BOTTOM_RIGHT:
279     {
280       index = 4;
281       break;
282     }
283     case WindowResizeDirection::RIGHT:
284     {
285       index = 5;
286       break;
287     }
288     case WindowResizeDirection::TOP_RIGHT:
289     {
290       index = 6;
291       break;
292     }
293     case WindowResizeDirection::TOP:
294     {
295       index = 7;
296       break;
297     }
298     default:
299     {
300       index = 8;
301       break;
302     }
303   }
304
305   if(index != 8 && windowRotationAngle != 0)
306   {
307     index = (index + (windowRotationAngle / 90) * 2) % 8;
308   }
309
310   return RESIZE_LOCATIONS[index];
311 }
312
313 /////////////////////////////////////////////////////////////////////////////////////////////////
314 // Window Callbacks
315 /////////////////////////////////////////////////////////////////////////////////////////////////
316
317 /// Called when the window iconify state is changed.
318 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
319 {
320   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
321   if(windowBase)
322   {
323     return windowBase->OnIconifyStateChanged(data, type, event);
324   }
325
326   return ECORE_CALLBACK_PASS_ON;
327 }
328
329 /// Called when the window gains focus
330 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
331 {
332   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
333   if(windowBase)
334   {
335     return windowBase->OnFocusIn(data, type, event);
336   }
337
338   return ECORE_CALLBACK_PASS_ON;
339 }
340
341 /// Called when the window loses focus
342 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
343 {
344   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
345   if(windowBase)
346   {
347     return windowBase->OnFocusOut(data, type, event);
348   }
349
350   return ECORE_CALLBACK_PASS_ON;
351 }
352
353 /// Called when the output is transformed
354 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
355 {
356   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
357   if(windowBase)
358   {
359     return windowBase->OnOutputTransform(data, type, event);
360   }
361
362   return ECORE_CALLBACK_PASS_ON;
363 }
364
365 /// Called when the output transform should be ignored
366 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
367 {
368   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
369   if(windowBase)
370   {
371     return windowBase->OnIgnoreOutputTransform(data, type, event);
372   }
373
374   return ECORE_CALLBACK_PASS_ON;
375 }
376
377 /**
378  * Called when rotate event is recevied.
379  */
380 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
381 {
382   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
383   if(windowBase)
384   {
385     DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
386     windowBase->OnRotation(data, type, event);
387   }
388   return ECORE_CALLBACK_PASS_ON;
389 }
390
391 /**
392  * Called when configure event is recevied.
393  */
394 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
395 {
396   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
397   if(windowBase)
398   {
399     windowBase->OnConfiguration(data, type, event);
400   }
401   return ECORE_CALLBACK_PASS_ON;
402 }
403
404 /////////////////////////////////////////////////////////////////////////////////////////////////
405 // Touch Callbacks
406 /////////////////////////////////////////////////////////////////////////////////////////////////
407
408 /**
409  * Called when a touch down is received.
410  */
411 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
412 {
413   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
414   if(windowBase)
415   {
416     windowBase->OnMouseButtonDown(data, type, event);
417   }
418   return ECORE_CALLBACK_PASS_ON;
419 }
420
421 /**
422  * Called when a touch up is received.
423  */
424 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
425 {
426   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
427   if(windowBase)
428   {
429     windowBase->OnMouseButtonUp(data, type, event);
430   }
431   return ECORE_CALLBACK_PASS_ON;
432 }
433
434 /**
435  * Called when a touch motion is received.
436  */
437 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
438 {
439   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
440   if(windowBase)
441   {
442     windowBase->OnMouseButtonMove(data, type, event);
443   }
444   return ECORE_CALLBACK_PASS_ON;
445 }
446
447 /**
448  * Called when a touch is canceled.
449  */
450 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
451 {
452   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
453   if(windowBase)
454   {
455     windowBase->OnMouseButtonCancel(data, type, event);
456   }
457   return ECORE_CALLBACK_PASS_ON;
458 }
459
460 /**
461  * Called when a mouse wheel is received.
462  */
463 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
464 {
465   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
466   if(windowBase)
467   {
468     windowBase->OnMouseWheel(data, type, event);
469   }
470   return ECORE_CALLBACK_PASS_ON;
471 }
472
473 /**
474  * Called when a detent rotation event is recevied.
475  */
476 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
477 {
478   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
479   if(windowBase)
480   {
481     windowBase->OnDetentRotation(data, type, event);
482   }
483   return ECORE_CALLBACK_PASS_ON;
484 }
485
486 /////////////////////////////////////////////////////////////////////////////////////////////////
487 // Key Callbacks
488 /////////////////////////////////////////////////////////////////////////////////////////////////
489
490 /**
491  * Called when a key down is received.
492  */
493 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
494 {
495   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
496   if(windowBase)
497   {
498     windowBase->OnKeyDown(data, type, event);
499   }
500   return ECORE_CALLBACK_PASS_ON;
501 }
502
503 /**
504  * Called when a key up is received.
505  */
506 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
507 {
508   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
509   if(windowBase)
510   {
511     windowBase->OnKeyUp(data, type, event);
512   }
513   return ECORE_CALLBACK_PASS_ON;
514 }
515
516 /////////////////////////////////////////////////////////////////////////////////////////////////
517 // Selection Callbacks
518 /////////////////////////////////////////////////////////////////////////////////////////////////
519
520 /**
521  * Called when the source window notifies us the content in clipboard is selected.
522  */
523 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
524 {
525   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
526   if(windowBase)
527   {
528     windowBase->OnDataSend(data, type, event);
529   }
530   return ECORE_CALLBACK_PASS_ON;
531 }
532
533 /**
534  * Called when the source window sends us about the selected content.
535  * For example, when item is selected in the clipboard.
536  */
537 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
538 {
539   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
540   if(windowBase)
541   {
542     windowBase->OnDataReceive(data, type, event);
543   }
544   return ECORE_CALLBACK_PASS_ON;
545 }
546
547 /////////////////////////////////////////////////////////////////////////////////////////////////
548 // Effect Start/End Callbacks
549 /////////////////////////////////////////////////////////////////////////////////////////////////
550
551 /**
552  * Called when transition animation of the window's shown/hidden is started by window manager.
553  */
554 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
555 {
556   WindowBaseEcoreWl2*           windowBase  = static_cast<WindowBaseEcoreWl2*>(data);
557   Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
558   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
559   if(windowBase)
560   {
561     if(effectStart->type < 3) // only under restack
562     {
563       windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
564     }
565   }
566   return ECORE_CALLBACK_PASS_ON;
567 }
568
569 /**
570  * Called when transition animation of the window's shown/hidden is ended by window manager.
571  */
572 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
573 {
574   Ecore_Wl2_Event_Effect_Start* effectEnd  = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
575   WindowBaseEcoreWl2*           windowBase = static_cast<WindowBaseEcoreWl2*>(data);
576   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
577   if(windowBase)
578   {
579     if(effectEnd->type < 3) // only under restack
580     {
581       windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
582     }
583   }
584   return ECORE_CALLBACK_PASS_ON;
585 }
586
587 /////////////////////////////////////////////////////////////////////////////////////////////////
588 // Keyboard Repeat Settings Changed Callbacks
589 /////////////////////////////////////////////////////////////////////////////////////////////////
590
591 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
592 {
593   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
594   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
595   if(windowBase)
596   {
597     windowBase->OnKeyboardRepeatSettingsChanged();
598   }
599
600   return ECORE_CALLBACK_RENEW;
601 }
602
603 /////////////////////////////////////////////////////////////////////////////////////////////////
604 // Keymap Changed Callbacks
605 /////////////////////////////////////////////////////////////////////////////////////////////////
606
607 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
608 {
609   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
610   if(windowBase)
611   {
612     windowBase->KeymapChanged(data, type, event);
613   }
614
615   return ECORE_CALLBACK_RENEW;
616 }
617
618 /////////////////////////////////////////////////////////////////////////////////////////////////
619 // Font Callbacks
620 /////////////////////////////////////////////////////////////////////////////////////////////////
621
622 #if defined(VCONF_ENABLED)
623 /**
624  * Called when a font name is changed.
625  */
626 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
627 {
628   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
629   if(windowBase)
630   {
631     windowBase->OnFontNameChanged();
632   }
633 }
634
635 /**
636  * Called when a font size is changed.
637  */
638 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
639 {
640   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
641   if(windowBase)
642   {
643     windowBase->OnFontSizeChanged();
644   }
645 }
646 #endif
647
648 /////////////////////////////////////////////////////////////////////////////////////////////////
649 // Window Redraw Request Event Callbacks
650 /////////////////////////////////////////////////////////////////////////////////////////////////
651
652 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
653 {
654   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
655   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
656   if(windowBase)
657   {
658     windowBase->OnEcoreEventWindowRedrawRequest();
659   }
660
661   return ECORE_CALLBACK_RENEW;
662 }
663
664 /////////////////////////////////////////////////////////////////////////////////////////////////
665 // Window Auxiliary Message Callbacks
666 /////////////////////////////////////////////////////////////////////////////////////////////////
667 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
668 {
669   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
670   if(windowBase)
671   {
672     windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
673   }
674   return ECORE_CALLBACK_RENEW;
675 }
676
677 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
678 {
679   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
680   if(windowBase)
681   {
682     windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
683   }
684 }
685
686 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
687 {
688   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
689   if(windowBase)
690   {
691     windowBase->RegistryGlobalCallbackRemove(data, registry, id);
692   }
693 }
694
695 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
696 {
697 }
698
699 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)
700 {
701 }
702
703 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
704 {
705   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
706   if(windowBase)
707   {
708     windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
709   }
710 }
711
712 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
713 {
714 }
715
716 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
717 {
718   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
719   if(windowBase)
720   {
721     windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
722   }
723 }
724
725 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
726 {
727 }
728
729 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
730 {
731 }
732
733 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
734 {
735 }
736
737 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
738 {
739 }
740
741 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)
742 {
743 }
744
745 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
746 {
747   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
748   if(windowBase)
749   {
750     windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
751   }
752 }
753
754 const struct wl_registry_listener registryListener =
755   {
756     RegistryGlobalCallback,
757     RegistryGlobalCallbackRemove};
758
759 const struct tizen_policy_listener tizenPolicyListener =
760   {
761     TizenPolicyConformant,
762     TizenPolicyConformantArea,
763     TizenPolicyNotificationChangeDone,
764     TizenPolicyTransientForDone,
765     TizenPolicyScreenModeChangeDone,
766     TizenPolicyIconifyStateChanged,
767     TizenPolicySupportedAuxiliaryHints,
768     TizenPolicyAllowedAuxiliaryHint,
769     TizenPolicyAuxiliaryMessage,
770     TizenPolicyConformantRegion};
771
772 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
773   {
774     DisplayPolicyBrightnessChangeDone};
775
776 } // unnamed namespace
777
778 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
779 : mEcoreEventHandler(),
780   mEcoreWindow(nullptr),
781   mWlSurface(nullptr),
782   mWlInputPanel(nullptr),
783   mWlOutput(nullptr),
784   mWlInputPanelSurface(nullptr),
785   mEglWindow(nullptr),
786   mDisplay(nullptr),
787   mEventQueue(nullptr),
788   mTizenPolicy(nullptr),
789   mTizenDisplayPolicy(nullptr),
790   mKeyMap(nullptr),
791   mSupportedAuxiliaryHints(),
792   mWindowPositionSize(positionSize),
793   mAuxiliaryHints(),
794   mType(WindowType::NORMAL),
795   mNotificationLevel(-1),
796   mScreenOffMode(0),
797   mBrightness(0),
798   mWindowRotationAngle(0),
799   mScreenRotationAngle(0),
800   mSupportedPreProtation(0),
801   mNotificationChangeState(0),
802   mScreenOffModeChangeState(0),
803   mBrightnessChangeState(0),
804   mLastSubmittedMoveResizeSerial(0),
805   mMoveResizeSerial(0),
806   mNotificationLevelChangeDone(true),
807   mScreenOffModeChangeDone(true),
808   mVisible(true),
809   mOwnSurface(false),
810   mBrightnessChangeDone(true)
811 {
812   Initialize(positionSize, surface, isTransparent);
813 }
814
815 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
816 {
817 #if defined(VCONF_ENABLED)
818   vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
819   vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
820 #endif
821
822   for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
823   {
824     ecore_event_handler_del(*iter);
825   }
826   mEcoreEventHandler.Clear();
827
828   if(mEventQueue)
829   {
830     wl_event_queue_destroy(mEventQueue);
831   }
832
833   mSupportedAuxiliaryHints.clear();
834   mAuxiliaryHints.clear();
835
836   if(mEglWindow != NULL)
837   {
838     wl_egl_window_destroy(mEglWindow);
839     mEglWindow = NULL;
840   }
841
842   if(mOwnSurface)
843   {
844     ecore_wl2_window_free(mEcoreWindow);
845
846     WindowSystem::Shutdown();
847   }
848 }
849
850 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
851 {
852   if(surface.Empty() == false)
853   {
854     // check we have a valid type
855     DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
856
857     mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
858   }
859   else
860   {
861     // we own the surface about to created
862     WindowSystem::Initialize();
863
864     mOwnSurface = true;
865     CreateWindow(positionSize);
866   }
867
868   mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
869
870   SetTransparency(isTransparent);
871
872   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
873   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
874   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
875   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
876   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
877
878   // Register Rotate event
879   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
880
881   // Register Configure event
882   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
883
884   // Register Touch events
885   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
886   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
887   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
888   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
889
890   // Register Mouse wheel events
891   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
892
893   // Register Detent event
894   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
895
896   // Register Key events
897   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
898   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
899
900   // Register Selection event - clipboard selection
901   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
902   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this));
903
904   // Register Effect Start/End event
905   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
906   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
907
908   // Register Keyboard repeat event
909   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
910
911   // Register Window redraw request event
912   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
913
914   // Register Window auxiliary event
915   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
916
917 #if defined(VCONF_ENABLED)
918   // Register Vconf notify - font name and size
919   vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
920   vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
921 #endif
922
923   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
924   mDisplay                   = ecore_wl2_display_get(display);
925
926   if(mDisplay)
927   {
928     wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
929     if(displayWrapper)
930     {
931       mEventQueue = wl_display_create_queue(mDisplay);
932       if(mEventQueue)
933       {
934         wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
935
936         wl_registry* registry = wl_display_get_registry(displayWrapper);
937         wl_registry_add_listener(registry, &registryListener, this);
938       }
939
940       wl_proxy_wrapper_destroy(displayWrapper);
941     }
942   }
943
944   Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
945
946   if(ecoreWlInput)
947   {
948     mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
949
950     mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
951   }
952
953   // get auxiliary hint
954   Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
955   if(hints)
956   {
957     Eina_List* l    = NULL;
958     char*      hint = NULL;
959
960     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))))
961     {
962       mSupportedAuxiliaryHints.push_back(hint);
963
964       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
965     }
966   }
967 }
968
969 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
970 {
971   Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
972   Eina_Bool                                    handled(ECORE_CALLBACK_PASS_ON);
973
974   if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
975   {
976     if(iconifyChangedEvent->iconified == EINA_TRUE)
977     {
978       mIconifyChangedSignal.Emit(true);
979     }
980     else
981     {
982       mIconifyChangedSignal.Emit(false);
983     }
984     handled = ECORE_CALLBACK_DONE;
985   }
986
987   return handled;
988 }
989
990 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
991 {
992   Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
993
994   if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
995   {
996     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
997
998     mFocusChangedSignal.Emit(true);
999   }
1000
1001   return ECORE_CALLBACK_PASS_ON;
1002 }
1003
1004 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
1005 {
1006   Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
1007
1008   if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1009   {
1010     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
1011
1012     mFocusChangedSignal.Emit(false);
1013   }
1014
1015   return ECORE_CALLBACK_PASS_ON;
1016 }
1017
1018 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
1019 {
1020   Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
1021
1022   if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
1023   {
1024     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
1025
1026     mScreenRotationAngle = GetScreenRotationAngle();
1027
1028     mOutputTransformedSignal.Emit();
1029   }
1030
1031   return ECORE_CALLBACK_PASS_ON;
1032 }
1033
1034 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
1035 {
1036   Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
1037
1038   if(ignoreTransformEvent->win == mEcoreWindow)
1039   {
1040     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
1041
1042     mScreenRotationAngle = GetScreenRotationAngle();
1043
1044     mOutputTransformedSignal.Emit();
1045   }
1046
1047   return ECORE_CALLBACK_PASS_ON;
1048 }
1049
1050 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
1051 {
1052   Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
1053
1054   if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1055   {
1056     DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
1057
1058     RotationEvent rotationEvent;
1059     rotationEvent.angle     = ev->angle;
1060     rotationEvent.winResize = 0;
1061
1062     if(ev->w == 0 || ev->h == 0)
1063     {
1064       // When rotation event does not have the window width or height,
1065       // previous DALi side window's size are used.
1066       ev->w = mWindowPositionSize.width;
1067       ev->h = mWindowPositionSize.height;
1068     }
1069
1070     mWindowRotationAngle = ev->angle;
1071
1072     mWindowPositionSize.width  = ev->w;
1073     mWindowPositionSize.height = ev->h;
1074
1075     PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1076
1077     rotationEvent.x      = newPositionSize.x;
1078     rotationEvent.y      = newPositionSize.y;
1079     rotationEvent.width  = newPositionSize.width;
1080     rotationEvent.height = newPositionSize.height;
1081
1082     mRotationSignal.Emit(rotationEvent);
1083   }
1084 }
1085
1086 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1087 {
1088   Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1089
1090   if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1091   {
1092     // Note: To comply with the wayland protocol, Dali should make an ack_configure
1093     // by calling ecore_wl2_window_commit
1094
1095     int tempWidth  = static_cast<int>(ev->w);
1096     int tempHeight = static_cast<int>(ev->h);
1097
1098     // Initialize with previous size for skip resize when new size is 0.
1099     // When window is just moved or window is resized by client application,
1100     // The configure notification event's size will be 0.
1101     // If new size is 0, the resized work should be skip.
1102     int  newWidth    = mWindowPositionSize.width;
1103     int  newHeight   = mWindowPositionSize.height;
1104     bool windowMoved = false, windowResized = false;
1105
1106     if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1107     {
1108       windowMoved = true;
1109     }
1110
1111     if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1112     {
1113       windowResized = true;
1114       newWidth      = tempWidth;
1115       newHeight     = tempHeight;
1116     }
1117
1118     if(windowMoved || windowResized)
1119     {
1120       mWindowPositionSize.x      = ev->x;
1121       mWindowPositionSize.y      = ev->y;
1122       mWindowPositionSize.width  = newWidth;
1123       mWindowPositionSize.height = newHeight;
1124       DALI_LOG_RELEASE_INFO("Update position & resize signal by server, current angle [%d] x[%d] y[%d] w[%d] h[%d]\n", mWindowRotationAngle, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1125
1126       ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1127
1128       Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1129       mUpdatePositionSizeSignal.Emit(newPositionSize);
1130     }
1131
1132     ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1133   }
1134 }
1135
1136 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1137 {
1138   Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1139
1140   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1141   {
1142     Device::Class::Type    deviceClass;
1143     Device::Subclass::Type deviceSubclass;
1144
1145     GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1146     GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1147
1148     PointState::Type state(PointState::DOWN);
1149
1150     if(deviceClass != Device::Class::Type::MOUSE)
1151     {
1152       // Check if the buttons field is set and ensure it's the primary touch button.
1153       // If this event was triggered by buttons other than the primary button (used for touch), then
1154       // just send an interrupted event to Core.
1155       if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1156       {
1157         state = PointState::INTERRUPTED;
1158       }
1159     }
1160
1161     Integration::Point point;
1162     point.SetDeviceId(touchEvent->multi.device);
1163     point.SetState(state);
1164     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1165     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1166     point.SetPressure(touchEvent->multi.pressure);
1167     point.SetAngle(Degree(touchEvent->multi.angle));
1168     point.SetDeviceClass(deviceClass);
1169     point.SetDeviceSubclass(deviceSubclass);
1170     point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1171
1172     mTouchEventSignal.Emit(point, touchEvent->timestamp);
1173   }
1174 }
1175
1176 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1177 {
1178   Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1179
1180   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1181   {
1182     Device::Class::Type    deviceClass;
1183     Device::Subclass::Type deviceSubclass;
1184
1185     GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1186     GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1187
1188     Integration::Point point;
1189     point.SetDeviceId(touchEvent->multi.device);
1190     point.SetState(PointState::UP);
1191     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1192     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1193     point.SetPressure(touchEvent->multi.pressure);
1194     point.SetAngle(Degree(touchEvent->multi.angle));
1195     point.SetDeviceClass(deviceClass);
1196     point.SetDeviceSubclass(deviceSubclass);
1197     point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1198
1199     mTouchEventSignal.Emit(point, touchEvent->timestamp);
1200   }
1201 }
1202
1203 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1204 {
1205   Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1206
1207   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1208   {
1209     Device::Class::Type    deviceClass;
1210     Device::Subclass::Type deviceSubclass;
1211
1212     GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1213     GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1214
1215     Integration::Point point;
1216     point.SetDeviceId(touchEvent->multi.device);
1217     point.SetState(PointState::MOTION);
1218     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1219     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1220     point.SetPressure(touchEvent->multi.pressure);
1221     point.SetAngle(Degree(touchEvent->multi.angle));
1222     point.SetDeviceClass(deviceClass);
1223     point.SetDeviceSubclass(deviceSubclass);
1224
1225     mTouchEventSignal.Emit(point, touchEvent->timestamp);
1226   }
1227 }
1228
1229 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1230 {
1231   Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1232
1233   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1234   {
1235     Integration::Point point;
1236     point.SetDeviceId(touchEvent->multi.device);
1237     point.SetState(PointState::INTERRUPTED);
1238     point.SetScreenPosition(Vector2(0.0f, 0.0f));
1239
1240     mTouchEventSignal.Emit(point, touchEvent->timestamp);
1241
1242     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1243   }
1244 }
1245
1246 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1247 {
1248   Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1249
1250   if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1251   {
1252     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
1253
1254     Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1255
1256     mWheelEventSignal.Emit(wheelEvent);
1257   }
1258 }
1259
1260 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1261 {
1262   Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1263
1264   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1265
1266   int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1267
1268   Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1269
1270   mWheelEventSignal.Emit(wheelEvent);
1271 }
1272
1273 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1274 {
1275   Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1276
1277   if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1278   {
1279     std::string keyName(keyEvent->keyname);
1280     std::string logicalKey("");
1281     std::string keyString("");
1282     std::string compose("");
1283
1284     DALI_TRACE_BEGIN(gTraceFilter, "DALI_ON_KEY_DOWN");
1285
1286     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1287     if(keyEvent->compose)
1288     {
1289       compose = keyEvent->compose;
1290     }
1291
1292     // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1293     if(keyEvent->key)
1294     {
1295       logicalKey = keyEvent->key;
1296     }
1297
1298     int keyCode = 0;
1299     GetKeyCode(keyName, keyCode); // Get key code dynamically.
1300
1301     if(keyCode == 0)
1302     {
1303       // Get a specific key code from dali key look up table.
1304       keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1305     }
1306
1307     keyCode = (keyCode == -1) ? 0 : keyCode;
1308     int           modifier(keyEvent->modifiers);
1309     unsigned long time = keyEvent->timestamp;
1310     if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1311     {
1312       keyCode = atoi(keyEvent->keyname + 8);
1313     }
1314
1315     // Ensure key event string is not NULL as keys like SHIFT have a null string.
1316     if(keyEvent->string)
1317     {
1318       keyString = keyEvent->string;
1319     }
1320
1321     std::string            deviceName;
1322     Device::Class::Type    deviceClass;
1323     Device::Subclass::Type deviceSubclass;
1324
1325     GetDeviceName(keyEvent, deviceName);
1326     GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1327     GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1328
1329     Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1330
1331     mKeyEventSignal.Emit(keyEvent);
1332
1333     DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_DOWN");
1334   }
1335 }
1336
1337 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1338 {
1339   Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1340
1341   if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1342   {
1343 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1344     // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1345     if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1346     {
1347       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1348       return;
1349     }
1350 #endif // Since ecore 1.23 version
1351
1352     std::string keyName(keyEvent->keyname);
1353     std::string logicalKey("");
1354     std::string keyString("");
1355     std::string compose("");
1356
1357     DALI_TRACE_BEGIN(gTraceFilter, "DALI_ON_KEY_UP");
1358
1359     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1360     if(keyEvent->compose)
1361     {
1362       compose = keyEvent->compose;
1363     }
1364
1365     // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1366     if(keyEvent->key)
1367     {
1368       logicalKey = keyEvent->key;
1369     }
1370
1371     int keyCode = 0;
1372     GetKeyCode(keyName, keyCode); // Get key code dynamically.
1373
1374     if(keyCode == 0)
1375     {
1376       // Get a specific key code from dali key look up table.
1377       keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1378     }
1379
1380     keyCode = (keyCode == -1) ? 0 : keyCode;
1381     int           modifier(keyEvent->modifiers);
1382     unsigned long time = keyEvent->timestamp;
1383     if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1384     {
1385       keyCode = atoi(keyEvent->keyname + 8);
1386     }
1387
1388     // Ensure key event string is not NULL as keys like SHIFT have a null string.
1389     if(keyEvent->string)
1390     {
1391       keyString = keyEvent->string;
1392     }
1393
1394     std::string            deviceName;
1395     Device::Class::Type    deviceClass;
1396     Device::Subclass::Type deviceSubclass;
1397
1398     GetDeviceName(keyEvent, deviceName);
1399     GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1400     GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1401
1402     Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1403
1404     mKeyEventSignal.Emit(keyEvent);
1405
1406     DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_UP");
1407   }
1408 }
1409
1410 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1411 {
1412   mSelectionDataSendSignal.Emit(event);
1413 }
1414
1415 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1416 {
1417   mSelectionDataReceivedSignal.Emit(event);
1418 }
1419
1420 void WindowBaseEcoreWl2::OnFontNameChanged()
1421 {
1422   mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1423 }
1424
1425 void WindowBaseEcoreWl2::OnFontSizeChanged()
1426 {
1427   mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1428 }
1429
1430 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1431 {
1432   mTransitionEffectEventSignal.Emit(state, type);
1433 }
1434
1435 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1436 {
1437   mKeyboardRepeatSettingsChangedSignal.Emit();
1438 }
1439
1440 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1441 {
1442   mWindowRedrawRequestSignal.Emit();
1443 }
1444
1445 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1446 {
1447   Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1448   if(message)
1449   {
1450     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1451     std::string           key(message->key);
1452     std::string           value(message->val);
1453     Dali::Property::Array options;
1454
1455     if(message->options)
1456     {
1457       Eina_List* l;
1458       void*      data;
1459       EINA_LIST_FOREACH(message->options, l, data)
1460       {
1461         DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1462         std::string option(static_cast<char*>(data));
1463         options.Add(option);
1464       }
1465     }
1466
1467     mAuxiliaryMessageSignal.Emit(key, value, options);
1468   }
1469 }
1470
1471 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1472 {
1473   Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1474   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1475   Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1476   if(ecoreWlInput)
1477   {
1478     mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1479   }
1480 }
1481
1482 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1483 {
1484   if(strcmp(interface, tizen_policy_interface.name) == 0)
1485   {
1486     uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1487
1488     mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1489     if(!mTizenPolicy)
1490     {
1491       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1492       return;
1493     }
1494
1495     tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1496
1497     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1498   }
1499   else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1500   {
1501     mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1502     if(!mTizenDisplayPolicy)
1503     {
1504       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1505       return;
1506     }
1507
1508     tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1509
1510     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1511   }
1512 }
1513
1514 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1515 {
1516   mTizenPolicy        = NULL;
1517   mTizenDisplayPolicy = NULL;
1518 }
1519
1520 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1521 {
1522   mNotificationLevel           = level;
1523   mNotificationChangeState     = state;
1524   mNotificationLevelChangeDone = true;
1525
1526   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1527 }
1528
1529 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1530 {
1531   mScreenOffMode            = mode;
1532   mScreenOffModeChangeState = state;
1533   mScreenOffModeChangeDone  = true;
1534
1535   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1536 }
1537
1538 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1539 {
1540   mBrightness            = brightness;
1541   mBrightnessChangeState = state;
1542   mBrightnessChangeDone  = true;
1543
1544   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1545 }
1546
1547 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1548 {
1549   xkb_keysym_t sym = XKB_KEY_NoSymbol;
1550   KeyCodeMap   foundKeyCode;
1551
1552   sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1553   if(sym == XKB_KEY_NoSymbol)
1554   {
1555     DALI_LOG_ERROR("Failed to get keysym in WindowBaseEcoreWl2\n");
1556     return;
1557   }
1558
1559   foundKeyCode.keySym    = sym;
1560   foundKeyCode.isKeyCode = false;
1561   xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1562   keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1563 }
1564
1565 Any WindowBaseEcoreWl2::GetNativeWindow()
1566 {
1567   return mEcoreWindow;
1568 }
1569
1570 int WindowBaseEcoreWl2::GetNativeWindowId()
1571 {
1572   return ecore_wl2_window_id_get(mEcoreWindow);
1573 }
1574
1575 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1576 {
1577 #ifdef OVER_TIZEN_VERSION_7
1578   return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1579 #else
1580   return std::string();
1581 #endif
1582 }
1583
1584 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1585 {
1586   int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1587   if(totalAngle == 90 || totalAngle == 270)
1588   {
1589     mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1590   }
1591   else
1592   {
1593     mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1594   }
1595
1596   return static_cast<EGLNativeWindowType>(mEglWindow);
1597 }
1598
1599 void WindowBaseEcoreWl2::DestroyEglWindow()
1600 {
1601   if(mEglWindow != NULL)
1602   {
1603     wl_egl_window_destroy(mEglWindow);
1604     mEglWindow = NULL;
1605   }
1606 }
1607
1608 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1609 {
1610   wl_egl_window_tizen_rotation rotation;
1611
1612   switch(angle)
1613   {
1614     case 0:
1615     {
1616       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1617       break;
1618     }
1619     case 90:
1620     {
1621       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1622       break;
1623     }
1624     case 180:
1625     {
1626       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1627       break;
1628     }
1629     case 270:
1630     {
1631       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1632       break;
1633     }
1634     default:
1635     {
1636       rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1637       break;
1638     }
1639   }
1640
1641   wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
1642 }
1643
1644 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
1645 {
1646   wl_output_transform bufferTransform;
1647
1648   switch(angle)
1649   {
1650     case 0:
1651     {
1652       bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1653       break;
1654     }
1655     case 90:
1656     {
1657       bufferTransform = WL_OUTPUT_TRANSFORM_90;
1658       break;
1659     }
1660     case 180:
1661     {
1662       bufferTransform = WL_OUTPUT_TRANSFORM_180;
1663       break;
1664     }
1665     case 270:
1666     {
1667       bufferTransform = WL_OUTPUT_TRANSFORM_270;
1668       break;
1669     }
1670     default:
1671     {
1672       bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1673       break;
1674     }
1675   }
1676
1677   DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
1678   wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
1679 }
1680
1681 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
1682 {
1683   wl_output_transform windowTransform;
1684
1685   switch(angle)
1686   {
1687     case 0:
1688     {
1689       windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1690       break;
1691     }
1692     case 90:
1693     {
1694       windowTransform = WL_OUTPUT_TRANSFORM_90;
1695       break;
1696     }
1697     case 180:
1698     {
1699       windowTransform = WL_OUTPUT_TRANSFORM_180;
1700       break;
1701     }
1702     case 270:
1703     {
1704       windowTransform = WL_OUTPUT_TRANSFORM_270;
1705       break;
1706     }
1707     default:
1708     {
1709       windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1710       break;
1711     }
1712   }
1713
1714   DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
1715   wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
1716 }
1717
1718 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
1719 {
1720   DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height);
1721   wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
1722
1723   // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1724   if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
1725   {
1726     wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
1727     mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1728   }
1729 }
1730
1731 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1732 {
1733   // Check capability
1734   wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
1735   if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
1736   {
1737     mSupportedPreProtation = true;
1738     return true;
1739   }
1740   mSupportedPreProtation = false;
1741   return false;
1742 }
1743
1744 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
1745 {
1746   PositionSize newPositionSize;
1747   int32_t      screenWidth, screenHeight;
1748   WindowSystem::GetScreenSize(screenWidth, screenHeight);
1749
1750   if(mWindowRotationAngle == 90)
1751   {
1752     newPositionSize.x      = positionSize.y;
1753     newPositionSize.y      = screenHeight - (positionSize.x + positionSize.width);
1754     newPositionSize.width  = positionSize.height;
1755     newPositionSize.height = positionSize.width;
1756   }
1757   else if(mWindowRotationAngle == 180)
1758   {
1759     newPositionSize.x      = screenWidth - (positionSize.x + positionSize.width);
1760     newPositionSize.y      = screenHeight - (positionSize.y + positionSize.height);
1761     newPositionSize.width  = positionSize.width;
1762     newPositionSize.height = positionSize.height;
1763   }
1764   else if(mWindowRotationAngle == 270)
1765   {
1766     newPositionSize.x      = screenWidth - (positionSize.y + positionSize.height);
1767     newPositionSize.y      = positionSize.x;
1768     newPositionSize.width  = positionSize.height;
1769     newPositionSize.height = positionSize.width;
1770   }
1771   else
1772   {
1773     newPositionSize.x      = positionSize.x;
1774     newPositionSize.y      = positionSize.y;
1775     newPositionSize.width  = positionSize.width;
1776     newPositionSize.height = positionSize.height;
1777   }
1778
1779   return newPositionSize;
1780 }
1781
1782 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
1783 {
1784   PositionSize newPositionSize;
1785   int32_t      screenWidth, screenHeight;
1786   WindowSystem::GetScreenSize(screenWidth, screenHeight);
1787
1788   if(mWindowRotationAngle == 90)
1789   {
1790     newPositionSize.x      = screenHeight - (positionSize.y + positionSize.height);
1791     newPositionSize.y      = positionSize.x;
1792     newPositionSize.width  = positionSize.height;
1793     newPositionSize.height = positionSize.width;
1794   }
1795   else if(mWindowRotationAngle == 180)
1796   {
1797     newPositionSize.x      = screenWidth - (positionSize.x + positionSize.width);
1798     newPositionSize.y      = screenHeight - (positionSize.y + positionSize.height);
1799     newPositionSize.width  = positionSize.width;
1800     newPositionSize.height = positionSize.height;
1801   }
1802   else if(mWindowRotationAngle == 270)
1803   {
1804     newPositionSize.x      = positionSize.y;
1805     newPositionSize.y      = screenWidth - (positionSize.x + positionSize.width);
1806     newPositionSize.width  = positionSize.height;
1807     newPositionSize.height = positionSize.width;
1808   }
1809   else
1810   {
1811     newPositionSize.x      = positionSize.x;
1812     newPositionSize.y      = positionSize.y;
1813     newPositionSize.width  = positionSize.width;
1814     newPositionSize.height = positionSize.height;
1815   }
1816
1817   return newPositionSize;
1818 }
1819
1820 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
1821 {
1822   PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1823
1824   mWindowPositionSize = newPositionSize;
1825   DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
1826   ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
1827 }
1828
1829 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
1830 {
1831   PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1832
1833   mWindowPositionSize = newPositionSize;
1834   DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1835   ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1836 }
1837
1838 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
1839 {
1840   PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1841
1842   mWindowPositionSize = newPositionSize;
1843   DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1844   ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1845 }
1846
1847 void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
1848 {
1849   DALI_LOG_RELEASE_INFO("ecore_wl2_window_layout_set, numCols[%d], numRows[%d], column[%d], row[%d], colSpan[%d], rowSpan[%d]\n", numCols, numRows, column, row, colSpan, rowSpan);
1850   ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
1851 }
1852
1853 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
1854 {
1855   ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
1856   ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
1857 }
1858
1859 void WindowBaseEcoreWl2::Raise()
1860 {
1861   // Use ecore_wl2_window_activate to prevent the window shown without rendering
1862   ecore_wl2_window_activate(mEcoreWindow);
1863 }
1864
1865 void WindowBaseEcoreWl2::Lower()
1866 {
1867   ecore_wl2_window_lower(mEcoreWindow);
1868 }
1869
1870 void WindowBaseEcoreWl2::Activate()
1871 {
1872   ecore_wl2_window_activate(mEcoreWindow);
1873 }
1874
1875 void WindowBaseEcoreWl2::Maximize(bool maximize)
1876 {
1877   ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
1878 }
1879
1880 bool WindowBaseEcoreWl2::IsMaximized() const
1881 {
1882   return ecore_wl2_window_maximized_get(mEcoreWindow);
1883 }
1884
1885 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
1886 {
1887   DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1888   ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1889   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
1890 }
1891
1892 void WindowBaseEcoreWl2::Minimize(bool minimize)
1893 {
1894   ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
1895 }
1896
1897 bool WindowBaseEcoreWl2::IsMinimized() const
1898 {
1899   return ecore_wl2_window_iconified_get(mEcoreWindow);
1900 }
1901
1902 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
1903 {
1904   DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1905   ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1906   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
1907 }
1908
1909 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
1910 {
1911   int rotations[4] = {0};
1912   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
1913   for(std::size_t i = 0; i < angles.size(); ++i)
1914   {
1915     rotations[i] = static_cast<int>(angles[i]);
1916     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
1917   }
1918   ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
1919 }
1920
1921 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
1922 {
1923   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
1924   ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
1925 }
1926
1927 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
1928 {
1929   ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
1930 }
1931
1932 void WindowBaseEcoreWl2::Show()
1933 {
1934   if(!mVisible)
1935   {
1936     ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1937   }
1938   mVisible = true;
1939
1940   ecore_wl2_window_show(mEcoreWindow);
1941 }
1942
1943 void WindowBaseEcoreWl2::Hide()
1944 {
1945   mVisible = false;
1946   ecore_wl2_window_hide(mEcoreWindow);
1947 }
1948
1949 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1950 {
1951   return mSupportedAuxiliaryHints.size();
1952 }
1953
1954 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
1955 {
1956   if(index >= GetSupportedAuxiliaryHintCount())
1957   {
1958     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
1959   }
1960
1961   return mSupportedAuxiliaryHints[index];
1962 }
1963
1964 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
1965 {
1966   bool supported = false;
1967
1968   // Check if the hint is suppported
1969   for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
1970   {
1971     if(*iter == hint)
1972     {
1973       supported = true;
1974       break;
1975     }
1976   }
1977
1978   if(!supported)
1979   {
1980     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
1981     return 0;
1982   }
1983
1984   // Check if the hint is already added
1985   for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1986   {
1987     if(mAuxiliaryHints[i].first == hint)
1988     {
1989       // Just change the value
1990       mAuxiliaryHints[i].second = value;
1991
1992       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
1993
1994       return i + 1; // id is index + 1
1995     }
1996   }
1997
1998   // Add the hint
1999   mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
2000
2001   unsigned int id = mAuxiliaryHints.size();
2002
2003   ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
2004
2005   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
2006
2007   return id;
2008 }
2009
2010 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
2011 {
2012   if(id == 0 || id > mAuxiliaryHints.size())
2013   {
2014     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
2015     return false;
2016   }
2017
2018   mAuxiliaryHints[id - 1].second = std::string();
2019
2020   ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
2021
2022   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
2023
2024   return true;
2025 }
2026
2027 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
2028 {
2029   if(id == 0 || id > mAuxiliaryHints.size())
2030   {
2031     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
2032     return false;
2033   }
2034
2035   mAuxiliaryHints[id - 1].second = value;
2036
2037   ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
2038
2039   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());
2040
2041   return true;
2042 }
2043
2044 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
2045 {
2046   if(id == 0 || id > mAuxiliaryHints.size())
2047   {
2048     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
2049     return std::string();
2050   }
2051
2052   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());
2053
2054   return mAuxiliaryHints[id - 1].second;
2055 }
2056
2057 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
2058 {
2059   for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2060   {
2061     if(mAuxiliaryHints[i].first == hint)
2062     {
2063       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
2064       return i + 1;
2065     }
2066   }
2067
2068   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
2069
2070   return 0;
2071 }
2072
2073 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
2074 {
2075   DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
2076   Eina_Rectangle rect;
2077   rect.x = inputRegion.x;
2078   rect.y = inputRegion.y;
2079   rect.w = inputRegion.width;
2080   rect.h = inputRegion.height;
2081
2082   ecore_wl2_window_input_rect_set(mEcoreWindow, &rect);
2083   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2084 }
2085
2086 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
2087 {
2088   if(mType != type)
2089   {
2090     mType = type;
2091     Ecore_Wl2_Window_Type windowType;
2092
2093     switch(type)
2094     {
2095       case Dali::WindowType::NORMAL:
2096       {
2097         windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2098         break;
2099       }
2100       case Dali::WindowType::NOTIFICATION:
2101       {
2102         windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2103         break;
2104       }
2105       case Dali::WindowType::UTILITY:
2106       {
2107         windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2108         break;
2109       }
2110       case Dali::WindowType::DIALOG:
2111       {
2112         windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2113         break;
2114       }
2115       case Dali::WindowType::IME:
2116       {
2117         windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2118         break;
2119       }
2120       case Dali::WindowType::DESKTOP:
2121       {
2122         windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
2123         break;
2124       }
2125       default:
2126       {
2127         windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2128         break;
2129       }
2130     }
2131     ecore_wl2_window_type_set(mEcoreWindow, windowType);
2132   }
2133 }
2134
2135 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2136 {
2137   return mType;
2138 }
2139
2140 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2141 {
2142   while(!mTizenPolicy)
2143   {
2144     wl_display_dispatch_queue(mDisplay, mEventQueue);
2145   }
2146
2147   int notificationLevel;
2148
2149   switch(level)
2150   {
2151     case Dali::WindowNotificationLevel::NONE:
2152     {
2153       notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2154       break;
2155     }
2156     case Dali::WindowNotificationLevel::BASE:
2157     {
2158       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2159       break;
2160     }
2161     case Dali::WindowNotificationLevel::MEDIUM:
2162     {
2163       notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2164       break;
2165     }
2166     case Dali::WindowNotificationLevel::HIGH:
2167     {
2168       notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2169       break;
2170     }
2171     case Dali::WindowNotificationLevel::TOP:
2172     {
2173       notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2174       break;
2175     }
2176     default:
2177     {
2178       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2179       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2180       break;
2181     }
2182   }
2183
2184   mNotificationLevelChangeDone = false;
2185   mNotificationChangeState     = TIZEN_POLICY_ERROR_STATE_NONE;
2186
2187   tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2188
2189   int count = 0;
2190
2191   while(!mNotificationLevelChangeDone && count < 3)
2192   {
2193     ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2194     wl_display_dispatch_queue(mDisplay, mEventQueue);
2195     count++;
2196   }
2197
2198   if(!mNotificationLevelChangeDone)
2199   {
2200     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2201     return Dali::WindowOperationResult::UNKNOWN_ERROR;
2202   }
2203   else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2204   {
2205     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2206     return Dali::WindowOperationResult::PERMISSION_DENIED;
2207   }
2208
2209   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2210
2211   return Dali::WindowOperationResult::SUCCEED;
2212 }
2213
2214 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2215 {
2216   while(!mTizenPolicy)
2217   {
2218     wl_display_dispatch_queue(mDisplay, mEventQueue);
2219   }
2220
2221   int count = 0;
2222
2223   while(!mNotificationLevelChangeDone && count < 3)
2224   {
2225     ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2226     wl_display_dispatch_queue(mDisplay, mEventQueue);
2227     count++;
2228   }
2229
2230   if(!mNotificationLevelChangeDone)
2231   {
2232     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2233     return Dali::WindowNotificationLevel::NONE;
2234   }
2235
2236   Dali::WindowNotificationLevel level;
2237
2238   switch(mNotificationLevel)
2239   {
2240     case TIZEN_POLICY_LEVEL_NONE:
2241     {
2242       level = Dali::WindowNotificationLevel::NONE;
2243       break;
2244     }
2245     case TIZEN_POLICY_LEVEL_DEFAULT:
2246     {
2247       level = Dali::WindowNotificationLevel::BASE;
2248       break;
2249     }
2250     case TIZEN_POLICY_LEVEL_MEDIUM:
2251     {
2252       level = Dali::WindowNotificationLevel::MEDIUM;
2253       break;
2254     }
2255     case TIZEN_POLICY_LEVEL_HIGH:
2256     {
2257       level = Dali::WindowNotificationLevel::HIGH;
2258       break;
2259     }
2260     case TIZEN_POLICY_LEVEL_TOP:
2261     {
2262       level = Dali::WindowNotificationLevel::TOP;
2263       break;
2264     }
2265     default:
2266     {
2267       DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2268       level = Dali::WindowNotificationLevel::NONE;
2269       break;
2270     }
2271   }
2272
2273   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2274
2275   return level;
2276 }
2277
2278 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2279 {
2280   while(!mTizenPolicy)
2281   {
2282     wl_display_dispatch_queue(mDisplay, mEventQueue);
2283   }
2284
2285   tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2286 }
2287
2288 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2289 {
2290   while(!mTizenPolicy)
2291   {
2292     wl_display_dispatch_queue(mDisplay, mEventQueue);
2293   }
2294
2295   mScreenOffModeChangeDone  = false;
2296   mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2297
2298   unsigned int mode = 0;
2299
2300   switch(screenOffMode)
2301   {
2302     case WindowScreenOffMode::TIMEOUT:
2303     {
2304       mode = 0;
2305       break;
2306     }
2307     case WindowScreenOffMode::NEVER:
2308     {
2309       mode = 1;
2310       break;
2311     }
2312   }
2313
2314   tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2315
2316   int count = 0;
2317
2318   while(!mScreenOffModeChangeDone && count < 3)
2319   {
2320     ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2321     wl_display_dispatch_queue(mDisplay, mEventQueue);
2322     count++;
2323   }
2324
2325   if(!mScreenOffModeChangeDone)
2326   {
2327     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2328     return Dali::WindowOperationResult::UNKNOWN_ERROR;
2329   }
2330   else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2331   {
2332     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2333     return Dali::WindowOperationResult::PERMISSION_DENIED;
2334   }
2335
2336   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2337
2338   return Dali::WindowOperationResult::SUCCEED;
2339 }
2340
2341 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2342 {
2343   while(!mTizenPolicy)
2344   {
2345     wl_display_dispatch_queue(mDisplay, mEventQueue);
2346   }
2347
2348   int count = 0;
2349
2350   while(!mScreenOffModeChangeDone && count < 3)
2351   {
2352     ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2353     wl_display_dispatch_queue(mDisplay, mEventQueue);
2354     count++;
2355   }
2356
2357   if(!mScreenOffModeChangeDone)
2358   {
2359     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2360     return WindowScreenOffMode::TIMEOUT;
2361   }
2362
2363   WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2364
2365   switch(mScreenOffMode)
2366   {
2367     case 0:
2368     {
2369       screenMode = WindowScreenOffMode::TIMEOUT;
2370       break;
2371     }
2372     case 1:
2373     {
2374       screenMode = WindowScreenOffMode::NEVER;
2375       break;
2376     }
2377   }
2378
2379   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2380
2381   return screenMode;
2382 }
2383
2384 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2385 {
2386   while(!mTizenDisplayPolicy)
2387   {
2388     wl_display_dispatch_queue(mDisplay, mEventQueue);
2389   }
2390
2391   mBrightnessChangeDone  = false;
2392   mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2393
2394   tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2395
2396   int count = 0;
2397
2398   while(!mBrightnessChangeDone && count < 3)
2399   {
2400     ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2401     wl_display_dispatch_queue(mDisplay, mEventQueue);
2402     count++;
2403   }
2404
2405   if(!mBrightnessChangeDone)
2406   {
2407     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2408     return Dali::WindowOperationResult::UNKNOWN_ERROR;
2409   }
2410   else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2411   {
2412     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2413     return Dali::WindowOperationResult::PERMISSION_DENIED;
2414   }
2415
2416   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2417
2418   return Dali::WindowOperationResult::SUCCEED;
2419 }
2420
2421 int WindowBaseEcoreWl2::GetBrightness() const
2422 {
2423   while(!mTizenDisplayPolicy)
2424   {
2425     wl_display_dispatch_queue(mDisplay, mEventQueue);
2426   }
2427
2428   int count = 0;
2429
2430   while(!mBrightnessChangeDone && count < 3)
2431   {
2432     ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2433     wl_display_dispatch_queue(mDisplay, mEventQueue);
2434     count++;
2435   }
2436
2437   if(!mBrightnessChangeDone)
2438   {
2439     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2440     return 0;
2441   }
2442
2443   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2444
2445   return mBrightness;
2446 }
2447
2448 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2449 {
2450   Ecore_Wl2_Window_Keygrab_Mode mode;
2451
2452   switch(grabMode)
2453   {
2454     case KeyGrab::TOPMOST:
2455     {
2456       mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2457       break;
2458     }
2459     case KeyGrab::SHARED:
2460     {
2461       mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2462       break;
2463     }
2464     case KeyGrab::OVERRIDE_EXCLUSIVE:
2465     {
2466       mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2467       break;
2468     }
2469     case KeyGrab::EXCLUSIVE:
2470     {
2471       mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2472       break;
2473     }
2474     default:
2475     {
2476       return false;
2477     }
2478   }
2479
2480   return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2481 }
2482
2483 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2484 {
2485   return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2486 }
2487
2488 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2489 {
2490   int keyCount         = key.Count();
2491   int keyGrabModeCount = grabMode.Count();
2492
2493   if(keyCount != keyGrabModeCount || keyCount == 0)
2494   {
2495     return false;
2496   }
2497
2498   eina_init();
2499
2500   Eina_List*                     keyList = NULL;
2501   Ecore_Wl2_Window_Keygrab_Info* info    = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2502
2503   for(int index = 0; index < keyCount; ++index)
2504   {
2505     info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2506
2507     switch(grabMode[index])
2508     {
2509       case KeyGrab::TOPMOST:
2510       {
2511         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2512         break;
2513       }
2514       case KeyGrab::SHARED:
2515       {
2516         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2517         break;
2518       }
2519       case KeyGrab::OVERRIDE_EXCLUSIVE:
2520       {
2521         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2522         break;
2523       }
2524       case KeyGrab::EXCLUSIVE:
2525       {
2526         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2527         break;
2528       }
2529       default:
2530       {
2531         info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2532         break;
2533       }
2534     }
2535
2536     keyList = eina_list_append(keyList, &info);
2537   }
2538
2539   Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2540
2541   result.Resize(keyCount, true);
2542
2543   Eina_List* l        = NULL;
2544   Eina_List* m        = NULL;
2545   void*      listData = NULL;
2546   void*      data     = NULL;
2547   if(grabList != NULL)
2548   {
2549     EINA_LIST_FOREACH(grabList, m, data)
2550     {
2551       int index = 0;
2552       EINA_LIST_FOREACH(keyList, l, listData)
2553       {
2554         if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
2555         {
2556           DALI_LOG_ERROR("input key list has null data!");
2557           break;
2558         }
2559
2560         if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2561         {
2562           result[index] = false;
2563         }
2564         ++index;
2565       }
2566     }
2567   }
2568
2569   delete[] info;
2570
2571   eina_list_free(keyList);
2572   eina_list_free(grabList);
2573   eina_shutdown();
2574
2575   return true;
2576 }
2577
2578 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
2579 {
2580   int keyCount = key.Count();
2581   if(keyCount == 0)
2582   {
2583     return false;
2584   }
2585
2586   eina_init();
2587
2588   Eina_List*                     keyList = NULL;
2589   Ecore_Wl2_Window_Keygrab_Info* info    = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2590
2591   for(int index = 0; index < keyCount; ++index)
2592   {
2593     info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2594     keyList         = eina_list_append(keyList, &info);
2595   }
2596
2597   Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
2598
2599   result.Resize(keyCount, true);
2600
2601   Eina_List* l        = NULL;
2602   Eina_List* m        = NULL;
2603   void*      listData = NULL;
2604   void*      data     = NULL;
2605
2606   if(ungrabList != NULL)
2607   {
2608     EINA_LIST_FOREACH(ungrabList, m, data)
2609     {
2610       int index = 0;
2611       EINA_LIST_FOREACH(keyList, l, listData)
2612       {
2613         if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2614         {
2615           result[index] = false;
2616         }
2617         ++index;
2618       }
2619     }
2620   }
2621
2622   delete[] info;
2623
2624   eina_list_free(keyList);
2625   eina_list_free(ungrabList);
2626   eina_shutdown();
2627
2628   return true;
2629 }
2630
2631 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
2632 {
2633   // calculate DPI
2634   float xres, yres;
2635
2636   Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
2637
2638   // 1 inch = 25.4 millimeters
2639   xres = ecore_wl2_output_dpi_get(output);
2640   yres = ecore_wl2_output_dpi_get(output);
2641
2642   dpiHorizontal = int(xres + 0.5f); // rounding
2643   dpiVertical   = int(yres + 0.5f);
2644 }
2645
2646 int WindowBaseEcoreWl2::GetWindowRotationAngle() const
2647 {
2648   int orientation = mWindowRotationAngle;
2649   if(mSupportedPreProtation)
2650   {
2651     orientation = 0;
2652   }
2653   return orientation;
2654 }
2655
2656 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2657 {
2658   if(mSupportedPreProtation)
2659   {
2660     DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n");
2661     return 0;
2662   }
2663   int transform;
2664   if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
2665   {
2666     transform = 0;
2667   }
2668   else
2669   {
2670     transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
2671   }
2672   mScreenRotationAngle = transform * 90;
2673   return mScreenRotationAngle;
2674 }
2675
2676 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
2677 {
2678   mWindowRotationAngle = degree;
2679   ecore_wl2_window_rotation_set(mEcoreWindow, degree);
2680 }
2681
2682 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
2683 {
2684   ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
2685 }
2686
2687 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
2688 {
2689   ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
2690 }
2691
2692 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
2693 {
2694   Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
2695   if(!display)
2696   {
2697     DALI_ASSERT_ALWAYS(0 && "Failed to get display");
2698   }
2699
2700   ecore_wl2_display_sync(display);
2701
2702   mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2703
2704   if(mEcoreWindow == 0)
2705   {
2706     DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
2707   }
2708
2709   // Set default type
2710   ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
2711 }
2712
2713 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
2714 {
2715   Ecore_Wl2_Window* ecoreParent = NULL;
2716   if(parentWinBase)
2717   {
2718     WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
2719     ecoreParent                       = winBaseEcore2->mEcoreWindow;
2720   }
2721   ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
2722 }
2723
2724 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
2725 {
2726   return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
2727 }
2728
2729 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
2730 {
2731   return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
2732 }
2733
2734 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
2735 {
2736   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPositionSizeWithAngle, angle: %d, x: %d, y: %d, w: %d, h: %d\n", angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2737   ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2738 }
2739
2740 void WindowBaseEcoreWl2::InitializeIme()
2741 {
2742   Eina_Iterator*      globals;
2743   struct wl_registry* registry;
2744   Ecore_Wl2_Global*   global;
2745   Ecore_Wl2_Display*  ecoreWl2Display;
2746
2747   if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
2748   {
2749     DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
2750     return;
2751   }
2752
2753   DALI_LOG_RELEASE_INFO("InitializeIme:  Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
2754
2755   if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
2756   {
2757     DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
2758     return;
2759   }
2760
2761   if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
2762   {
2763     DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
2764     return;
2765   }
2766
2767   EINA_ITERATOR_FOREACH(globals, global)
2768   {
2769 #ifdef OVER_TIZEN_VERSION_7
2770     if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
2771     {
2772       mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
2773     }
2774 #else
2775     if(strcmp(global->interface, "wl_input_panel") == 0)
2776     {
2777       mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
2778     }
2779 #endif
2780     else if(strcmp(global->interface, "wl_output") == 0)
2781     {
2782       mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
2783     }
2784   }
2785
2786   if(!mWlInputPanel)
2787   {
2788     DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
2789     return;
2790   }
2791
2792   if(!mWlOutput)
2793   {
2794     DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
2795     return;
2796   }
2797 #ifdef OVER_TIZEN_VERSION_7
2798   mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
2799 #else
2800   mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
2801 #endif
2802   if(!mWlInputPanelSurface)
2803   {
2804     DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
2805     return;
2806   }
2807 #ifdef OVER_TIZEN_VERSION_7
2808   zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
2809 #else
2810   wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
2811 #endif
2812 }
2813
2814 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
2815 {
2816   if(!mWlInputPanelSurface)
2817   {
2818     DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
2819     return;
2820   }
2821 #ifdef OVER_TIZEN_VERSION_7
2822   zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
2823 #else
2824   wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
2825 #endif
2826 }
2827
2828 void WindowBaseEcoreWl2::RequestMoveToServer()
2829 {
2830   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2831   if(!display)
2832   {
2833     DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
2834     return;
2835   }
2836
2837   Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2838   if(!input)
2839   {
2840     DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
2841     return;
2842   }
2843
2844   ecore_wl2_window_move(mEcoreWindow, input);
2845   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
2846 }
2847
2848 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
2849 {
2850   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2851   if(!display)
2852   {
2853     DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
2854     return;
2855   }
2856
2857   Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2858   if(!input)
2859   {
2860     DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
2861     return;
2862   }
2863
2864   ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle);
2865
2866   ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
2867   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, direction:%d oriention:%d mode:%d\n", mEcoreWindow, direction, mWindowRotationAngle, location);
2868 }
2869
2870 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
2871 {
2872   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
2873   if(enable == true)
2874   {
2875     ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
2876   }
2877   else
2878   {
2879     ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
2880   }
2881 }
2882
2883 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
2884 {
2885   return ecore_wl2_window_floating_mode_get(mEcoreWindow);
2886 }
2887
2888 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
2889 {
2890   Eina_Rectangle rect;
2891   rect.x = inputRegion.x;
2892   rect.y = inputRegion.y;
2893   rect.w = inputRegion.width;
2894   rect.h = inputRegion.height;
2895
2896   DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
2897   ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
2898   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2899 }
2900
2901 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
2902 {
2903   Eina_Rectangle rect;
2904   rect.x = inputRegion.x;
2905   rect.y = inputRegion.y;
2906   rect.w = inputRegion.width;
2907   rect.h = inputRegion.height;
2908
2909   DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
2910   ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
2911   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2912 }
2913
2914 } // namespace Adaptor
2915
2916 } // namespace Internal
2917
2918 } // namespace Dali
2919
2920 #pragma GCC diagnostic pop