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) 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>
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::SetClass()
240 void SetClass(const std::string& name, const std::string& className) override;
243 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
245 void Raise() override;
248 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
250 void Lower() override;
253 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
255 void Activate() override;
258 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
260 void Maximize(bool maximize) override;
263 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
265 bool IsMaximized() const override;
268 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
270 void SetMaximumSize(Dali::Window::WindowSize size) override;
273 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
275 void Minimize(bool minimize) override;
278 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
280 bool IsMinimized() const override;
283 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
285 void SetMimimumSize(Dali::Window::WindowSize size) override;
288 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
290 void SetAvailableAnlges(const std::vector<int>& angles) override;
293 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
295 void SetPreferredAngle(int angle) override;
298 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
300 void SetAcceptFocus(bool accept) override;
303 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
305 void Show() override;
308 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
310 void Hide() override;
313 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
315 unsigned int GetSupportedAuxiliaryHintCount() const override;
318 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
320 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
323 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
325 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
328 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
330 bool RemoveAuxiliaryHint(unsigned int id) override;
333 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
335 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
340 std::string GetAuxiliaryHintValue(unsigned int id) const override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
345 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
350 void SetInputRegion(const Rect<int>& inputRegion) override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
355 void SetType(Dali::WindowType type) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
360 Dali::WindowType GetType() const override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
365 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
370 Dali::WindowNotificationLevel GetNotificationLevel() const override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
375 void SetOpaqueState(bool opaque) override;
378 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
380 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
383 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
385 WindowScreenOffMode GetScreenOffMode() const override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
390 Dali::WindowOperationResult SetBrightness(int brightness) override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
395 int GetBrightness() const override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
400 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
405 bool UngrabKey(Dali::KEY key) override;
408 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
410 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
413 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
415 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
418 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
420 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
423 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
425 int GetWindowRotationAngle() const override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
430 int GetScreenRotationAngle() override;
433 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
435 void SetWindowRotationAngle(int degree) override;
438 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
440 void WindowRotationCompleted(int degree, int width, int height) override;
443 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
445 void SetTransparency(bool transparent) override;
448 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
450 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
453 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
455 int CreateFrameRenderedSyncFence() override;
458 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
460 int CreateFramePresentedSyncFence() override;
463 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
465 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
468 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
470 void InitializeIme() override;
473 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
475 void ImeWindowReadyToRender() override;
478 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
480 void RequestMoveToServer() override;
483 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
485 void RequestResizeToServer(WindowResizeDirection direction) override;
488 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
490 void EnableFloatingMode(bool enable) override;
493 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
495 bool IsFloatingModeEnabled() const override;
498 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
500 void IncludeInputRegion(const Rect<int>& inputRegion) override;
503 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
505 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
509 * Second stage initialization
511 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
514 * @brief Create window
516 void CreateWindow(PositionSize positionSize);
520 WindowBaseEcoreWl(const WindowBaseEcoreWl&) = delete;
523 WindowBaseEcoreWl& operator=(const WindowBaseEcoreWl& rhs) = delete;
526 typedef std::vector<std::pair<std::string, std::string> > AuxiliaryHints;
528 Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
530 Ecore_Wl_Window* mEcoreWindow;
531 wl_surface* mWlSurface;
532 wl_egl_window* mEglWindow;
533 wl_display* mDisplay;
534 wl_event_queue* mEventQueue;
535 tizen_policy* mTizenPolicy;
536 tizen_display_policy* mTizenDisplayPolicy;
538 std::vector<std::string> mSupportedAuxiliaryHints;
539 AuxiliaryHints mAuxiliaryHints;
541 int mNotificationLevel;
542 uint32_t mNotificationChangeState;
543 bool mNotificationLevelChangeDone;
546 uint32_t mScreenOffModeChangeState;
547 bool mScreenOffModeChangeDone;
550 uint32_t mBrightnessChangeState;
551 bool mBrightnessChangeDone;
555 int mWindowRotationAngle;
556 int mScreenRotationAngle;
557 int mSupportedPreProtation;
560 } // namespace Adaptor
562 } // namespace Internal
566 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H