1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_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/integration-api/events/key-event-integ.h>
23 #include <dali/integration-api/events/point.h>
24 #include <dali/integration-api/events/wheel-event-integ.h>
30 #include <dali/devel-api/adaptor-framework/mouse-in-out-event.h>
31 #include <dali/devel-api/adaptor-framework/window-devel.h>
32 #include <dali/internal/graphics/gles/egl-implementation.h>
33 #include <dali/internal/window-system/common/damage-observer.h>
34 #include <dali/internal/window-system/common/rotation-event.h>
35 #include <dali/public-api/adaptor-framework/key-grab.h>
36 #include <dali/public-api/adaptor-framework/style-change.h>
37 #include <dali/public-api/adaptor-framework/window-enumerations.h>
38 #include <dali/public-api/adaptor-framework/window.h>
47 * WindowBase interface
53 * @brief Struct used to retrieve accessibility information
55 struct AccessibilityInfo
67 typedef Signal<void(bool)> IconifySignalType;
68 typedef Signal<void(bool)> FocusSignalType;
69 typedef Signal<void()> OutputSignalType;
70 typedef Signal<void()> DeleteSignalType;
71 typedef Signal<void(const DamageArea&)> DamageSignalType;
72 typedef Signal<void(const RotationEvent&)> RotationSignalType;
73 typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
74 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType;
75 typedef Signal<void()> WindowRedrawRequestSignalType;
76 typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
77 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;
78 typedef Signal<void(const Dali::DevelWindow::MouseInOutEvent&)> MouseInOutEventSignalType;
79 typedef Signal<void(Dali::Int32Pair&)> MoveCompletedSignalType;
80 typedef Signal<void(Dali::Uint16Pair&)> ResizeCompletedSignalType;
81 typedef Signal<void(WindowInsetsPartType, WindowInsetsPartState, const Extents&)> InsetsChangedSignalType;
84 typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
85 typedef Signal<void(Integration::WheelEvent&)> WheelEventSignalType;
86 typedef Signal<void(Integration::KeyEvent&)> KeyEventSignalType;
89 typedef Signal<void(void*)> SelectionSignalType;
92 typedef Signal<void(StyleChange::Type)> StyleSignalType;
95 * @brief Default constructor
102 virtual ~WindowBase();
106 * @brief Get the native window handle
107 * @return The native window handle
109 virtual Any GetNativeWindow() = 0;
112 * @brief Get the native window id
113 * @return The native window id
115 virtual int GetNativeWindowId() = 0;
118 * @brief Get the native window resource id assinged by window manager
119 * @return The native window resource id
121 virtual std::string GetNativeWindowResourceId() = 0;
124 * @brief Create the egl window
126 virtual EGLNativeWindowType CreateEglWindow(int width, int height) = 0;
129 * @brief Destroy the egl window
131 virtual void DestroyEglWindow() = 0;
134 * @brief Set the egl window rotation
136 virtual void SetEglWindowRotation(int angle) = 0;
139 * @brief Set the egl window buffer transform
141 virtual void SetEglWindowBufferTransform(int angle) = 0;
144 * @brief Set the egl window transform
146 virtual void SetEglWindowTransform(int angle) = 0;
149 * @brief Resize the egl window
151 virtual void ResizeEglWindow(Dali::PositionSize positionSize) = 0;
154 * @brief Returns whether the egl window support rotation or not
156 virtual bool IsEglWindowRotationSupported() = 0;
159 * @brief Move the window
161 virtual void Move(Dali::PositionSize positionSize) = 0;
164 * @brief Resize the window
166 virtual void Resize(Dali::PositionSize positionSize) = 0;
169 * @brief Move and resize the window
171 virtual void MoveResize(Dali::PositionSize positionSize) = 0;
174 * @copydoc Dali::Window::SetLayout()
176 virtual void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) = 0;
179 * @copydoc Dali::Window::SetClass()
181 virtual void SetClass(const std::string& name, const std::string& className) = 0;
184 * @copydoc Dali::Window::Raise()
186 virtual void Raise() = 0;
189 * @copydoc Dali::Window::Lower()
191 virtual void Lower() = 0;
194 * @copydoc Dali::Window::Activate()
196 virtual void Activate() = 0;
199 * @copydoc Dali::DevelWindow::Maximize()
201 virtual void Maximize(bool maximize) = 0;
204 * @copydoc Dali::DevelWindow::IsMaximized()
206 virtual bool IsMaximized() const = 0;
209 * @copydoc Dali::DevelWindow::SetMaximumSize()
211 virtual void SetMaximumSize(Dali::Window::WindowSize size) = 0;
214 * @copydoc Dali::DevelWindow::Minimize()
216 virtual void Minimize(bool minimize) = 0;
219 * @copydoc Dali::DevelWindow::IsMinimized()
221 virtual bool IsMinimized() const = 0;
224 * @copydoc Dali::DevelWindow::SetMimimumSize()
226 virtual void SetMimimumSize(Dali::Window::WindowSize size) = 0;
229 * @copydoc Dali::Window::SetAvailableOrientations()
231 virtual void SetAvailableAnlges(const std::vector<int>& angles) = 0;
234 * @copydoc Dali::Window::SetPreferredOrientation()
236 virtual void SetPreferredAngle(int angle) = 0;
239 * @copydoc Dali::Window::SetAcceptFocus()
241 virtual void SetAcceptFocus(bool accept) = 0;
244 * @copydoc Dali::Window::Show()
246 virtual void Show() = 0;
249 * @copydoc Dali::Window::Hide()
251 virtual void Hide() = 0;
254 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
256 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
259 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
261 virtual std::string GetSupportedAuxiliaryHint(unsigned int index) const = 0;
264 * @copydoc Dali::Window::AddAuxiliaryHint()
266 virtual unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) = 0;
269 * @copydoc Dali::Window::RemoveAuxiliaryHint()
271 virtual bool RemoveAuxiliaryHint(unsigned int id) = 0;
274 * @copydoc Dali::Window::SetAuxiliaryHintValue()
276 virtual bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) = 0;
279 * @copydoc Dali::Window::GetAuxiliaryHintValue()
281 virtual std::string GetAuxiliaryHintValue(unsigned int id) const = 0;
284 * @copydoc Dali::Window::GetAuxiliaryHintId()
286 virtual unsigned int GetAuxiliaryHintId(const std::string& hint) const = 0;
289 * @copydoc Dali::Window::SetInputRegion()
291 virtual void SetInputRegion(const Rect<int>& inputRegion) = 0;
294 * @copydoc Dali::Window::SetType()
296 virtual void SetType(Dali::WindowType type) = 0;
299 * @copydoc Dali::Window::GetType()
301 virtual Dali::WindowType GetType() const = 0;
304 * @copydoc Dali::Window::SetNotificationLevel()
306 virtual Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) = 0;
309 * @copydoc Dali::Window::GetNotificationLevel()
311 virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
314 * @copydoc Dali::Window::SetOpaqueState()
316 virtual void SetOpaqueState(bool opaque) = 0;
319 * @copydoc Dali::Window::SetScreenOffMode()
321 virtual Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
324 * @copydoc Dali::Window::GetScreenOffMode()
326 virtual WindowScreenOffMode GetScreenOffMode() const = 0;
329 * @copydoc Dali::Window::SetBrightness()
331 virtual Dali::WindowOperationResult SetBrightness(int brightness) = 0;
334 * @copydoc Dali::Window::GetBrightness()
336 virtual int GetBrightness() const = 0;
339 * @copydoc Dali::KeyGrab::GrabKey()
341 virtual bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) = 0;
344 * @copydoc Dali::KeyGrab::UngrabKey()
346 virtual bool UngrabKey(Dali::KEY key) = 0;
349 * @copydoc Dali::KeyGrab::GrabKeyList()
351 virtual bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) = 0;
354 * @copydoc Dali::KeyGrab::UngrabKeyList()
356 virtual bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) = 0;
360 * @param[out] dpiHorizontal set to the horizontal dpi
361 * @param[out] dpiVertical set to the vertical dpi
363 virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
366 * @brief Return the angle of the window's rotation.
367 * @return The window orientation
369 virtual int GetWindowRotationAngle() const = 0;
372 * @brief Get the angle of screen rotation for the window
373 * @return The screen orientation
375 virtual int GetScreenRotationAngle() = 0;
378 * @brief Set the screen rotation angle of the window
380 virtual void SetWindowRotationAngle(int degree) = 0;
383 * @brief Inform the window rotation is completed
385 virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
388 * @brief starts the window is moved by display server
390 virtual void RequestMoveToServer() = 0;
393 * @brief starts the window is resized by display server
395 * @param[in] direction It is direction of the started edge/side.
397 virtual void RequestResizeToServer(WindowResizeDirection direction) = 0;
400 * @brief Enables the floating mode of window.
402 * The floating mode is to support making partial size window easliy.
403 * It is useful to make popup style window
404 * and this window is always upper than the other normal window.
406 * A special display server(as a Tizen display server) supports this mode.
408 * @param[in] enable Enable floating mode or not.
410 virtual void EnableFloatingMode(bool enable) = 0;
413 * @brief Gets whether floating mode is enabled or not.
415 virtual bool IsFloatingModeEnabled() const = 0;
418 * @copydoc Dali::Window::SetTransparency()
420 virtual void SetTransparency(bool transparent) = 0;
423 * @copydoc Dali::Window::SetParent()
425 virtual void SetParent(WindowBase* parentWinBase, bool belowParent) = 0;
428 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
429 * @return The file descriptor that tells when it is rendered.
431 virtual int CreateFrameRenderedSyncFence() = 0;
434 * @brief Create a sync fence that can tell the frame is presented by the display server.
435 * @return The file descriptor that tells when it is presented.
437 virtual int CreateFramePresentedSyncFence() = 0;
440 * @copydoc Dali::Window::SetPositionSizeWithAngle()
442 virtual void SetPositionSizeWithAngle(PositionSize positionSize, int angle) = 0;
445 * @brief Initialize for Ime window.
446 * It should be called when the window is only used for Ime keyboard window.
448 virtual void InitializeIme() = 0;
451 * @brief Send the signal to display server for Ime Window is ready to render.
452 * It is used for compositing by display server.
454 virtual void ImeWindowReadyToRender() = 0;
457 * @brief Includes input region.
458 * @param[in] inputRegion The added region to accept input events.
460 virtual void IncludeInputRegion(const Rect<int>& inputRegion) = 0;
463 * @brief Excludes input region.
464 * @param[in] inputRegion The subtracted region to except input events.
466 virtual void ExcludeInputRegion(const Rect<int>& inputRegion) = 0;
471 * @brief This signal is emitted when the window becomes iconified or deiconified.
473 IconifySignalType& IconifyChangedSignal();
476 * @brief This signal is emitted when the window focus is changed.
478 FocusSignalType& FocusChangedSignal();
481 * @brief This signal is emitted when the output is transformed.
483 OutputSignalType& OutputTransformedSignal();
486 * @brief This signal is emitted when the window receives a delete request.
488 DeleteSignalType& DeleteRequestSignal();
491 * @brief This signal is emitted when the window is damaged.
493 DamageSignalType& WindowDamagedSignal();
496 * @brief This signal is emitted when a rotation event is recevied.
498 RotationSignalType& RotationSignal();
501 * @brief This signal is emitted when a touch event is received.
503 TouchEventSignalType& TouchEventSignal();
506 * @brief This signal is emitted when a mouse wheel is received.
508 WheelEventSignalType& WheelEventSignal();
511 * @brief This signal is emitted when a key event is received.
513 KeyEventSignalType& KeyEventSignal();
516 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
518 SelectionSignalType& SelectionDataSendSignal();
521 * @brief This signal is emitted when the source window sends us about the selected content.
523 SelectionSignalType& SelectionDataReceivedSignal();
526 * @brief This signal is emitted when the style is changed.
528 StyleSignalType& StyleChangedSignal();
531 * @brief This signal is emitted when window's transition animation is started or ended.
533 TransitionEffectEventSignalType& TransitionEffectEventSignal();
536 * @brief This signal is emitted when the keyboard repeat is changed.
538 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
541 * @brief This signal is emitted when the window redraw is requested.
543 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
546 * @brief This signal is emitted when the window's geometry data is changed by display server or client.
547 * It is based on configure noification event.
549 UpdatePositionSizeType& UpdatePositionSizeSignal();
552 * @brief This signal is emitted when the window is received the auxiliary message from display server.
554 AuxiliaryMessageSignalType& AuxiliaryMessageSignal();
557 * @brief This signal is emitted when a mouse in or out event is recevied.
559 MouseInOutEventSignalType& MouseInOutEventSignal();
562 * @brief This signal is emitted when window has been moved by then display server.
563 * To be moved the window by display server, RequestMoveToServer() should be called.
564 * After the moving job is finished, this function will be called.
566 MoveCompletedSignalType& MoveCompletedSignal();
569 * @brief This signal is emitted when window has been resized by then display server.
570 * To be resized the window by display server, RequestResizeToServer() should be called.
571 * After the resizing job is finished, this function will be called.
573 ResizeCompletedSignalType& ResizeCompletedSignal();
576 * @brief This signal is emitted when window insets are changed by appearing or disappearing indicator, virtual keyboard, or clipboard.
578 InsetsChangedSignalType& InsetsChangedSignal();
582 WindowBase(const WindowBase&) = delete;
585 WindowBase& operator=(const WindowBase& rhs) = delete;
588 IconifySignalType mIconifyChangedSignal;
589 FocusSignalType mFocusChangedSignal;
590 OutputSignalType mOutputTransformedSignal;
591 DeleteSignalType mDeleteRequestSignal;
592 DamageSignalType mWindowDamagedSignal;
593 RotationSignalType mRotationSignal;
594 TouchEventSignalType mTouchEventSignal;
595 WheelEventSignalType mWheelEventSignal;
596 KeyEventSignalType mKeyEventSignal;
597 SelectionSignalType mSelectionDataSendSignal;
598 SelectionSignalType mSelectionDataReceivedSignal;
599 StyleSignalType mStyleChangedSignal;
600 TransitionEffectEventSignalType mTransitionEffectEventSignal;
601 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
602 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
603 UpdatePositionSizeType mUpdatePositionSizeSignal;
604 AuxiliaryMessageSignalType mAuxiliaryMessageSignal;
605 MouseInOutEventSignalType mMouseInOutEventSignal;
606 MoveCompletedSignalType mMoveCompletedSignal;
607 ResizeCompletedSignalType mResizeCompletedSignal;
608 InsetsChangedSignalType mInsetsChangedSignal;
611 } // namespace Adaptor
613 } // namespace Internal
617 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H