mKeyboardRepeatSettingsChangedSignal(),
mAuxiliaryMessageSignal(),
mMovedSignal(),
+ mOrientationChangedSignal(),
mLastKeyEvent(),
mLastTouchEvent(),
mIsTransparent(false),
mIconified(false),
mOpaqueState(false),
mWindowRotationAcknowledgement(false),
- mFocused(false)
+ mFocused(false),
+ mIsWindowRotating(false)
{
}
bridge->Emit(accessible, Accessibility::WindowEvent::DESTROY);
}
- if(mAdaptor)
+ if(DALI_LIKELY(mAdaptor))
{
mAdaptor->RemoveWindow(this);
}
mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage);
mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
+ mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished);
AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
{
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();
}
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::SetSize(Dali::Window::WindowSize size)
{
- 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);
mWindowWidth = newRect.width;
mWindowHeight = newRect.height;
- SurfaceResized();
+ 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);
- mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+ SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.width, newRect.height);
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
Dali::Window handle(this);
mResizeSignal.Emit(handle, newSize);
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)
{
PositionSize oldRect = mSurface->GetPositionSize();
- int32_t newX = position.GetX();
- int32_t newY = position.GetY();
+ int32_t newX = position.GetX();
+ int32_t newY = position.GetY();
mWindowSurface->MoveResize(PositionSize(newX, newY, oldRect.width, oldRect.height));
if((oldRect.x != newX) || (oldRect.y != newY))
{
- Dali::Window handle(this);
+ 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());
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
{
- return mSurface->GetPositionSize();
+ PositionSize positionSize = mSurface->GetPositionSize();
+ positionSize.width = mWindowWidth;
+ positionSize.height = mWindowHeight;
+ return positionSize;
}
void Window::SetPositionSize(PositionSize positionSize)
{
- PositionSize oldRect = mSurface->GetPositionSize();
+ bool moved = false;
+ bool resize = false;
+
+ PositionSize oldRect = GetPositionSize();
Dali::Window handle(this);
- mWindowSurface->MoveResize(positionSize);
+ if((oldRect.x != positionSize.x) || (oldRect.y != positionSize.y))
+ {
+ moved = true;
+ }
- PositionSize newRect = mSurface->GetPositionSize();
+ if((oldRect.width != positionSize.width) || (oldRect.height != positionSize.height))
+ {
+ resize = true;
+ }
- if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
+ if(moved || resize)
{
- Dali::Window::WindowPosition position(newRect.x, newRect.y);
+ mWindowSurface->MoveResize(positionSize);
+ }
+
+ // 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 = newRect.width;
- mWindowHeight = newRect.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), current angle (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.width, newRect.height);
+ 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);
}
Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
}
+void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+ mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
+}
+
Dali::Layer Window::GetRootLayer() const
{
return mScene.GetRootLayer();
mVisibilityChangedSignal.Emit(handle, false);
Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle);
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowHidden();
+ if(DALI_LIKELY(mAdaptor))
+ {
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowHidden();
+ }
}
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
mVisibilityChangedSignal.Emit(handle, true);
Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle);
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowShown();
+ if(DALI_LIKELY(mAdaptor))
+ {
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowShown();
+ }
}
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
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));
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+ }
}
void Window::OnDeleteRequest()
void Window::OnWindowRedrawRequest()
{
- mAdaptor->RenderOnce();
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->RenderOnce();
+ }
}
void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
{
- bool resized = false;
- bool moved = false;
- Dali::Window handle(this);
- PositionSize oldRect = mSurface->GetPositionSize();
+ bool moved = false;
+ bool resize = false;
- mWindowSurface->UpdatePositionSize(positionSize);
+ Dali::Window handle(this);
+ PositionSize oldRect = GetPositionSize();
PositionSize newRect = positionSize;
if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
{
- resized = true;
+ resize = true;
}
- if(moved)
+ 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(resized)
+ if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
{
Uint16Pair newSize(newRect.width, newRect.height);
- mWindowWidth = newRect.width;
- mWindowHeight = newRect.height;
+ mWindowWidth = newRect.width;
+ mWindowHeight = newRect.height;
- SurfaceResized();
+ SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
- mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+ }
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Updated PositionSize by server :resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
+ 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);
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
+ }
}
mSurface->SetFullSwapNextFrame();
- Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+ if(DALI_LIKELY(mScene))
+ {
+ 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)
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, 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));
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+ }
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), OnRotation(): x[%d], y[%d], resize signal emit [%d x %d]\n", this, mNativeWindowId, newPositionSize.x, newPositionSize.y, 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));
+ if(DALI_LIKELY(mAdaptor))
+ {
+ 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()
bridge->RemoveTopLevelWindow(accessible);
}
-void Window::RecalculateTouchPosition(Integration::Point& point)
+Vector2 Window::RecalculatePosition(const Vector2& position)
{
- Vector2 position = point.GetScreenPosition();
Vector2 convertedPosition;
switch(mRotationAngle)
break;
}
}
-
- point.SetScreenPosition(convertedPosition);
+ return convertedPosition;
}
Dali::Window Window::Get(Dali::Actor actor)
WindowOrientation Window::GetCurrentOrientation() const
{
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle);
return ConvertToOrientation(mRotationAngle);
}
bool Window::IsWindowRotating() const
{
- return mWindowSurface->IsWindowRotating();
+ return mIsWindowRotating;
}
const Dali::KeyEvent& Window::GetLastKeyEvent() const