Browse Source

Merge branch 'master' into template-part-attribute

pull/7854/head
Dariusz Komosiński 4 years ago
committed by GitHub
parent
commit
78ddf88e8f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      native/Avalonia.Native/src/OSX/controlhost.mm
  2. 9
      native/Avalonia.Native/src/OSX/window.mm
  3. 4
      packages/Avalonia/Avalonia.csproj
  4. 3
      samples/ControlCatalog.Android/ControlCatalog.Android.csproj
  5. 3
      samples/ControlCatalog/Pages/DialogsPage.xaml.cs
  6. 16
      src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
  7. 11
      src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
  8. 10
      src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj
  9. 52
      src/Android/Avalonia.AndroidTestApplication/MainActivity.cs
  10. 2
      src/Avalonia.Controls/Button.cs
  11. 10
      src/Avalonia.Controls/Platform/IPlatformNativeSurfaceHandle.cs
  12. 5
      src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs
  13. 2
      src/Avalonia.Diagnostics/Diagnostics/Views/LayoutExplorerView.axaml
  14. 13
      src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs
  15. 2
      src/Avalonia.MicroCom/Avalonia.MicroCom.csproj
  16. 2
      src/Avalonia.Themes.Default/Controls/ToggleSwitch.xaml
  17. 4
      src/Avalonia.Themes.Default/DefaultTheme.xaml
  18. 3
      src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml
  19. 2
      src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml
  20. 26
      src/Avalonia.X11/X11Window.cs
  21. 8
      src/Windows/Avalonia.Win32/WindowImpl.cs

3
native/Avalonia.Native/src/OSX/controlhost.mm

@ -36,7 +36,10 @@ public:
virtual void DestroyDefaultChild(void* child) override
{
// ARC will release the object for us
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-value"
(__bridge_transfer NSView*) child;
#pragma clang diagnostic pop
}
};

9
native/Avalonia.Native/src/OSX/window.mm

@ -457,7 +457,8 @@ public:
}
point = ConvertPointY(point);
auto viewPoint = [Window convertScreenToBase:ToNSPoint(point)];
NSRect convertRect = [Window convertRectToScreen:NSMakeRect(point.X, point.Y, 0.0, 0.0)];
auto viewPoint = NSMakePoint(convertRect.origin.x, convertRect.origin.y);
*ret = [View translateLocalPoint:ToAvnPoint(viewPoint)];
@ -477,7 +478,8 @@ public:
}
auto cocoaViewPoint = ToNSPoint([View translateLocalPoint:point]);
auto cocoaScreenPoint = [Window convertBaseToScreen:cocoaViewPoint];
NSRect convertRect = [Window convertRectToScreen:NSMakeRect(cocoaViewPoint.x, cocoaViewPoint.y, 0.0, 0.0)];
auto cocoaScreenPoint = NSPointFromCGPoint(NSMakePoint(convertRect.origin.x, convertRect.origin.y));
*ret = ConvertPointY(ToAvnPoint(cocoaScreenPoint));
return S_OK;
@ -573,7 +575,8 @@ public:
if(!((nseventType >= NSEventTypeLeftMouseDown && nseventType <= NSEventTypeMouseExited)
|| (nseventType >= NSEventTypeOtherMouseDown && nseventType <= NSEventTypeOtherMouseDragged)))
{
auto nspoint = [Window convertBaseToScreen: ToNSPoint(point)];
NSRect convertRect = [Window convertRectToScreen:NSMakeRect(point.X, point.Y, 0.0, 0.0)];
auto nspoint = NSMakePoint(convertRect.origin.x, convertRect.origin.y);
CGPoint cgpoint = NSPointToCGPoint(nspoint);
auto cgevent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, cgpoint, kCGMouseButtonLeft);
nsevent = [NSEvent eventWithCGEvent: cgevent];

4
packages/Avalonia/Avalonia.csproj

@ -8,7 +8,9 @@
<ProjectReference Include="../../src/Avalonia.Remote.Protocol/Avalonia.Remote.Protocol.csproj" />
<ProjectReference Include="../../src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj" >
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
</ProjectReference>
</ItemGroup>
<PropertyGroup>

