[Tizen] Fix to get the logical key to ecore key variable
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / windows / window-base-win.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/window-system/windows/window-base-win.h>
20
21 // INTERNAL HEADERS
22 #include <dali/internal/window-system/common/window-impl.h>
23 #include <dali/internal/window-system/common/window-render-surface.h>
24
25 // EXTERNAL_HEADERS
26 #include <dali/public-api/object/any.h>
27 #include <dali/integration-api/debug.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37
38 namespace
39 {
40
41 const std::string DEFAULT_DEVICE_NAME = "";
42 const Device::Class::Type DEFAULT_DEVICE_CLASS = Device::Class::NONE;
43 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
44
45 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
46
47 #if defined(DEBUG_ENABLED)
48 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
49 #endif
50
51 static bool EcoreEventWindowPropertyChanged( void* data, int type, TWinEventInfo *event )
52 {
53   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
54   if( windowBase )
55   {
56     return windowBase->OnWindowPropertyChanged( data, type, event );
57   }
58
59   return true;
60 }
61
62 /**
63  * Called when the window gains focus.
64  */
65 static bool EcoreEventWindowFocusIn( void* data, int type, TWinEventInfo *event )
66 {
67   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
68   if( windowBase )
69   {
70     windowBase->OnFocusIn( data, type, event );
71   }
72   return true;
73 }
74
75 /**
76  * Called when the window loses focus.
77  */
78 static bool EcoreEventWindowFocusOut( void* data, int type, TWinEventInfo *event )
79 {
80   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
81   if( windowBase )
82   {
83     windowBase->OnFocusOut( data, type, event );
84   }
85   return true;
86 }
87
88 /**
89  * Called when the window is damaged.
90  */
91 static bool EcoreEventWindowDamaged( void* data, int type, TWinEventInfo *event )
92 {
93   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
94   if( windowBase )
95   {
96     windowBase->OnWindowDamaged( data, type, event );
97   }
98
99   return true;
100 }
101
102 /////////////////////////////////////////////////////////////////////////////////////////////////
103 // Selection Callbacks
104 /////////////////////////////////////////////////////////////////////////////////////////////////
105
106 /**
107  * Called when the source window notifies us the content in clipboard is selected.
108  */
109 static bool EcoreEventSelectionClear( void* data, int type, TWinEventInfo *event )
110 {
111   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
112   if( windowBase )
113   {
114     windowBase->OnSelectionClear( data, type, event );
115   }
116   return true;
117 }
118
119 /**
120  * Called when the source window sends us about the selected content.
121  * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
122  */
123 static bool EcoreEventSelectionNotify( void* data, int type, TWinEventInfo *event )
124 {
125   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
126   if( windowBase )
127   {
128     windowBase->OnSelectionNotify( data, type, event );
129   }
130   return true;
131 }
132
133 /////////////////////////////////////////////////////////////////////////////////////////////////
134 // Touch Callbacks
135 /////////////////////////////////////////////////////////////////////////////////////////////////
136
137 /**
138  * Called when a touch down is received.
139  */
140 static bool EcoreEventMouseButtonDown( void* data, int type, TWinEventInfo *event )
141 {
142   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
143   if( windowBase )
144   {
145     windowBase->OnMouseButtonDown( data, type, event );
146   }
147   return true;
148 }
149
150 /**
151  * Called when a touch up is received.
152  */
153 static bool EcoreEventMouseButtonUp( void* data, int type, TWinEventInfo *event )
154 {
155   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
156   if( windowBase )
157   {
158     windowBase->OnMouseButtonUp( data, type, event );
159   }
160   return true;
161 }
162
163 /**
164  * Called when a touch motion is received.
165  */
166 static bool EcoreEventMouseButtonMove( void* data, int type, TWinEventInfo *event )
167 {
168   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
169   if( windowBase )
170   {
171     windowBase->OnMouseButtonMove( data, type, event );
172   }
173   return true;
174 }
175
176 /////////////////////////////////////////////////////////////////////////////////////////////////
177 // Wheel Callbacks
178 /////////////////////////////////////////////////////////////////////////////////////////////////
179
180 /**
181  * Called when a mouse wheel is received.
182  */
183 static bool EcoreEventMouseWheel( void* data, int type, TWinEventInfo *event )
184 {
185   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
186   if( windowBase )
187   {
188     windowBase->OnMouseWheel( data, type, event );
189   }
190   return true;
191 }
192
193 /////////////////////////////////////////////////////////////////////////////////////////////////
194 // Key Callbacks
195 /////////////////////////////////////////////////////////////////////////////////////////////////
196
197 /**
198  * Called when a key down is received.
199  */
200 static bool EcoreEventKeyDown( void* data, int type, TWinEventInfo *event )
201 {
202   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
203   if( windowBase )
204   {
205     windowBase->OnKeyDown( data, type, event );
206   }
207   return true;
208 }
209
210 /**
211  * Called when a key up is received.
212  */
213 static bool EcoreEventKeyUp( void* data, int type, TWinEventInfo *event )
214 {
215   WindowBaseWin* windowBase = static_cast< WindowBaseWin* >( data );
216   if( windowBase )
217   {
218     windowBase->OnKeyUp( data, type, event );
219   }
220   return true;
221 }
222 } // unnamed namespace
223
224 WindowBaseWin::WindowBaseWin( Dali::PositionSize positionSize, Any surface, bool isTransparent )
225 : mEventHandler(),
226   mWin32Window( 0 ),
227   mOwnSurface( false ),
228   mIsTransparent( false ), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
229   mRotationAppSet( false )
230 {
231   Initialize( positionSize, surface, isTransparent );
232 }
233
234 WindowBaseWin::~WindowBaseWin()
235 {
236   for( Dali::Vector< Event_Handler >::Iterator iter = mEventHandler.Begin(), endIter = mEventHandler.End(); iter != endIter; ++iter )
237   {
238     event_handler_del( *iter );
239   }
240   mEventHandler.Clear();
241
242   WindowsPlatformImplement::PostWinMessage( WM_CLOSE, 0, 0, mWin32Window );
243 }
244
245 static void EventEntry( long hWnd, unsigned int uMsg, long wParam, long lParam )
246 {
247   EventCallback callback = GetCallback( uMsg );
248   EventHandler *handler = (EventHandler*)GetEventHandler( uMsg );
249
250   if( NULL != callback )
251   {
252     //EventHandler *handler = new EventHandler();
253     TWinEventInfo eventInfo( hWnd, uMsg, wParam, lParam );
254     callback( handler, uMsg, &eventInfo );
255   }
256 }
257
258 void WindowBaseWin::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
259 {
260   // see if there is a surface in Any surface
261   unsigned int surfaceId = GetSurfaceId( surface );
262
263   // if the surface is empty, create a new one.
264   if( surfaceId == 0 )
265   {
266     // we own the surface about to created
267     mOwnSurface = true;
268     CreateWinWindow( positionSize, isTransparent );
269   }
270   else
271   {
272     // XLib should already be initialized so no point in calling XInitThreads
273     mWin32Window = static_cast< Win_Window_Handle >( surfaceId );
274   }
275
276   // Register window focus events
277   mEventHandler.PushBack( event_handler_add( WIN_EVENT_WINDOW_FOCUS_IN,       EcoreEventWindowFocusIn,   this ) );
278   mEventHandler.PushBack( event_handler_add( WIN_EVENT_WINDOW_FOCUS_OUT,      EcoreEventWindowFocusOut,  this ) );
279
280   // Register Window damage events
281   mEventHandler.PushBack( event_handler_add( WIN_EVENT_WINDOW_DAMAGE,         EcoreEventWindowDamaged,   this ) );
282
283   // Register Touch events
284   mEventHandler.PushBack( event_handler_add( EVENT_MOUSE_BUTTON_DOWN,       EcoreEventMouseButtonDown, this ) );
285   mEventHandler.PushBack( event_handler_add( EVENT_MOUSE_BUTTON_UP,         EcoreEventMouseButtonUp,   this ) );
286   mEventHandler.PushBack( event_handler_add( EVENT_MOUSE_MOVE,              EcoreEventMouseButtonMove, this ) );
287   mEventHandler.PushBack( event_handler_add( EVENT_MOUSE_OUT,               EcoreEventMouseButtonUp,   this ) ); // process mouse out event like up event
288
289   // Register Mouse wheel events
290   mEventHandler.PushBack( event_handler_add( EVENT_MOUSE_WHEEL,             EcoreEventMouseWheel,      this ) );
291
292   // Register Key events
293   mEventHandler.PushBack( event_handler_add( EVENT_KEY_DOWN,                EcoreEventKeyDown,         this ) );
294   mEventHandler.PushBack( event_handler_add( EVENT_KEY_UP,                  EcoreEventKeyUp,           this ) );
295
296   // Register Selection event
297   mEventHandler.PushBack( event_handler_add( WIN_EVENT_SELECTION_CLEAR,       EcoreEventSelectionClear,  this ) );
298   mEventHandler.PushBack( event_handler_add( WIN_EVENT_SELECTION_NOTIFY,      EcoreEventSelectionNotify, this ) );
299
300   WindowsPlatformImplement::AddListener( EventEntry );
301 }
302
303 bool WindowBaseWin::OnWindowPropertyChanged( void* data, int type, TWinEventInfo *event )
304 {
305   //Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast< Ecore_X_Event_Window_Property* >( event );
306   //bool handled( true );
307
308   //if( propertyChangedEvent->win == mWin32Window )
309   //{
310   //  Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
311
312   //  switch( state )
313   //  {
314   //    case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
315   //    {
316   //      // Window was hidden.
317   //      mWindow->OnIconifyChanged( true );
318   //      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%d) Withdrawn\n", mWindow );
319   //      handled = ECORE_CALLBACK_DONE;
320   //      break;
321   //    }
322   //    case ECORE_X_WINDOW_STATE_HINT_ICONIC:
323   //    {
324   //      // Window was iconified (minimised).
325   //      mWindow->OnIconifyChanged( true );
326   //      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%d) Iconfied\n", mWindow );
327   //      handled = ECORE_CALLBACK_DONE;
328   //      break;
329   //    }
330   //    case ECORE_X_WINDOW_STATE_HINT_NORMAL:
331   //    {
332   //      // Window was shown.
333   //      mWindow->OnIconifyChanged( false );
334   //      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%d) Shown\n", mWindow );
335   //      handled = ECORE_CALLBACK_DONE;
336   //      break;
337   //    }
338   //    default:
339   //    {
340   //      // Ignore
341   //      break;
342   //    }
343   //  }
344   //}
345
346   //return handled;
347   return true;
348 }
349
350 void WindowBaseWin::OnDeleteRequest()
351 {
352   mDeleteRequestSignal.Emit();
353 }
354
355 void WindowBaseWin::OnFocusIn( void* data, int type, TWinEventInfo *event )
356 {
357   //Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast< Ecore_X_Event_Window_Focus_In* >( event );
358
359   //if( focusInEvent->win == mWin32Window )
360   //{
361   //  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
362
363   //  mFocusChangedSignal.Emit( true );
364   //}
365 }
366
367 void WindowBaseWin::OnFocusOut( void* data, int type, TWinEventInfo *event )
368 {
369   //Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast< Ecore_X_Event_Window_Focus_Out* >( event );
370
371   //// If the window loses focus then hide the keyboard.
372   //if( focusOutEvent->win == mWin32Window )
373   //{
374   //  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
375
376   //  mFocusChangedSignal.Emit( false );
377   //}
378 }
379
380 void WindowBaseWin::OnWindowDamaged( void* data, int type, TWinEventInfo *event )
381 {
382   Event_Mouse_Button* windowDamagedEvent( (Event_Mouse_Button*)event );
383   EventHandler* handler( (EventHandler*)data );
384
385   if( windowDamagedEvent->window == mWin32Window )
386   {
387     DamageArea area;
388     area.x = 0;
389     area.y = 0;
390     area.width = 480;
391     area.height = 800;
392
393     //handler->SendEvent( area );
394     mWindowDamagedSignal.Emit( area );
395   }
396 }
397
398 void WindowBaseWin::OnMouseButtonDown( void* data, int type, TWinEventInfo *event )
399 {
400   Event_Mouse_Button touchEvent = *((Event_Mouse_Button*)event);
401   touchEvent.x = LOWORD( event->lParam );
402   touchEvent.y = HIWORD( event->lParam );
403   touchEvent.multi.device = DEVICE_MOUSE;
404
405   if( touchEvent.window == mWin32Window )
406   {
407     PointState::Type state ( PointState::DOWN );
408
409     // Check if the buttons field is set and ensure it's the primary touch button.
410     // If this event was triggered by buttons other than the primary button (used for touch), then
411     // just send an interrupted event to Core.
412     if( touchEvent.buttons && ( touchEvent.buttons != PRIMARY_TOUCH_BUTTON_ID ) )
413     {
414       state = PointState::INTERRUPTED;
415     }
416
417     Integration::Point point;
418     point.SetDeviceId( touchEvent.multi.device );
419     point.SetState( state );
420     point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + WindowsPlatformImplement::GetEdgeHeight() ) );
421     point.SetRadius( touchEvent.multi.radius, Vector2( touchEvent.multi.radius_x, touchEvent.multi.radius_y ) );
422     point.SetPressure( touchEvent.multi.pressure );
423     point.SetAngle( Degree( touchEvent.multi.angle ) );
424
425     mTouchEventSignal.Emit( point, touchEvent.timestamp );
426   }
427 }
428
429 void WindowBaseWin::OnMouseButtonUp( void* data, int type, TWinEventInfo *event )
430 {
431   Event_Mouse_Button touchEvent = *( (Event_Mouse_Button*)event );
432   touchEvent.x = LOWORD( event->lParam );
433   touchEvent.y = HIWORD( event->lParam );
434   touchEvent.multi.device = DEVICE_MOUSE;
435
436   if( touchEvent.window == mWin32Window )
437   {
438     PointState::Type state( PointState::UP );
439
440     // Check if the buttons field is set and ensure it's the primary touch button.
441     // If this event was triggered by buttons other than the primary button (used for touch), then
442     // just send an interrupted event to Core.
443     if( touchEvent.buttons && ( touchEvent.buttons != PRIMARY_TOUCH_BUTTON_ID ) )
444     {
445       state = PointState::INTERRUPTED;
446     }
447
448     Integration::Point point;
449     point.SetDeviceId( touchEvent.multi.device );
450     point.SetState( state );
451     point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + WindowsPlatformImplement::GetEdgeHeight() ) );
452     point.SetRadius( touchEvent.multi.radius, Vector2( touchEvent.multi.radius_x, touchEvent.multi.radius_y ) );
453     point.SetPressure( touchEvent.multi.pressure );
454     point.SetAngle( Degree( touchEvent.multi.angle ) );
455
456     mTouchEventSignal.Emit( point, touchEvent.timestamp );
457   }
458 }
459
460 void WindowBaseWin::OnMouseButtonMove( void* data, int type, TWinEventInfo *event )
461 {
462   Event_Mouse_Button touchEvent = *((Event_Mouse_Button*)event);
463   touchEvent.timestamp = GetTickCount();
464   touchEvent.x = LOWORD( event->lParam );
465   touchEvent.y = HIWORD( event->lParam );
466   touchEvent.multi.device = DEVICE_MOUSE;
467
468   if( touchEvent.window == mWin32Window )
469   {
470     PointState::Type state( PointState::MOTION );
471
472     // Check if the buttons field is set and ensure it's the primary touch button.
473     // If this event was triggered by buttons other than the primary button (used for touch), then
474     // just send an interrupted event to Core.
475     if( touchEvent.buttons && ( touchEvent.buttons != PRIMARY_TOUCH_BUTTON_ID ) )
476     {
477       state = PointState::INTERRUPTED;
478     }
479
480     Integration::Point point;
481     point.SetDeviceId( touchEvent.multi.device );
482     point.SetState( state );
483     point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + WindowsPlatformImplement::GetEdgeHeight() ) );
484     point.SetRadius( touchEvent.multi.radius, Vector2( touchEvent.multi.radius_x, touchEvent.multi.radius_y ) );
485     point.SetPressure( touchEvent.multi.pressure );
486     point.SetAngle( Degree( touchEvent.multi.angle ) );
487
488     mTouchEventSignal.Emit( point, touchEvent.timestamp );
489   }
490 }
491
492 void WindowBaseWin::OnMouseWheel( void* data, int type, TWinEventInfo *event )
493 {
494   Event_Mouse_Wheel mouseWheelEvent = *((Event_Mouse_Wheel*)( event ));
495
496   if( mouseWheelEvent.window == mWin32Window )
497   {
498     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseWin::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent.direction, mouseWheelEvent.modifiers, mouseWheelEvent.x, mouseWheelEvent.y, mouseWheelEvent.z );
499
500     WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent.direction, mouseWheelEvent.modifiers, Vector2( mouseWheelEvent.x, mouseWheelEvent.y ), mouseWheelEvent.z, mouseWheelEvent.timestamp );
501
502     mWheelEventSignal.Emit( wheelEvent );
503   }
504 }
505
506 void WindowBaseWin::OnKeyDown( void* data, int type, TWinEventInfo *event )
507 {
508   if( event->mWindow == mWin32Window )
509   {
510     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseWin::OnKeyDown\n" );
511
512     int keyCode = event->wParam;
513     std::string keyName( WindowsPlatformImplement::GetKeyName( keyCode ) );
514     std::string key( "" );
515     std::string keyString( "" );
516     std::string compose( "" );
517
518     int modifier( 0 );
519     unsigned long time( 0 );
520
521     // Ensure key event string is not NULL as keys like SHIFT have a null string.
522     keyString.push_back( event->wParam );
523
524     Integration::KeyEvent keyEvent( keyName, key, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
525
526     mKeyEventSignal.Emit( keyEvent );
527   }
528 }
529
530 void WindowBaseWin::OnKeyUp( void* data, int type, TWinEventInfo *event )
531 {
532   if( event->mWindow == mWin32Window )
533   {
534     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseWin::OnKeyDown\n" );
535
536     int keyCode = event->wParam;
537     std::string keyName( WindowsPlatformImplement::GetKeyName( keyCode ) );
538     std::string key( "" );
539     std::string keyString( "" );
540     std::string compose( "" );
541
542     int modifier( 0 );
543     unsigned long time( 0 );
544
545     // Ensure key event string is not NULL as keys like SHIFT have a null string.
546     keyString.push_back( event->wParam );
547
548     Integration::KeyEvent keyEvent( keyName, key, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
549
550     mKeyEventSignal.Emit( keyEvent );
551   }
552 }
553
554 void WindowBaseWin::OnSelectionClear( void* data, int type, TWinEventInfo *event )
555 {
556   //Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast< Ecore_X_Event_Selection_Clear* >( event );
557
558   //if( selectionClearEvent->win == mWin32Window )
559   //{
560   //  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseWin::OnSelectionClear\n" );
561
562   //  if( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
563   //  {
564   //    // Request to get the content from Ecore.
565   //    ecore_x_selection_secondary_request( selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT );
566   //  }
567   //}
568 }
569
570 void WindowBaseWin::OnSelectionNotify( void* data, int type, TWinEventInfo *event )
571 {
572   //Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast< Ecore_X_Event_Selection_Notify* >( event );
573
574   //if( selectionNotifyEvent->win == mWin32Window )
575   //{
576   //  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseWin::OnSelectionNotify\n" );
577
578   //  Ecore_X_Selection_Data* selectionData = static_cast< Ecore_X_Selection_Data* >( selectionNotifyEvent->data );
579   //  if( selectionData->data )
580   //  {
581   //    if( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
582   //    {
583   //      mSelectionDataReceivedSignal.Emit( event  );
584   //    }
585   //  }
586   //}
587 }
588
589 Any WindowBaseWin::GetNativeWindow()
590 {
591   return mWin32Window;
592 }
593
594 int WindowBaseWin::GetNativeWindowId()
595 {
596   return mWin32Window;
597 }
598
599 EGLNativeWindowType WindowBaseWin::CreateEglWindow( int width, int height )
600 {
601   return reinterpret_cast< EGLNativeWindowType >( mWin32Window );
602 }
603
604 void WindowBaseWin::DestroyEglWindow()
605 {
606 }
607
608 void WindowBaseWin::SetEglWindowRotation( int angle )
609 {
610 }
611
612 void WindowBaseWin::SetEglWindowBufferTransform( int angle )
613 {
614 }
615
616 void WindowBaseWin::SetEglWindowTransform( int angle )
617 {
618 }
619
620 void WindowBaseWin::ResizeEglWindow( PositionSize positionSize )
621 {
622 }
623
624 bool WindowBaseWin::IsEglWindowRotationSupported()
625 {
626   return false;
627 }
628
629 void WindowBaseWin::Move( PositionSize positionSize )
630 {
631   //ecore_x_window_move( mWin32Window, positionSize.x, positionSize.y );
632 }
633
634 void WindowBaseWin::Resize( PositionSize positionSize )
635 {
636   //ecore_x_window_resize( mWin32Window, positionSize.width, positionSize.height );
637 }
638
639 void WindowBaseWin::MoveResize( PositionSize positionSize )
640 {
641   //ecore_x_window_move_resize( mWin32Window, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
642 }
643
644 void WindowBaseWin::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
645 {
646 //  DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
647 //
648 //  if( visibleMode == Dali::Window::VISIBLE )
649 //  {
650 //    // when the indicator is visible, set proper mode for indicator server according to bg mode
651 //    if( opacityMode == Dali::Window::OPAQUE )
652 //    {
653 //      ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_OPAQUE );
654 //    }
655 //    else if( opacityMode == Dali::Window::TRANSLUCENT )
656 //    {
657 //      ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT );
658 //    }
659 //#if defined (DALI_PROFILE_MOBILE)
660 //    else if( opacityMode == Dali::Window::TRANSPARENT )
661 //    {
662 //      ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_OPAQUE );
663 //    }
664 //#endif
665 //  }
666 //  else
667 //  {
668 //    // when the indicator is not visible, set TRANSPARENT mode for indicator server
669 //    ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_TRANSPARENT ); // it means hidden indicator
670 //  }
671 }
672
673 void WindowBaseWin::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
674 {
675   /*int show_state = static_cast< int >( isShow );
676   ecore_x_window_prop_property_set( mWin32Window, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
677                                     ECORE_X_ATOM_CARDINAL, 32, &show_state, 1 );
678
679   if( isShow )
680   {
681     ecore_x_e_illume_indicator_state_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_STATE_ON );
682   }
683   else
684   {
685     ecore_x_e_illume_indicator_state_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_STATE_OFF );
686   }*/
687 }
688
689 void WindowBaseWin::IndicatorTypeChanged( IndicatorInterface::Type type )
690 {
691 }
692
693 void WindowBaseWin::SetClass( const std::string& name, const std::string& className )
694 {
695   //ecore_x_icccm_name_class_set( mWin32Window, name.c_str(), className.c_str() );
696 }
697
698 void WindowBaseWin::Raise()
699 {
700   //ecore_x_window_raise( mWin32Window );
701 }
702
703 void WindowBaseWin::Lower()
704 {
705   //ecore_x_window_lower( mWin32Window );
706 }
707
708 void WindowBaseWin::Activate()
709 {
710   //ecore_x_netwm_client_active_request( ecore_x_window_root_get( mWin32Window ), mWin32Window, 1 /* request type, 1:application, 2:pager */, 0 );
711 }
712
713 void WindowBaseWin::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
714 {
715 }
716
717 void WindowBaseWin::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
718 {
719 }
720
721 void WindowBaseWin::SetAcceptFocus( bool accept )
722 {
723 }
724
725 void WindowBaseWin::Show()
726 {
727   //ecore_x_window_show( mWin32Window );
728 }
729
730 void WindowBaseWin::Hide()
731 {
732   //ecore_x_window_hide( mWin32Window );
733 }
734
735 unsigned int WindowBaseWin::GetSupportedAuxiliaryHintCount() const
736 {
737   return 0;
738 }
739
740 std::string WindowBaseWin::GetSupportedAuxiliaryHint( unsigned int index ) const
741 {
742   return std::string();
743 }
744
745 unsigned int WindowBaseWin::AddAuxiliaryHint( const std::string& hint, const std::string& value )
746 {
747   return 0;
748 }
749
750 bool WindowBaseWin::RemoveAuxiliaryHint( unsigned int id )
751 {
752   return false;
753 }
754
755 bool WindowBaseWin::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
756 {
757   return false;
758 }
759
760 std::string WindowBaseWin::GetAuxiliaryHintValue( unsigned int id ) const
761 {
762   return std::string();
763 }
764
765 unsigned int WindowBaseWin::GetAuxiliaryHintId( const std::string& hint ) const
766 {
767   return 0;
768 }
769
770 void WindowBaseWin::SetInputRegion( const Rect< int >& inputRegion )
771 {
772 }
773
774 void WindowBaseWin::SetType( Dali::Window::Type type )
775 {
776 }
777
778 bool WindowBaseWin::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
779 {
780   return false;
781 }
782
783 Dali::Window::NotificationLevel::Type WindowBaseWin::GetNotificationLevel() const
784 {
785   return Dali::Window::NotificationLevel::NONE;
786 }
787
788 void WindowBaseWin::SetOpaqueState( bool opaque )
789 {
790 }
791
792 bool WindowBaseWin::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
793 {
794   return false;
795 }
796
797 Dali::Window::ScreenOffMode::Type WindowBaseWin::GetScreenOffMode() const
798 {
799   return Dali::Window::ScreenOffMode::TIMEOUT;
800 }
801
802 bool WindowBaseWin::SetBrightness( int brightness )
803 {
804   return false;
805 }
806
807 int WindowBaseWin::GetBrightness() const
808 {
809   return 0;
810 }
811
812 bool WindowBaseWin::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
813 {
814   return false;
815 }
816
817 bool WindowBaseWin::UngrabKey( Dali::KEY key )
818 {
819   return false;
820 }
821
822 bool WindowBaseWin::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
823 {
824   return false;
825 }
826
827 bool WindowBaseWin::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
828 {
829   return false;
830 }
831
832 void WindowBaseWin::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
833 {
834   // calculate DPI 
835   float xres, yres;
836
837   //// 1 inch = 25.4 millimeters
838   WindowsPlatformImplement::GetDPI( xres, yres );
839
840   xres *= 1.5;
841   yres *= 1.5;
842
843   dpiHorizontal = int( xres + 0.5f );  // rounding
844   dpiVertical = int( yres + 0.5f );
845 }
846
847 void WindowBaseWin::SetViewMode( ViewMode viewMode )
848 {
849 }
850
851 int WindowBaseWin::GetScreenRotationAngle()
852 {
853   return 0;
854 }
855
856 void WindowBaseWin::SetWindowRotationAngle( int degree )
857 {
858 }
859
860 void WindowBaseWin::WindowRotationCompleted( int degree, int width, int height )
861 {
862 }
863
864 void WindowBaseWin::SetTransparency( bool transparent )
865 {
866 }
867
868 unsigned int WindowBaseWin::GetSurfaceId( Any surface ) const
869 {
870   unsigned int surfaceId = 0;
871
872   if ( surface.Empty() == false )
873   {
874     // check we have a valid type
875     DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid ( winWindow ) ) || (surface.GetType() == typeid ( Win_Window_Handle ) ) )
876                         && "Surface type is invalid" );
877
878     if ( surface.GetType() == typeid ( Win_Window_Handle ) )
879     {
880       surfaceId = AnyCast< Win_Window_Handle >( surface );
881     }
882     else
883     {
884       surfaceId = AnyCast< winWindow >( surface );
885     }
886   }
887   return surfaceId;
888 }
889
890 void WindowBaseWin::CreateWinWindow( PositionSize positionSize, bool isTransparent )
891 {
892   long hWnd = WindowsPlatformImplement::CreateHwnd( "Demo", "Demo", positionSize.x, positionSize.y, positionSize.width, positionSize.height, NULL );
893
894   WindowsPlatformImplement::ShowWindow( hWnd );
895
896   mWin32Window = (Win_Window_Handle)hWnd;
897   DALI_ASSERT_ALWAYS( mWin32Window != 0 && "There is no EcoreWin window" );
898 }
899
900 } // namespace Adaptor
901
902 } // namespace Internal
903
904 } // namespace Dali
905
906 #pragma GCC diagnostic pop