2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h>
20 #include <dali/internal/graphics/gles/egl-graphics.h>
23 #include <dali/integration-api/debug.h>
26 #include <Ecore_Wl2.h>
28 #include <Ecore_Wayland.h>
40 DisplayConnection* DisplayConnectionEcoreWl::New()
42 DisplayConnection* pDisplayConnection(new DisplayConnectionEcoreWl());
44 return pDisplayConnection;
47 DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
49 mSurfaceType( RenderSurface::WINDOW_RENDER_SURFACE ),
54 DisplayConnectionEcoreWl::~DisplayConnectionEcoreWl()
56 if( mSurfaceType == RenderSurface::NATIVE_RENDER_SURFACE )
58 ReleaseNativeDisplay();
62 Any DisplayConnectionEcoreWl::GetDisplay()
64 return Any( mDisplay );
67 void DisplayConnectionEcoreWl::ConsumeEvents()
71 bool DisplayConnectionEcoreWl::InitializeGraphics()
73 auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
74 EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
76 if( !eglImpl.InitializeGles( mDisplay ) )
78 DALI_LOG_ERROR("Failed to initialize GLES.\n");
85 void DisplayConnectionEcoreWl::SetSurfaceType( RenderSurface::Type type )
89 if( mSurfaceType == RenderSurface::NATIVE_RENDER_SURFACE )
91 mDisplay = GetNativeDisplay();
96 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
97 mDisplay = reinterpret_cast< EGLNativeDisplayType >( ecore_wl2_display_get( display ) );
99 mDisplay = reinterpret_cast< EGLNativeDisplayType >( ecore_wl_display_get() );
104 void DisplayConnectionEcoreWl::SetGraphicsInterface( GraphicsInterface& graphics )
106 mGraphics = &graphics;
109 EGLNativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
111 return EGLNativeDisplayType();
114 void DisplayConnectionEcoreWl::ReleaseNativeDisplay()
119 } // namespace Adaptor
121 } // namespace Internal