/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL HEADERS
#include <dali/devel-api/adaptor-framework/orientation.h>
+#include <dali/devel-api/events/key-event-devel.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/touch-integ.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/actors/layer.h>
#include <thread>
// INTERNAL HEADERS
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/window-system/common/event-handler.h>
} // unnamed namespace
-Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
{
Any surface;
- return Window::New(surface, positionSize, name, className, isTransparent);
+ return Window::New(surface, positionSize, name, className, type, isTransparent);
}
-Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
{
Window* window = new Window();
window->mIsTransparent = isTransparent;
- window->Initialize(surface, positionSize, name, className);
+ window->Initialize(surface, positionSize, name, className, type);
return window;
}
Window::Window()
: mWindowSurface(nullptr),
mWindowBase(),
- mIsTransparent(false),
- mIsFocusAcceptable(true),
- mIconified(false),
- mOpaqueState(false),
- mResizeEnabled(false),
- mType(WindowType::NORMAL),
mParentWindow(NULL),
mPreferredAngle(static_cast<int>(WindowOrientation::NO_ORIENTATION_PREFERENCE)),
mRotationAngle(0),
mWindowWidth(0),
mWindowHeight(0),
- mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT),
mNativeWindowId(-1),
+ mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT),
mDeleteRequestSignal(),
mFocusChangeSignal(),
mResizeSignal(),
mVisibilityChangedSignal(),
mTransitionEffectEventSignal(),
- mKeyboardRepeatSettingsChangedSignal()
+ mKeyboardRepeatSettingsChangedSignal(),
+ mAuxiliaryMessageSignal(),
+ mMovedSignal(),
+ mOrientationChangedSignal(),
+ mLastKeyEvent(),
+ mLastTouchEvent(),
+ mIsTransparent(false),
+ mIsFocusAcceptable(true),
+ mIconified(false),
+ mOpaqueState(false),
+ mWindowRotationAcknowledgement(false),
+ mFocused(false),
+ mIsWindowRotating(false)
{
}
Window::~Window()
{
- if(mAdaptor)
+ if(mScene)
{
- auto bridge = Accessibility::Bridge::GetCurrentBridge();
- auto accessible2 = mScene.GetRootLayer();
- auto accessible = Accessibility::Accessible::Get(accessible2);
+ auto bridge = Accessibility::Bridge::GetCurrentBridge();
+ auto rootLayer = mScene.GetRootLayer();
+ auto accessible = Accessibility::Accessible::Get(rootLayer);
bridge->RemoveTopLevelWindow(accessible);
+ // Related to multi-window case. This is called for default window and non-default window, but it is effective for non-default window.
+ bridge->Emit(accessible, Accessibility::WindowEvent::DESTROY);
+ }
+ if(mAdaptor)
+ {
mAdaptor->RemoveWindow(this);
}
}
}
-void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className)
+void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, WindowType type)
{
// Create a window render surface
auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
// Get a window base
mWindowBase = mWindowSurface->GetWindowBase();
+ // Set Window Type
+ mWindowBase->SetType(type);
+
+ // Initialize for Ime window type
+ if(type == WindowType::IME)
+ {
+ mWindowBase->InitializeIme();
+ mWindowSurface->InitializeImeSurface();
+ }
+
// Connect signals
mWindowBase->IconifyChangedSignal().Connect(this, &Window::OnIconifyChanged);
mWindowBase->FocusChangedSignal().Connect(this, &Window::OnFocusChanged);
mWindowBase->TransitionEffectEventSignal().Connect(this, &Window::OnTransitionEffectEvent);
mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect(this, &Window::OnKeyboardRepeatSettingsChanged);
mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest);
+ mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize);
+ mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage);
mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
+ mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished);
- if(!positionSize.IsEmpty())
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
+ AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
SetClass(name, className);
{
mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
}
+
+ if(positionSize.width <= 0 || positionSize.height <= 0)
+ {
+ mWindowWidth = screenWidth;
+ mWindowHeight = screenHeight;
+ }
+ else
+ {
+ mWindowWidth = positionSize.width;
+ mWindowHeight = positionSize.height;
+ }
+
// For Debugging
mNativeWindowId = mWindowBase->GetNativeWindowId();
}
mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
mEventHandler->AddObserver(*this);
- auto bridge = Accessibility::Bridge::GetCurrentBridge();
- auto v = mScene.GetRootLayer();
- auto accessible = Accessibility::Accessible::Get(v, true);
- bridge->AddTopLevelWindow(accessible);
+ // Add Window to bridge for ATSPI
+ auto bridge = Accessibility::Bridge::GetCurrentBridge();
+ if(bridge->IsUp())
+ {
+ auto rootLayer = mScene.GetRootLayer();
+ auto accessible = Accessibility::Accessible::Get(rootLayer);
+ bridge->AddTopLevelWindow(accessible);
+ }
+
+ bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled);
+ bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled);
// If you call the 'Show' before creating the adaptor, the application cannot know the app resource id.
// The show must be called after the adaptor is initialized.
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId);
}
+void Window::Maximize(bool maximize)
+{
+ mWindowBase->Maximize(maximize);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Maximize: %d\n", this, mNativeWindowId, maximize);
+}
+
+bool Window::IsMaximized() const
+{
+ return mWindowBase->IsMaximized();
+}
+
+void Window::SetMaximumSize(Dali::Window::WindowSize size)
+{
+ mWindowBase->SetMaximumSize(size);
+}
+
+void Window::Minimize(bool minimize)
+{
+ mWindowBase->Minimize(minimize);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Minimize: %d\n", this, mNativeWindowId, minimize);
+}
+
+bool Window::IsMinimized() const
+{
+ return mWindowBase->IsMinimized();
+}
+
+void Window::SetMimimumSize(Dali::Window::WindowSize size)
+{
+ mWindowBase->SetMimimumSize(size);
+}
+
uint32_t Window::GetLayerCount() const
{
return mScene.GetLayerCount();
return mScene.GetRenderTaskList();
}
+std::string Window::GetNativeResourceId() const
+{
+ return mWindowBase->GetNativeWindowResourceId();
+}
+
void Window::AddAvailableOrientation(WindowOrientation orientation)
{
if(IsOrientationAvailable(orientation) == false)
WindowOrientation Window::GetPreferredOrientation()
{
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
WindowOrientation preferredOrientation = ConvertToOrientation(mPreferredAngle);
return preferredOrientation;
}
+void Window::SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation)
+{
+ int angle = ConvertToAngle(orientation);
+ mWindowBase->SetPositionSizeWithAngle(positionSize, angle);
+}
+
+void Window::EmitAccessibilityHighlightSignal(bool highlight)
+{
+ Dali::Window handle(this);
+ mAccessibilityHighlightSignal.Emit(handle, highlight);
+}
+
void Window::SetAvailableAnlges(const std::vector<int>& angles)
{
if(angles.size() > 4)
if(!mIconified)
{
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowShown();
-
Dali::Window handle(this);
mVisibilityChangedSignal.Emit(handle, true);
+ Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle);
+
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowShown();
}
mSurface->SetFullSwapNextFrame();
if(!mIconified)
{
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowHidden();
-
Dali::Window handle(this);
mVisibilityChangedSignal.Emit(handle, false);
+ Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle);
+
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowHidden();
}
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
void Window::SetInputRegion(const Rect<int>& inputRegion)
{
- mWindowBase->SetInputRegion(inputRegion);
+ Rect<int> convertRegion = RecalculateRect(inputRegion);
- DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window (%p), WinId (%d), SetInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
+
+ mWindowBase->SetInputRegion(convertRegion);
}
void Window::SetType(WindowType type)
{
- if(type != mType)
- {
- mWindowBase->SetType(type);
-
- mType = type;
- }
+ mWindowBase->SetType(type);
}
WindowType Window::GetType() const
{
- return mType;
+ return mWindowBase->GetType();
}
WindowOperationResult Window::SetNotificationLevel(WindowNotificationLevel level)
{
- if(mType != WindowType::NOTIFICATION)
+ WindowType type = mWindowBase->GetType();
+ if(type != WindowType::NOTIFICATION)
{
- DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType);
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", type);
return WindowOperationResult::INVALID_OPERATION;
}
WindowNotificationLevel Window::GetNotificationLevel() const
{
- if(mType != WindowType::NOTIFICATION)
+ WindowType type = mWindowBase->GetType();
+ if(type != WindowType::NOTIFICATION)
{
- DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType);
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", type);
return WindowNotificationLevel::NONE;
}
void Window::SetSize(Dali::Window::WindowSize size)
{
- if(!mResizeEnabled)
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
-
- PositionSize oldRect = mSurface->GetPositionSize();
+ PositionSize oldRect = GetPositionSize();
- mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
-
- PositionSize newRect = mSurface->GetPositionSize();
+ PositionSize newRect;
+ newRect.width = size.GetWidth();
+ newRect.height = size.GetHeight();
// When surface size is updated, inform adaptor of resizing and emit ResizeSignal
if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
{
+ mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, newRect.width, newRect.height));
+
Uint16Pair newSize(newRect.width, newRect.height);
- SurfaceResized();
+ mWindowWidth = newRect.width;
+ mWindowHeight = newRect.height;
- mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), SetSize(): (%d, %d), [%d x %d]\n", this, mNativeWindowId, mRotationAngle, oldRect.x, oldRect.y, newRect.width, newRect.height);
+
+ SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
Dali::Window handle(this);
mResizeSignal.Emit(handle, newSize);
}
mSurface->SetFullSwapNextFrame();
+
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
}
Dali::Window::WindowSize Window::GetSize() const
{
- PositionSize positionSize = mSurface->GetPositionSize();
-
- return Dali::Window::WindowSize(positionSize.width, positionSize.height);
+ return Dali::Window::WindowSize(mWindowWidth, mWindowHeight);
}
void Window::SetPosition(Dali::Window::WindowPosition position)
{
- if(!mResizeEnabled)
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
-
PositionSize oldRect = mSurface->GetPositionSize();
+ int32_t newX = position.GetX();
+ int32_t newY = position.GetY();
+
+ mWindowSurface->MoveResize(PositionSize(newX, newY, oldRect.width, oldRect.height));
- mWindowSurface->MoveResize(PositionSize(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
+ if((oldRect.x != newX) || (oldRect.y != newY))
+ {
+ Dali::Window handle(this);
+ Dali::Window::WindowPosition newPosition(newX, newY);
+
+ DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY());
+ mMovedSignal.Emit(handle, newPosition);
+ }
mSurface->SetFullSwapNextFrame();
+
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
}
Dali::Window::WindowPosition Window::GetPosition() const
{
- PositionSize positionSize = mSurface->GetPositionSize();
-
+ PositionSize positionSize = GetPositionSize();
return Dali::Window::WindowPosition(positionSize.x, positionSize.y);
}
+PositionSize Window::GetPositionSize() const
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+ positionSize.width = mWindowWidth;
+ positionSize.height = mWindowHeight;
+ return positionSize;
+}
+
void Window::SetPositionSize(PositionSize positionSize)
{
- if(!mResizeEnabled)
+ bool moved = false;
+ bool resize = false;
+
+ PositionSize oldRect = GetPositionSize();
+ Dali::Window handle(this);
+
+ if((oldRect.x != positionSize.x) || (oldRect.y != positionSize.y))
{
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
+ moved = true;
}
- PositionSize oldRect = mSurface->GetPositionSize();
+ if((oldRect.width != positionSize.width) || (oldRect.height != positionSize.height))
+ {
+ resize = true;
+ }
- mWindowSurface->MoveResize(positionSize);
+ if(moved || resize)
+ {
+ mWindowSurface->MoveResize(positionSize);
+ }
- PositionSize newRect = mSurface->GetPositionSize();
+ // When window is moved, emit Moved Signal
+ if(moved)
+ {
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, positionSize.x, positionSize.y);
+ Dali::Window::WindowPosition position(positionSize.x, positionSize.y);
+ mMovedSignal.Emit(handle, position);
+ }
// When surface size is updated, inform adaptor of resizing and emit ResizeSignal
- if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
+ if(resize)
{
- Uint16Pair newSize(newRect.width, newRect.height);
+ Uint16Pair newSize(positionSize.width, positionSize.height);
+
+ mWindowWidth = positionSize.width;
+ mWindowHeight = positionSize.height;
- SurfaceResized();
+ SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
- Dali::Window handle(this);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resize signal emit [%d x %d]\n", this, mNativeWindowId, positionSize.width, positionSize.height);
+
mResizeSignal.Emit(handle, newSize);
mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
}
mSurface->SetFullSwapNextFrame();
-}
-PositionSize Window::GetPositionSize() const
-{
- return mSurface->GetPositionSize();
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
}
Dali::Layer Window::GetRootLayer() const
if(mVisible)
{
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowHidden();
-
Dali::Window handle(this);
mVisibilityChangedSignal.Emit(handle, false);
+ Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle);
+
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowHidden();
}
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
if(mVisible)
{
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowShown();
-
Dali::Window handle(this);
mVisibilityChangedSignal.Emit(handle, true);
+ Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle);
+
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowShown();
}
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
mSurface->SetFullSwapNextFrame();
- if(auto b = Dali::Accessibility::Bridge::GetCurrentBridge())
+ if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge())
{
if(focusIn)
{
- b->ApplicationShown();
+ bridge->WindowFocused(handle);
}
else
{
- b->ApplicationHidden();
+ bridge->WindowUnfocused(handle);
}
}
+ mFocused = focusIn;
}
void Window::OnOutputTransformed()
{
- PositionSize positionSize = mSurface->GetPositionSize();
+ PositionSize positionSize = GetPositionSize();
- int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
- SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height), orientation);
+ SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height), mRotationAngle, mWindowBase->GetScreenRotationAngle());
mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
mAdaptor->RenderOnce();
}
+void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
+{
+ bool moved = false;
+ bool resize = false;
+
+ Dali::Window handle(this);
+
+ PositionSize oldRect = GetPositionSize();
+ PositionSize newRect = positionSize;
+
+ if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
+ {
+ moved = true;
+ }
+
+ if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
+ {
+ resize = true;
+ }
+
+ if(moved || resize)
+ {
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), position or size is updated by server , (%d, %d) [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.x, newRect.y, newRect.width, newRect.height);
+ mWindowSurface->UpdatePositionSize(positionSize);
+ }
+
+ if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
+ {
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, newRect.x, newRect.y);
+ Dali::Window::WindowPosition position(newRect.x, newRect.y);
+ mMovedSignal.Emit(handle, position);
+ }
+
+ // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
+ if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
+ {
+ Uint16Pair newSize(newRect.width, newRect.height);
+
+ mWindowWidth = newRect.width;
+ mWindowHeight = newRect.height;
+
+ SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
+
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resized signal emit [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
+ mResizeSignal.Emit(handle, newSize);
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
+ }
+
+ mSurface->SetFullSwapNextFrame();
+
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+}
+
void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
{
+ mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
FeedTouchPoint(point, timeStamp);
}
void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
{
+ mLastKeyEvent = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast<Dali::KeyEvent::State>(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass);
FeedKeyEvent(keyEvent);
}
void Window::OnRotation(const RotationEvent& rotation)
{
+ PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height);
+
mRotationAngle = rotation.angle;
mWindowWidth = rotation.width;
mWindowHeight = rotation.height;
+ mIsWindowRotating = true;
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), angle(%d), Window Rotation (%d , %d) [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newPositionSize.x, newPositionSize.y, mWindowWidth, mWindowHeight);
+
// Notify that the orientation is changed
mOrientation->OnOrientationChange(rotation);
- mWindowSurface->RequestRotation(mRotationAngle, mWindowWidth, mWindowHeight);
+ mWindowSurface->RequestRotation(mRotationAngle, newPositionSize);
- int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
- SurfaceRotated(mWindowWidth, mWindowHeight, orientation);
+ SurfaceRotated(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight), mRotationAngle, mWindowBase->GetScreenRotationAngle());
mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight);
- // Emit signal
Dali::Window handle(this);
mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
+ mOrientationChangedSignal.Emit(handle, GetCurrentOrientation());
mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
}
+void Window::OnRotationFinished()
+{
+ mIsWindowRotating = false;
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window rotation is finised\n", this, mNativeWindowId);
+}
+
void Window::OnPause()
{
if(mEventHandler)
mSurface->SetFullSwapNextFrame();
}
+void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options)
+{
+ mAuxiliaryMessageSignal.Emit(key, value, options);
+}
+
+void Window::OnAccessibilityEnabled()
+{
+ auto bridge = Accessibility::Bridge::GetCurrentBridge();
+ auto rootLayer = mScene.GetRootLayer();
+ auto accessible = Accessibility::Accessible::Get(rootLayer);
+ bridge->AddTopLevelWindow(accessible);
+
+ if(!mVisible || mIconified)
+ {
+ return;
+ }
+
+ Dali::Window handle(this);
+ bridge->WindowShown(handle);
+
+ if(mFocused)
+ {
+ bridge->WindowFocused(handle);
+ }
+}
+
+void Window::OnAccessibilityDisabled()
+{
+ auto bridge = Accessibility::Bridge::GetCurrentBridge();
+ auto rootLayer = mScene.GetRootLayer();
+ auto accessible = Accessibility::Accessible::Get(rootLayer);
+ bridge->RemoveTopLevelWindow(accessible);
+}
+
void Window::RecalculateTouchPosition(Integration::Point& point)
{
Vector2 position = point.GetScreenPosition();
{
Dali::DevelWindow::Unparent(parent);
}
- mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase);
+ mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, false);
+ }
+}
+
+void Window::SetParent(Dali::Window& parent, bool belowParent)
+{
+ if(DALI_UNLIKELY(parent))
+ {
+ mParentWindow = parent;
+ Dali::Window self = Dali::Window(this);
+ // check circular parent window setting
+ if(Dali::DevelWindow::GetParent(parent) == self)
+ {
+ Dali::DevelWindow::Unparent(parent);
+ }
+ mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, belowParent);
}
}
void Window::Unparent()
{
- mWindowBase->SetParent(nullptr);
+ mWindowBase->SetParent(nullptr, false);
mParentWindow.Reset();
}
WindowOrientation Window::GetCurrentOrientation() const
{
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle);
return ConvertToOrientation(mRotationAngle);
}
return mWindowBase->GetNativeWindowId();
}
+void Window::RequestMoveToServer()
+{
+ mWindowBase->RequestMoveToServer();
+}
+
+void Window::RequestResizeToServer(WindowResizeDirection direction)
+{
+ mWindowBase->RequestResizeToServer(direction);
+}
+
+void Window::EnableFloatingMode(bool enable)
+{
+ mWindowBase->EnableFloatingMode(enable);
+}
+
+Rect<int> Window::RecalculateRect(const Rect<int>& rect)
+{
+ Rect<int> newRect;
+ int screenWidth, screenHeight;
+
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
+
+ if(mRotationAngle == 90)
+ {
+ newRect.x = rect.y;
+ newRect.y = screenHeight - (rect.x + rect.width);
+ newRect.width = rect.height;
+ newRect.height = rect.width;
+ }
+ else if(mRotationAngle == 180)
+ {
+ newRect.x = screenWidth - (rect.x + rect.width);
+ newRect.y = screenHeight - (rect.y + rect.height);
+ newRect.width = rect.width;
+ newRect.height = rect.height;
+ }
+ else if(mRotationAngle == 270)
+ {
+ newRect.x = screenWidth - (rect.y + rect.height);
+ newRect.y = rect.x;
+ newRect.width = rect.height;
+ newRect.height = rect.width;
+ }
+ else
+ {
+ newRect.x = rect.x;
+ newRect.y = rect.y;
+ newRect.width = rect.width;
+ newRect.height = rect.height;
+ }
+ return newRect;
+}
+
+void Window::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+ Rect<int> convertRegion = RecalculateRect(inputRegion);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IncludeInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
+ mWindowBase->IncludeInputRegion(convertRegion);
+}
+
+void Window::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+ Rect<int> convertRegion = RecalculateRect(inputRegion);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), ExcludeInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
+ mWindowBase->ExcludeInputRegion(convertRegion);
+}
+
+void Window::SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
+{
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), needAcknowledgement(%d) Set needs Rotation Completed Acknowledgement\n", this, mNativeWindowId, needAcknowledgement);
+ mWindowSurface->SetNeedsRotationCompletedAcknowledgement(needAcknowledgement);
+ mWindowRotationAcknowledgement = needAcknowledgement;
+}
+
+void Window::SendRotationCompletedAcknowledgement()
+{
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SendRotationCompletedAcknowledgement(): orientation: %d, mWindowRotationAcknowledgement: %d\n", this, mNativeWindowId, mRotationAngle, mWindowRotationAcknowledgement);
+ if(mWindowRotationAcknowledgement)
+ {
+ SetRotationCompletedAcknowledgement();
+ }
+}
+
+bool Window::IsWindowRotating() const
+{
+ return mIsWindowRotating;
+}
+
+const Dali::KeyEvent& Window::GetLastKeyEvent() const
+{
+ return mLastKeyEvent;
+}
+
+const Dali::TouchEvent& Window::GetLastTouchEvent() const
+{
+ return mLastTouchEvent;
+}
+
} // namespace Adaptor
} // namespace Internal