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) 2023 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 configuration is changed.
54 void OnWindowConfigure(void* event);
57 * @brief Called when the window property is changed.
59 Eina_Bool OnWindowPropertyChanged(void* data, int type, void* event);
62 * @brief Called when the window receives a delete request
64 void OnDeleteRequest();
67 * @brief Called when the window gains focus.
69 void OnFocusIn(void* data, int type, void* event);
72 * @brief Called when the window loses focus.
74 void OnFocusOut(void* data, int type, void* event);
77 * @brief Called when the window is damaged.
79 void OnWindowDamaged(void* data, int type, void* event);
82 * @brief Called when a touch down is received.
84 void OnMouseButtonDown(void* data, int type, void* event);
87 * @brief Called when a touch up is received.
89 void OnMouseButtonUp(void* data, int type, void* event);
92 * @brief Called when a touch motion is received.
94 void OnMouseButtonMove(void* data, int type, void* event);
97 * @brief Called when a mouse wheel is received.
99 void OnMouseWheel(void* data, int type, void* event);
102 * @brief Called when a key down is received.
104 void OnKeyDown(void* data, int type, void* event);
107 * @brief Called when a key up is received.
109 void OnKeyUp(void* data, int type, void* event);
112 * @brief Called when the source window notifies us the content in clipboard is selected.
114 void OnSelectionClear(void* data, int type, void* event);
117 * @brief Called when the source window sends us about the selected content.
119 void OnSelectionNotify(void* data, int type, void* event);
123 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
125 Any GetNativeWindow() override;
128 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
130 int GetNativeWindowId() override;
133 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowResourceId()
135 std::string GetNativeWindowResourceId() override;
138 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
140 EGLNativeWindowType CreateEglWindow(int width, int height) override;
143 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
145 void DestroyEglWindow() override;
148 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
150 void SetEglWindowRotation(int angle) override;
153 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
155 void SetEglWindowBufferTransform(int angle) override;
158 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
160 void SetEglWindowTransform(int angle) override;
163 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
165 void ResizeEglWindow(PositionSize positionSize) override;
168 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
170 bool IsEglWindowRotationSupported() override;
173 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
175 void Move(PositionSize positionSize) override;
178 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
180 void Resize(PositionSize positionSize) override;
183 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
185 void MoveResize(PositionSize positionSize) override;
188 * @copydoc Dali::Internal::Adaptor::WindowBase::SetLayout()
190 void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) override;
193 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
195 void SetClass(const std::string& name, const std::string& className) override;
198 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
200 void Raise() override;
203 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
205 void Lower() override;
208 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
210 void Activate() override;
213 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
215 void Maximize(bool maximize) override;
218 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
220 bool IsMaximized() const override;
223 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
225 void SetMaximumSize(Dali::Window::WindowSize size) override;
228 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
230 void Minimize(bool minimize) override;
233 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
235 bool IsMinimized() const override;
238 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
240 void SetMimimumSize(Dali::Window::WindowSize size) override;
243 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
245 void SetAvailableAnlges(const std::vector<int>& angles) override;
248 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
250 void SetPreferredAngle(int angle) override;
253 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
255 void SetAcceptFocus(bool accept) override;
258 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
260 void Show() override;
263 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
265 void Hide() override;
268 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
270 unsigned int GetSupportedAuxiliaryHintCount() const override;
273 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
275 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
278 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
280 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
283 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
285 bool RemoveAuxiliaryHint(unsigned int id) override;
288 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
290 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
293 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
295 std::string GetAuxiliaryHintValue(unsigned int id) const override;
298 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
300 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
303 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
305 void SetInputRegion(const Rect<int>& inputRegion) override;
308 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
310 void SetType(Dali::WindowType type) override;
313 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
315 Dali::WindowType GetType() const override;
318 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
320 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
323 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
325 Dali::WindowNotificationLevel GetNotificationLevel() const override;
328 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
330 void SetOpaqueState(bool opaque) override;
333 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
335 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
340 WindowScreenOffMode GetScreenOffMode() const override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
345 Dali::WindowOperationResult SetBrightness(int brightness) override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
350 int GetBrightness() const override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
355 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
360 bool UngrabKey(Dali::KEY key) override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
365 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
370 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
375 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
378 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
380 int GetWindowRotationAngle() const override;
383 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
385 int GetScreenRotationAngle() override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
390 void SetWindowRotationAngle(int degree) override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
395 void WindowRotationCompleted(int degree, int width, int height) override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
400 void SetTransparency(bool transparent) override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
405 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
408 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
410 int CreateFrameRenderedSyncFence() override;
413 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
415 int CreateFramePresentedSyncFence() override;
418 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
420 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
423 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
425 void InitializeIme() override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
430 void ImeWindowReadyToRender() override;
433 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
435 void RequestMoveToServer() override;
438 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
440 void RequestResizeToServer(WindowResizeDirection direction) override;
443 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
445 void EnableFloatingMode(bool enable) override;
448 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
450 bool IsFloatingModeEnabled() const override;
453 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
455 void IncludeInputRegion(const Rect<int>& inputRegion) override;
458 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
460 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
463 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsLock()
465 bool PointerConstraintsLock() override;
468 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsUnlock()
470 bool PointerConstraintsUnlock() override;
473 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerRegionSet()
475 void LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height) override;
478 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerCursorPositionHintSet()
480 void LockedPointerCursorPositionHintSet(int32_t x, int32_t y) override;
483 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerWarp()
485 bool PointerWarp(int32_t x, int32_t y) override;
489 * Second stage initialization
491 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
494 * @brief Get the surface id if the surface parameter is not empty
495 * @param surface Any containing a surface id, or can be empty
496 * @return surface id, or zero if surface is empty
498 unsigned int GetSurfaceId(Any surface) const;
501 * @brief Create window
503 void CreateWindow(PositionSize positionSize, bool isTransparent);
507 WindowBaseEcoreX(const WindowBaseEcoreX&) = delete;
510 WindowBaseEcoreX& operator=(const WindowBaseEcoreX& rhs) = delete;
513 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
514 Ecore_X_Window mEcoreWindow; ///< Native window handle
515 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
516 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
517 bool mRotationAppSet : 1;
518 int mWindowRotationAngle;
521 } // namespace Adaptor
523 } // namespace Internal
527 #endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H