1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/internal/window-system/common/window-base.h>
25 #include <dali/internal/system/linux/dali-ecore-x.h>
26 #include <dali/internal/system/linux/dali-ecore.h>
35 * WindowBaseEcoreX class provides an WindowBase EcoreX implementation.
37 class WindowBaseEcoreX : public WindowBase
43 WindowBaseEcoreX(PositionSize positionSize, Any surface, bool isTransparent);
48 virtual ~WindowBaseEcoreX();
52 * @brief Called when the window property is changed.
54 Eina_Bool OnWindowPropertyChanged(void* data, int type, void* event);
57 * @brief Called when the window receives a delete request
59 void OnDeleteRequest();
62 * @brief Called when the window gains focus.
64 void OnFocusIn(void* data, int type, void* event);
67 * @brief Called when the window loses focus.
69 void OnFocusOut(void* data, int type, void* event);
72 * @brief Called when the window is damaged.
74 void OnWindowDamaged(void* data, int type, void* event);
77 * @brief Called when a touch down is received.
79 void OnMouseButtonDown(void* data, int type, void* event);
82 * @brief Called when a touch up is received.
84 void OnMouseButtonUp(void* data, int type, void* event);
87 * @brief Called when a touch motion is received.
89 void OnMouseButtonMove(void* data, int type, void* event);
92 * @brief Called when a mouse wheel is received.
94 void OnMouseWheel(void* data, int type, void* event);
97 * @brief Called when a key down is received.
99 void OnKeyDown(void* data, int type, void* event);
102 * @brief Called when a key up is received.
104 void OnKeyUp(void* data, int type, void* event);
107 * @brief Called when the source window notifies us the content in clipboard is selected.
109 void OnSelectionClear(void* data, int type, void* event);
112 * @brief Called when the source window sends us about the selected content.
114 void OnSelectionNotify(void* data, int type, void* event);
118 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
120 Any GetNativeWindow() override;
123 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
125 int GetNativeWindowId() override;
128 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
130 EGLNativeWindowType CreateEglWindow(int width, int height) override;
133 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
135 void DestroyEglWindow() override;
138 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
140 void SetEglWindowRotation(int angle) override;
143 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
145 void SetEglWindowBufferTransform(int angle) override;
148 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
150 void SetEglWindowTransform(int angle) override;
153 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
155 void ResizeEglWindow(PositionSize positionSize) override;
158 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
160 bool IsEglWindowRotationSupported() override;
163 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
165 void Move(PositionSize positionSize) override;
168 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
170 void Resize(PositionSize positionSize) override;
173 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
175 void MoveResize(PositionSize positionSize) override;
178 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
180 void SetClass(const std::string& name, const std::string& className) override;
183 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
185 void Raise() override;
188 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
190 void Lower() override;
193 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
195 void Activate() override;
198 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
200 void SetAvailableAnlges(const std::vector<int>& angles) override;
203 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
205 void SetPreferredAngle(int angle) override;
208 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
210 void SetAcceptFocus(bool accept) override;
213 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
215 void Show() override;
218 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
220 void Hide() override;
223 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
225 unsigned int GetSupportedAuxiliaryHintCount() const override;
228 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
230 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
233 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
235 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
238 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
240 bool RemoveAuxiliaryHint(unsigned int id) override;
243 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
245 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
248 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
250 std::string GetAuxiliaryHintValue(unsigned int id) const override;
253 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
255 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
258 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
260 void SetInputRegion(const Rect<int>& inputRegion) override;
263 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
265 void SetType(Dali::WindowType type) override;
268 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
270 Dali::WindowType GetType() const override;
273 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
275 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
278 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
280 Dali::WindowNotificationLevel GetNotificationLevel() const override;
283 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
285 void SetOpaqueState(bool opaque) override;
288 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
290 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
293 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
295 WindowScreenOffMode GetScreenOffMode() const override;
298 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
300 Dali::WindowOperationResult SetBrightness(int brightness) override;
303 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
305 int GetBrightness() const override;
308 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
310 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
313 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
315 bool UngrabKey(Dali::KEY key) override;
318 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
320 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
323 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
325 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
328 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
330 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
333 * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
335 int GetOrientation() const override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
340 int GetScreenRotationAngle() override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
345 void SetWindowRotationAngle(int degree) override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
350 void WindowRotationCompleted(int degree, int width, int height) override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
355 void SetTransparency(bool transparent) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
360 void SetParent(WindowBase* parentWinBase) override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
365 int CreateFrameRenderedSyncFence() override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
370 int CreateFramePresentedSyncFence() override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
375 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
378 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
380 void InitializeIme() override;
383 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
385 void ImeWindowReadyToRender() override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
390 void RequestMoveToServer() override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
395 void RequestResizeToServer(WindowResizeDirection direction) override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
400 void EnableFloatingMode(bool enable) override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
405 bool IsFloatingModeEnabled() const override;
409 * Second stage initialization
411 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
414 * @brief Get the surface id if the surface parameter is not empty
415 * @param surface Any containing a surface id, or can be empty
416 * @return surface id, or zero if surface is empty
418 unsigned int GetSurfaceId(Any surface) const;
421 * @brief Create window
423 void CreateWindow(PositionSize positionSize, bool isTransparent);
427 WindowBaseEcoreX(const WindowBaseEcoreX&) = delete;
430 WindowBaseEcoreX& operator=(const WindowBaseEcoreX& rhs) = delete;
433 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
434 Ecore_X_Window mEcoreWindow; ///< Native window handle
435 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
436 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
437 bool mRotationAppSet : 1;
438 int mWindowRotationAngle;
441 } // namespace Adaptor
443 } // namespace Internal
447 #endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H