#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 <dali/public-api/adaptor-framework/window-enumerations.h>
-#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/rendering/frame-buffer.h>
#include <thread>
#endif
} // unnamed namespace
-Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
+Window* Window::New(const std::string& name, const std::string& className, const WindowData& windowData)
{
Any surface;
- return Window::New(surface, positionSize, name, className, type, isTransparent);
+ return Window::New(surface, name, className, windowData);
}
-Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
+Window* Window::New(Any surface, const std::string& name, const std::string& className, const WindowData& windowData)
{
- Window* window = new Window();
- window->mIsTransparent = isTransparent;
- window->Initialize(surface, positionSize, name, className, type);
+ Window* window = new Window();
+ window->mIsTransparent = windowData.GetTransparency();
+ window->mIsFrontBufferRendering = windowData.GetFrontBufferRendering();
+ window->Initialize(surface, windowData.GetPositionSize(), name, className, windowData.GetWindowType());
return window;
}
mMovedSignal(),
mOrientationChangedSignal(),
mMouseInOutEventSignal(),
+ mMouseRelativeEventSignal(),
mMoveCompletedSignal(),
mResizeCompletedSignal(),
+ mInsetsChangedSignal(),
+ mPointerConstraintsSignal(),
mLastKeyEvent(),
- mLastTouchEvent(),
mIsTransparent(false),
mIsFocusAcceptable(true),
mIconified(false),
mOpaqueState(false),
mWindowRotationAcknowledgement(false),
mFocused(false),
- mIsWindowRotating(false)
+ mIsWindowRotating(false),
+ mIsEnabledUserGeometry(false),
+ mIsEmittedWindowCreatedEvent(false),
+ mIsFrontBufferRendering(false)
{
}
mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize);
mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage);
mWindowBase->MouseInOutEventSignal().Connect(this, &Window::OnMouseInOutEvent);
+ mWindowBase->MouseRelativeEventSignal().Connect(this, &Window::OnMouseRelativeEvent);
mWindowBase->MoveCompletedSignal().Connect(this, &Window::OnMoveCompleted);
mWindowBase->ResizeCompletedSignal().Connect(this, &Window::OnResizeCompleted);
+ mWindowBase->PointerConstraintsSignal().Connect(this, &Window::OnPointerConstraints);
mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished);
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
+ mWindowBase->InsetsChangedSignal().Connect(this, &Window::OnInsetsChanged);
SetClass(name, className);
mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
}
- if(positionSize.width <= 0 || positionSize.height <= 0)
+ mWindowWidth = positionSize.width;
+ mWindowHeight = positionSize.height;
+
+ bool isSetWithScreenSize = false;
+ if(mWindowWidth <= 0 || mWindowHeight <= 0)
{
- mWindowWidth = screenWidth;
- mWindowHeight = screenHeight;
+ mWindowWidth = screenWidth;
+ mWindowHeight = screenHeight;
+ isSetWithScreenSize = true;
+ DALI_LOG_RELEASE_INFO("Window size is set with screen size(%d x %d)\n", mWindowWidth, mWindowHeight);
}
- else
+
+ if(isSetWithScreenSize == false || positionSize.x != 0 || positionSize.y != 0)
{
- mWindowWidth = positionSize.width;
- mWindowHeight = positionSize.height;
+ SetUserGeometryPolicy();
}
// For Debugging
mNativeWindowId = mWindowBase->GetNativeWindowId();
+
+ if(mIsFrontBufferRendering)
+ {
+ SetFrontBufferRendering(mIsFrontBufferRendering);
+ }
}
void Window::SetRenderNotification(TriggerEventInterface* renderNotification)
mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
mEventHandler->AddObserver(*this);
+ if(mWindowBase->GetType() == WindowType::IME)
+ {
+ mWindowBase->InitializeIme();
+ mWindowSurface->InitializeImeSurface();
+ }
+
// Add Window to bridge for ATSPI
auto bridge = Accessibility::Bridge::GetCurrentBridge();
+
+ bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled);
+ bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled);
+
if(bridge->IsUp())
{
- auto rootLayer = mScene.GetRootLayer();
- auto accessible = Accessibility::Accessible::Get(rootLayer);
- bridge->AddTopLevelWindow(accessible);
-
- // Emit Window create event
- // Create and Destory signal only emit in multi-window environment, so it does not emit on default layer.
- bridge->Emit(accessible, Accessibility::WindowEvent::CREATE);
+ OnAccessibilityEnabled();
+ }
+ else
+ {
+ OnAccessibilityDisabled();
}
- bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled);
- bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled);
+ if(mScene)
+ {
+ bool isGeometry = Dali::Internal::Adaptor::WindowSystem::IsGeometryHittestEnabled();
+ mScene.SetGeometryHittestEnabled(isGeometry);
+
+ mScene.SetNativeId(GetNativeId());
+ }
// 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.
return mScene.GetLayer(depth);
}
-Dali::RenderTaskList Window::GetRenderTaskList() const
+void Window::KeepRendering(float durationSeconds)
+{
+ mScene.KeepRendering(durationSeconds);
+}
+
+void Window::SetPartialUpdateEnabled(bool enabled)
+{
+ mScene.SetPartialUpdateEnabled(enabled);
+}
+
+bool Window::IsPartialUpdateEnabled() const
{
- return mScene.GetRenderTaskList();
+ return mScene.IsPartialUpdateEnabled();
}
std::string Window::GetNativeResourceId() const
newRect.width = size.GetWidth();
newRect.height = size.GetHeight();
+ SetUserGeometryPolicy();
+
// When surface size is updated, inform adaptor of resizing and emit ResizeSignal
if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
{
mResizeSignal.Emit(handle, newSize);
mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
+
+ if(Dali::Accessibility::IsUp())
+ {
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
+ }
}
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
int32_t newX = position.GetX();
int32_t newY = position.GetY();
+ SetUserGeometryPolicy();
+
mWindowSurface->Move(PositionSize(newX, newY, oldRect.width, oldRect.height));
if((oldRect.x != newX) || (oldRect.y != newY))
DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY());
mMovedSignal.Emit(handle, newPosition);
+
+ if(Dali::Accessibility::IsUp())
+ {
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
+ }
}
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 oldRect = GetPositionSize();
Dali::Window handle(this);
+ SetUserGeometryPolicy();
+
if((oldRect.x != positionSize.x) || (oldRect.y != positionSize.y))
{
moved = true;
mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
}
- mSurface->SetFullSwapNextFrame();
+ if((moved || resize) && Dali::Accessibility::IsUp())
+ {
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+ }
- Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+ mSurface->SetFullSwapNextFrame();
}
void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
{
+ SetUserGeometryPolicy();
mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
}
mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
}
- mSurface->SetFullSwapNextFrame();
+ if((moved || resize) && Dali::Accessibility::IsUp())
+ {
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+ }
- Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+ mSurface->SetFullSwapNextFrame();
}
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);
+ DevelKeyEvent::SetWindowId(mLastKeyEvent, keyEvent.windowId);
FeedKeyEvent(keyEvent);
}
mMouseInOutEventSignal.Emit(handle, mouseInOutEvent);
}
+void Window::OnMouseRelativeEvent(const Dali::DevelWindow::MouseRelativeEvent& mouseRelativeEvent)
+{
+ Dali::Window handle(this);
+
+ mMouseRelativeEventSignal.Emit(handle, mouseRelativeEvent);
+}
+
+void Window::OnPointerConstraints(const Dali::Int32Pair& position, bool locked, bool confined)
+{
+ Dali::Window handle(this);
+
+ Vector2 newPosition = RecalculatePosition(Vector2(position.GetX(), position.GetY()));
+ Dali::DevelWindow::PointerConstraintsEvent pointerConstraintsEvent(static_cast<int32_t>(newPosition.x), static_cast<int32_t>(newPosition.y), locked, confined);
+
+ mPointerConstraintsSignal.Emit(handle, pointerConstraintsEvent);
+}
+
void Window::OnRotation(const RotationEvent& rotation)
{
PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height);
mAuxiliaryMessageSignal.Emit(key, value, options);
}
+void Window::OnInsetsChanged(WindowInsetsPartType partType, WindowInsetsPartState partState, const Extents& insets)
+{
+ mInsetsChangedSignal.Emit(partType, partState, insets);
+}
+
void Window::OnAccessibilityEnabled()
{
auto bridge = Accessibility::Bridge::GetCurrentBridge();
auto rootLayer = mScene.GetRootLayer();
auto accessible = Accessibility::Accessible::Get(rootLayer);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is enabled\n", this, mNativeWindowId);
+
bridge->AddTopLevelWindow(accessible);
+ InterceptKeyEventSignal().Connect(this, &Window::OnAccessibilityInterceptKeyEvent);
+
+ Dali::Window handle(this);
+ if(!mIsEmittedWindowCreatedEvent)
+ {
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Created Event\n", this, mNativeWindowId);
+ bridge->WindowCreated(handle);
+ mIsEmittedWindowCreatedEvent = true;
+ }
if(!mVisible || mIconified)
{
return;
}
- Dali::Window handle(this);
bridge->WindowShown(handle);
if(mFocused)
{
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Focused Event\n", this, mNativeWindowId);
bridge->WindowFocused(handle);
}
}
auto bridge = Accessibility::Bridge::GetCurrentBridge();
auto rootLayer = mScene.GetRootLayer();
auto accessible = Accessibility::Accessible::Get(rootLayer);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is disabled\n", this, mNativeWindowId);
+
+ InterceptKeyEventSignal().Disconnect(this, &Window::OnAccessibilityInterceptKeyEvent);
bridge->RemoveTopLevelWindow(accessible);
}
+bool Window::OnAccessibilityInterceptKeyEvent(const Dali::KeyEvent& keyEvent)
+{
+ auto bridge = Accessibility::Bridge::GetCurrentBridge();
+
+ if(!bridge->IsUp() || keyEvent.IsNoInterceptModifier())
+ {
+ DALI_LOG_ERROR("This KeyEvent should not have been intercepted!");
+
+ return false;
+ }
+
+ auto callback = [handle = Dali::Window(this)](Dali::KeyEvent keyEvent, bool consumed) {
+ if(!consumed)
+ {
+ Dali::DevelKeyEvent::SetNoInterceptModifier(keyEvent, true);
+ Dali::DevelWindow::FeedKeyEvent(handle, keyEvent);
+ }
+ };
+
+ bool emitted = bridge->EmitKeyEvent(keyEvent, callback);
+
+ // If emitted, consume the event in order not to have to wait for the D-Bus call
+ // to finish. If the event turns out not to be consumed by the remote client,
+ // then it is fed back to the window from the D-Bus callback.
+ return emitted;
+}
+
void Window::OnMoveCompleted(Dali::Window::WindowPosition& position)
{
Dali::Window handle(this);
void Window::RequestMoveToServer()
{
+ SetUserGeometryPolicy();
mWindowBase->RequestMoveToServer();
}
void Window::RequestResizeToServer(WindowResizeDirection direction)
{
+ SetUserGeometryPolicy();
mWindowBase->RequestResizeToServer(direction);
}
mWindowBase->EnableFloatingMode(enable);
}
+bool Window::IsFloatingModeEnabled()
+{
+ return mWindowBase->IsFloatingModeEnabled();
+}
+
void Window::IncludeInputRegion(const Rect<int>& inputRegion)
{
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IncludeInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
return mLastKeyEvent;
}
-const Dali::TouchEvent& Window::GetLastTouchEvent() const
+void Window::SetUserGeometryPolicy()
+{
+ if(mIsEnabledUserGeometry == true)
+ {
+ return;
+ }
+
+ mIsEnabledUserGeometry = true;
+ AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window user.geometry is changed\n", this, mNativeWindowId);
+}
+
+bool Window::PointerConstraintsLock()
+{
+ return mWindowBase->PointerConstraintsLock();
+}
+
+bool Window::PointerConstraintsUnlock()
+{
+ return mWindowBase->PointerConstraintsUnlock();
+}
+
+void Window::LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ mWindowBase->LockedPointerRegionSet(x, y, width, height);
+}
+
+void Window::LockedPointerCursorPositionHintSet(int32_t x, int32_t y)
+{
+ mWindowBase->LockedPointerCursorPositionHintSet(x, y);
+}
+
+bool Window::PointerWarp(int32_t x, int32_t y)
+{
+ return mWindowBase->PointerWarp(x, y);
+}
+
+void Window::CursorVisibleSet(bool visible)
+{
+ mWindowBase->CursorVisibleSet(visible);
+}
+
+bool Window::KeyboardGrab(Device::Subclass::Type deviceSubclass)
+{
+ return mWindowBase->KeyboardGrab(deviceSubclass);
+}
+
+bool Window::KeyboardUnGrab()
+{
+ return mWindowBase->KeyboardUnGrab();
+}
+
+void Window::SetFullScreen(bool fullscreen)
+{
+ mWindowBase->SetFullScreen(fullscreen);
+}
+
+bool Window::GetFullScreen()
+{
+ return mWindowBase->GetFullScreen();
+}
+
+void Window::SetFrontBufferRendering(bool enable)
+{
+ mWindowBase->SetFrontBufferRendering(enable);
+ mWindowSurface->SetFrontBufferRendering(enable);
+}
+
+bool Window::GetFrontBufferRendering()
{
- return mLastTouchEvent;
+ return mWindowBase->GetFrontBufferRendering();
}
} // namespace Adaptor