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