[Tizen] Add input region APIs
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / android / window-base-android.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 <dali/internal/window-system/android/window-base-android.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/integration-api/adaptor-framework/android/android-framework.h>
27 #include <dali/integration-api/debug.h>
28 #include <dali/public-api/events/mouse-button.h>
29 #include <dali/public-api/object/any.h>
30
31 namespace Dali
32 {
33 namespace Internal
34 {
35 namespace Adaptor
36 {
37 #if defined(DEBUG_ENABLED)
38 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
39 #endif
40
41 WindowBaseAndroid::WindowBaseAndroid(Dali::PositionSize positionSize, Any surface, bool isTransparent)
42 : mWindow(nullptr),
43   mOwnSurface(false),
44   mIsTransparent(false), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
45   mRotationAppSet(false)
46 {
47   Initialize(positionSize, surface, isTransparent);
48 }
49
50 WindowBaseAndroid::~WindowBaseAndroid() = default;
51
52 void WindowBaseAndroid::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
53 {
54   if(!surface.Empty())
55   {
56     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Initialising using supplied Android native window\n");
57     mWindow = static_cast<ANativeWindow*>(AnyCast<void*>(surface));
58   }
59   else
60   {
61     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Initialising using default Android native window\n");
62     mWindow = Dali::Integration::AndroidFramework::Get().GetApplicationWindow();
63   }
64
65   DALI_ASSERT_ALWAYS(mWindow && "Failed to get Android window");
66   mIsTransparent = true;
67 }
68
69 void WindowBaseAndroid::OnDeleteRequest()
70 {
71   mDeleteRequestSignal.Emit();
72 }
73
74 void WindowBaseAndroid::OnFocusIn(void* data, int type, void* event)
75 {
76 }
77
78 void WindowBaseAndroid::OnFocusOut(void* data, int type, void* event)
79 {
80 }
81
82 void WindowBaseAndroid::OnWindowDamaged(void* data, int type, void* event)
83 {
84 }
85
86 void WindowBaseAndroid::OnMouseButtonDown(void* data, int type, void* event)
87 {
88 }
89
90 void WindowBaseAndroid::OnMouseButtonUp(void* data, int type, void* event)
91 {
92 }
93
94 void WindowBaseAndroid::OnMouseButtonMove(void* data, int type, void* event)
95 {
96 }
97
98 void WindowBaseAndroid::OnMouseWheel(void* data, int type, void* event)
99 {
100 }
101
102 void WindowBaseAndroid::OnKeyDown(void* data, int type, void* event)
103 {
104 }
105
106 void WindowBaseAndroid::OnKeyUp(void* data, int type, void* event)
107 {
108 }
109
110 void WindowBaseAndroid::OnSelectionClear(void* data, int type, void* event)
111 {
112 }
113
114 void WindowBaseAndroid::OnSelectionNotify(void* data, int type, void* event)
115 {
116 }
117
118 Any WindowBaseAndroid::GetNativeWindow()
119 {
120   return static_cast<void*>(mWindow);
121 }
122
123 int WindowBaseAndroid::GetNativeWindowId()
124 {
125   return 0;
126 }
127
128 EGLNativeWindowType WindowBaseAndroid::CreateEglWindow(int width, int height)
129 {
130   // from eglplatform.h header
131   // typedef struct ANativeWindow* EGLNativeWindowType;
132   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Returns the window created for us.\n");
133   return mWindow;
134 }
135
136 void WindowBaseAndroid::DestroyEglWindow()
137 {
138   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Does nothing, the window is not owned by us.\n");
139 }
140
141 void WindowBaseAndroid::SetEglWindowRotation(int angle)
142 {
143 }
144
145 void WindowBaseAndroid::SetEglWindowBufferTransform(int angle)
146 {
147 }
148
149 void WindowBaseAndroid::SetEglWindowTransform(int angle)
150 {
151 }
152
153 void WindowBaseAndroid::ResizeEglWindow(PositionSize positionSize)
154 {
155 }
156
157 bool WindowBaseAndroid::IsEglWindowRotationSupported()
158 {
159   return false;
160 }
161
162 void WindowBaseAndroid::Move(PositionSize positionSize)
163 {
164 }
165
166 void WindowBaseAndroid::Resize(PositionSize positionSize)
167 {
168 }
169
170 void WindowBaseAndroid::MoveResize(PositionSize positionSize)
171 {
172 }
173
174 void WindowBaseAndroid::SetClass(const std::string& name, const std::string& className)
175 {
176 }
177
178 void WindowBaseAndroid::Raise()
179 {
180 }
181
182 void WindowBaseAndroid::Lower()
183 {
184 }
185
186 void WindowBaseAndroid::Activate()
187 {
188 }
189
190 void WindowBaseAndroid::SetAvailableAnlges(const std::vector<int>& angles)
191 {
192 }
193
194 void WindowBaseAndroid::SetPreferredAngle(int angle)
195 {
196 }
197
198 void WindowBaseAndroid::SetAcceptFocus(bool accept)
199 {
200 }
201
202 void WindowBaseAndroid::Show()
203 {
204 }
205
206 void WindowBaseAndroid::Hide()
207 {
208 }
209
210 unsigned int WindowBaseAndroid::GetSupportedAuxiliaryHintCount() const
211 {
212   return 0;
213 }
214
215 std::string WindowBaseAndroid::GetSupportedAuxiliaryHint(unsigned int index) const
216 {
217   return std::string();
218 }
219
220 unsigned int WindowBaseAndroid::AddAuxiliaryHint(const std::string& hint, const std::string& value)
221 {
222   return 0;
223 }
224
225 bool WindowBaseAndroid::RemoveAuxiliaryHint(unsigned int id)
226 {
227   return false;
228 }
229
230 bool WindowBaseAndroid::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
231 {
232   return false;
233 }
234
235 std::string WindowBaseAndroid::GetAuxiliaryHintValue(unsigned int id) const
236 {
237   return std::string();
238 }
239
240 unsigned int WindowBaseAndroid::GetAuxiliaryHintId(const std::string& hint) const
241 {
242   return 0;
243 }
244
245 void WindowBaseAndroid::SetInputRegion(const Rect<int>& inputRegion)
246 {
247 }
248
249 void WindowBaseAndroid::SetType(Dali::WindowType type)
250 {
251 }
252
253 Dali::WindowType WindowBaseAndroid::GetType() const
254 {
255   return Dali::WindowType::NORMAL;
256 }
257
258 Dali::WindowOperationResult WindowBaseAndroid::SetNotificationLevel(Dali::WindowNotificationLevel level)
259 {
260   return Dali::WindowOperationResult::NOT_SUPPORTED;
261 }
262
263 Dali::WindowNotificationLevel WindowBaseAndroid::GetNotificationLevel() const
264 {
265   return Dali::WindowNotificationLevel::NONE;
266 }
267
268 void WindowBaseAndroid::SetOpaqueState(bool opaque)
269 {
270 }
271
272 Dali::WindowOperationResult WindowBaseAndroid::SetScreenOffMode(WindowScreenOffMode screenOffMode)
273 {
274   return Dali::WindowOperationResult::NOT_SUPPORTED;
275 }
276
277 WindowScreenOffMode WindowBaseAndroid::GetScreenOffMode() const
278 {
279   return WindowScreenOffMode::TIMEOUT;
280 }
281
282 Dali::WindowOperationResult WindowBaseAndroid::SetBrightness(int brightness)
283 {
284   return Dali::WindowOperationResult::NOT_SUPPORTED;
285 }
286
287 int WindowBaseAndroid::GetBrightness() const
288 {
289   return 0;
290 }
291
292 bool WindowBaseAndroid::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
293 {
294   return false;
295 }
296
297 bool WindowBaseAndroid::UngrabKey(Dali::KEY key)
298 {
299   return false;
300 }
301
302 bool WindowBaseAndroid::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
303 {
304   return false;
305 }
306
307 bool WindowBaseAndroid::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
308 {
309   return false;
310 }
311
312 void WindowBaseAndroid::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
313 {
314   AConfiguration* config = Dali::Integration::AndroidFramework::Get().GetApplicationConfiguration();
315
316   int32_t density = AConfiguration_getDensity(config);
317   if(density == ACONFIGURATION_DENSITY_ANY)
318   {
319     DALI_LOG_ERROR("Failed to get Android DPI, use 0 instead.");
320     density = 0;
321   }
322
323   dpiHorizontal = density;
324   dpiVertical   = density;
325 }
326
327 int WindowBaseAndroid::GetScreenRotationAngle()
328 {
329   return 0;
330 }
331
332 void WindowBaseAndroid::SetWindowRotationAngle(int degree)
333 {
334 }
335
336 void WindowBaseAndroid::WindowRotationCompleted(int degree, int width, int height)
337 {
338 }
339
340 void WindowBaseAndroid::SetTransparency(bool transparent)
341 {
342 }
343
344 void WindowBaseAndroid::SetParent(WindowBase* parentWinBase)
345 {
346 }
347
348 int WindowBaseAndroid::CreateFrameRenderedSyncFence()
349 {
350   return -1;
351 }
352
353 int WindowBaseAndroid::CreateFramePresentedSyncFence()
354 {
355   return -1;
356 }
357
358 int WindowBaseAndroid::GetOrientation() const
359 {
360   return 0;
361 }
362
363 void WindowBaseAndroid::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
364 {
365 }
366
367 void WindowBaseAndroid::InitializeIme()
368 {
369 }
370
371 void WindowBaseAndroid::ImeWindowReadyToRender()
372 {
373 }
374
375 void WindowBaseAndroid::RequestMoveToServer()
376 {
377 }
378
379 void WindowBaseAndroid::RequestResizeToServer(WindowResizeDirection direction)
380 {
381 }
382
383 void WindowBaseAndroid::EnableFloatingMode(bool enable)
384 {
385 }
386
387 bool WindowBaseAndroid::IsFloatingModeEnabled() const
388 {
389   return false;
390 }
391
392 void WindowBaseAndroid::IncludeInputRegion(const Rect<int>& inputRegion)
393 {
394 }
395
396 void WindowBaseAndroid::ExcludeInputRegion(const Rect<int>& inputRegion)
397 {
398 }
399
400 } // namespace Adaptor
401
402 } // namespace Internal
403
404 } // namespace Dali