3
samples/ControlCatalog.Android/ControlCatalog.Android.csproj

@ -21,8 +21,9 @@
<PropertyGroup Condition="'$(Configuration)'=='Release' and '$(TF_BUILD)' == ''">
<DebugSymbols>True</DebugSymbols>
<RunAOTCompilation>False</RunAOTCompilation>
<RunAOTCompilation>True</RunAOTCompilation>
<EnableLLVM>True</EnableLLVM>
<AndroidEnableProfiledAot>True</AndroidEnableProfiledAot>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

3
samples/ControlCatalog/Pages/DialogsPage.xaml.cs

@ -157,7 +157,8 @@ namespace ControlCatalog.Pages
(button = new Button
{
HorizontalAlignment = HorizontalAlignment.Center,
Content = "Click to close"
Content = "Click to close",
IsDefault = true
})
}
},

16
src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs

@ -2,18 +2,22 @@ using System;
using Android.Content;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Avalonia.Android.Platform.SkiaPlatform;
using Avalonia.Platform;
namespace Avalonia.Android
{
public abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, IPlatformHandle
public abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, IPlatformNativeSurfaceHandle
{
bool _invalidateQueued;
readonly object _lock = new object();
private readonly Handler _handler;
IntPtr IPlatformHandle.Handle =>
AndroidFramebuffer.ANativeWindow_fromSurface(JNIEnv.Handle, Holder.Surface.Handle);
public InvalidationAwareSurfaceView(Context context) : base(context)
{
@ -25,7 +29,7 @@ namespace Avalonia.Android
{
lock (_lock)
{
if(_invalidateQueued)
if (_invalidateQueued)
return;
_handler.Post(() =>
{
@ -70,7 +74,7 @@ namespace Avalonia.Android
public void SurfaceDestroyed(ISurfaceHolder holder)
{
Log.Info("AVALONIA", "Surface Destroyed");
}
protected void DoDraw()
@ -83,5 +87,9 @@ namespace Avalonia.Android
}
protected abstract void Draw();
public string HandleDescriptor => "SurfaceView";
public PixelSize Size => new PixelSize(Holder.SurfaceFrame.Width(), Holder.SurfaceFrame.Height());
public double Scaling => Resources.DisplayMetrics.Density;
}
}

11
src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using Android.Content;
using Android.Graphics;
using Android.Runtime;
using Android.Views;
using Android.Views.InputMethods;
using Avalonia.Android.OpenGL;
@ -38,11 +37,10 @@ namespace Avalonia.Android.Platform.SkiaPlatform
_keyboardHelper = new AndroidKeyboardEventsHelper<TopLevelImpl>(this);
_touchHelper = new AndroidTouchEventsHelper<TopLevelImpl>(this, () => InputRoot,
GetAvaloniaPointFromEvent);
_gl = GlPlatformSurface.TryCreate(this);
_framebuffer = new FramebufferManager(this);
RenderScaling = (int)_view.Resources.DisplayMetrics.Density;
RenderScaling = (int)_view.Scaling;
MaxClientSize = new PixelSize(_view.Resources.DisplayMetrics.WidthPixels,
_view.Resources.DisplayMetrics.HeightPixels).ToSize(RenderScaling);
@ -77,7 +75,7 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public IPlatformHandle Handle => _view;
public IEnumerable<object> Surfaces => new object[] { _gl, _framebuffer };
public IEnumerable<object> Surfaces => new object[] { _gl, _framebuffer, Handle };
public IRenderer CreateRenderer(IRenderRoot root) =>
AndroidPlatform.Options.UseDeferredRendering
@ -216,10 +214,9 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public AcrylicPlatformCompensationLevels AcrylicCompensationLevels => new AcrylicPlatformCompensationLevels(1, 1, 1);
IntPtr EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo.Handle =>
AndroidFramebuffer.ANativeWindow_fromSurface(JNIEnv.Handle, _view.Holder.Surface.Handle);
IntPtr EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo.Handle => ((IPlatformHandle)_view).Handle;
public PixelSize Size => new PixelSize(_view.Holder.SurfaceFrame.Width(), _view.Holder.SurfaceFrame.Height());
public PixelSize Size => _view.Size;
public double Scaling => RenderScaling;

10
src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj

@ -11,12 +11,18 @@
<MSBuildEnableWorkloadResolver>true</MSBuildEnableWorkloadResolver>
<DebugType>portable</DebugType>
</PropertyGroup>
<ItemGroup>
<AndroidResource Include="..\..\..\build\Assets\Icon.png">
<Link>Resources\drawable\Icon.png</Link>
</AndroidResource>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release' and '$(TF_BUILD)' == ''">
<DebugSymbols>True</DebugSymbols>
<RunAOTCompilation>True</RunAOTCompilation>
<EnableLLVM>True</EnableLLVM>
<!--<AndroidEnableProfiledAot>True</AndroidEnableProfiledAot>-->
<AndroidEnableProfiledAot>True</AndroidEnableProfiledAot>
</PropertyGroup>
<ItemGroup>

52
src/Android/Avalonia.AndroidTestApplication/MainActivity.cs

@ -1,9 +1,10 @@
using System;
using Android.App;
using Android.Content.PM;
using Android.OS;
using Avalonia.Android;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Input.TextInput;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Styling;
@ -14,22 +15,15 @@ namespace Avalonia.AndroidTestApplication
[Activity(Label = "Main",
MainLauncher = true,
Icon = "@drawable/icon",
Theme = "@style/Theme.AppCompat.NoActionBar",
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize,
Theme = "@style/Theme.AppCompat.NoActionBar",
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize,
LaunchMode = LaunchMode.SingleInstance/*,
ScreenOrientation = ScreenOrientation.Landscape*/)]
public class MainBaseActivity : AvaloniaActivity
public class MainActivity : AvaloniaActivity<App>
{
protected override void OnCreate(Bundle savedInstanceState)
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
if (Avalonia.Application.Current == null)
{
AppBuilder.Configure<App>()
.UseAndroid()
.SetupWithoutStarting();
}
base.OnCreate(savedInstanceState);
Content = App.CreateSimpleWindow();
return base.CustomizeAppBuilder(builder);
}
}
@ -37,13 +31,17 @@ namespace Avalonia.AndroidTestApplication
{
public override void Initialize()
{
Styles.Add(new DefaultTheme());
var baseLight = (IStyle)AvaloniaXamlLoader.Load(
new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"));
Styles.Add(baseLight);
Styles.Add(new SimpleTheme(new Uri("avares://Avalonia.AndroidTestApplication")));
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime)
{
singleViewLifetime.MainView = CreateSimpleWindow();
}
base.OnFrameworkInitializationCompleted();
}
// This provides a simple UI tree for testing input handling, drawing, etc
@ -76,12 +74,12 @@ namespace Avalonia.AndroidTestApplication
Foreground = Brushes.Black
},
CreateTextBox(Input.TextInput.TextInputContentType.Normal),
CreateTextBox(Input.TextInput.TextInputContentType.Password),
CreateTextBox(Input.TextInput.TextInputContentType.Email),
CreateTextBox(Input.TextInput.TextInputContentType.Url),
CreateTextBox(Input.TextInput.TextInputContentType.Phone),
CreateTextBox(Input.TextInput.TextInputContentType.Number),
CreateTextBox(TextInputContentType.Normal),
CreateTextBox(TextInputContentType.Password),
CreateTextBox(TextInputContentType.Email),
CreateTextBox(TextInputContentType.Url),
CreateTextBox(TextInputContentType.Digits),
CreateTextBox(TextInputContentType.Number),
}
}
};
@ -89,16 +87,16 @@ namespace Avalonia.AndroidTestApplication
return window;
}
private static TextBox CreateTextBox(Input.TextInput.TextInputContentType contentType)
private static TextBox CreateTextBox(TextInputContentType contentType)
{
var textBox = new TextBox()
{
Margin = new Thickness(20, 10),
Watermark = contentType.ToString(),
BorderThickness = new Thickness(3),
FontSize = 20
FontSize = 20,
[TextInputOptions.ContentTypeProperty] = contentType
};
textBox.TextInputOptionsQuery += (s, e) => { e.ContentType = contentType; };
return textBox;
}

