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