[NUI] Fix svace issue (DFDF221207-00724).
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window / Window.cs
old mode 100644 (file)
new mode 100755 (executable)
index 160aaf9..796b7b9
@@ -36,6 +36,7 @@ namespace Tizen.NUI
     {
         private HandleRef stageCPtr;
         private Layer rootLayer;
+        private Layer borderLayer;
         private string windowTitle;
         private List<Layer> childLayers = new List<Layer>();
         private LayoutController localController;
@@ -43,7 +44,14 @@ namespace Tizen.NUI
         static internal bool IsSupportedMultiWindow()
         {
             bool isSupported = false;
-            Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
+            try
+            {
+                Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
+            }
+            catch (DllNotFoundException e)
+            {
+                Tizen.Log.Fatal("NUI", $"{e}\n");
+            }
             return isSupported;
         }
 
@@ -66,13 +74,14 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         static public Window Get(View view)
         {
-            if(view == null)
+            if (view == null)
             {
                 NUILog.Error("if there is no view, it can not get a window");
                 return null;
             }
 
-            Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.Get(View.getCPtr(view))) as Window;
+            //to fix memory leak issue, match the handle count with native side.
+            Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -118,6 +127,30 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Creates a new Window with a specific name.<br />
+        /// This creates an extra window in addition to the default main window<br />
+        /// </summary>
+        /// <param name="name">The name for extra window. </param>
+        /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
+        /// <param name="windowPosition">The position and size of the Window.</param>
+        /// <param name="isTranslucent">Whether Window is translucent.</param>
+        /// <returns>A new Window.</returns>
+        /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
+        {
+            if (IsSupportedMultiWindow() == false)
+            {
+                NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
+            }
+            this.windowTitle = name;
+            this.EnableBorder(borderInterface);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+
+        /// <summary>
         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
@@ -179,26 +212,28 @@ namespace Tizen.NUI
         /// <summary>
         /// Enumeration for transition effect's state.
         /// </summary>
-        [Obsolete("Please do not use! This will be removed. Please use Window.EffectState instead!")]
+        [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
         [EditorBrowsable(EditorBrowsableState.Never)]
+        //  This is already deprecated, so suppress warning here.
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
         public enum EffectStates
         {
             /// <summary>
             /// None state.
             /// </summary>
-            [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.None instead!")]
+            [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
             [EditorBrowsable(EditorBrowsableState.Never)]
             None = 0,
             /// <summary>
             /// Transition effect is started.
             /// </summary>
-            [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.Start instead!")]
+            [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
             [EditorBrowsable(EditorBrowsableState.Never)]
             Start,
             /// <summary>
             /// Transition effect is ended.
             /// </summary>
-            [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.End instead!")]
+            [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
             [EditorBrowsable(EditorBrowsableState.Never)]
             End,
         }
@@ -229,26 +264,28 @@ namespace Tizen.NUI
         /// <summary>
         /// Enumeration for transition effect's type.
         /// </summary>
-        [Obsolete("Please do not use! This will be removed. Please use Window.EffectType instead!")]
+        [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
         [EditorBrowsable(EditorBrowsableState.Never)]
+        //  This is already deprecated, so suppress warning here.
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
         public enum EffectTypes
         {
             /// <summary>
             /// None type.
             /// </summary>
-            [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.None instead!")]
+            [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
             [EditorBrowsable(EditorBrowsableState.Never)]
             None = 0,
             /// <summary>
             /// Window show effect.
             /// </summary>
-            [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Show instead!")]
+            [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
             [EditorBrowsable(EditorBrowsableState.Never)]
             Show,
             /// <summary>
             /// Window hide effect.
             /// </summary>
-            [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Hide instead!")]
+            [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
             [EditorBrowsable(EditorBrowsableState.Never)]
             Hide,
         }
@@ -306,6 +343,11 @@ namespace Tizen.NUI
         public enum ResizeDirection
         {
             /// <summary>
+            /// None type.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            None = 0,
+            /// <summary>
             /// Start resizing window to the top-left edge.
             /// </summary>
             [EditorBrowsable(EditorBrowsableState.Never)]
@@ -357,6 +399,8 @@ namespace Tizen.NUI
 
         /// <summary>
         /// Gets or sets a window type.
+        /// Most of window type can be set to use WindowType, except for IME type.
+        /// IME type can be set to use one of NUIApplication's constrcutors.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public WindowType Type
@@ -508,7 +552,7 @@ namespace Tizen.NUI
             {
                 Position2D position = GetPosition();
                 Size2D size = GetSize();
-                Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
+                Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0);
                 position.Dispose();
                 return ret;
             }
@@ -564,7 +608,7 @@ namespace Tizen.NUI
         /// </summary>
         /// <param name="keyEvent">The key event to feed.</param>
         /// <since_tizen> 4 </since_tizen>
-        [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
+        [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
         public static void FeedKeyEvent(Key keyEvent)
         {
             Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
@@ -726,7 +770,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void SetInputRegion(Rectangle inputRegion)
         {
-            Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
+            Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
@@ -893,13 +937,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void Add(View view)
         {
-            Interop.Actor.Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
-            if (null != view)
-            {
-                view.InternalParent = this.GetRootLayer();
-            }
+            this.GetRootLayer().Add(view);
         }
 
         /// <summary>
@@ -909,12 +947,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void Remove(View view)
         {
-            Interop.Actor.Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
-            this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
-            if (null != view)
-            {
-                view.InternalParent = null;
-            }
+            this.GetRootLayer().Remove(view);
         }
 
         /// <summary>
@@ -1074,7 +1107,28 @@ namespace Tizen.NUI
         /// <since_tizen> 5 </since_tizen>
         public void FeedKey(Key keyEvent)
         {
-            Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
+            Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Feeds a touch point into the window.
+        /// </summary>
+        /// <param name="touchPoint">The touch point to feed.</param>
+        /// <param name="timeStamp">The timeStamp.</param>
+        internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
+        {
+            Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Feeds a wheel event into the window.
+        /// </summary>
+        /// <param name="wheelEvent">The wheel event to feed.</param>
+        internal void FeedWheel(Wheel wheelEvent)
+        {
+            Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
@@ -1123,6 +1177,26 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Sets parent window of the window.
+        /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
+        /// This function has the additional flag whether the child is located above or below of the parent.
+        /// </summary>
+        /// <param name="parent">The parent window.</param>
+        /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
+        /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetParent(Window parent, bool belowParent)
+        {
+            if (IsSupportedMultiWindow() == false)
+            {
+                NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
+            }
+            Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Unsets parent window of the window.
         /// After unsetting, the window is disconnected his parent window.
         /// </summary>
@@ -1153,7 +1227,7 @@ namespace Tizen.NUI
             {
                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
             }
-            Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(SwigCPtr)) as Window;
+            Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -1169,11 +1243,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
-        {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
-        }
-
         internal static bool IsInstalled()
         {
             bool ret = Interop.Stage.IsInstalled();
@@ -1267,24 +1336,6 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Sets window position and size for specific orientation.
-        /// This api reserves the position and size per orientation to display server.
-        /// When the device is rotated, the window is moved/resized with the reserved position/size by display server.
-        /// Currently, it only works when the window's type is WindowType::Ime.
-        /// It means this function is only for IME window of internal keyboard application.
-        /// It is only for internal keyboard application.
-        /// This should be hidden.
-        /// </summary>
-        /// <param name="positionSize">The reserved position and size for the orientation.</param>
-        /// <param name="orientation">The orientation.</param>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void SetPositionSizeWithOrientation(Rectangle positionSize, Window.WindowOrientation orientation)
-        {
-            Interop.Window.SetPositionSizeWithOrientation(SwigCPtr, Rectangle.getCPtr(positionSize), (int)orientation);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        /// <summary>
         /// Get native window ID
         /// </summary>
         /// <returns>native window ID</returns>
@@ -1309,8 +1360,17 @@ namespace Tizen.NUI
             {
                 throw new ArgumentNullException(nameof(layer));
             }
-            Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            if (isBorderWindow)
+            {
+                Interop.Actor.Add(GetBorderWindowRootLayer().SwigCPtr, layer.SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
+            }
+            else
+            {
+                Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
 
             LayersChildren?.Add(layer);
             layer.SetWindow(this);
@@ -1332,8 +1392,12 @@ namespace Tizen.NUI
         internal Vector2 GetSize()
         {
             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
+
+            convertRealWindowSizeToBorderWindowSize(val);
+
             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            val.Dispose();
             return ret;
         }
 
@@ -1361,16 +1425,29 @@ namespace Tizen.NUI
 
         internal Layer GetRootLayer()
         {
-            // Window.IsInstalled() is actually true only when called from event thread and
-            // Core has been initialized, not when Stage is ready.
-            if (rootLayer == null && Window.IsInstalled())
+            if (isBorderWindow)
             {
-                rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                LayersChildren?.Add(rootLayer);
-                rootLayer.SetWindow(this);
+                if (borderLayer == null)
+                {
+                    borderLayer = GetBorderWindowRootLayer();
+                    LayersChildren?.Add(borderLayer);
+                    borderLayer.SetWindow(this);
+                }
+                return borderLayer;
+            }
+            else
+            {
+                // Window.IsInstalled() is actually true only when called from event thread and
+                // Core has been initialized, not when Stage is ready.
+                if (rootLayer == null && Window.IsInstalled())
+                {
+                    rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    LayersChildren?.Add(rootLayer);
+                    rootLayer.SetWindow(this);
+                }
+                return rootLayer;
             }
-            return rootLayer;
         }
 
         internal void SetBackgroundColor(Vector4 color)
@@ -1421,6 +1498,9 @@ namespace Tizen.NUI
                 throw new ArgumentNullException(nameof(size));
             }
             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
+
+            convertBorderWindowSizeToRealWindowSize(val);
+
             Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
             val.Dispose();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -1430,8 +1510,12 @@ namespace Tizen.NUI
         internal Size2D GetWindowSize()
         {
             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
+
+            convertRealWindowSizeToBorderWindowSize(val);
+
             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            val.Dispose();
             return ret;
         }
 
@@ -1441,8 +1525,8 @@ namespace Tizen.NUI
             {
                 throw new ArgumentNullException(nameof(position));
             }
-            var val = new Uint16Pair((uint)position.X, (uint)position.Y);
-            Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val));
+            var val = new Int32Pair(position.X, position.Y);
+            Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
             val.Dispose();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             // Setting Position of the window should request a relayout of the tree.
@@ -1450,8 +1534,8 @@ namespace Tizen.NUI
 
         internal Position2D GetPosition()
         {
-            var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true);
-            Position2D ret = new Position2D(val.GetX(), val.GetY());
+            var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
+            Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
             val.Dispose();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -1459,7 +1543,19 @@ namespace Tizen.NUI
 
         internal void SetPositionSize(Rectangle positionSize)
         {
+            if (positionSize == null)
+            {
+                throw new ArgumentNullException(nameof(positionSize));
+            }
+            var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
+
+            convertBorderWindowSizeToRealWindowSize(val);
+
+            positionSize.Width = val.GetX();
+            positionSize.Height = val.GetY();
+
             Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
+            val.Dispose();
 
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
@@ -1506,25 +1602,171 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Adds input region.
+        /// Includes input region.
+        /// This function inlcudes input regions.
+        /// It can be used multiple times and supports multiple regions.
+        /// It means input region will be extended.
+        /// This input is related to mouse and touch event.
+        /// If device has touch screen, this function is useful.
+        /// Otherwise device does not have that, we can use it after connecting mouse to the device.
+        /// </summary>
+        /// <param name="inputRegion">The included region to accept input events.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void IncludeInputRegion(Rectangle inputRegion)
+        {
+            Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// This function excludes input regions.
+        /// It can be used multiple times and supports multiple regions.
+        /// It means input region will be reduced.
+        /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
+        /// This input is related to mouse and touch event.
+        /// If device has touch screen, this function is useful.
+        /// Otherwise device does not have that, we can use it after connecting mouse to the device.
+        /// </summary>
+        /// <param name="inputRegion">The excluded region to except input events.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void ExcludeInputRegion(Rectangle inputRegion)
+        {
+            Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Maximizes window's size.
+        /// If this function is called with true, window will be resized with screen size.
+        /// Otherwise window will be resized with previous size.
+        /// It is for the window's MAX button in window's border.
+        /// If window border is supported by display server, it is not necessary.
+        /// </summary>
+        /// <param name="max">If window is maximized or unmaximized.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Maximize(bool max)
+        {
+            Interop.Window.Maximize(SwigCPtr, max);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Returns whether the window is maximized or not.
+        /// </summary>
+        /// <returns>True if the window is maximized, false otherwise.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool IsMaximized()
+        {
+            bool ret = Interop.Window.IsMaximized(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Sets window's maximum size.
+        ///
+        /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
+        /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
+        ///
+        /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
+        ///
+        /// </summary>
+        /// <param name="size">the maximum size.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetMaximumSize(Size2D size)
+        {
+            if (null == size)
+            {
+                throw new ArgumentNullException(nameof(size));
+            }
+            var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
+
+            Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
+            val.Dispose();
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Minimizes window's size.
+        /// If this function is called with true, window will be iconified.
+        /// Otherwise window will be activated.
+        /// It is for the window's MIN button in window border.
+        /// If window border is supported by display server, it is not necessary.
+        /// </summary>
+        /// <param name="min">If window is minimized or unminimized.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Minimize(bool min)
+        {
+            Interop.Window.Minimize(SwigCPtr, min);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Returns whether the window is minimized or not.
+        /// </summary>
+        /// <returns>True if the window is minimized, false otherwise.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool IsMinimized()
+        {
+            bool ret = Interop.Window.IsMinimized(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Sets window's minimum size.
+        /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
+        /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
+        /// </summary>
+        /// <param name="size">the minimum size.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetMimimumSize(Size2D size)
+        {
+            if (null == size)
+            {
+                throw new ArgumentNullException(nameof(size));
+            }
+            var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
+
+            Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
+            val.Dispose();
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Query whether window is rotating or not.
         /// </summary>
-        /// <param name="inputRegion">The added region to accept input events.</param>
+        /// <returns>True if window is rotating, false otherwise.</returns>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void AddInputRegion(Rectangle inputRegion)
+        public bool IsWindowRotating()
         {
-            Interop.Window.AddInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
+            bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
         }
 
         /// <summary>
-        /// Subtracts input region.
+        /// Gets the last key event the window gets.
         /// </summary>
-        /// <param name="inputRegion">The subtracted region to except input events.</param>
+        /// <returns>The last key event the window gets.</returns>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void SubtractInputRegion(Rectangle inputRegion)
+        public Key GetLastKeyEvent()
         {
-            Interop.Window.SubtractInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
+            Key ret = new Key(Interop.Window.GetLastKeyEvent(SwigCPtr), false);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Gets the last touch event the window gets.
+        /// </summary>
+        /// <returns>The last touch event the window gets.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Touch GetLastTouchEvent()
+        {
+            Touch ret = new Touch(Interop.Window.GetLastTouchEvent(SwigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
         }
 
         /// <summary>
@@ -1555,6 +1797,8 @@ namespace Tizen.NUI
             {
                 return;
             }
+            
+            this.DisconnectNativeSignals();
 
             if (type == DisposeTypes.Explicit)
             {
@@ -1562,13 +1806,11 @@ namespace Tizen.NUI
                 //Release your own managed resources here.
                 //You should release all of your own disposable objects here.
 
-                if (rootLayer != null)
+                if (IsBorderEnabled)
                 {
-                    rootLayer.Dispose();
+                    DisposeBorder();
                 }
 
-                localController?.Dispose();
-
                 foreach (var layer in childLayers)
                 {
                     if (layer != null)
@@ -1578,9 +1820,10 @@ namespace Tizen.NUI
                 }
 
                 childLayers.Clear();
+
+                localController?.Dispose();
             }
 
-            this.DisconnectNativeSignals();
 
             base.Dispose(type);
         }
@@ -1716,5 +1959,28 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// <summary>
+        /// Get Native Window handle.
+        /// <example>
+        /// How to get Native Window handle
+        /// <code>
+        /// Window window = NUIApplication.GetDefaultWindow();
+        /// var handle = window.NativeHandle;
+        /// if(handle.IsInvalid == false)
+        /// {
+        ///     IntPtr nativeHandle = handle.DangerousGetHandle();
+        ///     // do something with nativeHandle
+        /// }
+        /// </code>
+        /// </example>
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public SafeHandle NativeHandle
+        {
+            get
+            {
+                return new NUI.SafeNativeWindowHandle(this);
+            }
+        }
     }
 }