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