Merge "Add input region APIs" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / macos / display-connection-impl-mac.cpp
1 /*
2  * Copyright (c) 2021 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 <EGL/egl.h>
20 #include <dali/internal/window-system/macos/display-connection-impl-mac.h>
21
22 // EXTERNAL INCLUDES
23 #include <dali/integration-api/debug.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/internal/graphics/gles/egl-graphics.h>
27
28 namespace Dali::Internal::Adaptor
29 {
30 DisplayConnection* DisplayConnectionCocoa::New()
31 {
32   return new DisplayConnectionCocoa();
33 }
34
35 DisplayConnectionCocoa::DisplayConnectionCocoa()
36 : mGraphics(nullptr)
37 {
38 }
39
40 DisplayConnectionCocoa::~DisplayConnectionCocoa()
41 {
42 }
43
44 Any DisplayConnectionCocoa::GetDisplay()
45 {
46   return EGL_DEFAULT_DISPLAY;
47 }
48
49 void DisplayConnectionCocoa::ConsumeEvents()
50 {
51 }
52
53 bool DisplayConnectionCocoa::InitializeEgl(EglInterface& egl)
54 {
55   EglImplementation& eglImpl = static_cast<EglImplementation&>(egl);
56
57   if(!eglImpl.InitializeGles(EGL_DEFAULT_DISPLAY))
58   {
59     DALI_LOG_ERROR("Failed to initialize GLES.\n");
60     return false;
61   }
62
63   return true;
64 }
65
66 bool DisplayConnectionCocoa::InitializeGraphics()
67 {
68   auto               eglGraphics = static_cast<EglGraphics*>(mGraphics);
69   EglImplementation& eglImpl     = eglGraphics->GetEglImplementation();
70
71   if(!eglImpl.InitializeGles(EGL_DEFAULT_DISPLAY))
72   {
73     DALI_LOG_ERROR("Failed to initialize GLES.\n");
74     return false;
75   }
76
77   return true;
78 }
79
80 void DisplayConnectionCocoa::SetSurfaceType(Dali::RenderSurfaceInterface::Type type)
81 {
82 }
83
84 void DisplayConnectionCocoa::SetGraphicsInterface(GraphicsInterface& graphics)
85 {
86   mGraphics = &graphics;
87 }
88
89 } // namespace Dali::Internal::Adaptor