2
src/Avalonia.Controls/Button.cs

@ -539,6 +539,7 @@ namespace Avalonia.Controls
if (e.Key == Key.Enter && IsVisible && IsEnabled)
{
OnClick();
e.Handled = true;
}
}
@ -552,6 +553,7 @@ namespace Avalonia.Controls
if (e.Key == Key.Escape && IsVisible && IsEnabled)
{
OnClick();
e.Handled = true;
}
}

10
src/Avalonia.Controls/Platform/IPlatformNativeSurfaceHandle.cs

@ -0,0 +1,10 @@
using System;
namespace Avalonia.Platform
{
public interface IPlatformNativeSurfaceHandle : IPlatformHandle
{
PixelSize Size { get; }
double Scaling { get; }
}
}

5
src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs

@ -41,5 +41,10 @@ namespace Avalonia.Diagnostics
/// <remarks>Default handler is <see cref="Screenshots.FilePickerHandler"/></remarks>
public IScreenshotHandler ScreenshotHandler { get; set; }
= Convetions.DefaultScreenshotHandler;
/// <summary>
/// Gets or sets whether DevTools should use the dark mode theme
/// </summary>
public bool UseDarkMode { get; set; }
}
}

2
src/Avalonia.Diagnostics/Diagnostics/Views/LayoutExplorerView.axaml

