1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_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>
26 #include <Ecore_Wayland.h>
27 #include <tizen-extension-client-protocol.h>
28 #include <wayland-egl.h>
36 class WindowRenderSurface;
37 class WindowRenderSurfaceEcoreWl;
40 * WindowBaseEcoreWl class provides an WindowBase Ecore-Wayland implementation.
42 class WindowBaseEcoreWl : public WindowBase
48 WindowBaseEcoreWl(PositionSize positionSize, Any surface, bool isTransparent);
53 virtual ~WindowBaseEcoreWl();
57 * @brief Called when the window iconify state is changed.
59 Eina_Bool OnIconifyStateChanged(void* data, int type, void* event);
62 * @brief Called when the window gains focus.
64 Eina_Bool OnFocusIn(void* data, int type, void* event);
67 * @brief Called when the window loses focus.
69 Eina_Bool OnFocusOut(void* data, int type, void* event);
72 * @brief Called when the output is transformed.
74 Eina_Bool OnOutputTransform(void* data, int type, void* event);
77 * @brief Called when the output transform should be ignored.
79 Eina_Bool OnIgnoreOutputTransform(void* data, int type, void* event);
82 * @brief Called when a rotation event is recevied.
84 void OnRotation(void* data, int type, void* event);
87 * @brief Called when a touch down is received.
89 void OnMouseButtonDown(void* data, int type, void* event);
92 * @brief Called when a touch up is received.
94 void OnMouseButtonUp(void* data, int type, void* event);
97 * @brief Called when a touch motion is received.
99 void OnMouseButtonMove(void* data, int type, void* event);
102 * @brief Called when a touch is canceled.
104 void OnMouseButtonCancel(void* data, int type, void* event);
107 * @brief Called when a mouse wheel is received.
109 void OnMouseWheel(void* data, int type, void* event);
112 * @brief Called when a detent rotation event is recevied.
114 void OnDetentRotation(void* data, int type, void* event);
117 * @brief Called when a key down is received.
119 void OnKeyDown(void* data, int type, void* event);
122 * @brief Called when a key up is received.
124 void OnKeyUp(void* data, int type, void* event);
127 * @brief Called when the source window notifies us the content in clipboard is selected.
129 void OnDataSend(void* data, int type, void* event);
132 * @brief Called when the source window sends us about the selected content.
134 void OnDataReceive(void* data, int type, void* event);
137 * @brief Called when a font name is changed.
139 void OnFontNameChanged();
142 * @brief Called when a font size is changed.
144 void OnFontSizeChanged();
147 * @brief RegistryGlobalCallback
149 void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
152 * @brief RegistryGlobalCallbackRemove
154 void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id);
157 * @brief TizenPolicyNotificationChangeDone
159 void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state);
162 * @brief TizenPolicyScreenModeChangeDone
164 void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state);
167 * @brief DisplayPolicyBrightnessChangeDone
169 void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state);
173 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
175 Any GetNativeWindow() override;
178 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
180 int GetNativeWindowId() override;
183 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowResourceId()
185 std::string GetNativeWindowResourceId() override;
188 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
190 EGLNativeWindowType CreateEglWindow(int width, int height) override;
193 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
195 void DestroyEglWindow() override;
198 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
200 void SetEglWindowRotation(int angle) override;
203 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
205 void SetEglWindowBufferTransform(int angle) override;
208 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
210 void SetEglWindowTransform(int angle) override;
213 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
215 void ResizeEglWindow(PositionSize positionSize) override;
218 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
220 bool IsEglWindowRotationSupported() override;
223 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
225 void Move(PositionSize positionSize) override;
228 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
230 void Resize(PositionSize positionSize) override;
233 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
235 void MoveResize(PositionSize positionSize) override;
238 * @copydoc Dali::Internal::Adaptor::WindowBase::SetLayout()
240 void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) override;
243 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
245 void SetClass(const std::string& name, const std::string& className) override;
248 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
250 void Raise() override;
253 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
255 void Lower() override;
258 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
260 void Activate() override;
263 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
265 void Maximize(bool maximize) override;
268 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
270 bool IsMaximized() const override;
273 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
275 void SetMaximumSize(Dali::Window::WindowSize size) override;
278 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
280 void Minimize(bool minimize) override;
283 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
285 bool IsMinimized() const override;
288 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
290 void SetMimimumSize(Dali::Window::WindowSize size) override;
293 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
295 void SetAvailableAnlges(const std::vector<int>& angles) override;
298 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
300 void SetPreferredAngle(int angle) override;
303 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
305 void SetAcceptFocus(bool accept) override;
308 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
310 void Show() override;
313 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
315 void Hide() override;
318 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
320 unsigned int GetSupportedAuxiliaryHintCount() const override;
323 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
325 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
328 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
330 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
333 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
335 bool RemoveAuxiliaryHint(unsigned int id) override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
340 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
345 std::string GetAuxiliaryHintValue(unsigned int id) const override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
350 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
355 void SetInputRegion(const Rect<int>& inputRegion) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
360 void SetType(Dali::WindowType type) override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
365 Dali::WindowType GetType() const override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
370 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
375 Dali::WindowNotificationLevel GetNotificationLevel() const override;
378 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
380 void SetOpaqueState(bool opaque) override;
383 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
385 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
390 WindowScreenOffMode GetScreenOffMode() const override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
395 Dali::WindowOperationResult SetBrightness(int brightness) override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
400 int GetBrightness() const override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
405 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
408 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
410 bool UngrabKey(Dali::KEY key) override;
413 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
415 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
418 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
420 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
423 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
425 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
430 int GetWindowRotationAngle() const override;
433 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
435 int GetScreenRotationAngle() override;
438 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
440 void SetWindowRotationAngle(int degree) override;
443 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
445 void WindowRotationCompleted(int degree, int width, int height) override;
448 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
450 void SetTransparency(bool transparent) override;
453 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
455 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
458 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
460 int CreateFrameRenderedSyncFence() override;
463 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
465 int CreateFramePresentedSyncFence() override;
468 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
470 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
473 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
475 void InitializeIme() override;
478 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
480 void ImeWindowReadyToRender() override;
483 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
485 void RequestMoveToServer() override;
488 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
490 void RequestResizeToServer(WindowResizeDirection direction) override;
493 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
495 void EnableFloatingMode(bool enable) override;
498 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
500 bool IsFloatingModeEnabled() const override;
503 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
505 void IncludeInputRegion(const Rect<int>& inputRegion) override;
508 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
510 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
513 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsLock()
515 bool PointerConstraintsLock() override;
518 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsUnlock()
520 bool PointerConstraintsUnlock() override;
523 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerRegionSet()
525 void LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height) override;
528 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerCursorPositionHintSet()
530 void LockedPointerCursorPositionHintSet(int32_t x, int32_t y) override;
533 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerWarp()
535 bool PointerWarp(int32_t x, int32_t y) override;
538 * @copydoc Dali::Internal::Adaptor::WindowBase::CursorVisibleSet()
540 void CursorVisibleSet(bool visible) override;
544 * Second stage initialization
546 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
549 * @brief Create window
551 void CreateWindow(PositionSize positionSize);
555 WindowBaseEcoreWl(const WindowBaseEcoreWl&) = delete;
558 WindowBaseEcoreWl& operator=(const WindowBaseEcoreWl& rhs) = delete;
561 typedef std::vector<std::pair<std::string, std::string> > AuxiliaryHints;
563 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
565 Ecore_Wl_Window* mEcoreWindow;
566 wl_surface* mWlSurface;
567 wl_egl_window* mEglWindow;
568 wl_display* mDisplay;
569 wl_event_queue* mEventQueue;
570 tizen_policy* mTizenPolicy;
571 tizen_display_policy* mTizenDisplayPolicy;
573 std::vector<std::string> mSupportedAuxiliaryHints;
574 AuxiliaryHints mAuxiliaryHints;
576 int mNotificationLevel;
577 uint32_t mNotificationChangeState;
578 bool mNotificationLevelChangeDone;
581 uint32_t mScreenOffModeChangeState;
582 bool mScreenOffModeChangeDone;
585 uint32_t mBrightnessChangeState;
586 bool mBrightnessChangeDone;
590 int mWindowRotationAngle;
591 int mScreenRotationAngle;
592 int mSupportedPreProtation;
595 } // namespace Adaptor
597 } // namespace Internal
601 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H