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/device-info-event.h>
31 #include <dali/devel-api/adaptor-framework/mouse-in-out-event.h>
32 #include <dali/devel-api/adaptor-framework/window-devel.h>
33 #include <dali/internal/graphics/gles/egl-implementation.h>
34 #include <dali/internal/window-system/common/damage-observer.h>
35 #include <dali/internal/window-system/common/rotation-event.h>
36 #include <dali/public-api/adaptor-framework/key-grab.h>
37 #include <dali/public-api/adaptor-framework/style-change.h>
38 #include <dali/public-api/adaptor-framework/window-enumerations.h>
39 #include <dali/public-api/adaptor-framework/window.h>
48 * WindowBase interface
54 * @brief Struct used to retrieve accessibility information
56 struct AccessibilityInfo
68 typedef Signal<void(bool)> IconifySignalType;
69 typedef Signal<void(bool)> MaximizeSignalType;
70 typedef Signal<void(bool)> FocusSignalType;
71 typedef Signal<void()> OutputSignalType;
72 typedef Signal<void()> DeleteSignalType;
73 typedef Signal<void(const DamageArea&)> DamageSignalType;
74 typedef Signal<void(const RotationEvent&)> RotationSignalType;
75 typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
76 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType;
77 typedef Signal<void()> WindowRedrawRequestSignalType;
78 typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
79 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;
80 typedef Signal<void(const Dali::DevelWindow::MouseInOutEvent&)> MouseInOutEventSignalType;
81 typedef Signal<void(Dali::Int32Pair&)> MoveCompletedSignalType;
82 typedef Signal<void(Dali::Uint16Pair&)> ResizeCompletedSignalType;
83 typedef Signal<void(const Dali::DevelWindow::DeviceInfoEvent&)> DeviceInfoEventSignalType;
86 typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
87 typedef Signal<void(Integration::WheelEvent&)> WheelEventSignalType;
88 typedef Signal<void(Integration::KeyEvent&)> KeyEventSignalType;
91 typedef Signal<void(void*)> SelectionSignalType;
94 typedef Signal<void(StyleChange::Type)> StyleSignalType;
97 * @brief Default constructor
104 virtual ~WindowBase();
108 * @brief Get the native window handle
109 * @return The native window handle
111 virtual Any GetNativeWindow() = 0;
114 * @brief Get the native window id
115 * @return The native window id
117 virtual int GetNativeWindowId() = 0;
120 * @brief Get the native window resource id assinged by window manager
121 * @return The native window resource id
123 virtual std::string GetNativeWindowResourceId() = 0;
126 * @brief Create the egl window
128 virtual EGLNativeWindowType CreateEglWindow(int width, int height) = 0;
131 * @brief Destroy the egl window
133 virtual void DestroyEglWindow() = 0;
136 * @brief Set the egl window rotation
138 virtual void SetEglWindowRotation(int angle) = 0;
141 * @brief Set the egl window buffer transform
143 virtual void SetEglWindowBufferTransform(int angle) = 0;
146 * @brief Set the egl window transform
148 virtual void SetEglWindowTransform(int angle) = 0;
151 * @brief Resize the egl window
153 virtual void ResizeEglWindow(Dali::PositionSize positionSize) = 0;
156 * @brief Returns whether the egl window support rotation or not
158 virtual bool IsEglWindowRotationSupported() = 0;
161 * @brief Move the window
163 virtual void Move(Dali::PositionSize positionSize) = 0;
166 * @brief Resize the window
168 virtual void Resize(Dali::PositionSize positionSize) = 0;
171 * @brief Move and resize the window
173 virtual void MoveResize(Dali::PositionSize positionSize) = 0;
176 * @copydoc Dali::Window::SetLayout()
178 virtual void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) = 0;
181 * @copydoc Dali::Window::SetClass()
183 virtual void SetClass(const std::string& name, const std::string& className) = 0;
186 * @copydoc Dali::Window::Raise()
188 virtual void Raise() = 0;
191 * @copydoc Dali::Window::Lower()
193 virtual void Lower() = 0;
196 * @copydoc Dali::Window::Activate()
198 virtual void Activate() = 0;
201 * @copydoc Dali::DevelWindow::Maximize()
203 virtual void Maximize(bool maximize) = 0;
206 * @copydoc Dali::DevelWindow::IsMaximized()
208 virtual bool IsMaximized() const = 0;
211 * @copydoc Dali::DevelWindow::SetMaximumSize()
213 virtual void SetMaximumSize(Dali::Window::WindowSize size) = 0;
216 * @copydoc Dali::DevelWindow::Minimize()
218 virtual void Minimize(bool minimize) = 0;
221 * @copydoc Dali::DevelWindow::IsMinimized()
223 virtual bool IsMinimized() const = 0;
226 * @copydoc Dali::DevelWindow::SetMimimumSize()
228 virtual void SetMimimumSize(Dali::Window::WindowSize size) = 0;
231 * @copydoc Dali::Window::SetAvailableOrientations()
233 virtual void SetAvailableAnlges(const std::vector<int>& angles) = 0;
236 * @copydoc Dali::Window::SetPreferredOrientation()
238 virtual void SetPreferredAngle(int angle) = 0;
241 * @copydoc Dali::Window::SetAcceptFocus()
243 virtual void SetAcceptFocus(bool accept) = 0;
246 * @copydoc Dali::Window::Show()
248 virtual void Show() = 0;
251 * @copydoc Dali::Window::Hide()
253 virtual void Hide() = 0;
256 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
258 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
261 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
263 virtual std::string GetSupportedAuxiliaryHint(unsigned int index) const = 0;
266 * @copydoc Dali::Window::AddAuxiliaryHint()
268 virtual unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) = 0;
271 * @copydoc Dali::Window::RemoveAuxiliaryHint()
273 virtual bool RemoveAuxiliaryHint(unsigned int id) = 0;
276 * @copydoc Dali::Window::SetAuxiliaryHintValue()
278 virtual bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) = 0;
281 * @copydoc Dali::Window::GetAuxiliaryHintValue()
283 virtual std::string GetAuxiliaryHintValue(unsigned int id) const = 0;
286 * @copydoc Dali::Window::GetAuxiliaryHintId()
288 virtual unsigned int GetAuxiliaryHintId(const std::string& hint) const = 0;
291 * @copydoc Dali::Window::SetInputRegion()
293 virtual void SetInputRegion(const Rect<int>& inputRegion) = 0;
296 * @copydoc Dali::Window::SetType()
298 virtual void SetType(Dali::WindowType type) = 0;
301 * @copydoc Dali::Window::GetType()
303 virtual Dali::WindowType GetType() const = 0;
306 * @copydoc Dali::Window::SetNotificationLevel()
308 virtual Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) = 0;
311 * @copydoc Dali::Window::GetNotificationLevel()
313 virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
316 * @copydoc Dali::Window::SetOpaqueState()
318 virtual void SetOpaqueState(bool opaque) = 0;
321 * @copydoc Dali::Window::SetScreenOffMode()
323 virtual Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
326 * @copydoc Dali::Window::GetScreenOffMode()
328 virtual WindowScreenOffMode GetScreenOffMode() const = 0;
331 * @copydoc Dali::Window::SetBrightness()
333 virtual Dali::WindowOperationResult SetBrightness(int brightness) = 0;
336 * @copydoc Dali::Window::GetBrightness()
338 virtual int GetBrightness() const = 0;
341 * @copydoc Dali::KeyGrab::GrabKey()
343 virtual bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) = 0;
346 * @copydoc Dali::KeyGrab::UngrabKey()
348 virtual bool UngrabKey(Dali::KEY key) = 0;
351 * @copydoc Dali::KeyGrab::GrabKeyList()
353 virtual bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) = 0;
356 * @copydoc Dali::KeyGrab::UngrabKeyList()
358 virtual bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) = 0;
362 * @param[out] dpiHorizontal set to the horizontal dpi
363 * @param[out] dpiVertical set to the vertical dpi
365 virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
368 * @brief Return the angle of the window's rotation.
369 * @return The window orientation
371 virtual int GetWindowRotationAngle() const = 0;
374 * @brief Get the angle of screen rotation for the window
375 * @return The screen orientation
377 virtual int GetScreenRotationAngle() = 0;
380 * @brief Set the screen rotation angle of the window
382 virtual void SetWindowRotationAngle(int degree) = 0;
385 * @brief Inform the window rotation is completed
387 virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
390 * @brief starts the window is moved by display server
392 virtual void RequestMoveToServer() = 0;
395 * @brief starts the window is resized by display server
397 * @param[in] direction It is direction of the started edge/side.
399 virtual void RequestResizeToServer(WindowResizeDirection direction) = 0;
402 * @brief Enables the floating mode of window.
404 * The floating mode is to support making partial size window easliy.
405 * It is useful to make popup style window
406 * and this window is always upper than the other normal window.
408 * A special display server(as a Tizen display server) supports this mode.
410 * @param[in] enable Enable floating mode or not.
412 virtual void EnableFloatingMode(bool enable) = 0;
415 * @brief Gets whether floating mode is enabled or not.
417 virtual bool IsFloatingModeEnabled() const = 0;
420 * @copydoc Dali::Window::SetTransparency()
422 virtual void SetTransparency(bool transparent) = 0;
425 * @copydoc Dali::Window::SetParent()
427 virtual void SetParent(WindowBase* parentWinBase, bool belowParent) = 0;
430 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
431 * @return The file descriptor that tells when it is rendered.
433 virtual int CreateFrameRenderedSyncFence() = 0;
436 * @brief Create a sync fence that can tell the frame is presented by the display server.
437 * @return The file descriptor that tells when it is presented.
439 virtual int CreateFramePresentedSyncFence() = 0;
442 * @copydoc Dali::Window::SetPositionSizeWithAngle()
444 virtual void SetPositionSizeWithAngle(PositionSize positionSize, int angle) = 0;
447 * @brief Initialize for Ime window.
448 * It should be called when the window is only used for Ime keyboard window.
450 virtual void InitializeIme() = 0;
453 * @brief Send the signal to display server for Ime Window is ready to render.
454 * It is used for compositing by display server.
456 virtual void ImeWindowReadyToRender() = 0;
459 * @brief Includes input region.
460 * @param[in] inputRegion The added region to accept input events.
462 virtual void IncludeInputRegion(const Rect<int>& inputRegion) = 0;
465 * @brief Excludes input region.
466 * @param[in] inputRegion The subtracted region to except input events.
468 virtual void ExcludeInputRegion(const Rect<int>& inputRegion) = 0;
473 * @brief This signal is emitted when the window becomes iconified or deiconified.
475 IconifySignalType& IconifyChangedSignal();
478 * @brief This signal is emitted when the window becomes maximized or unmaximized.
480 MaximizeSignalType& MaximizeChangedSignal();
483 * @brief This signal is emitted when the window focus is changed.
485 FocusSignalType& FocusChangedSignal();
488 * @brief This signal is emitted when the output is transformed.
490 OutputSignalType& OutputTransformedSignal();
493 * @brief This signal is emitted when the window receives a delete request.
495 DeleteSignalType& DeleteRequestSignal();
498 * @brief This signal is emitted when the window is damaged.
500 DamageSignalType& WindowDamagedSignal();
503 * @brief This signal is emitted when a rotation event is recevied.
505 RotationSignalType& RotationSignal();
508 * @brief This signal is emitted when a touch event is received.
510 TouchEventSignalType& TouchEventSignal();
513 * @brief This signal is emitted when a mouse wheel is received.
515 WheelEventSignalType& WheelEventSignal();
518 * @brief This signal is emitted when a key event is received.
520 KeyEventSignalType& KeyEventSignal();
523 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
525 SelectionSignalType& SelectionDataSendSignal();
528 * @brief This signal is emitted when the source window sends us about the selected content.
530 SelectionSignalType& SelectionDataReceivedSignal();
533 * @brief This signal is emitted when the style is changed.
535 StyleSignalType& StyleChangedSignal();
538 * @brief This signal is emitted when window's transition animation is started or ended.
540 TransitionEffectEventSignalType& TransitionEffectEventSignal();
543 * @brief This signal is emitted when the keyboard repeat is changed.
545 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
548 * @brief This signal is emitted when the window redraw is requested.
550 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
553 * @brief This signal is emitted when the window's geometry data is changed by display server or client.
554 * It is based on configure noification event.
556 UpdatePositionSizeType& UpdatePositionSizeSignal();
559 * @brief This signal is emitted when the window is received the auxiliary message from display server.
561 AuxiliaryMessageSignalType& AuxiliaryMessageSignal();
564 * @brief This signal is emitted when a mouse in or out event is recevied.
566 MouseInOutEventSignalType& MouseInOutEventSignal();
569 * @brief This signal is emitted when window has been moved by then display server.
570 * To be moved the window by display server, RequestMoveToServer() should be called.
571 * After the moving job is finished, this function will be called.
573 MoveCompletedSignalType& MoveCompletedSignal();
576 * @brief This signal is emitted when window has been resized by then display server.
577 * To be resized the window by display server, RequestResizeToServer() should be called.
578 * After the resizing job is finished, this function will be called.
580 ResizeCompletedSignalType& ResizeCompletedSignal();
583 * @brief This signal is emitted when a device info event is recevied.
585 DeviceInfoEventSignalType& DeviceInfoEventSignal();
589 WindowBase(const WindowBase&) = delete;
592 WindowBase& operator=(const WindowBase& rhs) = delete;
595 IconifySignalType mIconifyChangedSignal;
596 MaximizeSignalType mMaximizeChangedSignal;
597 FocusSignalType mFocusChangedSignal;
598 OutputSignalType mOutputTransformedSignal;
599 DeleteSignalType mDeleteRequestSignal;
600 DamageSignalType mWindowDamagedSignal;
601 RotationSignalType mRotationSignal;
602 TouchEventSignalType mTouchEventSignal;
603 WheelEventSignalType mWheelEventSignal;
604 KeyEventSignalType mKeyEventSignal;
605 SelectionSignalType mSelectionDataSendSignal;
606 SelectionSignalType mSelectionDataReceivedSignal;
607 StyleSignalType mStyleChangedSignal;
608 TransitionEffectEventSignalType mTransitionEffectEventSignal;
609 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
610 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
611 UpdatePositionSizeType mUpdatePositionSizeSignal;
612 AuxiliaryMessageSignalType mAuxiliaryMessageSignal;
613 MouseInOutEventSignalType mMouseInOutEventSignal;
614 MoveCompletedSignalType mMoveCompletedSignal;
615 ResizeCompletedSignalType mResizeCompletedSignal;
616 DeviceInfoEventSignalType mDeviceInfoEventSignal;
619 } // namespace Adaptor
621 } // namespace Internal
625 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H