[Tizen] Replace set geometry function in ecore-wl2 backend. 36/275736/1
authorWonsik Jung <sidein@samsung.com>
Tue, 31 May 2022 05:55:30 +0000 (14:55 +0900)
committerWonsik Jung <sidein@samsung.com>
Tue, 31 May 2022 06:01:50 +0000 (15:01 +0900)
Replace set geometry function when window configure notifcation event occurs.
From ecore_wl2_window_sync_geometry_set() to ecore_wl2_window_geometry_set().
It is for only tizen window backend.

Change-Id: I9bf4f0748e9393af21f70213341fb0d5655a4f51

dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-render-surface.cpp
dali/internal/window-system/common/window-render-surface.h
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp

index 86dcbd0..b1c7194 100644 (file)
@@ -821,7 +821,33 @@ void Window::OnWindowRedrawRequest()
 
 void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
 {
-  SetPositionSize(positionSize);
+  PositionSize oldRect = mSurface->GetPositionSize();
+
+  mWindowSurface->UpdatePositionSize(positionSize);
+
+  PositionSize newRect = positionSize;
+
+  // 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();
+
+    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::Window handle(this);
+    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)
index 3261edb..a8475ea 100644 (file)
@@ -376,6 +376,41 @@ bool WindowRenderSurface::ReplaceGraphicsSurface()
   return eglImpl.ReplaceSurfaceWindow(window, mEGLSurface, mEGLContext);
 }
 
+void WindowRenderSurface::UpdatePositionSize(Dali::PositionSize positionSize)
+{
+  bool needToMove   = false;
+  bool needToResize = false;
+
+  // Check moving
+  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))
+  {
+    needToResize = true;
+  }
+
+  if(needToResize)
+  {
+    mResizeFinished = false;
+    mPositionSize   = positionSize;
+  }
+  else
+  {
+    if(needToMove)
+    {
+      mPositionSize = positionSize;
+    }
+  }
+
+  DALI_LOG_INFO(gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::MoveResize: %d, %d, %d, %d\n", mPositionSize.x, mPositionSize.y, mPositionSize.width, mPositionSize.height);
+}
+
 void WindowRenderSurface::MoveResize(Dali::PositionSize positionSize)
 {
   bool needToMove   = false;
index b1194ca..5e58893 100644 (file)
@@ -129,6 +129,15 @@ public: // API
   void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement);
 
   /**
+   * @brief Updates window surface's position and size.
+   * It is just to update the local variable in window surface.
+   * This function is only called when window's position or size is changed by display server.
+   *
+   * @param[in] positionSize The updated window surface's position and size.
+   */
+  void UpdatePositionSize(Dali::PositionSize positionSize);
+
+  /**
    * @brief Query whether window is rotating or not.
    *
    * @return true if window is rotating, false otherwise.
index fc0e36c..5426505 100644 (file)
@@ -1063,12 +1063,14 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
 
     if(windowMoved || windowResized)
     {
-      mWindowPositionSize.x = ev->x;
-      mWindowPositionSize.y = ev->y;
-      mWindowPositionSize.width = newWidth;
+      mWindowPositionSize.x      = ev->x;
+      mWindowPositionSize.y      = ev->y;
+      mWindowPositionSize.width  = newWidth;
       mWindowPositionSize.height = newHeight;
       DALI_LOG_RELEASE_INFO("Update position & resize signal by server, current angle [%d] x[%d] y[%d] w[%d] h[%d]\n", mWindowRotationAngle, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
 
+      ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
+
       Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
       DALI_LOG_RELEASE_INFO("emit signal to update window's position and size, x[%d] y[%d] w[%d] h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
       mUpdatePositionSizeSignal.Emit(newPositionSize);