Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJul committed Dec 23, 2024
1 parent 69bfca3 commit f3a587f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/Avalonia.X11/Screens/X11Screen.Providers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.Platform;
Expand Down Expand Up @@ -221,7 +222,7 @@ public X11Screen CreateScreenFromKey(nint key)
}
}

return new FallBackScreen(default, _x11);
throw new ArgumentOutOfRangeException(nameof(key));
}
}

Expand Down
30 changes: 14 additions & 16 deletions src/Avalonia.X11/X11Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ internal class AvaloniaX11Platform : IWindowingPlatform
private Lazy<KeyboardDevice> _keyboardDevice = new Lazy<KeyboardDevice>(() => new KeyboardDevice());
public KeyboardDevice KeyboardDevice => _keyboardDevice.Value;
public Dictionary<IntPtr, X11EventDispatcher.EventHandler> Windows { get; } = new ();
public XI2Manager? XI2 { get; }
public X11Info Info { get; }
public X11Screens X11Screens { get; }
public Compositor Compositor { get; }
public IScreenImpl Screens { get; }
public X11PlatformOptions Options { get; }
public IntPtr OrphanedWindow { get; }
public X11Globals Globals { get; }
public XResources Resources { get; }
public XI2Manager? XI2 { get; private set; }
public X11Info Info { get; private set; } = null!;
public X11Screens X11Screens { get; private set; } = null!;
public Compositor Compositor { get; private set; } = null!;
public IScreenImpl Screens { get; private set; } = null!;
public X11PlatformOptions Options { get; private set; } = null!;
public IntPtr OrphanedWindow { get; private set; }
public X11Globals Globals { get; private set; } = null!;
public XResources Resources { get; private set; } = null!;
public ManualRawEventGrouperDispatchQueue EventGrouperDispatchQueue { get; } = new();

public AvaloniaX11Platform(X11PlatformOptions options)
public void Initialize(X11PlatformOptions options)
{
Options = options;

Expand Down Expand Up @@ -405,15 +405,13 @@ public static AppBuilder UseX11(this AppBuilder builder)
builder
.UseStandardRuntimePlatformSubsystem()
.UseWindowingSubsystem(() =>
{
var options = AvaloniaLocator.Current.GetService<X11PlatformOptions>() ?? new X11PlatformOptions();
_ = new AvaloniaX11Platform(options);
});
new AvaloniaX11Platform().Initialize(AvaloniaLocator.Current.GetService<X11PlatformOptions>() ??
new X11PlatformOptions()));
return builder;
}

public static void InitializeX11Platform(X11PlatformOptions? options = null) =>
_ = new AvaloniaX11Platform(options ?? new X11PlatformOptions());
public static void InitializeX11Platform(X11PlatformOptions options = null) =>
new AvaloniaX11Platform().Initialize(options ?? new X11PlatformOptions());
}

}

0 comments on commit f3a587f

Please sign in to comment.