@ -15,6 +15,7 @@
<SolidColorBrush x:Key="PaddingHighlightBrush" Color="#CEDA8E" />
<SolidColorBrush x:Key="SizeBackgroundBrush" Color="#88B2BD" />
<SolidColorBrush x:Key="SizeHighlightBrush" Color="#9ED0DC" />
<SolidColorBrush x:Key="ThicknessEditorForeground" Color="Black" />
</UserControl.Resources>
<Grid RowDefinitions="*,Auto">
@ -46,6 +47,7 @@
<controls:ThicknessEditor Grid.Row="0" Grid.Column="0" Header="margin" VerticalAlignment="Top"
HorizontalAlignment="Center"
TextBlock.Foreground="{StaticResource ThicknessEditorForeground}"
Background="{StaticResource MarginBackgroundBrush}"
Highlight="{StaticResource MarginHighlightBrush}"
Thickness="{Binding MarginThickness}">

13
src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs

@ -11,6 +11,7 @@ using Avalonia.Input;
using Avalonia.Input.Raw;
using Avalonia.Markup.Xaml;
using Avalonia.Styling;
using Avalonia.Themes.Default;
using Avalonia.VisualTree;
namespace Avalonia.Diagnostics.Views
@ -242,7 +243,17 @@ namespace Avalonia.Diagnostics.Views
private void RootClosed(object? sender, EventArgs e) => Close();
public void SetOptions(DevToolsOptions options) =>
public void SetOptions(DevToolsOptions options)
{
(DataContext as MainViewModel)?.SetOptions(options);
if (options.UseDarkMode)
{
if (Styles[0] is SimpleTheme st)
{
st.Mode = SimpleThemeMode.Dark;
}
}
}
}
}

2
src/Avalonia.MicroCom/Avalonia.MicroCom.csproj

@ -10,6 +10,8 @@
<ProjectReference Include="..\Avalonia.Build.Tasks\Avalonia.Build.Tasks.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<ExcludeAssets>all</ExcludeAssets>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
</ProjectReference>
</ItemGroup>
<Import Project="..\..\build\BuildTargets.targets" />

2
src/Avalonia.Themes.Default/Controls/ToggleSwitch.xaml

@ -254,7 +254,7 @@
<Style Selector="ToggleSwitch:disabled /template/ Border#OuterBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffDisabled}"/>
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffPressed}"/>
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffDisabled}"/>
</Style>
<Style Selector="ToggleSwitch:disabled /template/ Ellipse#SwitchKnobOff">

4
src/Avalonia.Themes.Default/DefaultTheme.xaml

