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) 2022 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::GetNativeWindowResourceId()
130 std::string GetNativeWindowResourceId() override;
133 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
135 EGLNativeWindowType CreateEglWindow(int width, int height) override;
138 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
140 void DestroyEglWindow() override;
143 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
145 void SetEglWindowRotation(int angle) override;
148 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
150 void SetEglWindowBufferTransform(int angle) override;
153 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
155 void SetEglWindowTransform(int angle) override;
158 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
160 void ResizeEglWindow(PositionSize positionSize) override;
163 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
165 bool IsEglWindowRotationSupported() override;
168 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
170 void Move(PositionSize positionSize) override;
173 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
175 void Resize(PositionSize positionSize) override;
178 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
180 void MoveResize(PositionSize positionSize) override;
183 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
185 void SetClass(const std::string& name, const std::string& className) override;
188 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
190 void Raise() override;
193 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
195 void Lower() override;
198 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
200 void Activate() override;
203 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
205 void Maximize(bool maximize) override;
208 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
210 bool IsMaximized() const override;
213 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
215 void SetMaximumSize(Dali::Window::WindowSize size) override;
218 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
220 void Minimize(bool minimize) override;
223 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
225 bool IsMinimized() const override;
228 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
230 void SetMimimumSize(Dali::Window::WindowSize size) override;
233 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
235 void SetAvailableAnlges(const std::vector<int>& angles) override;
238 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
240 void SetPreferredAngle(int angle) override;
243 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
245 void SetAcceptFocus(bool accept) override;
248 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
250 void Show() override;
253 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
255 void Hide() override;
258 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
260 unsigned int GetSupportedAuxiliaryHintCount() const override;
263 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
265 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
268 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
270 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
273 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
275 bool RemoveAuxiliaryHint(unsigned int id) override;
278 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
280 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
283 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
285 std::string GetAuxiliaryHintValue(unsigned int id) const override;
288 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
290 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
293 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
295 void SetInputRegion(const Rect<int>& inputRegion) override;
298 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
300 void SetType(Dali::WindowType type) override;
303 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
305 Dali::WindowType GetType() const override;
308 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
310 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
313 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
315 Dali::WindowNotificationLevel GetNotificationLevel() const override;
318 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
320 void SetOpaqueState(bool opaque) override;
323 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
325 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
328 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
330 WindowScreenOffMode GetScreenOffMode() const override;
333 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
335 Dali::WindowOperationResult SetBrightness(int brightness) override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
340 int GetBrightness() const override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
345 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
350 bool UngrabKey(Dali::KEY key) override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
355 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
360 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
365 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
370 int GetWindowRotationAngle() const override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
375 int GetScreenRotationAngle() override;
378 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
380 void SetWindowRotationAngle(int degree) override;
383 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
385 void WindowRotationCompleted(int degree, int width, int height) override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
390 void SetTransparency(bool transparent) override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
395 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
400 int CreateFrameRenderedSyncFence() override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
405 int CreateFramePresentedSyncFence() override;
408 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
410 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
413 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
415 void InitializeIme() override;
418 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
420 void ImeWindowReadyToRender() override;
423 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
425 void RequestMoveToServer() override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
430 void RequestResizeToServer(WindowResizeDirection direction) override;
433 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
435 void EnableFloatingMode(bool enable) override;
438 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
440 bool IsFloatingModeEnabled() const override;
443 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
445 void IncludeInputRegion(const Rect<int>& inputRegion) override;
448 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
450 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
454 * Second stage initialization
456 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
459 * @brief Get the surface id if the surface parameter is not empty
460 * @param surface Any containing a surface id, or can be empty
461 * @return surface id, or zero if surface is empty
463 unsigned int GetSurfaceId(Any surface) const;
466 * @brief Create window
468 void CreateWindow(PositionSize positionSize, bool isTransparent);
472 WindowBaseEcoreX(const WindowBaseEcoreX&) = delete;
475 WindowBaseEcoreX& operator=(const WindowBaseEcoreX& rhs) = delete;
478 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
479 Ecore_X_Window mEcoreWindow; ///< Native window handle
480 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
481 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
482 bool mRotationAppSet : 1;
483 int mWindowRotationAngle;
486 } // namespace Adaptor
488 } // namespace Internal
492 #endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H