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::SetNotificationLevel()
336 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
339 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
341 Dali::WindowNotificationLevel GetNotificationLevel() const override;
344 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
346 void SetOpaqueState(bool opaque) override;
349 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
351 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
354 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
356 WindowScreenOffMode GetScreenOffMode() const override;
359 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
361 Dali::WindowOperationResult SetBrightness(int brightness) override;
364 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
366 int GetBrightness() const override;
369 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
371 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
374 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
376 bool UngrabKey(Dali::KEY key) override;
379 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
381 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
384 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
386 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
389 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
391 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
394 * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
396 int GetOrientation() const override;
399 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
401 int GetScreenRotationAngle() override;
404 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
406 void SetWindowRotationAngle(int degree) override;
409 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
411 void WindowRotationCompleted(int degree, int width, int height) override;
414 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
416 void SetTransparency(bool transparent) override;
419 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
421 void SetParent(WindowBase* parentWinBase) override;
424 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
426 int CreateFrameRenderedSyncFence() override;
429 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
431 int CreateFramePresentedSyncFence() override;
435 * Second stage initialization
437 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
440 * Initialize Ecore ElDBus
442 void InitializeEcoreElDBus();
445 * @brief Create window
447 void CreateWindow(PositionSize positionSize);
451 WindowBaseEcoreWl(const WindowBaseEcoreWl&) = delete;
454 WindowBaseEcoreWl& operator=(const WindowBaseEcoreWl& rhs) = delete;
457 typedef std::vector<std::pair<std::string, std::string> > AuxiliaryHints;
459 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
461 Ecore_Wl_Window* mEcoreWindow;
462 wl_surface* mWlSurface;
463 wl_egl_window* mEglWindow;
464 wl_display* mDisplay;
465 wl_event_queue* mEventQueue;
466 tizen_policy* mTizenPolicy;
467 tizen_display_policy* mTizenDisplayPolicy;
469 std::vector<std::string> mSupportedAuxiliaryHints;
470 AuxiliaryHints mAuxiliaryHints;
472 int mNotificationLevel;
473 uint32_t mNotificationChangeState;
474 bool mNotificationLevelChangeDone;
477 uint32_t mScreenOffModeChangeState;
478 bool mScreenOffModeChangeDone;
481 uint32_t mBrightnessChangeState;
482 bool mBrightnessChangeDone;
486 int mWindowRotationAngle;
487 int mScreenRotationAngle;
488 int mSupportedPreProtation;
489 #ifdef DALI_ELDBUS_AVAILABLE
490 Eldbus_Connection* mSystemConnection;
491 #endif // DALI_ELDBUS_AVAILABLE
494 } // namespace Adaptor
496 } // namespace Internal
500 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H