Fix motion issue for linux

This commit is contained in:
chinboy
2025-07-05 15:43:15 +08:00
parent e7be4b1f70
commit e920d60294
2 changed files with 24 additions and 9 deletions
+4 -3
View File
@@ -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();
+20 -6
View File
@@ -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();
});
});
});
}