@ -3,8 +3,9 @@
x:Class="Avalonia.Themes.Default.DefaultTheme">
<!-- Define ToolTip first so its styles can be overriden by other controls (e.g. TextBox) -->
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ToolTip.xaml"/>
<!-- PathIcon also needs to be defined early so it can be overriden by other styles (e.g. ComboBox) -->
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/PathIcon.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/DataValidationErrors.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/FocusAdorner.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Button.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Carousel.xaml"/>
@ -22,7 +23,6 @@
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ContextMenu.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/MenuItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/OverlayPopupHost.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/PathIcon.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/PopupRoot.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ProgressBar.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/RadioButton.xaml"/>

3
src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml

@ -3,6 +3,8 @@
x:Class="Avalonia.Themes.Fluent.Controls.FluentControls">
<!-- Define ToolTip first so its styles can be overriden by other controls (e.g. TextBox) -->
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ToolTip.xaml"/>
<!-- PathIcon also needs to be defined early so it can be overriden by other styles (e.g. ComboBox) -->
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/PathIcon.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Button.xaml"/>
@ -21,7 +23,6 @@
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ContextMenu.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/MenuItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/PathIcon.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/PopupRoot.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ProgressBar.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/RadioButton.xaml"/>

2
src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml

@ -220,7 +220,7 @@
<Style Selector="ToggleSwitch:disabled /template/ Border#OuterBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffDisabled}"/>
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffPressed}"/>
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffDisabled}"/>
</Style>
<Style Selector="ToggleSwitch:disabled /template/ Ellipse#SwitchKnobOff">

26
src/Avalonia.X11/X11Window.cs

@ -134,8 +134,8 @@ namespace Avalonia.X11
SetWindowValuemask.WinGravity | SetWindowValuemask.BackingStore)), ref attr);
else
_renderHandle = _handle;
Handle = new PlatformHandle(_handle, "XID");
Handle = new SurfacePlatformHandle(this);
_realSize = new PixelSize(defaultWidth, defaultHeight);
platform.Windows[_handle] = OnEvent;
XEventMask ignoredMask = XEventMask.SubstructureRedirectMask
@ -169,7 +169,9 @@ namespace Avalonia.X11
if (glx != null)
surfaces.Insert(0, new GlxGlPlatformSurface(glx.Display, glx.DeferredContext,
new SurfaceInfo(this, _x11.Display, _handle, _renderHandle)));
surfaces.Add(Handle);
Surfaces = surfaces.ToArray();
UpdateMotifHints();
UpdateSizeHints(null);
@ -1142,5 +1144,23 @@ namespace Avalonia.X11
public AcrylicPlatformCompensationLevels AcrylicCompensationLevels { get; } = new AcrylicPlatformCompensationLevels(1, 0.8, 0.8);
public bool NeedsManagedDecorations => false;
public class SurfacePlatformHandle : IPlatformNativeSurfaceHandle
{
private readonly X11Window _owner;
public PixelSize Size => _owner.ToPixelSize(_owner.ClientSize);
public double Scaling => _owner.RenderScaling;
public SurfacePlatformHandle(X11Window owner)
{
_owner = owner;
}
public IntPtr Handle => _owner._renderHandle;
public string? HandleDescriptor => "XID";
}
}
}

8
src/Windows/Avalonia.Win32/WindowImpl.cs

@ -459,7 +459,7 @@ namespace Avalonia.Win32
}
}
public IEnumerable<object> Surfaces => new object[] { Handle, _gl, _framebuffer };
public IEnumerable<object> Surfaces => new object[] { (IPlatformNativeSurfaceHandle)Handle, _gl, _framebuffer };
public PixelPoint Position
{
@ -1383,12 +1383,16 @@ namespace Avalonia.Win32
public ITextInputMethodImpl TextInputMethod => Imm32InputMethod.Current;
private class WindowImplPlatformHandle : IPlatformHandle
private class WindowImplPlatformHandle : IPlatformNativeSurfaceHandle
{
private readonly WindowImpl _owner;
public WindowImplPlatformHandle(WindowImpl owner) => _owner = owner;
public IntPtr Handle => _owner.Hwnd;
public string HandleDescriptor => PlatformConstants.WindowHandleType;
public PixelSize Size => PixelSize.FromSize(_owner.ClientSize, Scaling);
public double Scaling => _owner.RenderScaling;
}
}
}

Loading…
Cancel
Save