Update with recovered code from VM binaries (Jan 1)

Recovered from decompiled OpenMaui.Controls.Linux.dll:
- SkiaShell.cs: FlyoutHeader, FlyoutFooter, scroll support (918 -> 1325 lines)
- X11Window.cs: Cursor support (XCreateFontCursor, XDefineCursor)
- All handlers with dark mode support
- All services with latest implementations
- LinuxApplication with theme change handling
This commit is contained in:
2026-01-01 06:22:48 -05:00
parent 1e84c6168a
commit 1f096c38dc
254 changed files with 49359 additions and 38457 deletions

View File

@@ -1,65 +1,113 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Maui.Handlers;
using System.ComponentModel;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;
using SkiaSharp;
using Microsoft.Maui.Handlers;
namespace Microsoft.Maui.Platform.Linux.Handlers;
/// <summary>
/// Handler for ProgressBar on Linux using Skia rendering.
/// Maps IProgress interface to SkiaProgressBar platform view.
/// IProgress has: Progress (0-1), ProgressColor
/// </summary>
public partial class ProgressBarHandler : ViewHandler<IProgress, SkiaProgressBar>
public class ProgressBarHandler : ViewHandler<IProgress, SkiaProgressBar>
{
public static IPropertyMapper<IProgress, ProgressBarHandler> Mapper = new PropertyMapper<IProgress, ProgressBarHandler>(ViewHandler.ViewMapper)
{
[nameof(IProgress.Progress)] = MapProgress,
[nameof(IProgress.ProgressColor)] = MapProgressColor,
[nameof(IView.Background)] = MapBackground,
};
public static IPropertyMapper<IProgress, ProgressBarHandler> Mapper = (IPropertyMapper<IProgress, ProgressBarHandler>)(object)new PropertyMapper<IProgress, ProgressBarHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)ViewHandler.ViewMapper })
{
["Progress"] = MapProgress,
["ProgressColor"] = MapProgressColor,
["IsEnabled"] = MapIsEnabled,
["Background"] = MapBackground,
["BackgroundColor"] = MapBackgroundColor
};
public static CommandMapper<IProgress, ProgressBarHandler> CommandMapper = new(ViewHandler.ViewCommandMapper)
{
};
public static CommandMapper<IProgress, ProgressBarHandler> CommandMapper = new CommandMapper<IProgress, ProgressBarHandler>((CommandMapper)(object)ViewHandler.ViewCommandMapper);
public ProgressBarHandler() : base(Mapper, CommandMapper)
{
}
public ProgressBarHandler()
: base((IPropertyMapper)(object)Mapper, (CommandMapper)(object)CommandMapper)
{
}
public ProgressBarHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
: base(mapper ?? Mapper, commandMapper ?? CommandMapper)
{
}
protected override SkiaProgressBar CreatePlatformView()
{
return new SkiaProgressBar();
}
protected override SkiaProgressBar CreatePlatformView()
{
return new SkiaProgressBar();
}
protected override void ConnectHandler(SkiaProgressBar platformView)
{
base.ConnectHandler(platformView);
IProgress virtualView = base.VirtualView;
BindableObject val = (BindableObject)(object)((virtualView is BindableObject) ? virtualView : null);
if (val != null)
{
val.PropertyChanged += OnVirtualViewPropertyChanged;
}
IProgress virtualView2 = base.VirtualView;
VisualElement val2 = (VisualElement)(object)((virtualView2 is VisualElement) ? virtualView2 : null);
if (val2 != null)
{
platformView.IsVisible = val2.IsVisible;
}
}
public static void MapProgress(ProgressBarHandler handler, IProgress progress)
{
if (handler.PlatformView is null) return;
handler.PlatformView.Progress = Math.Clamp(progress.Progress, 0.0, 1.0);
}
protected override void DisconnectHandler(SkiaProgressBar platformView)
{
IProgress virtualView = base.VirtualView;
BindableObject val = (BindableObject)(object)((virtualView is BindableObject) ? virtualView : null);
if (val != null)
{
val.PropertyChanged -= OnVirtualViewPropertyChanged;
}
base.DisconnectHandler(platformView);
}
public static void MapProgressColor(ProgressBarHandler handler, IProgress progress)
{
if (handler.PlatformView is null) return;
private void OnVirtualViewPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
IProgress virtualView = base.VirtualView;
VisualElement val = (VisualElement)(object)((virtualView is VisualElement) ? virtualView : null);
if (val != null && e.PropertyName == "IsVisible")
{
base.PlatformView.IsVisible = val.IsVisible;
base.PlatformView.Invalidate();
}
}
if (progress.ProgressColor is not null)
handler.PlatformView.ProgressColor = progress.ProgressColor.ToSKColor();
}
public static void MapProgress(ProgressBarHandler handler, IProgress progress)
{
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.Progress = progress.Progress;
}
public static void MapBackground(ProgressBarHandler handler, IProgress progress)
{
if (handler.PlatformView is null) return;
public static void MapProgressColor(ProgressBarHandler handler, IProgress progress)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (progress.ProgressColor != null)
{
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.ProgressColor = progress.ProgressColor.ToSKColor();
}
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.Invalidate();
}
if (progress.Background is SolidPaint solidPaint && solidPaint.Color is not null)
{
handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor();
}
}
public static void MapIsEnabled(ProgressBarHandler handler, IProgress progress)
{
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.IsEnabled = ((IView)progress).IsEnabled;
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.Invalidate();
}
public static void MapBackground(ProgressBarHandler handler, IProgress progress)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
Paint background = ((IView)progress).Background;
SolidPaint val = (SolidPaint)(object)((background is SolidPaint) ? background : null);
if (val != null && val.Color != null)
{
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.BackgroundColor = val.Color.ToSKColor();
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.Invalidate();
}
}
public static void MapBackgroundColor(ProgressBarHandler handler, IProgress progress)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
VisualElement val = (VisualElement)(object)((progress is VisualElement) ? progress : null);
if (val != null && val.BackgroundColor != null)
{
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.BackgroundColor = val.BackgroundColor.ToSKColor();
((ViewHandler<IProgress, SkiaProgressBar>)(object)handler).PlatformView.Invalidate();
}
}
}