diff --git a/src/AtomUI.Controls/Popup/Popup.cs b/src/AtomUI.Controls/Popup/Popup.cs index 7b0ef26f8..8310a19bd 100644 --- a/src/AtomUI.Controls/Popup/Popup.cs +++ b/src/AtomUI.Controls/Popup/Popup.cs @@ -545,7 +545,7 @@ public class Popup : AvaloniaPopup, _buddyLayer.AttachWithMotion(null, () => { opened?.Invoke(); - popupRoot.Opacity = 1.0; + popupRoot.Opacity = 1.0d; popupRoot.PlatformImpl?.SetTopmost(true); _isNeedWaitFlipSync = false; _openAnimating = false; @@ -588,8 +588,9 @@ public class Popup : AvaloniaPopup, _closeAnimating = true; var popupRoot = Host as PopupRoot; Debug.Assert(popupRoot != null); - popupRoot.Opacity = 0d; - _buddyLayer.DetachWithMotion(null, () => + _buddyLayer.DetachWithMotion(() => { + popupRoot.Opacity = 0.0; + }, () => { closed?.Invoke(); Close(); diff --git a/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs b/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs index b029655dc..04cbe26fe 100644 --- a/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs +++ b/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs @@ -55,7 +55,7 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer private Popup _buddyPopup; private IPopupHost? _popupHost; - private PopupBuddyDecorator _buddyDecorator; + internal PopupBuddyDecorator _buddyDecorator; public PopupBuddyLayer(Popup buddyPopup, TopLevel parent) : base(parent) @@ -171,6 +171,13 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer Show(); popupRoot?.Activate(); } + else if (OperatingSystem.IsLinux()) + { + Show(); + var popupRoot = _popupHost as PopupRoot; + popupRoot?.Hide(); + popupRoot?.Show(); + } else { Show(); @@ -214,7 +221,6 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer public void DetachWithMotion(Action? aboutToStart = null, Action? completedAction = null) { - aboutToStart?.Invoke(); var motion = CloseMotion ?? new ZoomBigOutMotion(); if (MotionDuration != TimeSpan.Zero) { @@ -222,11 +228,19 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer } _buddyDecorator.CaptureContentControl(); NotifyAboutToRunDetachMotion(); - motion.Run(_buddyDecorator, null, () => + + Dispatcher.UIThread.Post(() => { - completedAction?.Invoke(); - NotifyDetachMotionCompleted(); - Detach(); + aboutToStart?.Invoke(); + Dispatcher.UIThread.Post(() => + { + motion.Run(_buddyDecorator, null, () => + { + completedAction?.Invoke(); + NotifyDetachMotionCompleted(); + Detach(); + }); + }); }); }