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::Minimize()
215 void Minimize(bool minimize) override;
218 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
220 bool IsMinimized() const override;
223 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
225 void SetAvailableAnlges(const std::vector<int>& angles) override;
228 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
230 void SetPreferredAngle(int angle) override;
233 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
235 void SetAcceptFocus(bool accept) override;
238 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
240 void Show() override;
243 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
245 void Hide() override;
248 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
250 unsigned int GetSupportedAuxiliaryHintCount() const override;
253 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
255 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
258 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
260 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
263 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
265 bool RemoveAuxiliaryHint(unsigned int id) override;
268 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
270 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
273 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
275 std::string GetAuxiliaryHintValue(unsigned int id) const override;
278 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
280 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
283 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
285 void SetInputRegion(const Rect<int>& inputRegion) override;
288 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
290 void SetType(Dali::WindowType type) override;
293 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
295 Dali::WindowType GetType() const override;
298 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
300 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
303 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
305 Dali::WindowNotificationLevel GetNotificationLevel() const override;
308 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
310 void SetOpaqueState(bool opaque) override;
313 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
315 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
318 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
320 WindowScreenOffMode GetScreenOffMode() const override;
323 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
325 Dali::WindowOperationResult SetBrightness(int brightness) override;
328 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
330 int GetBrightness() const override;
333 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
335 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
340 bool UngrabKey(Dali::KEY key) override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
345 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
350 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
355 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
360 int GetOrientation() const override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
365 int GetScreenRotationAngle() override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
370 void SetWindowRotationAngle(int degree) override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
375 void WindowRotationCompleted(int degree, int width, int height) override;
378 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
380 void SetTransparency(bool transparent) override;
383 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
385 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
390 int CreateFrameRenderedSyncFence() override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
395 int CreateFramePresentedSyncFence() override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
400 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
405 void InitializeIme() override;
408 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
410 void ImeWindowReadyToRender() override;
413 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
415 void RequestMoveToServer() override;
418 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
420 void RequestResizeToServer(WindowResizeDirection direction) override;
423 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
425 void EnableFloatingMode(bool enable) override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
430 bool IsFloatingModeEnabled() const override;
433 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
435 void IncludeInputRegion(const Rect<int>& inputRegion) override;
438 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
440 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
444 * Second stage initialization
446 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
449 * @brief Get the surface id if the surface parameter is not empty
450 * @param surface Any containing a surface id, or can be empty
451 * @return surface id, or zero if surface is empty
453 unsigned int GetSurfaceId(Any surface) const;
456 * @brief Create window
458 void CreateWindow(PositionSize positionSize, bool isTransparent);
462 WindowBaseEcoreX(const WindowBaseEcoreX&) = delete;
465 WindowBaseEcoreX& operator=(const WindowBaseEcoreX& rhs) = delete;
468 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
469 Ecore_X_Window mEcoreWindow; ///< Native window handle
470 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
471 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
472 bool mRotationAppSet : 1;
473 int mWindowRotationAngle;
476 } // namespace Adaptor
478 } // namespace Internal
482 #endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H