Browse Source

Merge branch 'master' into x11-remove-transient-hint

pull/3712/head
danwalmsley 7 years ago
committed by GitHub
parent
commit
ad2a700450
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      samples/ControlCatalog/MainView.xaml.cs
  2. 6
      src/Avalonia.Controls/Remote/RemoteWidget.cs

7
samples/ControlCatalog/MainView.xaml.cs

@ -60,8 +60,8 @@ namespace ControlCatalog
var decorations = this.Find<ComboBox>("Decorations"); var decorations = this.Find<ComboBox>("Decorations");
decorations.SelectionChanged += (sender, e) => decorations.SelectionChanged += (sender, e) =>
{ {
Window window = (Window)VisualRoot; if (VisualRoot is Window window)
window.SystemDecorations = (SystemDecorations)decorations.SelectedIndex; window.SystemDecorations = (SystemDecorations)decorations.SelectedIndex;
}; };
} }
@ -69,7 +69,8 @@ namespace ControlCatalog
{ {
base.OnAttachedToVisualTree(e); base.OnAttachedToVisualTree(e);
var decorations = this.Find<ComboBox>("Decorations"); var decorations = this.Find<ComboBox>("Decorations");
decorations.SelectedIndex = (int)((Window)VisualRoot).SystemDecorations; if (VisualRoot is Window window)
decorations.SelectedIndex = (int)window.SystemDecorations;
} }
} }
} }

6
src/Avalonia.Controls/Remote/RemoteWidget.cs

@ -75,7 +75,11 @@ namespace Avalonia.Controls.Remote
var fmt = (PixelFormat) _lastFrame.Format; var fmt = (PixelFormat) _lastFrame.Format;
if (_bitmap == null || _bitmap.PixelSize.Width != _lastFrame.Width || if (_bitmap == null || _bitmap.PixelSize.Width != _lastFrame.Width ||
_bitmap.PixelSize.Height != _lastFrame.Height) _bitmap.PixelSize.Height != _lastFrame.Height)
_bitmap = new WriteableBitmap(new PixelSize(_lastFrame.Width, _lastFrame.Height), new Vector(96, 96), fmt); {
_bitmap?.Dispose();
_bitmap = new WriteableBitmap(new PixelSize(_lastFrame.Width, _lastFrame.Height),
new Vector(96, 96), fmt);
}
using (var l = _bitmap.Lock()) using (var l = _bitmap.Lock())
{ {
var lineLen = (fmt == PixelFormat.Rgb565 ? 2 : 4) * _lastFrame.Width; var lineLen = (fmt == PixelFormat.Rgb565 ? 2 : 4) * _lastFrame.Width;

Loading…
Cancel
Save