Browse Source

Merge branch 'master' into fixes/less-warnings

fixes/less-warnings
Steven Kirk 5 years ago
parent
commit
e9ccc1b4db
  1. 8
      native/Avalonia.Native/src/OSX/window.mm
  2. 28
      src/Avalonia.Base/Data/BindingOperations.cs
  3. 5
      src/Avalonia.Base/Reactive/AvaloniaPropertyObservable.cs
  4. 2
      src/Avalonia.Dialogs/ManagedFileChooserSources.cs

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

@ -2068,17 +2068,17 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
-(void)becomeKeyWindow -(void)becomeKeyWindow
{ {
[self showWindowMenuWithAppMenu];
if([self activateAppropriateChild: true]) if([self activateAppropriateChild: true])
{ {
[self showWindowMenuWithAppMenu];
if(_parent != nullptr) if(_parent != nullptr)
{ {
_parent->BaseEvents->Activated(); _parent->BaseEvents->Activated();
} }
[super becomeKeyWindow];
} }
[super becomeKeyWindow];
} }
-(void) restoreParentWindow; -(void) restoreParentWindow;

28
src/Avalonia.Base/Data/BindingOperations.cs

@ -45,7 +45,7 @@ namespace Avalonia.Data
case BindingMode.OneWay: case BindingMode.OneWay:
return target.Bind(property, binding.Observable ?? binding.Subject, binding.Priority); return target.Bind(property, binding.Observable ?? binding.Subject, binding.Priority);
case BindingMode.TwoWay: case BindingMode.TwoWay:
return new CompositeDisposable( return new TwoWayBindingDisposable(
target.Bind(property, binding.Subject, binding.Priority), target.Bind(property, binding.Subject, binding.Priority),
target.GetObservable(property).Subscribe(binding.Subject)); target.GetObservable(property).Subscribe(binding.Subject));
case BindingMode.OneTime: case BindingMode.OneTime:
@ -88,6 +88,32 @@ namespace Avalonia.Data
throw new ArgumentException("Invalid binding mode."); throw new ArgumentException("Invalid binding mode.");
} }
} }
private sealed class TwoWayBindingDisposable : IDisposable
{
private readonly IDisposable _first;
private readonly IDisposable _second;
private bool _isDisposed;
public TwoWayBindingDisposable(IDisposable first, IDisposable second)
{
_first = first;
_second = second;
}
public void Dispose()
{
if (_isDisposed)
{
return;
}
_first.Dispose();
_second.Dispose();
_isDisposed = true;
}
}
} }
public sealed class DoNothingType public sealed class DoNothingType

5
src/Avalonia.Base/Reactive/AvaloniaPropertyObservable.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
namespace Avalonia.Reactive namespace Avalonia.Reactive
{ {
@ -55,9 +56,9 @@ namespace Avalonia.Reactive
newValue = (T)e.Sender.GetValue(e.Property); newValue = (T)e.Sender.GetValue(e.Property);
} }
if (!Equals(newValue, _value)) if (!EqualityComparer<T>.Default.Equals(newValue, _value))
{ {
_value = (T)newValue; _value = newValue;
PublishNext(_value); PublishNext(_value);
} }
} }

2
src/Avalonia.Dialogs/ManagedFileChooserSources.cs

@ -67,7 +67,7 @@ namespace Avalonia.Dialogs
{ {
Directory.GetFiles(x.VolumePath); Directory.GetFiles(x.VolumePath);
} }
catch (UnauthorizedAccessException) catch (Exception)
{ {
return null; return null;
} }

Loading…
Cancel
Save