Skip to content

Commit d428185

Browse files
committed
Merge remote-tracking branch 'origin/feature/FormattedTextPort' into feature/FormattedTextPort
2 parents ea11348 + 06861a0 commit d428185

File tree

13 files changed

+262
-133
lines changed

13 files changed

+262
-133
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
inputs:
5252
actions: 'build'
5353
scheme: ''
54-
sdk: 'macosx11.0'
54+
sdk: 'macosx11.1'
5555
configuration: 'Release'
5656
xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace'
5757
xcodeVersion: '12' # Options: 8, 9, default, specifyPath

build/SharedVersion.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup Label="PackageIcon">
24-
<None Include="$(MSBuildThisFileDirectory)/Assets/Icon.png" Pack="true" PackagePath=""/>
24+
<None Include="$(MSBuildThisFileDirectory)/Assets/Icon.png" Pack="true" Visible="false" PackagePath=""/>
2525
</ItemGroup>
2626
</Project>

native/Avalonia.Native/src/OSX/rendertarget.mm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ -(void) dealloc
111111
if(_renderbuffer != 0)
112112
glDeleteRenderbuffers(1, &_renderbuffer);
113113
}
114-
CFRelease(surface);
114+
115+
if(surface != nullptr)
116+
{
117+
CFRelease(surface);
118+
}
115119
}
116120
@end
117121

@@ -145,6 +149,12 @@ - (CALayer *)layer {
145149
}
146150

