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) 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>
26 #include <Ecore_Wayland.h>
27 #include <tizen-extension-client-protocol.h>
28 #include <wayland-egl.h>
30 #ifdef DALI_ELDBUS_AVAILABLE
40 class WindowRenderSurface;
41 class WindowRenderSurfaceEcoreWl;
44 * WindowBaseEcoreWl class provides an WindowBase Ecore-Wayland implementation.
46 class WindowBaseEcoreWl : public WindowBase
52 WindowBaseEcoreWl(PositionSize positionSize, Any surface, bool isTransparent);
57 virtual ~WindowBaseEcoreWl();
61 * @brief Called when the window iconify state is changed.
63 Eina_Bool OnIconifyStateChanged(void* data, int type, void* event);
66 * @brief Called when the window gains focus.
68 Eina_Bool OnFocusIn(void* data, int type, void* event);
71 * @brief Called when the window loses focus.
73 Eina_Bool OnFocusOut(void* data, int type, void* event);
76 * @brief Called when the output is transformed.
78 Eina_Bool OnOutputTransform(void* data, int type, void* event);
81 * @brief Called when the output transform should be ignored.
83 Eina_Bool OnIgnoreOutputTransform(void* data, int type, void* event);
86 * @brief Called when a rotation event is recevied.
88 void OnRotation(void* data, int type, void* event);
91 * @brief Called when a touch down is received.
93 void OnMouseButtonDown(void* data, int type, void* event);
96 * @brief Called when a touch up is received.
98 void OnMouseButtonUp(void* data, int type, void* event);
101 * @brief Called when a touch motion is received.
103 void OnMouseButtonMove(void* data, int type, void* event);
106 * @brief Called when a touch is canceled.
108 void OnMouseButtonCancel(void* data, int type, void* event);
111 * @brief Called when a mouse wheel is received.
113 void OnMouseWheel(void* data, int type, void* event);
116 * @brief Called when a detent rotation event is recevied.
118 void OnDetentRotation(void* data, int type, void* event);
121 * @brief Called when a key down is received.
123 void OnKeyDown(void* data, int type, void* event);
126 * @brief Called when a key up is received.
128 void OnKeyUp(void* data, int type, void* event);
131 * @brief Called when the source window notifies us the content in clipboard is selected.
133 void OnDataSend(void* data, int type, void* event);
136 * @brief Called when the source window sends us about the selected content.
138 void OnDataReceive(void* data, int type, void* event);
141 * @brief Called when a font name is changed.
143 void OnFontNameChanged();
146 * @brief Called when a font size is changed.
148 void OnFontSizeChanged();
150 #ifdef DALI_ELDBUS_AVAILABLE
152 * @brief Called when Ecore ElDBus accessibility event is received.
154 void OnEcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message);
158 * @brief RegistryGlobalCallback
160 void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
163 * @brief RegistryGlobalCallbackRemove
165 void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id);
168 * @brief TizenPolicyNotificationChangeDone
170 void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state);
173 * @brief TizenPolicyScreenModeChangeDone
175 void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state);
178 * @brief DisplayPolicyBrightnessChangeDone
180 void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state);
184 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
186 Any GetNativeWindow() override;
189 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
191 int GetNativeWindowId() override;
194 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
196 EGLNativeWindowType CreateEglWindow(int width, int height) override;
199 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
201 void DestroyEglWindow() override;
204 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
206 void SetEglWindowRotation(int angle) override;
209 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
211 void SetEglWindowBufferTransform(int angle) override;
214 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
216 void SetEglWindowTransform(int angle) override;
219 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
221 void ResizeEglWindow(PositionSize positionSize) override;
224 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
226 bool IsEglWindowRotationSupported() override;
229 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
231 void Move(PositionSize positionSize) override;
234 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
236 void Resize(PositionSize positionSize) override;
239 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
241 void MoveResize(PositionSize positionSize) override;
244 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
246 void SetClass(const std::string& name, const std::string& className) override;
249 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
251 void Raise() override;
254 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
256 void Lower() override;
259 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
261 void Activate() override;
264 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
266 void SetAvailableAnlges(const std::vector<int>& angles) override;
269 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
271 void SetPreferredAngle(int angle) override;
274 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
276 void SetAcceptFocus(bool accept) override;
279 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
281 void Show() override;
284 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
286 void Hide() override;
289 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
291 unsigned int GetSupportedAuxiliaryHintCount() const override;
294 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
296 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
299 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
301 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
304 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
306 bool RemoveAuxiliaryHint(unsigned int id) override;
309 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
311 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
314 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
316 std::string GetAuxiliaryHintValue(unsigned int id) const override;
319 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
321 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
324 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
326 void SetInputRegion(const Rect<int>& inputRegion) override;
329 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
331 void SetType(Dali::WindowType type) override;
334 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
336 Dali::WindowType GetType() const override;
339 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
341 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
344 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
346 Dali::WindowNotificationLevel GetNotificationLevel() const override;
349 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
351 void SetOpaqueState(bool opaque) override;
354 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
356 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
359 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
361 WindowScreenOffMode GetScreenOffMode() const override;
364 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
366 Dali::WindowOperationResult SetBrightness(int brightness) override;
369 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
371 int GetBrightness() const override;
374 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
376 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
379 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
381 bool UngrabKey(Dali::KEY key) override;
384 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
386 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
389 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
391 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
394 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
396 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
399 * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
401 int GetOrientation() const override;
404 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
406 int GetScreenRotationAngle() override;
409 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
411 void SetWindowRotationAngle(int degree) override;
414 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
416 void WindowRotationCompleted(int degree, int width, int height) override;
419 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
421 void SetTransparency(bool transparent) override;
424 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
426 void SetParent(WindowBase* parentWinBase) override;
429 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
431 int CreateFrameRenderedSyncFence() override;
434 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
436 int CreateFramePresentedSyncFence() override;
439 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
441 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
444 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
446 void InitializeIme() override;
449 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
451 void ImeWindowReadyToRender() override;
454 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
456 void RequestMoveToServer() override;
459 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
461 void RequestResizeToServer(WindowResizeDirection direction) override;
464 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
466 void EnableFloatingMode(bool enable) override;
469 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
471 bool IsFloatingModeEnabled() const override;
475 * Second stage initialization
477 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
480 * Initialize Ecore ElDBus
482 void InitializeEcoreElDBus();
485 * @brief Create window
487 void CreateWindow(PositionSize positionSize);
491 WindowBaseEcoreWl(const WindowBaseEcoreWl&) = delete;
494 WindowBaseEcoreWl& operator=(const WindowBaseEcoreWl& rhs) = delete;
497 typedef std::vector<std::pair<std::string, std::string> > AuxiliaryHints;
499 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
501 Ecore_Wl_Window* mEcoreWindow;
502 wl_surface* mWlSurface;
503 wl_egl_window* mEglWindow;
504 wl_display* mDisplay;
505 wl_event_queue* mEventQueue;
506 tizen_policy* mTizenPolicy;
507 tizen_display_policy* mTizenDisplayPolicy;
509 std::vector<std::string> mSupportedAuxiliaryHints;
510 AuxiliaryHints mAuxiliaryHints;
512 int mNotificationLevel;
513 uint32_t mNotificationChangeState;
514 bool mNotificationLevelChangeDone;
517 uint32_t mScreenOffModeChangeState;
518 bool mScreenOffModeChangeDone;
521 uint32_t mBrightnessChangeState;
522 bool mBrightnessChangeDone;
526 int mWindowRotationAngle;
527 int mScreenRotationAngle;
528 int mSupportedPreProtation;
529 #ifdef DALI_ELDBUS_AVAILABLE
530 Eldbus_Connection* mSystemConnection;
531 #endif // DALI_ELDBUS_AVAILABLE
534 } // namespace Adaptor
536 } // namespace Internal
540 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H