Revert "[Tizen](ATSPI) squashed implementation"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/window-system/common/window-impl.h>
20
21 // EXTERNAL HEADERS
22 #include <dali/integration-api/core.h>
23 #include <dali/public-api/actors/actor.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/public-api/actors/camera-actor.h>
26 #include <dali/public-api/render-tasks/render-task.h>
27 #include <dali/public-api/render-tasks/render-task-list.h>
28 #include <dali/public-api/rendering/frame-buffer.h>
29 #include <dali/devel-api/adaptor-framework/orientation.h>
30 #include <dali/integration-api/events/touch-event-integ.h>
31
32 #ifdef DALI_ADAPTOR_COMPILATION
33 #include <dali/integration-api/render-surface-interface.h>
34 #else
35 #include <dali/integration-api/adaptors/render-surface-interface.h>
36 #endif
37
38 // INTERNAL HEADERS
39 #include <dali/internal/window-system/common/event-handler.h>
40 #include <dali/internal/window-system/common/orientation-impl.h>
41 #include <dali/internal/window-system/common/render-surface-factory.h>
42 #include <dali/internal/window-system/common/window-factory.h>
43 #include <dali/internal/window-system/common/window-base.h>
44 #include <dali/internal/window-system/common/window-render-surface.h>
45 #include <dali/internal/window-system/common/window-visibility-observer.h>
46
47 namespace Dali
48 {
49 namespace Internal
50 {
51 namespace Adaptor
52 {
53
54 namespace
55 {
56
57 #if defined(DEBUG_ENABLED)
58 Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
59 #endif
60
61 } // unnamed namespace
62
63 Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
64 {
65   Window* window = new Window();
66   window->mIsTransparent = isTransparent;
67   window->Initialize( positionSize, name, className );
68   return window;
69 }
70
71 Window::Window()
72 : mWindowSurface( nullptr ),
73   mWindowBase(),
74   mIsTransparent( false ),
75   mIsFocusAcceptable( true ),
76   mIconified( false ),
77   mOpaqueState( false ),
78   mResizeEnabled( false ),
79   mType( Dali::Window::NORMAL ),
80   mParentWindow( NULL ),
81   mPreferredOrientation( Dali::Window::PORTRAIT ),
82   mRotationAngle( 0 ),
83   mWindowWidth( 0 ),
84   mWindowHeight( 0 ),
85   mFocusChangedSignal(),
86   mResizedSignal(),
87   mDeleteRequestSignal(),
88   mFocusChangeSignal(),
89   mResizeSignal()
90 {
91 }
92
93 Window::~Window()
94 {
95   if ( mEventHandler )
96   {
97     mEventHandler->RemoveObserver( *this );
98   }
99 }
100
101 void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
102 {
103   // Create a window render surface
104   Any surface;
105   auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
106   mSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
107   mWindowSurface = static_cast<WindowRenderSurface*>( mSurface.get() );
108
109   // Get a window base
110   mWindowBase = mWindowSurface->GetWindowBase();
111
112   // Connect signals
113   mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
114   mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
115   mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
116
117   mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
118
119   if( !positionSize.IsEmpty() )
120   {
121     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
122     mResizeEnabled = true;
123   }
124
125   SetClass( name, className );
126
127   mWindowSurface->Map();
128
129   mOrientation = Orientation::New( this );
130 }
131
132 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
133 {
134   mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface, *mAdaptor ) );
135   mEventHandler->AddObserver( *this );
136 }
137
138 void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
139 {
140   mWindowSurface = static_cast<WindowRenderSurface*>( surface );
141 }
142
143 void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
144 {
145 }
146
147 void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
148 {
149 }
150
151 void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
152 {
153 }
154
155 void Window::SetClass( std::string name, std::string className )
156 {
157   mName = name;
158   mClassName = className;
159   mWindowBase->SetClass( name, className );
160 }
161
162 std::string Window::GetClassName() const
163 {
164   return mClassName;
165 }
166
167 void Window::Raise()
168 {
169   mWindowBase->Raise();
170   DALI_LOG_RELEASE_INFO( "Window (%p) Raise() \n", this );
171 }
172
173 void Window::Lower()
174 {
175   mWindowBase->Lower();
176   DALI_LOG_RELEASE_INFO( "Window (%p) Lower() \n", this );
177 }
178
179 void Window::Activate()
180 {
181   mWindowBase->Activate();
182   DALI_LOG_RELEASE_INFO( "Window (%p) Activate() \n", this );
183 }
184
185 uint32_t Window::GetLayerCount() const
186 {
187   return mScene.GetLayerCount();
188 }
189
190 Dali::Layer Window::GetLayer( uint32_t depth ) const
191 {
192   return mScene.GetLayer( depth );
193 }
194
195 Dali::RenderTaskList Window::GetRenderTaskList() const
196 {
197   return mScene.GetRenderTaskList();
198 }
199
200 void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
201 {
202   bool found = false;
203
204   if( orientation <= Dali::Window::LANDSCAPE_INVERSE )
205   {
206     for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
207     {
208       if( mAvailableOrientations[i] == orientation )
209       {
210         found = true;
211         break;
212       }
213     }
214
215     if( !found )
216     {
217       mAvailableOrientations.push_back( orientation );
218       SetAvailableOrientations( mAvailableOrientations );
219     }
220   }
221 }
222
223 void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
224 {
225   for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
226        iter != mAvailableOrientations.end(); ++iter )
227   {
228     if( *iter == orientation )
229     {
230       mAvailableOrientations.erase( iter );
231       break;
232     }
233   }
234   SetAvailableOrientations( mAvailableOrientations );
235 }
236
237 void Window::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
238 {
239   if( orientations.size() > 4 )
240   {
241     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableOrientations: Invalid vector size! [%d]\n", orientations.size() );
242     return;
243   }
244
245   mAvailableOrientations = orientations;
246
247   mWindowBase->SetAvailableOrientations( mAvailableOrientations );
248 }
249
250 const std::vector< Dali::Window::WindowOrientation >& Window::GetAvailableOrientations()
251 {
252   return mAvailableOrientations;
253 }
254
255 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
256 {
257   mPreferredOrientation = orientation;
258
259   mWindowBase->SetPreferredOrientation( mPreferredOrientation );
260 }
261
262 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
263 {
264   return mPreferredOrientation;
265 }
266
267 Dali::Any Window::GetNativeHandle() const
268 {
269   return mWindowSurface->GetNativeWindow();
270 }
271
272 void Window::SetAcceptFocus( bool accept )
273 {
274   mIsFocusAcceptable = accept;
275
276   mWindowBase->SetAcceptFocus( accept );
277 }
278
279 bool Window::IsFocusAcceptable() const
280 {
281   return mIsFocusAcceptable;
282 }
283
284 void Window::Show()
285 {
286   mVisible = true;
287
288   mWindowBase->Show();
289
290   if( !mIconified )
291   {
292     WindowVisibilityObserver* observer( mAdaptor );
293     observer->OnWindowShown();
294   }
295
296   DALI_LOG_RELEASE_INFO( "Window (%p) Show(): iconified = %d\n", this, mIconified );
297 }
298
299 void Window::Hide()
300 {
301   mVisible = false;
302
303   mWindowBase->Hide();
304
305   if( !mIconified )
306   {
307     WindowVisibilityObserver* observer( mAdaptor );
308     observer->OnWindowHidden();
309   }
310
311   DALI_LOG_RELEASE_INFO( "Window (%p) Hide(): iconified = %d\n", this, mIconified );
312 }
313
314 bool Window::IsVisible() const
315 {
316   return mVisible && !mIconified;
317 }
318
319 unsigned int Window::GetSupportedAuxiliaryHintCount() const
320 {
321   return mWindowBase->GetSupportedAuxiliaryHintCount();
322 }
323
324 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
325 {
326   return mWindowBase->GetSupportedAuxiliaryHint( index );
327 }
328
329 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
330 {
331   return mWindowBase->AddAuxiliaryHint( hint, value );
332 }
333
334 bool Window::RemoveAuxiliaryHint( unsigned int id )
335 {
336   return mWindowBase->RemoveAuxiliaryHint( id );
337 }
338
339 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
340 {
341   return mWindowBase->SetAuxiliaryHintValue( id, value );
342 }
343
344 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
345 {
346   return mWindowBase->GetAuxiliaryHintValue( id );
347 }
348
349 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
350 {
351   return mWindowBase->GetAuxiliaryHintId( hint );
352 }
353
354 void Window::SetInputRegion( const Rect< int >& inputRegion )
355 {
356   mWindowBase->SetInputRegion( inputRegion );
357
358   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
359 }
360
361 void Window::SetType( Dali::Window::Type type )
362 {
363   if( type != mType )
364   {
365     mWindowBase->SetType( type );
366
367     mType = type;
368   }
369 }
370
371 Dali::Window::Type Window::GetType() const
372 {
373   return mType;
374 }
375
376 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
377 {
378   if( mType != Dali::Window::NOTIFICATION )
379   {
380     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
381     return false;
382   }
383
384   return mWindowBase->SetNotificationLevel( level );
385 }
386
387 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
388 {
389   if( mType != Dali::Window::NOTIFICATION )
390   {
391     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
392     return Dali::Window::NotificationLevel::NONE;
393   }
394
395   return mWindowBase->GetNotificationLevel();
396 }
397
398 void Window::SetOpaqueState( bool opaque )
399 {
400   mOpaqueState = opaque;
401
402   mWindowBase->SetOpaqueState( opaque );
403
404   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
405 }
406
407 bool Window::IsOpaqueState() const
408 {
409   return mOpaqueState;
410 }
411
412 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
413 {
414   return mWindowBase->SetScreenOffMode( screenOffMode );
415 }
416
417 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
418 {
419   return mWindowBase->GetScreenOffMode();
420 }
421
422 bool Window::SetBrightness( int brightness )
423 {
424   if( brightness < 0 || brightness > 100 )
425   {
426     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
427     return false;
428   }
429
430   return mWindowBase->SetBrightness( brightness );
431 }
432
433 int Window::GetBrightness() const
434 {
435   return mWindowBase->GetBrightness();
436 }
437
438 void Window::SetSize( Dali::Window::WindowSize size )
439 {
440   if( !mResizeEnabled )
441   {
442     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
443     mResizeEnabled = true;
444   }
445
446   PositionSize oldRect = mSurface->GetPositionSize();
447
448   mWindowSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
449
450   PositionSize newRect = mSurface->GetPositionSize();
451
452   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
453   if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
454   {
455     Uint16Pair newSize( newRect.width, newRect.height );
456
457     bool forceUpdate = false;
458     if( mWindowBase->IsEglWindowRotationSupported() )
459     {
460       forceUpdate = true;
461     }
462
463     SurfaceResized( forceUpdate );
464
465     mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
466
467     Dali::Window handle( this );
468     mResizedSignal.Emit( newSize );
469     mResizeSignal.Emit( handle, newSize );
470
471     mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
472   }
473 }
474
475 Dali::Window::WindowSize Window::GetSize() const
476 {
477   PositionSize positionSize = mSurface->GetPositionSize();
478
479   return Dali::Window::WindowSize( positionSize.width, positionSize.height );
480 }
481
482 void Window::SetPosition( Dali::Window::WindowPosition position )
483 {
484   if( !mResizeEnabled )
485   {
486     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
487     mResizeEnabled = true;
488   }
489
490   PositionSize oldRect = mSurface->GetPositionSize();
491
492   mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
493 }
494
495 Dali::Window::WindowPosition Window::GetPosition() const
496 {
497   PositionSize positionSize = mSurface->GetPositionSize();
498
499   return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
500 }
501
502 void Window::SetPositionSize( PositionSize positionSize )
503 {
504   if( !mResizeEnabled )
505   {
506     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
507     mResizeEnabled = true;
508   }
509
510   PositionSize oldRect = mSurface->GetPositionSize();
511
512   mWindowSurface->MoveResize( positionSize );
513
514   PositionSize newRect = mSurface->GetPositionSize();
515
516   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
517   if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
518   {
519     Uint16Pair newSize( newRect.width, newRect.height );
520
521     bool forceUpdate = false;
522     if( mWindowBase->IsEglWindowRotationSupported() )
523     {
524       forceUpdate = true;
525     }
526
527     SurfaceResized( forceUpdate );
528
529     mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
530
531     Dali::Window handle( this );
532     mResizedSignal.Emit( newSize );
533     mResizeSignal.Emit( handle, newSize );
534     mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
535   }
536 }
537
538 Dali::Layer Window::GetRootLayer() const
539 {
540   return mScene.GetRootLayer();
541 }
542
543 void Window::SetTransparency( bool transparent )
544 {
545   mWindowSurface->SetTransparency( transparent );
546 }
547
548 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
549 {
550   return mWindowBase->GrabKey( key, grabMode );
551 }
552
553 bool Window::UngrabKey( Dali::KEY key )
554 {
555   return mWindowBase->UngrabKey( key );
556 }
557
558 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
559 {
560   return mWindowBase->GrabKeyList( key, grabMode, result );
561 }
562
563 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
564 {
565   return mWindowBase->UngrabKeyList( key, result );
566 }
567
568 void Window::OnIconifyChanged( bool iconified )
569 {
570   if( iconified )
571   {
572     mIconified = true;
573
574     if( mVisible )
575     {
576       WindowVisibilityObserver* observer( mAdaptor );
577       observer->OnWindowHidden();
578     }
579
580     DALI_LOG_RELEASE_INFO( "Window (%p) Iconified: visible = %d\n", this, mVisible );
581   }
582   else
583   {
584     mIconified = false;
585
586     if( mVisible )
587     {
588       WindowVisibilityObserver* observer( mAdaptor );
589       observer->OnWindowShown();
590     }
591
592     DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified: visible = %d\n", this, mVisible );
593   }
594 }
595
596 void Window::OnFocusChanged( bool focusIn )
597 {
598   Dali::Window handle( this );
599   mFocusChangedSignal.Emit( focusIn );
600   mFocusChangeSignal.Emit( handle, focusIn );
601 }
602
603 void Window::OnOutputTransformed()
604 {
605   bool forceUpdate = false;
606   if( mWindowBase->IsEglWindowRotationSupported() )
607   {
608     forceUpdate = true;
609   }
610   PositionSize positionSize = mSurface->GetPositionSize();
611   SurfaceResized( forceUpdate );
612   mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
613   mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
614 }
615
616 void Window::OnDeleteRequest()
617 {
618   mDeleteRequestSignal.Emit();
619 }
620
621 void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
622 {
623   FeedTouchPoint( point, timeStamp );
624 }
625
626 void Window::OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
627 {
628   FeedWheelEvent( wheelEvent );
629 }
630
631 void Window::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
632 {
633   FeedKeyEvent( keyEvent );
634 }
635
636 void Window::OnRotation( const RotationEvent& rotation )
637 {
638   mRotationAngle = rotation.angle;
639   mWindowWidth = rotation.width;
640   mWindowHeight = rotation.height;
641
642   // Notify that the orientation is changed
643   mOrientation->OnOrientationChange( rotation );
644
645   mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
646
647   bool forceUpdate = false;
648   if( mWindowBase->IsEglWindowRotationSupported() )
649   {
650     forceUpdate = true;
651   }
652
653   SurfaceResized( forceUpdate );
654
655   mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
656
657   // Emit signal
658   Dali::Window handle( this );
659   mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
660   mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
661
662   mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
663 }
664
665 void Window::OnPause()
666 {
667   if( mEventHandler )
668   {
669     mEventHandler->Pause();
670   }
671 }
672
673 void Window::OnResume()
674 {
675   if( mEventHandler )
676   {
677     mEventHandler->Resume();
678   }
679 }
680
681 void Window::RecalculateTouchPosition( Integration::Point& point )
682 {
683   Vector2 position = point.GetScreenPosition();
684   Vector2 convertedPosition;
685
686   switch( mRotationAngle )
687   {
688     case 90:
689     {
690       convertedPosition.x = static_cast<float>( mWindowWidth ) - position.y;
691       convertedPosition.y = position.x;
692       break;
693     }
694     case 180:
695     {
696       convertedPosition.x = static_cast<float>( mWindowWidth ) - position.x;
697       convertedPosition.y = static_cast<float>( mWindowHeight ) - position.y;
698       break;
699     }
700     case 270:
701     {
702       convertedPosition.x = position.y;
703       convertedPosition.y = static_cast<float>( mWindowHeight ) - position.x;
704       break;
705     }
706     default:
707     {
708       convertedPosition = position;
709       break;
710     }
711   }
712
713   point.SetScreenPosition( convertedPosition );
714 }
715
716 Dali::Window Window::Get( Dali::Actor actor )
717 {
718   Internal::Adaptor::Window* windowImpl = nullptr;
719
720   if ( Internal::Adaptor::Adaptor::IsAvailable() )
721   {
722     Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
723     windowImpl = static_cast<Internal::Adaptor::Window*>( adaptor.GetWindow( actor ) );
724   }
725
726   return Dali::Window( windowImpl );
727 }
728
729 void Window::SetParent( Dali::Window& parent )
730 {
731   if ( DALI_UNLIKELY( parent ) )
732   {
733     mParentWindow = parent;
734     Dali::Window grandParent = Dali::DevelWindow::GetParent( parent );
735     // check circular parent window setting
736     if ( DALI_UNLIKELY( grandParent ) && mWindowBase->IsMatchedWindow( grandParent.GetNativeHandle() ) )
737     {
738       Dali::DevelWindow::Unparent( parent );
739     }
740     mWindowBase->SetParent( parent.GetNativeHandle() );
741   }
742 }
743
744 void Window::Unparent()
745 {
746   Any parent;
747   mWindowBase->SetParent( parent );
748 }
749
750 Dali::Window Window::GetParent()
751 {
752   return mParentWindow;
753 }
754
755 } // Adaptor
756
757 } // Internal
758
759 } // Dali