147151
- (void)resize:(AvnPixelSize)size withScale: (float) scale{
152+
153+
if(size.Height <= 0)
154+
size.Height = 1;
155+
if(size.Width <= 0)
156+
size.Width = 1;
157+
148158
@synchronized (lock) {
149159
if(surface == nil
150160
|| surface->size.Width != size.Width

src/Avalonia.Controls.DataGrid/DataGrid.cs

Lines changed: 54 additions & 53 deletions
Large diffs are not rendered by default.

src/Avalonia.Controls.DataGrid/Utils/ValidationUtil.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,24 @@ public static IEnumerable<Exception> UnpackException(Exception exception)
8080
{
8181
if (exception != null)
8282
{
83-
var aggregate = exception as AggregateException;
84-
var exceptions = aggregate == null ?
85-
(IEnumerable<Exception>)new[] { exception } :
86-
aggregate.InnerExceptions;
87-
var filtered = exceptions.Where(x => !(x is BindingChainException)).ToList();
83+
var exceptions = exception is AggregateException aggregate ?
84+
aggregate.InnerExceptions :
85+
(IEnumerable<Exception>)new[] { exception };
8886

89-
if (filtered.Count > 0)
90-
{
91-
return filtered;
92-
}
87+
return exceptions.Where(x => !(x is BindingChainException)).ToList();
9388
}
9489

95-
return null;
90+
return Array.Empty<Exception>();
91+
}
92+
93+
public static object UnpackDataValidationException(Exception exception)
94+
{
95+
if (exception is DataValidationException dataValidationException)
96+
{
97+
return dataValidationException.ErrorData;
98+
}
99+
100+
return exception;
96101
}
97102

98103
/// <summary>

src/Avalonia.Controls/ContextMenu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T>
246246
/// <summary>
247247
/// Opens the menu.
248248
/// </summary>
249-
public override void Open() => throw new NotSupportedException();
249+
public override void Open() => Open(null);
250250

251251
/// <summary>
252252
/// Opens a context menu on the specified control.

src/Avalonia.Layout/ElementManager.cs

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void ClearRealizedRange(int realizedIndex, int count)
129129
{
130130
for (int i = 0; i < count; i++)
131131
{
132-
// Clear from the edges so that ItemsRepeater can optimize on maintaining
132+
// Clear from the edges so that ItemsRepeater can optimize on maintaining
133133
// realized indices without walking through all the children every time.
134134
int index = realizedIndex == 0 ? realizedIndex + i : (realizedIndex + count - 1) - i;
135135
var elementRef = _realizedElements[index];
@@ -212,7 +212,7 @@ public bool IsDataIndexRealized(int index)
212212
public ILayoutable GetRealizedElement(int dataIndex)
213213
{
214214
return IsVirtualizingContext ?
215-
GetAt(GetRealizedRangeIndexFromDataIndex(dataIndex)) :
215+
GetAt(GetRealizedRangeIndexFromDataIndex(dataIndex)) :
216216
_context.GetOrCreateElementAt(
217217
dataIndex,
218218
ElementRealizationOptions.ForceCreate | ElementRealizationOptions.SuppressAutoRecycle);
@@ -252,7 +252,6 @@ public bool IsWindowConnected(in Rect window, ScrollOrientation orientation, boo
252252
(orientation == ScrollOrientation.Vertical ? ScrollOrientation.Horizontal : ScrollOrientation.Vertical) :
253253
orientation;
254254

255-
256255
var windowStart = effectiveOrientation == ScrollOrientation.Vertical ? window.Y : window.X;
257256
var windowEnd = effectiveOrientation == ScrollOrientation.Vertical ? window.Y + window.Height : window.X + window.Width;
258257
var firstElementStart = effectiveOrientation == ScrollOrientation.Vertical ? firstElementBounds.Y : firstElementBounds.X;
@@ -273,53 +272,53 @@ public void DataSourceChanged(object source, NotifyCollectionChangedEventArgs ar
273272
switch (args.Action)
274273
{
275274
case NotifyCollectionChangedAction.Add:
276-
{
277-
OnItemsAdded(args.NewStartingIndex, args.NewItems.Count);
278-
}
279-
break;
275+
{
276+
OnItemsAdded(args.NewStartingIndex, args.NewItems.Count);
277+
}
278+
break;
280279

281280
case NotifyCollectionChangedAction.Replace:
282-
{
283-
int oldSize = args.OldItems.Count;
284-
int newSize = args.NewItems.Count;
285-
int oldStartIndex = args.OldStartingIndex;
286-
int newStartIndex = args.NewStartingIndex;
287-
288-
if (oldSize == newSize &&
289-
oldStartIndex == newStartIndex &&
290-
IsDataIndexRealized(oldStartIndex) &&
291-
IsDataIndexRealized(oldStartIndex + oldSize -1))
292281
{
293-
// Straight up replace of n items within the realization window.
294-
// Removing and adding might causes us to lose the anchor causing us
295-
// to throw away all containers and start from scratch.
296-
// Instead, we can just clear those items and set the element to
297-
// null (sentinel) and let the next measure get new containers for them.
298-
var startRealizedIndex = GetRealizedRangeIndexFromDataIndex(oldStartIndex);
299-
for (int realizedIndex = startRealizedIndex; realizedIndex < startRealizedIndex + oldSize; realizedIndex++)
282+
int oldSize = args.OldItems.Count;
283+
int newSize = args.NewItems.Count;
284+
int oldStartIndex = args.OldStartingIndex;
285+
int newStartIndex = args.NewStartingIndex;
286+
287+
if (oldSize == newSize &&
288+
oldStartIndex == newStartIndex &&
289+
IsDataIndexRealized(oldStartIndex) &&
290+
IsDataIndexRealized(oldStartIndex + oldSize - 1))
300291
{
301-
var elementRef = _realizedElements[realizedIndex];
302-
303-
if (elementRef != null)
292+
// Straight up replace of n items within the realization window.
293+
// Removing and adding might causes us to lose the anchor causing us
294+
// to throw away all containers and start from scratch.
295+
// Instead, we can just clear those items and set the element to
296+
// null (sentinel) and let the next measure get new containers for them.
297+
var startRealizedIndex = GetRealizedRangeIndexFromDataIndex(oldStartIndex);
298+
for (int realizedIndex = startRealizedIndex; realizedIndex < startRealizedIndex + oldSize; realizedIndex++)
304299
{
305-
_context.RecycleElement(elementRef);
306-
_realizedElements[realizedIndex] = null;
300+
var elementRef = _realizedElements[realizedIndex];
301+
302+
if (elementRef != null)
303+
{
304+
_context.RecycleElement(elementRef);
305+
_realizedElements[realizedIndex] = null;
306+
}
307307
}
308308
}
309+
else
310+
{
311+
OnItemsRemoved(oldStartIndex, oldSize);
312+
OnItemsAdded(newStartIndex, newSize);
313+
}
309314
}
310-
else
311-
{
312-
OnItemsRemoved(oldStartIndex, oldSize);
313-
OnItemsAdded(newStartIndex, newSize);
314-
}
315-
}
316-
break;
315+
break;
317316

318317
case NotifyCollectionChangedAction.Remove:
319-
{
320-
OnItemsRemoved(args.OldStartingIndex, args.OldItems.Count);
321-
}
322-
break;
318+
{
319+
OnItemsRemoved(args.OldStartingIndex, args.OldItems.Count);
320+
}
321+
break;
323322

324323
case NotifyCollectionChangedAction.Reset:
325324
ClearRealizedRange();
@@ -376,7 +375,7 @@ private void DiscardElementsOutsideWindow(in Rect window, ScrollOrientation orie
376375
int backCutoffIndex = realizedRangeSize;
377376

378377
for (int i = 0;
379-
i<realizedRangeSize &&
378+
i < realizedRangeSize &&
380379
!Intersects(window, _realizedElementLayoutBounds[i], orientation);
381380
++i)
382381
{
@@ -391,7 +390,7 @@ private void DiscardElementsOutsideWindow(in Rect window, ScrollOrientation orie
391390
--backCutoffIndex;
392391
}
393392

394-
if (backCutoffIndex<realizedRangeSize - 1)
393+
if (backCutoffIndex < realizedRangeSize - 1)
395394
{
396395
ClearRealizedRange(backCutoffIndex + 1, realizedRangeSize - backCutoffIndex - 1);
397396
}
@@ -419,14 +418,14 @@ private void OnItemsAdded(int index, int count)
419418
// to insert items.
420419
int lastRealizedDataIndex = _firstRealizedDataIndex + GetRealizedElementCount() - 1;
421420
int newStartingIndex = index;
422-
if (newStartingIndex > _firstRealizedDataIndex &&
421+
if (newStartingIndex >= _firstRealizedDataIndex &&
423422
newStartingIndex <= lastRealizedDataIndex)
424423
{
425424
// Inserted within the realized range
426425
int insertRangeStartIndex = newStartingIndex - _firstRealizedDataIndex;
427426
for (int i = 0; i < count; i++)
428427
{
429-
// Insert null (sentinel) here instead of an element, that way we dont
428+
// Insert null (sentinel) here instead of an element, that way we dont
430429
// end up creating a lot of elements only to be thrown out in the next layout.
431430
int insertRangeIndex = insertRangeStartIndex + i;
432431
int dataIndex = newStartingIndex + i;

src/Avalonia.Themes.Fluent/Controls/Expander.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
</Setter>
109109
</Style>
110110
<Style Selector="Expander /template/ ToggleButton#PART_toggle:pointerover /template/ Border">
111-
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlTransientBorderBrush}" />
111+
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlHighlightBaseMediumBrush}" />
112112
</Style>
113113
<Style Selector="Expander:down:expanded /template/ ToggleButton#PART_toggle /template/ Path">
114114
<Setter Property="RenderTransform">

src/Avalonia.X11/X11Atoms.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ internal class X11Atoms
114114
public readonly IntPtr XA_WM_CLASS = (IntPtr)67;
115115
public readonly IntPtr XA_WM_TRANSIENT_FOR = (IntPtr)68;
116116

117+
public readonly IntPtr RR_PROPERTY_RANDR_EDID = (IntPtr)82;
118+
117119
public readonly IntPtr WM_PROTOCOLS;
118120
public readonly IntPtr WM_DELETE_WINDOW;
119121
public readonly IntPtr WM_TAKE_FOCUS;

0 commit comments

Comments
 (0)