Ver Fonte

X11Window cleanup

Nikita Tsukanov há 5 anos atrás
pai
commit
0f353769ec
1 ficheiros alterados com 4 adições e 23 exclusões
  1. 4 23
      src/Avalonia.X11/X11Window.cs

+ 4 - 23
src/Avalonia.X11/X11Window.cs

@@ -746,7 +746,6 @@ namespace Avalonia.X11
 
         void Cleanup()
         {
-            SetTransientParent(null, false);
             if (_xic != IntPtr.Zero)
             {
                 XDestroyIC(_xic);
@@ -782,27 +781,15 @@ namespace Avalonia.X11
             return true;
         }
 
-        void SetTransientParent(X11Window window, bool informServer = true)
-        {            
-            if (informServer)
-                SetTransientForHint(window?._handle);
-        }
-
-        void SetTransientForHint(IntPtr? parent)
+        public void SetParent(IWindowImpl parent)
         {
-            if (parent == null || parent == IntPtr.Zero)
+            if (parent == null || parent.Handle == null || parent.Handle.Handle == IntPtr.Zero)
                 XDeleteProperty(_x11.Display, _handle, _x11.Atoms.XA_WM_TRANSIENT_FOR);
             else
-                XSetTransientForHint(_x11.Display, _handle, parent.Value);
+                XSetTransientForHint(_x11.Display, _handle, parent.Handle.Handle);
         }
 
         public void Show()
-        {
-            SetTransientParent(null);
-            ShowCore();
-        }
-        
-        void ShowCore()
         {
             _wasMappedAtLeastOnce = true;
             XMapWindow(_x11.Display, _handle);
@@ -811,7 +798,6 @@ namespace Avalonia.X11
 
         public void Hide() => XUnmapWindow(_x11.Display, _handle);
         
-        
         public Point PointToClient(PixelPoint point) => new Point((point.X - Position.X) / Scaling, (point.Y - Position.Y) / Scaling);
 
         public PixelPoint PointToScreen(Point point) => new PixelPoint(
@@ -1032,12 +1018,7 @@ namespace Avalonia.X11
         {
             ChangeWMAtoms(value, _x11.Atoms._NET_WM_STATE_ABOVE);
         }
-
-        public void SetParent(IWindowImpl parent)
-        {
-            SetTransientParent((X11Window)parent);
-        }
-
+        
         public void SetEnabled(bool enable)
         {
             _disabled = !enable;