[NUI] Fix bug where window size didn't change when borderline was dynamically changed.
authorjoogab.yun <joogab.yun@samsung.com>
Wed, 18 Jan 2023 02:09:58 +0000 (11:09 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 18 Jan 2023 07:46:35 +0000 (16:46 +0900)
src/Tizen.NUI/src/public/Window/BorderWindow.cs

index 7d7950f..0ec8ffe 100755 (executable)
@@ -137,10 +137,34 @@ namespace Tizen.NUI
         {
             if (borderInterface != null)
             {
+                if (borderLineThickness != borderInterface.BorderLineThickness)
+                {
+                    int diffBorderLine = (int)borderInterface.BorderLineThickness - (int)borderLineThickness;
+                    borderLineThickness = borderInterface.BorderLineThickness;
+
+                    if (borderView != null)
+                    {
+                        Extents extents = borderView.Padding;
+                        ushort start = (extents.Start + diffBorderLine) > 0 ? (ushort)(extents.Start + diffBorderLine) : (ushort)0;
+                        ushort end = (extents.End + diffBorderLine) > 0 ? (ushort)(extents.End + diffBorderLine) : (ushort)0;
+                        ushort top = (extents.Top + diffBorderLine) > 0 ? (ushort)(extents.Top + diffBorderLine) : (ushort)0;
+                        ushort bottom = (extents.Bottom + diffBorderLine) > 0 ? (ushort)(extents.Bottom + diffBorderLine) : (ushort)0;
+                        borderView.Padding = new Extents(start, end, top, bottom);
+                        if (IsMaximized() == true)
+                        {
+                            borderView.OnMaximize(true);
+                        }
+                    }
+
+                    using var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
+                    val.SetWidth((ushort)(val.GetWidth() + diffBorderLine * 2));
+                    val.SetHeight((ushort)(val.GetHeight() + diffBorderLine * 2));
+                    Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
+                }
+
                 float height = 0;
                 if (hasTopView) height += topView.SizeHeight;
                 if (hasBottomView) height += bottomView.SizeHeight;
-
                 if (height != borderHeight)
                 {
                     float diff = height - borderHeight;
@@ -154,12 +178,14 @@ namespace Tizen.NUI
                     SetMimimumSize(mimimumSize);
                     minSize = borderInterface.MinSize;
                 }
+                
                 if (maxSize != borderInterface.MaxSize)
                 {
                     using Size2D maximumSize = new Size2D((borderInterface.MaxSize?.Width + (int)borderInterface.BorderLineThickness * 2 ?? 0), (borderInterface.MaxSize?.Height ?? 0) + (int)(borderHeight + borderInterface.BorderLineThickness * 2));
                     SetMaximumSize(maximumSize);
                     maxSize = borderInterface.MaxSize;
                 }
+                
                 if (borderResizePolicy != borderInterface.ResizePolicy)
                 {
                     AddAuxiliaryHint("wm.policy.win.resize_aspect_ratio", "0");
@@ -169,29 +195,7 @@ namespace Tizen.NUI
                         AddAuxiliaryHint("wm.policy.win.resize_aspect_ratio", "1");
                     }
                 }
-                if (borderLineThickness != borderInterface.BorderLineThickness)
-                {
-                    int diffBorderLine = (int)(borderInterface.BorderLineThickness - borderLineThickness);
-                    borderLineThickness = borderInterface.BorderLineThickness;
-
-                    if (borderView != null)
-                    {
-                        Extents extents = borderView.Padding;
-                        ushort start = (extents.Start + diffBorderLine) > 0 ? (ushort)(extents.Start + diffBorderLine) : (ushort)0;
-                        ushort end = (extents.End + diffBorderLine) > 0 ? (ushort)(extents.End + diffBorderLine) : (ushort)0;
-                        ushort top = (extents.Top + diffBorderLine) > 0 ? (ushort)(extents.Top + diffBorderLine) : (ushort)0;
-                        ushort bottom = (extents.Bottom + diffBorderLine) > 0 ? (ushort)(extents.Bottom + diffBorderLine) : (ushort)0;
-                        borderView.Padding = new Extents(start, end, top, bottom);
-                        if (IsMaximized() == true)
-                        {
-                            borderView.OnMaximize(true);
-                        }
-                    }
-
-                    ResizedEventArgs e = new ResizedEventArgs();
-                    e.WindowSize = WindowSize;
-                    windowResizeEventHandler?.Invoke(this, e);
-                }
+                
             }
         }
         /// <summary>