Modify configure notification event callback for window is resized or moved.
This evnet is sent from the display server.
If the event has 0'size, the window is resized by client application.
In this case, dali should ignore that.
If the event has real size size, the window is resized by display server.
In this case, dali should resize own's window buffer and re-render his contents.
Change-Id: I1c72c7c8cd06ed388f43b59e18a29793f73b3b31
mStyleChangedSignal(),
mAccessibilitySignal(),
mTransitionEffectEventSignal(),
- mKeyboardRepeatSettingsChangedSignal()
+ mKeyboardRepeatSettingsChangedSignal(),
+ mUpdatePositionSizeSignal()
{
}
return mWindowRedrawRequestSignal;
}
+WindowBase::UpdatePositionSizeType& WindowBase::UpdatePositionSizeSignal()
+{
+ return mUpdatePositionSizeSignal;
+}
+
+
} // namespace Adaptor
} // namespace Internal
typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType;
typedef Signal<void()> WindowRedrawRequestSignalType;
+ typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
// Input events
typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
*/
WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
+ /**
+ * @brief This signal is emitted when the window is resized or moved by display server.
+ */
+ UpdatePositionSizeType& UpdatePositionSizeSignal();
+
protected:
// Undefined
WindowBase(const WindowBase&) = delete;
TransitionEffectEventSignalType mTransitionEffectEventSignal;
KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
+ UpdatePositionSizeType mUpdatePositionSizeSignal;
+
};
} // namespace Adaptor
mIsFocusAcceptable(true),
mIconified(false),
mOpaqueState(false),
- mResizeEnabled(false),
mType(WindowType::NORMAL),
mParentWindow(NULL),
mPreferredAngle(static_cast<int>(WindowOrientation::NO_ORIENTATION_PREFERENCE)),
mWindowBase->TransitionEffectEventSignal().Connect(this, &Window::OnTransitionEffectEvent);
mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect(this, &Window::OnKeyboardRepeatSettingsChanged);
mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest);
+ mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize);
mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
- if(!positionSize.IsEmpty())
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
+ AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
SetClass(name, className);
void Window::SetSize(Dali::Window::WindowSize size)
{
- if(!mResizeEnabled)
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
-
PositionSize oldRect = mSurface->GetPositionSize();
mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
void Window::SetPosition(Dali::Window::WindowPosition position)
{
- if(!mResizeEnabled)
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
-
PositionSize oldRect = mSurface->GetPositionSize();
mWindowSurface->MoveResize(PositionSize(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
void Window::SetPositionSize(PositionSize positionSize)
{
- if(!mResizeEnabled)
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
-
PositionSize oldRect = mSurface->GetPositionSize();
mWindowSurface->MoveResize(positionSize);
mAdaptor->RenderOnce();
}
+void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
+{
+ SetPositionSize(positionSize);
+}
+
void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
{
FeedTouchPoint(point, timeStamp);
void OnWindowRedrawRequest();
/**
+ * @brief Called when the window is resized or moved by display server.
+ *
+ * @param positionSize the updated window's position and size.
+ */
+ void OnUpdatePositionSize(Dali::PositionSize& positionSize);
+
+ /**
* @brief Set available orientation to window base.
*/
void SetAvailableAnlges(const std::vector<int>& angles);
bool mIsFocusAcceptable : 1;
bool mIconified : 1;
bool mOpaqueState : 1;
- bool mResizeEnabled : 1;
WindowType mType;
Dali::Window mParentWindow;
bool needToResize = false;
// Check moving
- if((fabs(positionSize.x - mPositionSize.x) > MINIMUM_DIMENSION_CHANGE) ||
- (fabs(positionSize.y - mPositionSize.y) > MINIMUM_DIMENSION_CHANGE))
+ if((fabs(positionSize.x - mPositionSize.x) >= MINIMUM_DIMENSION_CHANGE) ||
+ (fabs(positionSize.y - mPositionSize.y) >= MINIMUM_DIMENSION_CHANGE))
{
needToMove = true;
}
// Check resizing
- if((fabs(positionSize.width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
- (fabs(positionSize.height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE))
+ if((fabs(positionSize.width - mPositionSize.width) >= MINIMUM_DIMENSION_CHANGE) ||
+ (fabs(positionSize.height - mPositionSize.height) >= MINIMUM_DIMENSION_CHANGE))
{
needToResize = true;
}
{
Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
- if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
+ if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
// Note: To comply with the wayland protocol, Dali should make an ack_configure
// by calling ecore_wl2_window_commit
+
+ int tempWidth = static_cast<int>(ev->w);
+ int tempHeight = static_cast<int>(ev->h);
+
+ // Initialize with previous size for skip resize when new size is 0.
+ // When window is just moved or window is resized by client application,
+ // The configure notification event's size will be 0.
+ // If new size is 0, the resized work should be skip.
+ int newWidth = mWindowPositionSize.width;
+ int newHeight = mWindowPositionSize.height;
+ bool windowMoved = false, windowResized = false;
+
+ if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
+ {
+ windowMoved = true;
+ }
+
+ if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
+ {
+ windowResized = true;
+ newWidth = tempWidth;
+ newHeight = tempHeight;
+ }
+
+ if(windowMoved || windowResized)
+ {
+ Dali::PositionSize newPositionSize(ev->x, ev->y, newWidth, newHeight);
+ mUpdatePositionSizeSignal.Emit(newPositionSize);
+ }
+
ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
}
}