[Tizen] Add codes for Dali Windows Backend
[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 )\r
246 {\r
247   EventCallback callback = GetCallback( uMsg );\r
248   EventHandler *handler = (EventHandler*)GetEventHandler( uMsg );\r
249 \r
250   if( NULL != callback )\r
251   {\r
252     //EventHandler *handler = new EventHandler();\r
253     TWinEventInfo eventInfo( hWnd, uMsg, wParam, lParam );\r
254     callback( handler, uMsg, &eventInfo );\r
255   }\r
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 );\r
383   EventHandler* handler( (EventHandler*)data );\r
384 \r
385   if( windowDamagedEvent->window == mWin32Window )\r
386   {\r
387     DamageArea area;\r
388     area.x = 0;\r
389     area.y = 0;\r
390     area.width = 480;\r
391     area.height = 800;\r
392 \r
393     //handler->SendEvent( area );\r
394     mWindowDamagedSignal.Emit( area );\r
395   }\r
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 );\r
402   touchEvent.y = HIWORD( event->lParam );\r
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 );\r
433   touchEvent.y = HIWORD( event->lParam );\r
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 );\r
465   touchEvent.y = HIWORD( event->lParam );\r
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 keyString( "" );
515     std::string compose( "" );
516
517     int modifier( 0 );
518     unsigned long time( 0 );
519
520     // Ensure key event string is not NULL as keys like SHIFT have a null string.
521     keyString.push_back( event->wParam );
522
523     Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
524
525     mKeyEventSignal.Emit( keyEvent );
526   }
527 }
528
529 void WindowBaseWin::OnKeyUp( void* data, int type, TWinEventInfo *event )
530 {
531   if( event->mWindow == mWin32Window )
532   {
533     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseWin::OnKeyDown\n" );
534
535     int keyCode = event->wParam;
536     std::string keyName( WindowsPlatformImplement::GetKeyName( keyCode ) );
537     std::string keyString( "" );
538     std::string compose( "" );
539
540     int modifier( 0 );
541     unsigned long time( 0 );
542
543     // Ensure key event string is not NULL as keys like SHIFT have a null string.
544     keyString.push_back( event->wParam );
545
546     Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
547
548     mKeyEventSignal.Emit( keyEvent );
549   }
550 }
551
552 void WindowBaseWin::OnSelectionClear( void* data, int type, TWinEventInfo *event )
553 {
554   //Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast< Ecore_X_Event_Selection_Clear* >( event );
555
556   //if( selectionClearEvent->win == mWin32Window )
557   //{
558   //  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseWin::OnSelectionClear\n" );
559
560   //  if( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
561   //  {
562   //    // Request to get the content from Ecore.
563   //    ecore_x_selection_secondary_request( selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT );
564   //  }
565   //}
566 }
567
568 void WindowBaseWin::OnSelectionNotify( void* data, int type, TWinEventInfo *event )
569 {
570   //Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast< Ecore_X_Event_Selection_Notify* >( event );
571
572   //if( selectionNotifyEvent->win == mWin32Window )
573   //{
574   //  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseWin::OnSelectionNotify\n" );
575
576   //  Ecore_X_Selection_Data* selectionData = static_cast< Ecore_X_Selection_Data* >( selectionNotifyEvent->data );
577   //  if( selectionData->data )
578   //  {
579   //    if( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
580   //    {
581   //      mSelectionDataReceivedSignal.Emit( event  );
582   //    }
583   //  }
584   //}
585 }
586
587 Any WindowBaseWin::GetNativeWindow()
588 {
589   return mWin32Window;
590 }
591
592 int WindowBaseWin::GetNativeWindowId()
593 {
594   return mWin32Window;
595 }
596
597 EGLNativeWindowType WindowBaseWin::CreateEglWindow( int width, int height )
598 {
599   return reinterpret_cast< EGLNativeWindowType >( mWin32Window );
600 }
601
602 void WindowBaseWin::DestroyEglWindow()
603 {
604 }
605
606 void WindowBaseWin::SetEglWindowRotation( int angle )
607 {
608 }
609
610 void WindowBaseWin::SetEglWindowBufferTransform( int angle )
611 {
612 }
613
614 void WindowBaseWin::SetEglWindowTransform( int angle )
615 {
616 }
617
618 void WindowBaseWin::ResizeEglWindow( PositionSize positionSize )
619 {
620 }
621
622 bool WindowBaseWin::IsEglWindowRotationSupported()
623 {
624   return false;
625 }
626
627 void WindowBaseWin::Move( PositionSize positionSize )
628 {
629   //ecore_x_window_move( mWin32Window, positionSize.x, positionSize.y );
630 }
631
632 void WindowBaseWin::Resize( PositionSize positionSize )
633 {
634   //ecore_x_window_resize( mWin32Window, positionSize.width, positionSize.height );
635 }
636
637 void WindowBaseWin::MoveResize( PositionSize positionSize )
638 {
639   //ecore_x_window_move_resize( mWin32Window, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
640 }
641
642 void WindowBaseWin::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
643 {
644 //  DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
645 //
646 //  if( visibleMode == Dali::Window::VISIBLE )
647 //  {
648 //    // when the indicator is visible, set proper mode for indicator server according to bg mode
649 //    if( opacityMode == Dali::Window::OPAQUE )
650 //    {
651 //      ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_OPAQUE );
652 //    }
653 //    else if( opacityMode == Dali::Window::TRANSLUCENT )
654 //    {
655 //      ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT );
656 //    }
657 //#if defined (DALI_PROFILE_MOBILE)
658 //    else if( opacityMode == Dali::Window::TRANSPARENT )
659 //    {
660 //      ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_OPAQUE );
661 //    }
662 //#endif
663 //  }
664 //  else
665 //  {
666 //    // when the indicator is not visible, set TRANSPARENT mode for indicator server
667 //    ecore_x_e_illume_indicator_opacity_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_TRANSPARENT ); // it means hidden indicator
668 //  }
669 }
670
671 void WindowBaseWin::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
672 {
673   /*int show_state = static_cast< int >( isShow );
674   ecore_x_window_prop_property_set( mWin32Window, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
675                                     ECORE_X_ATOM_CARDINAL, 32, &show_state, 1 );
676
677   if( isShow )
678   {
679     ecore_x_e_illume_indicator_state_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_STATE_ON );
680   }
681   else
682   {
683     ecore_x_e_illume_indicator_state_set( mWin32Window, ECORE_X_ILLUME_INDICATOR_STATE_OFF );
684   }*/
685 }
686
687 void WindowBaseWin::IndicatorTypeChanged( IndicatorInterface::Type type )
688 {
689 }
690
691 void WindowBaseWin::SetClass( const std::string& name, const std::string& className )
692 {
693   //ecore_x_icccm_name_class_set( mWin32Window, name.c_str(), className.c_str() );
694 }
695
696 void WindowBaseWin::Raise()
697 {
698   //ecore_x_window_raise( mWin32Window );
699 }
700
701 void WindowBaseWin::Lower()
702 {
703   //ecore_x_window_lower( mWin32Window );
704 }
705
706 void WindowBaseWin::Activate()
707 {
708   //ecore_x_netwm_client_active_request( ecore_x_window_root_get( mWin32Window ), mWin32Window, 1 /* request type, 1:application, 2:pager */, 0 );
709 }
710
711 void WindowBaseWin::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
712 {
713 }
714
715 void WindowBaseWin::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
716 {
717 }
718
719 void WindowBaseWin::SetAcceptFocus( bool accept )
720 {
721 }
722
723 void WindowBaseWin::Show()
724 {
725   //ecore_x_window_show( mWin32Window );
726 }
727
728 void WindowBaseWin::Hide()
729 {
730   //ecore_x_window_hide( mWin32Window );
731 }
732
733 unsigned int WindowBaseWin::GetSupportedAuxiliaryHintCount() const
734 {
735   return 0;
736 }
737
738 std::string WindowBaseWin::GetSupportedAuxiliaryHint( unsigned int index ) const
739 {
740   return std::string();
741 }
742
743 unsigned int WindowBaseWin::AddAuxiliaryHint( const std::string& hint, const std::string& value )
744 {
745   return 0;
746 }
747
748 bool WindowBaseWin::RemoveAuxiliaryHint( unsigned int id )
749 {
750   return false;
751 }
752
753 bool WindowBaseWin::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
754 {
755   return false;
756 }
757
758 std::string WindowBaseWin::GetAuxiliaryHintValue( unsigned int id ) const
759 {
760   return std::string();
761 }
762
763 unsigned int WindowBaseWin::GetAuxiliaryHintId( const std::string& hint ) const
764 {
765   return 0;
766 }
767
768 void WindowBaseWin::SetInputRegion( const Rect< int >& inputRegion )
769 {
770 }
771
772 void WindowBaseWin::SetType( Dali::Window::Type type )
773 {
774 }
775
776 bool WindowBaseWin::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
777 {
778   return false;
779 }
780
781 Dali::Window::NotificationLevel::Type WindowBaseWin::GetNotificationLevel() const
782 {
783   return Dali::Window::NotificationLevel::NONE;
784 }
785
786 void WindowBaseWin::SetOpaqueState( bool opaque )
787 {
788 }
789
790 bool WindowBaseWin::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
791 {
792   return false;
793 }
794
795 Dali::Window::ScreenOffMode::Type WindowBaseWin::GetScreenOffMode() const
796 {
797   return Dali::Window::ScreenOffMode::TIMEOUT;
798 }
799
800 bool WindowBaseWin::SetBrightness( int brightness )
801 {
802   return false;
803 }
804
805 int WindowBaseWin::GetBrightness() const
806 {
807   return 0;
808 }
809
810 bool WindowBaseWin::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
811 {
812   return false;
813 }
814
815 bool WindowBaseWin::UngrabKey( Dali::KEY key )
816 {
817   return false;
818 }
819
820 bool WindowBaseWin::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
821 {
822   return false;
823 }
824
825 bool WindowBaseWin::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
826 {
827   return false;
828 }
829
830 void WindowBaseWin::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
831 {
832   // calculate DPI 
833   float xres, yres;
834
835   //// 1 inch = 25.4 millimeters
836   WindowsPlatformImplement::GetDPI( xres, yres );
837
838   xres *= 1.5;
839   yres *= 1.5;
840
841   dpiHorizontal = int( xres + 0.5f );  // rounding
842   dpiVertical = int( yres + 0.5f );
843 }
844
845 void WindowBaseWin::SetViewMode( ViewMode viewMode )
846 {
847 }
848
849 int WindowBaseWin::GetScreenRotationAngle()
850 {
851   return 0;
852 }
853
854 void WindowBaseWin::SetWindowRotationAngle( int degree )
855 {
856 }
857
858 void WindowBaseWin::WindowRotationCompleted( int degree, int width, int height )
859 {
860 }
861
862 void WindowBaseWin::SetTransparency( bool transparent )
863 {
864 }
865
866 unsigned int WindowBaseWin::GetSurfaceId( Any surface ) const
867 {
868   unsigned int surfaceId = 0;
869
870   if ( surface.Empty() == false )
871   {
872     // check we have a valid type
873     DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid ( winWindow ) ) || (surface.GetType() == typeid ( Win_Window_Handle ) ) )
874                         && "Surface type is invalid" );
875
876     if ( surface.GetType() == typeid ( Win_Window_Handle ) )
877     {
878       surfaceId = AnyCast< Win_Window_Handle >( surface );
879     }
880     else
881     {
882       surfaceId = AnyCast< winWindow >( surface );
883     }
884   }
885   return surfaceId;
886 }
887
888 void WindowBaseWin::CreateWinWindow( PositionSize positionSize, bool isTransparent )
889 {
890   long hWnd = WindowsPlatformImplement::CreateHwnd( "Demo", "Demo", positionSize.x, positionSize.y, positionSize.width, positionSize.height, NULL );\r
891 \r
892   WindowsPlatformImplement::ShowWindow( hWnd );\r
893 \r
894   mWin32Window = (Win_Window_Handle)hWnd;\r
895   DALI_ASSERT_ALWAYS( mWin32Window != 0 && "There is no EcoreWin window" );
896 }
897
898 } // namespace Adaptor
899
900 } // namespace Internal
901
902 } // namespace Dali
903
904 #pragma GCC diagnostic pop