before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
[TypeConverter(typeof(EasingTypeConverter))]
public abstract class Easing : IEasing
{
/// <inheritdoc/>
public abstract double Ease(double progress);
static Dictionary<string, Type> _easingTypes;
static readonly Type s_thisType = typeof(Easing);
/// <summary>
... | I think this could be written in less copy paste reliant way, since you already have copy paste errors below (every exception message after the first one is wrong). | [TypeConverter(typeof(EasingTypeConverter))]
public abstract class Easing : IEasing
{
/// <inheritdoc/>
public abstract double Ease(double progress);
static Dictionary<string, Type> _easingTypes;
static readonly Type s_thisType = typeof(Easing);
/// <summary>
... | @@ -25,6 +26,37 @@ public abstract class Easing : IEasing
/// <returns>Returns the instance of the parsed type.</returns>
public static Easing Parse(string e)
{
+ if (e.Contains(','))
+ {
+ var k = e.Split(',');
+
+ if (k.Count() != 4)
+ ... | src/Avalonia.Animation/Easing/Easing.cs | 26 | C# | 0.571 | bug | 164 | 51 | 49 | false | Spline easing | 4,180 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | jmacato | Review this pull request change.
Language: C#
File: src/Avalonia.Animation/Easing/Easing.cs
PR Title: Spline easing
BEFORE CODE: [TypeConverter(typeof(EasingTypeConverter))]
public abstract class Easing : IEasing
{
/// <inheritdoc/>
public abstract double Ease(double progress);
... | I think this could be written in less copy paste reliant way, since you already have copy paste errors below (every exception message after the first one is wrong). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
pu... | I guess we need to setup coding guidelines since this line is using two styles combined (`_` to avoid name clashes with parameter names, but you have `this` anyway). | namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
//... | @@ -0,0 +1,85 @@
+namespace Avalonia.Animation.Easings
+{
+ /// <summary>
+ /// Eases a <see cref="double"/> value
+ /// using a user-defined cubic bezier curve.
+ /// Good for custom easing functions that doesn't quite
+ /// fit with the built-in ones.
+ /// </summary>
+ public class SplineEasing... | src/Avalonia.Animation/Easing/SplineEasing.cs | 13 | C# | 0.571 | style | 165 | 38 | 38 | false | Spline easing | 4,180 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | jmacato | Review this pull request change.
Language: C#
File: src/Avalonia.Animation/Easing/SplineEasing.cs
PR Title: Spline easing
BEFORE CODE: namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing f... | I guess we need to setup coding guidelines since this line is using two styles combined (`_` to avoid name clashes with parameter names, but you have `this` anyway). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
pu... | I think fields are usually declared before ctors in our codebase. | namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
//... | @@ -0,0 +1,85 @@
+namespace Avalonia.Animation.Easings
+{
+ /// <summary>
+ /// Eases a <see cref="double"/> value
+ /// using a user-defined cubic bezier curve.
+ /// Good for custom easing functions that doesn't quite
+ /// fit with the built-in ones.
+ /// </summary>
+ public class SplineEasing... | src/Avalonia.Animation/Easing/SplineEasing.cs | 25 | C# | 0.214 | suggestion | 65 | 50 | 50 | false | Spline easing | 4,180 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | jmacato | Review this pull request change.
Language: C#
File: src/Avalonia.Animation/Easing/SplineEasing.cs
PR Title: Spline easing
BEFORE CODE: namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing f... | I think fields are usually declared before ctors in our codebase. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
pu... | I also wonder if we need dedicated storage for the control points since you might as well just use `KeySpline` members to save memory. | namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
//... | @@ -0,0 +1,85 @@
+namespace Avalonia.Animation.Easings
+{
+ /// <summary>
+ /// Eases a <see cref="double"/> value
+ /// using a user-defined cubic bezier curve.
+ /// Good for custom easing functions that doesn't quite
+ /// fit with the built-in ones.
+ /// </summary>
+ public class SplineEasing... | src/Avalonia.Animation/Easing/SplineEasing.cs | 19 | C# | 0.714 | suggestion | 134 | 44 | 44 | false | Spline easing | 4,180 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | jmacato | Review this pull request change.
Language: C#
File: src/Avalonia.Animation/Easing/SplineEasing.cs
PR Title: Spline easing
BEFORE CODE: namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing f... | I also wonder if we need dedicated storage for the control points since you might as well just use `KeySpline` members to save memory. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
pu... | `_internalKeySpline` can be `readonly` as well. | namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
//... | @@ -0,0 +1,85 @@
+namespace Avalonia.Animation.Easings
+{
+ /// <summary>
+ /// Eases a <see cref="double"/> value
+ /// using a user-defined cubic bezier curve.
+ /// Good for custom easing functions that doesn't quite
+ /// fit with the built-in ones.
+ /// </summary>
+ public class SplineEasing... | src/Avalonia.Animation/Easing/SplineEasing.cs | 25 | C# | 0.214 | suggestion | 47 | 50 | 50 | false | Spline easing | 4,180 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | jmacato | Review this pull request change.
Language: C#
File: src/Avalonia.Animation/Easing/SplineEasing.cs
PR Title: Spline easing
BEFORE CODE: namespace Avalonia.Animation.Easings
{
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing f... | `_internalKeySpline` can be `readonly` as well. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
public SplineEasing()
{
... | I find this mighty confusing that certain values are defined here, and some are passed with that all default value ctor (which you can't even call easily call as `new SplineEasing()` invokes parameterless one). | /// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit with the built-in ones.
/// </summary>
public class SplineEasing : Easing
{
/// <summary>
/// X coordinate of... | @@ -0,0 +1,85 @@
+namespace Avalonia.Animation.Easings
+{
+ /// <summary>
+ /// Eases a <see cref="double"/> value
+ /// using a user-defined cubic bezier curve.
+ /// Good for custom easing functions that doesn't quite
+ /// fit with the built-in ones.
+ /// </summary>
+ public class SplineEasing... | src/Avalonia.Animation/Easing/SplineEasing.cs | 26 | C# | 0.571 | suggestion | 210 | 51 | 51 | false | Spline easing | 4,180 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | jmacato | Review this pull request change.
Language: C#
File: src/Avalonia.Animation/Easing/SplineEasing.cs
PR Title: Spline easing
BEFORE CODE: /// <summary>
/// Eases a <see cref="double"/> value
/// using a user-defined cubic bezier curve.
/// Good for custom easing functions that doesn't quite
/// fit... | I find this mighty confusing that certain values are defined here, and some are passed with that all default value ctor (which you can't even call easily call as `new SplineEasing()` invokes parameterless one). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// Returns a new binding value with the specified value.
/// </summary>
/// <param name="value">The new value.</param>
/// <returns>The new binding value.</returns>
/// <exception cref="InvalidOperationException">
/// The binding type is <see cref=... | I think these warnings would be better fixed with the `[return: MaybeNull]` attribute. | }
/// <summary>
/// Returns a new binding value with the specified value.
/// </summary>
/// <param name="value">The new value.</param>
/// <returns>The new binding value.</returns>
/// <exception cref="InvalidOperationException">
/// The binding type is ... | @@ -190,7 +190,7 @@ public BindingValue<T> WithValue(T value)
/// Gets the value of the binding value if present, otherwise the default value.
/// </summary>
/// <returns>The value.</returns>
- public T GetValueOrDefault() => HasValue ? _value : default;
+ public T GetValueOrDef... | src/Avalonia.Base/Data/BindingValue.cs | 26 | C# | 0.571 | suggestion | 86 | 51 | 51 | false | Remove warnings from Avalonia.Base | 4,182 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | MarchingCube | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Data/BindingValue.cs
PR Title: Remove warnings from Avalonia.Base
BEFORE CODE:
/// <summary>
/// Returns a new binding value with the specified value.
/// </summary>
/// <param name="value">The new value.</param>
... | I think these warnings would be better fixed with the `[return: MaybeNull]` attribute. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
this T builder)
where T : AppBuilderBase<T>, new()
{
return builder.UseWindowingSubsystem(
() => Win32.Win32Platform.Initialize(
AvaloniaLocator.Current.GetService<Win32PlatformOptions>() ?? new Win32PlatformOptions()),
... | ```suggestion
/// Enables ANGLE for Windows. For every Windows version that is above Windows 7, the default is true otherwise it's false.
``` | this T builder)
where T : AppBuilderBase<T>, new()
{
return builder.UseWindowingSubsystem(
() => Win32.Win32Platform.Initialize(
AvaloniaLocator.Current.GetService<Win32PlatformOptions>() ?? new Win32PlatformOptions()),
... | @@ -35,15 +35,46 @@ public static class Win32ApplicationExtensions
}
}
+ /// <summary>
+ /// Platform-specific options which apply to Windows.
+ /// </summary>
public class Win32PlatformOptions
{
+ /// <summary>
+ /// Deferred renderer would be used on Windows when set t... | src/Windows/Avalonia.Win32/Win32Platform.cs | 26 | C# | 0.714 | suggestion | 151 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/Win32Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: this T builder)
where T : AppBuilderBase<T>, new()
{
return builder.UseWindowingSubsystem(
... | ```suggestion
/// Enables ANGLE for Windows. For every Windows version that is above Windows 7, the default is true otherwise it's false.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
namespace Avalonia
{
public static class Win32ApplicationExtensions
{
public static T UseWin32<T>(
this T builder)
where T : AppBuilderBase<T>, new()
{
return builder.UseWindowingSubsystem(
() => Win32.Win32Platform.Initialize(
... | ```suggestion
/// Avalonia has two rendering modes: Immediate and Deferred rendering.
``` |
namespace Avalonia
{
public static class Win32ApplicationExtensions
{
public static T UseWin32<T>(
this T builder)
where T : AppBuilderBase<T>, new()
{
return builder.UseWindowingSubsystem(
() => Win32.Win32Platform.Initialize(
... | @@ -35,15 +35,46 @@ public static class Win32ApplicationExtensions
}
}
+ /// <summary>
+ /// Platform-specific options which apply to Windows.
+ /// </summary>
public class Win32PlatformOptions
{
+ /// <summary>
+ /// Deferred renderer would be used on Windows when set t... | src/Windows/Avalonia.Win32/Win32Platform.cs | 26 | C# | 0.571 | suggestion | 99 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/Win32Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE:
namespace Avalonia
{
public static class Win32ApplicationExtensions
{
public static T UseWin32<T>(
this T builder... | ```suggestion
/// Avalonia has two rendering modes: Immediate and Deferred rendering.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.Win32.Input;
using Avalonia.Win32.Interop;
using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia
{
public static class Win32ApplicationExtensions
{
public static T UseWin32<T>(
this T builder)
where T : AppBuilderBase<T>, new()
{
... | ```suggestion
/// Deferred renderer would be used when set to true. Immediate renderer when set to false. The default value is true.
``` | using Avalonia.Win32.Input;
using Avalonia.Win32.Interop;
using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia
{
public static class Win32ApplicationExtensions
{
public static T UseWin32<T>(
this T builder)
where T : AppBuilderBase<T>, new()
{
... | @@ -35,15 +35,46 @@ public static class Win32ApplicationExtensions
}
}
+ /// <summary>
+ /// Platform-specific options which apply to Windows.
+ /// </summary>
public class Win32PlatformOptions
{
+ /// <summary>
+ /// Deferred renderer would be used on Windows when set t... | src/Windows/Avalonia.Win32/Win32Platform.cs | 26 | C# | 0.786 | suggestion | 146 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/Win32Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: using Avalonia.Win32.Input;
using Avalonia.Win32.Interop;
using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia
{
publ... | ```suggestion
/// Deferred renderer would be used when set to true. Immediate renderer when set to false. The default value is true.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return builder.UseWindowingSubsystem(
() => Win32.Win32Platform.Initialize(
AvaloniaLocator.Current.GetService<Win32PlatformOptions>() ?? new Win32PlatformOptions()),
"Win32");
}
}
/// <summary>
/// Platform-specific options which appl... | ```suggestion
/// GPU rendering will not be enabled if this is set to false.
``` | return builder.UseWindowingSubsystem(
() => Win32.Win32Platform.Initialize(
AvaloniaLocator.Current.GetService<Win32PlatformOptions>() ?? new Win32PlatformOptions()),
"Win32");
}
}
/// <summary>
/// Platform-specific options which appl... | @@ -35,15 +35,46 @@ public static class Win32ApplicationExtensions
}
}
+ /// <summary>
+ /// Platform-specific options which apply to Windows.
+ /// </summary>
public class Win32PlatformOptions
{
+ /// <summary>
+ /// Deferred renderer would be used on Windows when set t... | src/Windows/Avalonia.Win32/Win32Platform.cs | 26 | C# | 0.571 | suggestion | 90 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/Win32Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: return builder.UseWindowingSubsystem(
() => Win32.Win32Platform.Initialize(
AvaloniaLocator.Cu... | ```suggestion
/// GPU rendering will not be enabled if this is set to false.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Determines whether to use GPU for rendering in your project. The default value is true.
/// </summary>
public bool UseGpu { get; set; } = true;
/// <summary>
/// Embeds popups to the window when set to true. The default value is false.
/// </summary>
public b... | ```suggestion
/// IME would be enabled by default if the current user input language is one of the following: Mandarin, Japanese, Vietnamese or Korean.
``` | /// Determines whether to use GPU for rendering in your project. The default value is true.
/// </summary>
public bool UseGpu { get; set; } = true;
/// <summary>
/// Embeds popups to the window when set to true. The default value is false.
/// </summary>
public b... | @@ -162,14 +162,48 @@ bool ShouldUseXim()
namespace Avalonia
{
-
+ /// <summary>
+ /// Platform-specific options which apply to Linux.
+ /// </summary>
public class X11PlatformOptions
{
+ /// <summary>
+ /// Enables native Linux EGL when set to true. The default value is false.
+ ... | src/Avalonia.X11/X11Platform.cs | 26 | C# | 0.786 | suggestion | 165 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.X11/X11Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: /// Determines whether to use GPU for rendering in your project. The default value is true.
/// </summary>
public bool UseGpu { ge... | ```suggestion
/// IME would be enabled by default if the current user input language is one of the following: Mandarin, Japanese, Vietnamese or Korean.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
where T : AppBuilderBase<T>, new()
{
builder.UseWindowingSubsystem(() =>
{
var platform = AvaloniaNativePlatform.Initialize(
AvaloniaLocator.Current.GetService<AvaloniaNativePlatformOptions>() ??
new AvaloniaNativePlatfo... | ```suggestion
/// Deferred renderer would be used when set to true. Immediate renderer when set to false. The default value is true.
``` | where T : AppBuilderBase<T>, new()
{
builder.UseWindowingSubsystem(() =>
{
var platform = AvaloniaNativePlatform.Initialize(
AvaloniaLocator.Current.GetService<AvaloniaNativePlatformOptions>() ??
new AvaloniaNativePlatfo... | @@ -26,19 +26,52 @@ public static T UseAvaloniaNative<T>(this T builder)
}
}
+ /// <summary>
+ /// OSX backend options.
+ /// </summary>
public class AvaloniaNativePlatformOptions
{
+ /// <summary>
+ /// Deferred renderer would be used on Windows when set to true. Immedi... | src/Avalonia.Native/AvaloniaNativePlatformExtensions.cs | 26 | C# | 0.786 | suggestion | 146 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Native/AvaloniaNativePlatformExtensions.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: where T : AppBuilderBase<T>, new()
{
builder.UseWindowingSubsystem(() =>
{
... | ```suggestion
/// Deferred renderer would be used when set to true. Immediate renderer when set to false. The default value is true.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Platform-specific options which apply to Linux.
/// </summary>
public class X11PlatformOptions
{
/// <summary>
/// Enables native Linux EGL when set to true. The default value is false.
/// </summary>
public bool UseEGL { get; set; }
/// <summary>
///... | ```suggestion
/// Deferred renderer would be used when set to true. Immediate renderer when set to false. The default value is true.
``` | /// Platform-specific options which apply to Linux.
/// </summary>
public class X11PlatformOptions
{
/// <summary>
/// Enables native Linux EGL when set to true. The default value is false.
/// </summary>
public bool UseEGL { get; set; }
/// <summary>
///... | @@ -162,14 +162,48 @@ bool ShouldUseXim()
namespace Avalonia
{
-
+ /// <summary>
+ /// Platform-specific options which apply to Linux.
+ /// </summary>
public class X11PlatformOptions
{
+ /// <summary>
+ /// Enables native Linux EGL when set to true. The default value is false.
+ ... | src/Avalonia.X11/X11Platform.cs | 26 | C# | 0.786 | suggestion | 146 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.X11/X11Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: /// Platform-specific options which apply to Linux.
/// </summary>
public class X11PlatformOptions
{
/// <summary>
/// Ena... | ```suggestion
/// Deferred renderer would be used when set to true. Immediate renderer when set to false. The default value is true.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
/// <summary>
/// Enables native Linux EGL when set to true. The default value is false.
/// </summary>
public bool UseEGL { get; set; }
/// <summary>
/// Determines whether to use GPU for rendering in your project. The default value is true.
/// </summary>... | ```suggestion
/// Avalonia has two rendering modes: Immediate and Deferred rendering.
``` | {
/// <summary>
/// Enables native Linux EGL when set to true. The default value is false.
/// </summary>
public bool UseEGL { get; set; }
/// <summary>
/// Determines whether to use GPU for rendering in your project. The default value is true.
/// </summary>... | @@ -162,14 +162,48 @@ bool ShouldUseXim()
namespace Avalonia
{
-
+ /// <summary>
+ /// Platform-specific options which apply to Linux.
+ /// </summary>
public class X11PlatformOptions
{
+ /// <summary>
+ /// Enables native Linux EGL when set to true. The default value is false.
+ ... | src/Avalonia.X11/X11Platform.cs | 26 | C# | 0.571 | suggestion | 99 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.X11/X11Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: {
/// <summary>
/// Enables native Linux EGL when set to true. The default value is false.
/// </summary>
public bool ... | ```suggestion
/// Avalonia has two rendering modes: Immediate and Deferred rendering.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
var platform = AvaloniaNativePlatform.Initialize(
AvaloniaLocator.Current.GetService<AvaloniaNativePlatformOptions>() ??
new AvaloniaNativePlatformOptions());
builder.AfterSetup (x=>
{
... | ```suggestion
/// Avalonia has two rendering modes: Immediate and Deferred rendering.
``` | {
var platform = AvaloniaNativePlatform.Initialize(
AvaloniaLocator.Current.GetService<AvaloniaNativePlatformOptions>() ??
new AvaloniaNativePlatformOptions());
builder.AfterSetup (x=>
{
... | @@ -26,19 +26,52 @@ public static T UseAvaloniaNative<T>(this T builder)
}
}
+ /// <summary>
+ /// OSX backend options.
+ /// </summary>
public class AvaloniaNativePlatformOptions
{
+ /// <summary>
+ /// Deferred renderer would be used on Windows when set to true. Immedi... | src/Avalonia.Native/AvaloniaNativePlatformExtensions.cs | 26 | C# | 0.571 | suggestion | 99 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Native/AvaloniaNativePlatformExtensions.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: {
var platform = AvaloniaNativePlatform.Initialize(
AvaloniaLocator.Current.GetSer... | ```suggestion
/// Avalonia has two rendering modes: Immediate and Deferred rendering.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
namespace Avalonia
{
/// <summary>
/// Platform-specific options which apply to Linux.
/// </summary>
public class X11PlatformOptions
{
/// <summary>
/// Enables native Linux EGL when set to true. The default value is false.
/// </summary>
public bool UseEGL { get;... | Technically that's dbusmenu / appmenu protocol that originated in Ubuntu Unity desktop environment and was then adopted by KDE (included out of the box) and is available for XFCE, MATE and ValaPanel (for LDXE). | }
namespace Avalonia
{
/// <summary>
/// Platform-specific options which apply to Linux.
/// </summary>
public class X11PlatformOptions
{
/// <summary>
/// Enables native Linux EGL when set to true. The default value is false.
/// </summary>
public bool UseEGL { get;... | @@ -162,14 +162,48 @@ bool ShouldUseXim()
namespace Avalonia
{
-
+ /// <summary>
+ /// Platform-specific options which apply to Linux.
+ /// </summary>
public class X11PlatformOptions
{
+ /// <summary>
+ /// Enables native Linux EGL when set to true. The default value is false.
+ ... | src/Avalonia.X11/X11Platform.cs | 26 | C# | 0.429 | suggestion | 211 | 51 | 51 | false | Add comments about OSX,Linux, Windows platform options | 6,351 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.X11/X11Platform.cs
PR Title: Add comments about OSX,Linux, Windows platform options
BEFORE CODE: }
namespace Avalonia
{
/// <summary>
/// Platform-specific options which apply to Linux.
/// </summary>
public class X11PlatformOptions
... | Technically that's dbusmenu / appmenu protocol that originated in Ubuntu Unity desktop environment and was then adopted by KDE (included out of the box) and is available for XFCE, MATE and ValaPanel (for LDXE). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
ClearView();
return;
}
// Cache the current text value
string text = Text ?? string.Empty;
// Determine if any filtering mode is on
bool stringFiltering = TextFilter != null;
bool objectFiltering = FilterMode == Au... | sorry, just a tiny nit
```suggestion
if (ItemFilter is null)
``` | ClearView();
return;
}
// Cache the current text value
string text = Text ?? string.Empty;
// Determine if any filtering mode is on
bool stringFiltering = TextFilter != null;
bool objectFiltering = FilterMode == Au... | @@ -2094,7 +2094,21 @@ private void RefreshView()
bool inResults = !(stringFiltering || objectFiltering);
if (!inResults)
{
- inResults = stringFiltering ? TextFilter(text, FormatValue(item)) : ItemFilter(text, item);
+ if (stringF... | src/Avalonia.Controls/AutoCompleteBox.cs | 26 | C# | 0.714 | suggestion | 92 | 51 | 51 | false | Fix AutoCompleteBox NRE | 6,536 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/AutoCompleteBox.cs
PR Title: Fix AutoCompleteBox NRE
BEFORE CODE: ClearView();
return;
}
// Cache the current text value
string text = Text ?? string.Empty;
// ... | sorry, just a tiny nit
```suggestion
if (ItemFilter is null)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var child = new TextBlock();
var (target, _) = CreateTarget();
((ISetLogicalParent)child).SetParent(logicalParent);
target.Content = child;
target.Content = null;
// InheritanceParent is exposed via StylingParent.
Assert.Same(logicalP... | `Content_Will_`?? Might be missing some word here? | var child = new TextBlock();
var (target, _) = CreateTarget();
((ISetLogicalParent)child).SetParent(logicalParent);
target.Content = child;
target.Content = null;
// InheritanceParent is exposed via StylingParent.
Assert.Same(logicalP... | @@ -353,6 +353,19 @@ public void Should_Clear_Host_When_Host_Template_Cleared()
Assert.Null(target.Host);
}
+ [Fact]
+ public void Content_Will_By_Datacontext_When_ControlTemplate_Is_Null() | tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_InTemplate.cs | 26 | C# | 0.357 | question | 51 | 51 | 51 | false | feat(ContentPresenter): Content of ContentPresenter should become DataContext of the subtree whenever ContentTemplate is not null | 7,008 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | workgroupengineering | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_InTemplate.cs
PR Title: feat(ContentPresenter): Content of ContentPresenter should become DataContext of the subtree whenever ContentTemplate is not null
BEFORE CODE: var child = new Te... | `Content_Will_`?? Might be missing some word here? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System;
using Avalonia.Interactivity;
using Avalonia.VisualTree;
namespace Avalonia.Input
{
public static class Gestures
{
private static bool _isDoubleTapped = false;
public static readonly RoutedEvent<TappedEventArgs> TappedEvent = RoutedEvent.Register<TappedEventArgs>(
"Tap... | That's a _global_ variable. We usually try to avoid those | using System;
using Avalonia.Interactivity;
using Avalonia.VisualTree;
namespace Avalonia.Input
{
public static class Gestures
{
private static bool s_isDoubleTapped = false;
public static readonly RoutedEvent<TappedEventArgs> TappedEvent = RoutedEvent.Register<TappedEventArgs>(
"Ta... | @@ -6,6 +6,7 @@ namespace Avalonia.Input
{
public static class Gestures
{
+ private static bool _isDoubleTapped = false; | src/Avalonia.Input/Gestures.cs | 9 | C# | 0.286 | suggestion | 57 | 34 | 34 | false | Fix DoubleTapped on touch | 7,213 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Input/Gestures.cs
PR Title: Fix DoubleTapped on touch
BEFORE CODE: using System;
using Avalonia.Interactivity;
using Avalonia.VisualTree;
namespace Avalonia.Input
{
public static class Gestures
{
private static bool _isDoubleTapped = ... | That's a _global_ variable. We usually try to avoid those | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.Styling;
using Avalonia.Themes.Fluent;
using ControlCatalog.ViewModels;
namespace ControlCatalog
{
public class App : Application
{
public App()
{
DataContext = new ApplicationViewModel();
}
public static readonly StyleInclude DataGridFluent = new Sty... | Nit: shouldn't be called "FluentLight" anymore since it's both now. | using Avalonia.Styling;
using Avalonia.Themes.Fluent;
using ControlCatalog.ViewModels;
namespace ControlCatalog
{
public class App : Application
{
public App()
{
DataContext = new ApplicationViewModel();
}
public static readonly StyleInclude DataGridFluent = new Sty... | @@ -16,33 +17,19 @@ public App()
DataContext = new ApplicationViewModel();
}
- private static readonly StyleInclude DataGridFluent = new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
+ public static readonly StyleInclude DataGridFluent = new StyleInclude(new Uri("avares:/... | samples/ControlCatalog/App.xaml.cs | 26 | C# | 0.286 | nitpick | 67 | 51 | 51 | false | Fast Fluent theme switching | 7,256 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | Takoooooo | Review this pull request change.
Language: C#
File: samples/ControlCatalog/App.xaml.cs
PR Title: Fast Fluent theme switching
BEFORE CODE: using Avalonia.Styling;
using Avalonia.Themes.Fluent;
using ControlCatalog.ViewModels;
namespace ControlCatalog
{
public class App : Application
{
public App()
... | Nit: shouldn't be called "FluentLight" anymore since it's both now. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.Input.Platform;
using Avalonia.MicroCom;
using Avalonia.Native.Interop;
using Avalonia.OpenGL;
using Avalonia.Platform;
using Avalonia.Rendering;
namespace Avalonia.Native
{
class AvaloniaNativePlatform : IPlatformSettings, ITouchPlatformSettings, IWindowingPlatform
{
private readonly IA... | If the interface was commented you could add `<inheritdoc cref="ITouchPlatformSettings.TouchDoubleClickSize"/>`. | using Avalonia.Input.Platform;
using Avalonia.MicroCom;
using Avalonia.Native.Interop;
using Avalonia.OpenGL;
using Avalonia.Platform;
using Avalonia.Rendering;
namespace Avalonia.Native
{
class AvaloniaNativePlatform : IPlatformSettings, IWindowingPlatform
{
private readonly IAvaloniaNativeFactory _fa... | @@ -26,9 +26,13 @@ class AvaloniaNativePlatform : IPlatformSettings, IWindowingPlatform
public TimeSpan DoubleClickTime => TimeSpan.FromMilliseconds(500); //TODO
+ public Size TouchDoubleClickSize => new Size(16, 16); | src/Avalonia.Native/AvaloniaNativePlatform.cs | 26 | C# | 0.571 | suggestion | 112 | 51 | 51 | false | Add properties to IPlatformSettings to define double-click Size\Time for Touch input. | 7,274 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Native/AvaloniaNativePlatform.cs
PR Title: Add properties to IPlatformSettings to define double-click Size\Time for Touch input.
BEFORE CODE: using Avalonia.Input.Platform;
using Avalonia.MicroCom;
using Avalonia.Native.Interop;
using Avalonia.OpenGL;... | If the interface was commented you could add `<inheritdoc cref="ITouchPlatformSettings.TouchDoubleClickSize"/>`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return;
var args = (RawTouchEventArgs)ev;
if (!_pointers.TryGetValue(args.TouchPointId, out var pointer))
{
if (args.Type == RawPointerEventType.TouchEnd)
return;
var hit = args.Root.InputHitTest(args.Position);
... | as I remember there was added `GetRequiredService` not such a long time ago. | return;
var args = (RawTouchEventArgs)ev;
if (!_pointers.TryGetValue(args.TouchPointId, out var pointer))
{
if (args.Type == RawPointerEventType.TouchEnd)
return;
var hit = args.Root.InputHitTest(args.Position);
... | @@ -58,20 +58,20 @@ public void ProcessRawEvent(RawInputEventArgs ev)
}
else
{
- var settings = AvaloniaLocator.Current.GetService<IPlatformSettings>();
+ var settings = AvaloniaLocator.Current.GetService<ITouchPlatformSettings>(); | src/Avalonia.Input/TouchDevice.cs | 26 | C# | 0.357 | suggestion | 76 | 51 | 51 | false | Add properties to IPlatformSettings to define double-click Size\Time for Touch input. | 7,274 | AvaloniaUI/Avalonia | 24,333 | C# | Sorien | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Input/TouchDevice.cs
PR Title: Add properties to IPlatformSettings to define double-click Size\Time for Touch input.
BEFORE CODE: return;
var args = (RawTouchEventArgs)ev;
if (!_pointers.TryGetValue(args.TouchPo... | as I remember there was added `GetRequiredService` not such a long time ago. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private static readonly IList Empty = Array.Empty<object>();
private string _textSearchTerm = string.Empty;
private DispatcherTimer? _textSearchTimer;
private ISelectionModel? _selection;
private int _oldSelectedIndex;
private object? _oldSelectedItem;
private IL... | I'm not sure that adding a CLR event handler for this event is helpful - it's an "internal" event used for communication between `SelectingItemsControl` and its items, and shouldn't really be listened for in user code - making it a public CLR event might mean that people start listening for this event instead of `Selec... |
private static readonly IList Empty = Array.Empty<object>();
private string _textSearchTerm = string.Empty;
private DispatcherTimer? _textSearchTimer;
private ISelectionModel? _selection;
private int _oldSelectedIndex;
private object? _oldSelectedItem;
private IL... | @@ -139,6 +139,17 @@ static SelectingItemsControl()
IsSelectedChangedEvent.AddClassHandler<SelectingItemsControl>((x, e) => x.ContainerSelectionChanged(e));
}
+ /// <summary>
+ /// Event that should be raised by items that implement <see cref="ISelectable"/> to
+ /// notify ... | src/Avalonia.Controls/Primitives/SelectingItemsControl.cs | 26 | C# | 0.786 | suggestion | 333 | 51 | 51 | false | Routing event fixes | 8,147 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | wieslawsoltes | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Primitives/SelectingItemsControl.cs
PR Title: Routing event fixes
BEFORE CODE:
private static readonly IList Empty = Array.Empty<object>();
private string _textSearchTerm = string.Empty;
private DispatcherTimer? _text... | I'm not sure that adding a CLR event handler for this event is helpful - it's an "internal" event used for communication between `SelectingItemsControl` and its items, and shouldn't really be listened for in user code - making it a public CLR event might mean that people start listening for this event instead of `Selec... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
get => GetValue(ContextFlyoutProperty);
set => SetValue(ContextFlyoutProperty, value);
}
/// <summary>
/// Gets or sets a user-defined object attached to the control.
/// </summary>
public object? Tag
{
get => GetValue(TagProperty);
... | Again, kind of an internal event though this one does have potential use-cases in user code so I'm OK with exposing this on as a CLR event. | get => GetValue(ContextFlyoutProperty);
set => SetValue(ContextFlyoutProperty, value);
}
/// <summary>
/// Gets or sets a user-defined object attached to the control.
/// </summary>
public object? Tag
{
get => GetValue(TagProperty);
... | @@ -126,6 +126,15 @@ public FlowDirection FlowDirection
set => SetValue(FlowDirectionProperty, value);
}
+ /// <summary>
+ /// Occurs when an element wishes to be scrolled into view.
+ /// </summary>
+ public event EventHandler<ContextRequestedEventArgs>? RequestBring... | src/Avalonia.Controls/Control.cs | 26 | C# | 0.429 | suggestion | 139 | 51 | 51 | false | Routing event fixes | 8,147 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | wieslawsoltes | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Control.cs
PR Title: Routing event fixes
BEFORE CODE: get => GetValue(ContextFlyoutProperty);
set => SetValue(ContextFlyoutProperty, value);
}
/// <summary>
/// Gets or sets a user-defined obje... | Again, kind of an internal event though this one does have potential use-cases in user code so I'm OK with exposing this on as a CLR event. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// Gets or sets the startup location of the window.
/// </summary>
public WindowStartupLocation WindowStartupLocation
{
get { return _windowStartupLocation; }
set { SetAndRaise(WindowStartupLocationProperty, ref _windowStartupLocation, valu... | @kekekeks are these events (`WindowOpened`, `WindowClosed`) meant for user consumption? Does it make sense to expose CLR events for them? | }
/// <summary>
/// Gets or sets the startup location of the window.
/// </summary>
public WindowStartupLocation WindowStartupLocation
{
get { return _windowStartupLocation; }
set { SetAndRaise(WindowStartupLocationProperty, ref _windowStartupLoca... | @@ -446,6 +445,24 @@ public PixelPoint Position
}
}
+ /// <summary>
+ /// Routed event that can be used for global tracking of window destruction.
+ /// </summary>
+ public event EventHandler<RoutedEventArgs>? WindowClosed | src/Avalonia.Controls/Window.cs | 26 | C# | 0.571 | question | 137 | 51 | 51 | false | Routing event fixes | 8,147 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | wieslawsoltes | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Window.cs
PR Title: Routing event fixes
BEFORE CODE:
/// <summary>
/// Gets or sets the startup location of the window.
/// </summary>
public WindowStartupLocation WindowStartupLocation
{
g... | @kekekeks are these events (`WindowOpened`, `WindowClosed`) meant for user consumption? Does it make sense to expose CLR events for them? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// </summary>
public static readonly StyledProperty<string?> TitleProperty =
AvaloniaProperty.Register<Window, string?>(nameof(Title), "Window");
/// <summary>
/// Defines the <see cref="Icon"/> property.
/// </summary>
public static readonly StyledProperty<... | This is a breaking change so I'm going to remove the `backport-candidate` label. | /// </summary>
public static readonly StyledProperty<string?> TitleProperty =
AvaloniaProperty.Register<Window, string?>(nameof(Title), "Window");
/// <summary>
/// Defines the <see cref="Icon"/> property.
/// </summary>
public static readonly StyledProperty<... | @@ -171,13 +171,13 @@ public class Window : WindowBase, IStyleable, IFocusScope, ILayoutRoot
/// <summary>
/// Routed event that can be used for global tracking of window destruction
/// </summary>
- public static readonly RoutedEvent WindowClosedEvent = | src/Avalonia.Controls/Window.cs | 26 | C# | 0.429 | suggestion | 80 | 51 | 51 | false | Routing event fixes | 8,147 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | wieslawsoltes | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Window.cs
PR Title: Routing event fixes
BEFORE CODE: /// </summary>
public static readonly StyledProperty<string?> TitleProperty =
AvaloniaProperty.Register<Window, string?>(nameof(Title), "Window");
/// <... | This is a breaking change so I'm going to remove the `backport-candidate` label. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Converts x:DataType directives to regular DataType assignments if property with Avalonia.Metadata.DataTypeAttribute exists.
/// </summary>
/// <returns></returns>
public IXamlAstNode Transform(AstTransformationContext context, IXamlAstNode node)
{
if (node is Xaml... | @kekekeks I am not sure if it's a good idea to resolve type on this step.
I tried to move this transformer to a later step, when we operate with previously resolved CLR types, but Xml directives are nonexistent on that step. | /// Converts x:DataType directives to regular DataType assignments if property with Avalonia.Metadata.DataTypeAttribute exists.
/// </summary>
/// <returns></returns>
public IXamlAstNode Transform(AstTransformationContext context, IXamlAstNode node)
{
if (node is Xaml... | @@ -0,0 +1,79 @@
+using System.Collections.Generic;
+using System.Linq;
+using XamlX;
+using XamlX.Ast;
+using XamlX.Transform;
+using XamlX.Transform.Transformers;
+using XamlX.TypeSystem;
+
+namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
+{
+ internal class XDataTypeTransformer : IXamlAstTra... | src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs | 26 | C# | 0.643 | refactor | 226 | 51 | 51 | false | Implicitly map x:DataType to a DataType on a DataTemplate. | 8,220 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs
PR Title: Implicitly map x:DataType to a DataType on a DataTemplate.
BEFORE CODE: /// Converts x:DataType directives to regular DataType assignments if property ... | @kekekeks I am not sure if it's a good idea to resolve type on this step.
I tried to move this transformer to a later step, when we operate with previously resolved CLR types, but Xml directives are nonexistent on that step. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using XamlX.Ast;
using XamlX.Transform;
using XamlX.Transform.Transformers;
using XamlX.TypeSystem;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
{
internal class XDataTypeTransformer : IXamlAstTransformer
{
private const string DataTypePropertyName = "DataType";
... | I expect we can only check for XamlAstXamlPropertyValueNode here and nothing else to avoid double property overwriting. | using XamlX.Ast;
using XamlX.Transform;
using XamlX.Transform.Transformers;
using XamlX.TypeSystem;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
{
internal class XDataTypeTransformer : IXamlAstTransformer
{
private const string DataTypePropertyName = "DataType";
... | @@ -0,0 +1,79 @@
+using System.Collections.Generic;
+using System.Linq;
+using XamlX;
+using XamlX.Ast;
+using XamlX.Transform;
+using XamlX.Transform.Transformers;
+using XamlX.TypeSystem;
+
+namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
+{
+ internal class XDataTypeTransformer : IXamlAstTra... | src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs | 26 | C# | 0.429 | suggestion | 120 | 51 | 51 | false | Implicitly map x:DataType to a DataType on a DataTemplate. | 8,220 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs
PR Title: Implicitly map x:DataType to a DataType on a DataTemplate.
BEFORE CODE: using XamlX.Ast;
using XamlX.Transform;
using XamlX.Transform.Transformers;
using XamlX... | I expect we can only check for XamlAstXamlPropertyValueNode here and nothing else to avoid double property overwriting. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
if (node is XamlAstObjectNode on)
{
for (var c = 0; c < on.Children.Count; c++)
{
var ch = on.Children[c];
if (ch is XamlAstXmlDirective { Namespace: XamlNamespaces.Xaml2006, Name: DataTypePropertyName } d)
... | You are checking for existence of a property with `DataTypePropertyName` but later resolve property name via attribute and don't check if the property already exists. | {
if (node is XamlAstObjectNode on)
{
for (var c = 0; c < on.Children.Count; c++)
{
var ch = on.Children[c];
if (ch is XamlAstXmlDirective { Namespace: XamlNamespaces.Xaml2006, Name: DataTypePropertyName } d)
... | @@ -0,0 +1,79 @@
+using System.Collections.Generic;
+using System.Linq;
+using XamlX;
+using XamlX.Ast;
+using XamlX.Transform;
+using XamlX.Transform.Transformers;
+using XamlX.TypeSystem;
+
+namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
+{
+ internal class XDataTypeTransformer : IXamlAstTra... | src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs | 26 | C# | 0.643 | suggestion | 166 | 51 | 51 | false | Implicitly map x:DataType to a DataType on a DataTemplate. | 8,220 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | maxkatz6 | Review this pull request change.
Language: C#
File: src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs
PR Title: Implicitly map x:DataType to a DataType on a DataTemplate.
BEFORE CODE: {
if (node is XamlAstObjectNode on)
{
f... | You are checking for existence of a property with `DataTypePropertyName` but later resolve property name via attribute and don't check if the property already exists. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System.Linq;
using XamlX;
using XamlX.Ast;
using XamlX.Emit;
using XamlX.IL;
using XamlX.Transform;
using XamlX.TypeSystem;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
{
using XamlParseException = XamlX.XamlParseException;
using XamlLoadException = XamlX.XamlLoadException;
c... | There are conflicts after ControlTheme PR. | using System.Linq;
using XamlX;
using XamlX.Ast;
using XamlX.Emit;
using XamlX.IL;
using XamlX.Transform;
using XamlX.TypeSystem;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
{
class AvaloniaXamlIlSetterTransformer : IXamlAstTransformer
{
public IXamlAstNode Transform(AstTransf... | @@ -22,21 +19,54 @@ public IXamlAstNode Transform(AstTransformationContext context, IXamlAstNode nod
&& on.Type.GetClrType().FullName == "Avalonia.Styling.Setter"))
return node;
- var parent = context.ParentNodes().OfType<XamlAstObjectNode>()
+ IXamlType targe... | src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlSetterTransformer.cs | 26 | C# | 0.071 | suggestion | 42 | 51 | 51 | false | Add x:SetterTargetType | 8,572 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | pr8x | Review this pull request change.
Language: C#
File: src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlSetterTransformer.cs
PR Title: Add x:SetterTargetType
BEFORE CODE: using System.Linq;
using XamlX;
using XamlX.Ast;
using XamlX.Emit;
using XamlX.IL;
using XamlX.Transform;
using ... | There are conflicts after ControlTheme PR. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// </summary>
public bool CanHorizontallyScroll
{
get => _canHorizontallyScroll;
set => SetAndRaise(CanHorizontallyScrollProperty, ref _canHorizontallyScroll, value);
}
/// <summary>
/// Gets or sets a value indicating whether the content can be ... | Are you sure that we want to intercept non-primary pointers for scrolling? | /// </summary>
public bool CanHorizontallyScroll
{
get => _canHorizontallyScroll;
set => SetAndRaise(CanHorizontallyScrollProperty, ref _canHorizontallyScroll, value);
}
/// <summary>
/// Gets or sets a value indicating whether the content can be ... | @@ -66,8 +66,7 @@ public void Initialize(IInputElement target, IGestureRecognizerActionsDispatcher
public void PointerPressed(PointerPressedEventArgs e)
{
- if (e.Pointer.IsPrimary &&
- (e.Pointer.Type == PointerType.Touch || e.Pointer.Type == PointerType.Pen))
+ ... | src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs | 26 | C# | 0.214 | question | 74 | 51 | 51 | false | Revamp android input handling to support mouse, pen and historical points | 8,698 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
PR Title: Revamp android input handling to support mouse, pen and historical points
BEFORE CODE: /// </summary>
public bool CanHorizontallyScroll
{
get => _ca... | Are you sure that we want to intercept non-primary pointers for scrolling? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// </summary>
public bool CanHorizontallyScroll
{
get => _canHorizontallyScroll;
set => SetAndRaise(CanHorizontallyScrollProperty, ref _canHorizontallyScroll, value);
}
/// <summary>
/// Gets or sets a value indicating whether the content can be ... | ```suggestion
if (e.Pointer.IsPrimary &&
(e.Pointer.Type == PointerType.Touch || e.Pointer.Type == PointerType.Pen))
``` | /// </summary>
public bool CanHorizontallyScroll
{
get => _canHorizontallyScroll;
set => SetAndRaise(CanHorizontallyScrollProperty, ref _canHorizontallyScroll, value);
}
/// <summary>
/// Gets or sets a value indicating whether the content can be ... | @@ -66,8 +66,7 @@ public void Initialize(IInputElement target, IGestureRecognizerActionsDispatcher
public void PointerPressed(PointerPressedEventArgs e)
{
- if (e.Pointer.IsPrimary &&
- (e.Pointer.Type == PointerType.Touch || e.Pointer.Type == PointerType.Pen))
+ ... | src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs | 26 | C# | 0.857 | suggestion | 152 | 51 | 51 | false | Revamp android input handling to support mouse, pen and historical points | 8,698 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
PR Title: Revamp android input handling to support mouse, pen and historical points
BEFORE CODE: /// </summary>
public bool CanHorizontallyScroll
{
get => _ca... | ```suggestion
if (e.Pointer.IsPrimary &&
(e.Pointer.Type == PointerType.Touch || e.Pointer.Type == PointerType.Pen))
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
};
/// <summary>
/// Schedules <see cref="OnLoadedCore"/> to be called for this control.
/// For performance, it will be queued with other controls.
/// </summary>
internal void ScheduleOnLoadedCore()
{
if (_isLoaded == false)
{
... | Two things:
1. Should this really be virtual? I don't see it actually used anywhere. Since there were concerns about performance, and this is internal-only and not public, I would not mark it as virtual until really needed.
2. If it is needed, OnUnloadedCore() should probably be virtual as well.
However, gener... | };
/// <summary>
/// Schedules <see cref="OnLoadedCore"/> to be called for this control.
/// For performance, it will be queued with other controls.
/// </summary>
internal void ScheduleOnLoadedCore()
{
if (_isLoaded == false)
{
... | @@ -344,10 +344,10 @@ internal void ScheduleOnLoadedCore()
/// Invoked as the first step of marking the control as loaded and raising the
/// <see cref="Loaded"/> event.
/// </summary>
- internal void OnLoadedCore()
+ internal virtual void OnLoadedCore() | src/Avalonia.Controls/Control.cs | 26 | C# | 0.643 | performance | 487 | 51 | 51 | false | Update and fix ReactiveUI on master branch + ios | 8,738 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Control.cs
PR Title: Update and fix ReactiveUI on master branch + ios
BEFORE CODE: };
/// <summary>
/// Schedules <see cref="OnLoadedCore"/> to be called for this control.
/// For performance, it will be queue... | Two things:
1. Should this really be virtual? I don't see it actually used anywhere. Since there were concerns about performance, and this is internal-only and not public, I would not mark it as virtual until really needed.
2. If it is needed, OnUnloadedCore() should probably be virtual as well.
However, gener... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
};
/// <summary>
/// Schedules <see cref="OnLoadedCore"/> to be called for this control.
/// For performance, it will be queued with other controls.
/// </summary>
internal void ScheduleOnLoadedCore()
{
if (_isLoaded == false)
{
... | ```suggestion
internal void OnLoadedCore()
``` | };
/// <summary>
/// Schedules <see cref="OnLoadedCore"/> to be called for this control.
/// For performance, it will be queued with other controls.
/// </summary>
internal void ScheduleOnLoadedCore()
{
if (_isLoaded == false)
{
... | @@ -344,10 +344,10 @@ internal void ScheduleOnLoadedCore()
/// Invoked as the first step of marking the control as loaded and raising the
/// <see cref="Loaded"/> event.
/// </summary>
- internal void OnLoadedCore()
+ internal virtual void OnLoadedCore() | src/Avalonia.Controls/Control.cs | 26 | C# | 0.571 | suggestion | 56 | 51 | 51 | false | Update and fix ReactiveUI on master branch + ios | 8,738 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Control.cs
PR Title: Update and fix ReactiveUI on master branch + ios
BEFORE CODE: };
/// <summary>
/// Schedules <see cref="OnLoadedCore"/> to be called for this control.
/// For performance, it will be queue... | ```suggestion
internal void OnLoadedCore()
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
/// <inheritdoc/>
public bool IsEffectivelyEnabled
{
get => _isEffectivelyEnabled;
private set
{
SetAndRaise(IsEffectivelyEnabledProperty, ref _isEffectivelyEnabled, value);
PseudoClasses.Set(":disabled", !value);
... | what should happen in this scenario:
1. control is disabled, looses focus.
2. another control gets focused
3. the original control is enabled again...
At step 3 will the original control steal the focus?
|
/// <inheritdoc/>
public bool IsEffectivelyEnabled
{
get => _isEffectivelyEnabled;
private set
{
SetAndRaise(IsEffectivelyEnabledProperty, ref _isEffectivelyEnabled, value);
PseudoClasses.Set(":disabled", !value);
... | @@ -442,6 +443,23 @@ private set
{
SetAndRaise(IsEffectivelyEnabledProperty, ref _isEffectivelyEnabled, value);
PseudoClasses.Set(":disabled", !value);
+
+ if (!IsEffectivelyEnabled)
+ {
+ if (FocusManager.Instance?.Current ... | src/Avalonia.Base/Input/InputElement.cs | 26 | C# | 0.5 | question | 217 | 51 | 51 | false | Disabled controls should lose focus and don't accept keyboard events | 9,627 | AvaloniaUI/Avalonia | 24,333 | C# | danwalmsley | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/InputElement.cs
PR Title: Disabled controls should lose focus and don't accept keyboard events
BEFORE CODE: }
/// <inheritdoc/>
public bool IsEffectivelyEnabled
{
get => _isEffectivelyEnabled;
... | what should happen in this scenario:
1. control is disabled, looses focus.
2. another control gets focused
3. the original control is enabled again...
At step 3 will the original control steal the focus?
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
get => GetValue(IsTabStopProperty);
set => SetValue(IsTabStopProperty, value);
}
/// <inheritdoc/>
public bool IsEffectivelyEnabled
{
get => _isEffectivelyEnabled;
private set
{
SetAndRaise(IsEffectivelyEnabledP... | Consider the following situation:
- Two buttons, `A` and `B`
- `A` has focus
- `A` is made disabled, so focus is cleared
- `B` is focused by the user
- `A` is made enabled
- At this point `A._restoreFocus` is still true, focus jumps back to `A`
I'm not sure this is desired?
A repro:
```xml
<Window xml... | set => SetValue(IsTabStopProperty, value);
}
/// <inheritdoc/>
public bool IsEffectivelyEnabled
{
get => _isEffectivelyEnabled;
private set
{
SetAndRaise(IsEffectivelyEnabledProperty, ref _isEffectivelyEnabled, value);
... | @@ -442,6 +443,23 @@ private set
{
SetAndRaise(IsEffectivelyEnabledProperty, ref _isEffectivelyEnabled, value);
PseudoClasses.Set(":disabled", !value);
+
+ if (!IsEffectivelyEnabled)
+ {
+ if (FocusManager.Instance?.Current ... | src/Avalonia.Base/Input/InputElement.cs | 26 | C# | 0.857 | suggestion | 935 | 51 | 51 | false | Disabled controls should lose focus and don't accept keyboard events | 9,627 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | Takoooooo | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/InputElement.cs
PR Title: Disabled controls should lose focus and don't accept keyboard events
BEFORE CODE: get => GetValue(IsTabStopProperty);
set => SetValue(IsTabStopProperty, value);
}
/// <inher... | Consider the following situation:
- Two buttons, `A` and `B`
- `A` has focus
- `A` is made disabled, so focus is cleared
- `B` is focused by the user
- `A` is made enabled
- At this point `A._restoreFocus` is still true, focus jumps back to `A`
I'm not sure this is desired?
A repro:
```xml
<Window xml... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return progress >= 0.5 ? newValue : oldValue;
}
}
public override IDisposable BindAnimation(Animatable control, IObservable<IGradientBrush?> instance)
{
if (Property is null)
{
throw new InvalidOperationException("Animator ... | This is a nit so feel free to ignore.
However, I wonder why are you all still using this syntax? It's widely not liked and is very unintuitive. Its usage only made some sense for a small period of time between language versions. With the addition of the "not" keyword (C# 9.0) it also really shouldn't be done anymore... | return progress >= 0.5 ? newValue : oldValue;
}
}
public override IDisposable BindAnimation(Animatable control, IObservable<IGradientBrush?> instance)
{
if (Property is null)
{
throw new InvalidOperationException("Animator ... | @@ -72,6 +73,25 @@ public override IDisposable BindAnimation(Animatable control, IObservable<IGradi
return control.Bind((AvaloniaProperty<IBrush?>)Property, instance, BindingPriority.Animation);
}
+ private static ImmutableTransform? InterpolateTransform(double progress,
+ ITra... | src/Avalonia.Base/Animation/Animators/GradientBrushAnimator.cs | 26 | C# | 0.786 | nitpick | 521 | 51 | 51 | false | Support TransformOperations animations in Brush animator | 9,807 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Animation/Animators/GradientBrushAnimator.cs
PR Title: Support TransformOperations animations in Brush animator
BEFORE CODE: return progress >= 0.5 ? newValue : oldValue;
}
}
public override IDispo... | This is a nit so feel free to ignore.
However, I wonder why are you all still using this syntax? It's widely not liked and is very unintuitive. Its usage only made some sense for a small period of time between language versions. With the addition of the "not" keyword (C# 9.0) it also really shouldn't be done anymore... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return progress >= 0.5 ? newValue : oldValue;
}
}
public override IDisposable BindAnimation(Animatable control, IObservable<IGradientBrush?> instance)
{
if (Property is null)
{
throw new InvalidOperationException("Animator ... | ```suggestion
if (oldTransform is not null)
``` | return progress >= 0.5 ? newValue : oldValue;
}
}
public override IDisposable BindAnimation(Animatable control, IObservable<IGradientBrush?> instance)
{
if (Property is null)
{
throw new InvalidOperationException("Animator ... | @@ -72,6 +73,25 @@ public override IDisposable BindAnimation(Animatable control, IObservable<IGradi
return control.Bind((AvaloniaProperty<IBrush?>)Property, instance, BindingPriority.Animation);
}
+ private static ImmutableTransform? InterpolateTransform(double progress,
+ ITra... | src/Avalonia.Base/Animation/Animators/GradientBrushAnimator.cs | 26 | C# | 0.714 | suggestion | 61 | 51 | 51 | false | Support TransformOperations animations in Brush animator | 9,807 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Animation/Animators/GradientBrushAnimator.cs
PR Title: Support TransformOperations animations in Brush animator
BEFORE CODE: return progress >= 0.5 ? newValue : oldValue;
}
}
public override IDispo... | ```suggestion
if (oldTransform is not null)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Decorator target = new Decorator
{
Padding = new Thickness(8),
Width = 180,
Height = 80,
Child = new StackPanel()
{
Orientation = Orientation.Horizontal,
Children =
... | Does this PR somehow breaks immediate mode rendering? It might be worth investigating. |
[Win32Fact("Has text")]
public async Task Wrapping_NoWrap()
{
Decorator target = new Decorator
{
Padding = new Thickness(8),
Width = 200,
Height = 200,
Child = new TextBlock
{
... | @@ -92,7 +92,7 @@ Control text(VerticalAlignment verticalAlignment, bool clip = true, bool restric
};
await RenderToFile(target);
- CompareImages();
+ CompareImages(skipImmediate: true); | tests/Avalonia.RenderTests/Controls/TextBlockTests.cs | 26 | C# | 0.214 | question | 86 | 30 | 51 | false | [SKIA] UseOpacitySaveLayer feature switch | 9,964 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | Gillibald | Review this pull request change.
Language: C#
File: tests/Avalonia.RenderTests/Controls/TextBlockTests.cs
PR Title: [SKIA] UseOpacitySaveLayer feature switch
BEFORE CODE: Decorator target = new Decorator
{
Padding = new Thickness(8),
Width = 180,
... | Does this PR somehow breaks immediate mode rendering? It might be worth investigating. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System;
using Avalonia.Metadata;
using SkiaSharp;
namespace Avalonia.Skia;
[Unstable]
public interface ISkiaSharpApiLeaseFeature
{
public ISkiaSharpApiLease Lease();
}
[Unstable]
public interface ISkiaSharpApiLease : IDisposable
{
SKCanvas SkCanvas { get; }
GRContext GrContext { get; }
SKSurfac... | As per discussion, this property shouldn't be removed from the API. | using System;
using Avalonia.Metadata;
using SkiaSharp;
namespace Avalonia.Skia;
[Unstable]
public interface ISkiaSharpApiLeaseFeature
{
public ISkiaSharpApiLease Lease();
}
[Unstable]
public interface ISkiaSharpApiLease : IDisposable
{
SKCanvas SkCanvas { get; }
GRContext? GrContext { get; }
SKSurfa... | @@ -16,5 +16,4 @@ public interface ISkiaSharpApiLease : IDisposable
SKCanvas SkCanvas { get; }
GRContext GrContext { get; }
SKSurface SkSurface { get; }
- double CurrentOpacity { get; } | src/Skia/Avalonia.Skia/ISkiaSharpApiLeaseFeature.cs | 19 | C# | 0.286 | suggestion | 67 | 20 | 21 | false | [SKIA] UseOpacitySaveLayer feature switch | 9,964 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | Gillibald | Review this pull request change.
Language: C#
File: src/Skia/Avalonia.Skia/ISkiaSharpApiLeaseFeature.cs
PR Title: [SKIA] UseOpacitySaveLayer feature switch
BEFORE CODE: using System;
using Avalonia.Metadata;
using SkiaSharp;
namespace Avalonia.Skia;
[Unstable]
public interface ISkiaSharpApiLeaseFeature
{
publ... | As per discussion, this property shouldn't be removed from the API. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.Utilities;
using XamlIlEmitContext = XamlX.Emit.XamlEmitContextWithLocals<XamlX.IL.IXamlILEmitter, XamlX.IL.XamlILNodeEmitResult>;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
{
static class XamlIlBindingPathHelper
{
public static IXamlType UpdateCompiledBindingExtension(Ast... | ```suggestion
else if (binding.Arguments.Count > 0 && binding.Arguments[0] is XamlIlBindingPathNode alreadyTransformed)
``` | using Avalonia.Utilities;
using XamlIlEmitContext = XamlX.Emit.XamlEmitContextWithLocals<XamlX.IL.IXamlILEmitter, XamlX.IL.XamlILNodeEmitResult>;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
{
static class XamlIlBindingPathHelper
{
public static IXamlType UpdateCompiledBindingExtension(Ast... | @@ -37,6 +37,10 @@ public static IXamlType UpdateCompiledBindingExtension(AstTransformationContext
bindingResultType = transformed.BindingResultType;
binding.Arguments[0] = transformed;
}
+ if (binding.Arguments.Count > 0 && binding.Arguments[0] is XamlIlBinding... | src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs | 26 | C# | 0.714 | suggestion | 137 | 51 | 51 | false | Implement support for InheritDataTypeFromItemsAttribute | 10,121 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs
PR Title: Implement support for InheritDataTypeFromItemsAttribute
BEFORE CODE: using Avalonia.Utilities;
using XamlIlEmitContext = XamlX.Emit.XamlEmitContextWithLocals<XamlX.IL.I... | ```suggestion
else if (binding.Arguments.Count > 0 && binding.Arguments[0] is XamlIlBindingPathNode alreadyTransformed)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// Defines the <see cref="ContentTemplate"/> property.
/// </summary>
public static readonly StyledProperty<IDataTemplate?> ContentTemplateProperty =
AvaloniaProperty.Register<ContentControl, IDataTemplate?>(nameof(ContentTemplate));
/// <summary>
... | I'm not sure if this will be a problem, but I think this means that the subscriptions to the `ContentControl` properties will never be released. So if the default value is used, and then a template is supplied, the original default template subscriptions won't be removed. |
/// <summary>
/// Defines the <see cref="ContentTemplate"/> property.
/// </summary>
public static readonly StyledProperty<IDataTemplate?> ContentTemplateProperty =
AvaloniaProperty.Register<ContentControl, IDataTemplate?>(nameof(ContentTemplate));
/// <summary>
... | @@ -43,6 +43,23 @@ public class ContentControl : TemplatedControl, IContentControl, IContentPresent
static ContentControl()
{
ContentProperty.Changed.AddClassHandler<ContentControl>((x, e) => x.ContentChanged(e));
+ TemplateProperty.OverrideDefaultValue<ContentControl>(new Func... | src/Avalonia.Controls/ContentControl.cs | 26 | C# | 0.643 | suggestion | 272 | 51 | 51 | false | Add default template to the ContentControl, remove theme specific templates | 11,365 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ContentControl.cs
PR Title: Add default template to the ContentControl, remove theme specific templates
BEFORE CODE: /// <summary>
/// Defines the <see cref="ContentTemplate"/> property.
/// </summary>
public s... | I'm not sure if this will be a problem, but I think this means that the subscriptions to the `ContentControl` properties will never be released. So if the default value is used, and then a template is supplied, the original default template subscriptions won't be removed. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Input.GestureRecognizers;
using Avalonia.VisualTree;
namespace Avalonia.Input
{
public class Pointer : IPointer, IDisposable
{
private static int s_NextFreePointerId = 1000;
public static int GetNextFreeId() => s_... | The current capture owner should be notified that it has lost the capture. | public bool IsPrimary { get; }
/// <summary>
/// Gets the gesture recognizer that is currently capturing by the pointer, if any.
/// </summary>
internal GestureRecognizer? CapturedGestureRecognizer { get; private set; }
public void Dispose()
{
Captur... | @@ -69,6 +73,25 @@ private void OnCaptureDetached(object? sender, VisualTreeAttachmentEventArgs e)
public PointerType Type { get; }
public bool IsPrimary { get; }
- public void Dispose() => Capture(null);
+
+ /// <summary>
+ /// Gets the gesture recognizer that is cu... | src/Avalonia.Base/Input/Pointer.cs | 26 | C# | 0.286 | suggestion | 74 | 98 | 30 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/Pointer.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Input.GestureRecognizers;
using Avalonia.VisualTree;
namespace Avalonia.Input
{
publi... | The current capture owner should be notified that it has lost the capture. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.Input.GestureRecognizers;
namespace Avalonia.Input
{
public class PinchGestureRecognizer : AvaloniaObject, IGestureRecognizer
{
private IInputElement? _target;
private IGestureRecognizerActionsDispatcher? _actions;
private float _initialDistance;
private IPointer... | Recognizer being a StyledElement is required for TemplateBinding to work
https://github.com/AvaloniaUI/Avalonia/blob/23d96c73667091bad8c28e19c79bab82bbbfb211/src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs#L33-L41 | using Avalonia.Input.GestureRecognizers;
namespace Avalonia.Input
{
public class PinchGestureRecognizer : GestureRecognizer
{
private float _initialDistance;
private IPointer? _firstContact;
private Point _firstPoint;
private IPointer? _secondContact;
private Point _sec... | @@ -2,7 +2,7 @@
namespace Avalonia.Input
{
- public class PinchGestureRecognizer : StyledElement, IGestureRecognizer
+ public class PinchGestureRecognizer : AvaloniaObject, IGestureRecognizer | src/Avalonia.Base/Input/GestureRecognizers/PinchGestureRecognizer.cs | 5 | C# | 0.429 | style | 242 | 30 | 30 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/PinchGestureRecognizer.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: using Avalonia.Input.GestureRecognizers;
namespace Avalonia.Input
{
public class PinchGestureRecognizer : AvaloniaObject, IGestureRe... | Recognizer being a StyledElement is required for TemplateBinding to work
https://github.com/AvaloniaUI/Avalonia/blob/23d96c73667091bad8c28e19c79bab82bbbfb211/src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs#L33-L41 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.Input.GestureRecognizers;
namespace Avalonia.Input
{
public class PinchGestureRecognizer : AvaloniaObject, IGestureRecognizer
{
private IInputElement? _target;
private IGestureRecognizerActionsDispatcher? _actions;
private float _initialDistance;
private IPointer... | Why do we need this property to be public? | using Avalonia.Input.GestureRecognizers;
namespace Avalonia.Input
{
public class PinchGestureRecognizer : GestureRecognizer
{
private float _initialDistance;
private IPointer? _firstContact;
private Point _firstPoint;
private IPointer? _secondContact;
private Point _sec... | @@ -13,6 +13,8 @@ public class PinchGestureRecognizer : StyledElement, IGestureRecognizer
private Point _secondPoint;
private Point _origin;
+ public IInputElement? Target => _target; | src/Avalonia.Base/Input/GestureRecognizers/PinchGestureRecognizer.cs | 16 | C# | 0.071 | question | 42 | 41 | 41 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/PinchGestureRecognizer.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: using Avalonia.Input.GestureRecognizers;
namespace Avalonia.Input
{
public class PinchGestureRecognizer : AvaloniaObject, IGestureRe... | Why do we need this property to be public? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
_clickCount = 0;
}
++_clickCount;
_lastClickTime = timestamp;
_lastClickRect = new Rect(p, new Size())
.Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.... | This looks to be copy-pasted 3 times | var doubleClickSize = settings.GetDoubleTapSize(PointerType.Mouse);
if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime)
{
_clickCount = 0;
}
++_clickCount;
... | @@ -158,7 +159,22 @@ static PointerPointProperties CreateProperties(RawPointerEventArgs args)
device = device ?? throw new ArgumentNullException(nameof(device));
root = root ?? throw new ArgumentNullException(nameof(root));
- var source = _pointer.Captured ?? hitTest;
+ ... | src/Avalonia.Base/Input/MouseDevice.cs | 26 | C# | 0.071 | suggestion | 36 | 51 | 51 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/MouseDevice.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: {
_clickCount = 0;
}
++_clickCount;
_lastClickTime = timestamp;... | This looks to be copy-pasted 3 times | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
public void Move(Interactive target, Interactive source, in Point position, KeyModifiers modifiers = default)
{
var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, (Visual)target, position,
Timestamp(), PointerPointProperties.None, modifiers);
... | Both _pointer.Capture and CaptureGestureRecognizer should be resetting both captures and notify the current capture holder that the capture is lost |
public void Move(Interactive target, Interactive source, in Point position, KeyModifiers modifiers = default)
{
var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, (Visual)target, position,
Timestamp(), PointerPointProperties.None, modifiers);
... | @@ -27,18 +27,30 @@ public void Down(Interactive target, Interactive source, Point position = defaul
public void Move(Interactive target, Interactive source, in Point position, KeyModifiers modifiers = default)
{
- target.RaiseEvent(new PointerEventArgs(InputElement.PointerMovedEvent, sou... | tests/Avalonia.UnitTests/TouchTestHelper.cs | 26 | C# | 0.429 | suggestion | 147 | 40 | 40 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: tests/Avalonia.UnitTests/TouchTestHelper.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE:
public void Move(Interactive target, Interactive source, in Point position, KeyModifiers modifiers = default)
{
var e = new PointerEve... | Both _pointer.Capture and CaptureGestureRecognizer should be resetting both captures and notify the current capture holder that the capture is lost | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia.Input.GestureRecognizers
{
public abstract class GestureRecognizer : StyledElement
{
public abstract IInputElement? Target { get; }
public abstract void Initia... | Might be best to make these methods `protected internal`? User code shouldn't be calling them I don't think? | namespace Avalonia.Input.GestureRecognizers
{
public abstract class GestureRecognizer : StyledElement
{
protected internal IInputElement? Target { get; internal set; }
protected abstract void PointerPressed(PointerPressedEventArgs e);
protected abstract void PointerReleased(PointerRele... | @@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Avalonia.Input.GestureRecognizers
+{
+ public abstract class GestureRecognizer : StyledElement
+ {
+ public abstract IInputElement? Target { get; }
+ ... | src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizer.cs | 12 | C# | 0.571 | question | 108 | 24 | 37 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizer.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia.Input.... | Might be best to make these methods `protected internal`? User code shouldn't be calling them I don't think? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia.Input.GestureRecognizers
{
public abstract class GestureRecognizer : StyledElement
{
public abstract IInputElement? Target { get; }
public abstract void Initia... | Both `Target` and `Initialize` should be handled by the base class, IMO.
e. g.
```
protected internal IInputElement? Target { get; internal set; }
```
with `Initialize` being removed completely. | namespace Avalonia.Input.GestureRecognizers
{
public abstract class GestureRecognizer : StyledElement
{
protected internal IInputElement? Target { get; internal set; }
protected abstract void PointerPressed(PointerPressedEventArgs e);
protected abstract void PointerReleased(PointerRele... | @@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Avalonia.Input.GestureRecognizers
+{
+ public abstract class GestureRecognizer : StyledElement
+ {
+ public abstract IInputElement? Target { get; } | src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizer.cs | 11 | C# | 1 | suggestion | 203 | 24 | 36 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizer.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia.Input.... | Both `Target` and `Initialize` should be handled by the base class, IMO.
e. g.
```
protected internal IInputElement? Target { get; internal set; }
```
with `Initialize` being removed completely. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (recognizer is StyledElement styleableRecognizer
&& _inputElement is StyledElement styleableParent)
styleableParent.GetObservable(StyledElement.TemplatedParentProperty).Subscribe(parent => styleableRecognizer.TemplatedParent = parent);
}
}
... | We still need to skip the next recognizer from the collection when the current one has captured the pointer | if (recognizer is StyledElement styleableRecognizer
&& _inputElement is StyledElement styleableParent)
styleableParent.GetObservable(StyledElement.TemplatedParentProperty).Subscribe(parent => styleableRecognizer.TemplatedParent = parent);
}
}
... | @@ -41,24 +38,21 @@ public void Add(IGestureRecognizer recognizer)
}
}
- static readonly List<IGestureRecognizer> s_Empty = new List<IGestureRecognizer>();
+ static readonly List<GestureRecognizer> s_Empty = new List<GestureRecognizer>();
- public IEnumerator<IGestureRecog... | src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs | 26 | C# | 0.357 | suggestion | 107 | 51 | 51 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: if (recognizer is StyledElement styleableRecognizer
&& _inputElement is StyledElement styleablePa... | We still need to skip the next recognizer from the collection when the current one has captured the pointer | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
namespace Avalonia.Input.GestureRecognizers
{
public abstract class GestureRecognizer : StyledElement
{
protected internal IInputElement? Target { get; internal set; }
protected internal abstract void PointerPressed(PointerPressedEventArgs e);
protected internal abstract void PointerRe... | Since overriding the method leads to the user code adding `protected internal` too, can we use an `internal` wrapper method that calls a `protected` one instead? | namespace Avalonia.Input.GestureRecognizers
{
public abstract class GestureRecognizer : StyledElement
{
protected internal IInputElement? Target { get; internal set; }
protected abstract void PointerPressed(PointerPressedEventArgs e);
protected abstract void PointerReleased(PointerRele... | @@ -0,0 +1,17 @@
+namespace Avalonia.Input.GestureRecognizers
+{
+ public abstract class GestureRecognizer : StyledElement
+ {
+ protected internal IInputElement? Target { get; internal set; }
+
+ protected internal abstract void PointerPressed(PointerPressedEventArgs e); | src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizer.cs | 7 | C# | 0.571 | question | 161 | 18 | 32 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizer.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: namespace Avalonia.Input.GestureRecognizers
{
public abstract class GestureRecognizer : StyledElement
{
protected internal IIn... | Since overriding the method leads to the user code adding `protected internal` too, can we use an `internal` wrapper method that calls a `protected` one instead? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_clickCount = 0;
}
++_clickCount;
_lastClickTime = timestamp;
_lastClickRect = new Rect(p, new Size())
.Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2));
_lastMouseDownBu... | Why can't we use `gestureRecognizer.Target` as the source below? e. g.
`var source = gestureRecognizer.Target ?? pointer.Captured ?? hitTest)`.
And then add a check before `source.RaiseEvent`? That would reduce the amount of copypasta | var doubleClickTime = settings.GetDoubleTapTime(PointerType.Pen).TotalMilliseconds;
var doubleClickSize = settings.GetDoubleTapSize(PointerType.Pen);
if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime)
{
... | @@ -107,6 +108,18 @@ private void ProcessRawEvent(RawPointerEventArgs e)
KeyModifiers inputModifiers, IInputElement? hitTest,
Lazy<IReadOnlyList<RawPointerPoint>?>? intermediatePoints)
{
+ if (pointer.CapturedGestureRecognizer is GestureRecognizer gestureRecognizer)
+ ... | src/Avalonia.Base/Input/PenDevice.cs | 26 | C# | 0.643 | question | 236 | 51 | 51 | false | Rework GestureRecognizer handling | 11,518 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/PenDevice.cs
PR Title: Rework GestureRecognizer handling
BEFORE CODE: _clickCount = 0;
}
++_clickCount;
_lastClickTime = timestamp;
_lastClickRect = new Re... | Why can't we use `gestureRecognizer.Target` as the source below? e. g.
`var source = gestureRecognizer.Target ?? pointer.Captured ?? hitTest)`.
And then add a check before `source.RaiseEvent`? That would reduce the amount of copypasta | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
[DynamicDependency(XamlAccessible, typeof(Avalonia.Metadata.XmlnsDefinitionAttribute))]
[DynamicDependency(XamlAccessible, typeof(Avalonia.Point))]
[DynamicDependency(XamlAccessible, typeof(Avalonia.RelativePoint))]
[DynamicDependency(XamlAccessible, typeof(Avalonia.RelativeUnit))]
[DynamicDependenc... | `System.Collections.Generic.IReadOnlyList<>` from `AvaloniaXamlIlWellKnownTypes` seems missing (it's very likely kept by another type but let's be sure).
I assume that generating this list wasn't worth the amount of work since it's unlikely to change often? | using System;
using System.Diagnostics.CodeAnalysis;
// WARNING: this is a partial class, second part of which is generated by CompilerDynamicDependenciesGenerator.
namespace Avalonia.Markup.Xaml.XamlIl;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
internal sealed partial class CompilerDynamicDe... | @@ -0,0 +1,133 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+// WARNING: Keep in sync with any `typeSystem.GetType(string)` usage in the compiler.
+// If any type is missed here, runtime loader might crash due to trimmed types.
+
+// ReSharper disable RedundantNameQualifier
+
+namespace Avalonia.Markup.... | src/Markup/Avalonia.Markup.Xaml.Loader/CompilerDynamicDependencies.cs | 26 | C# | 0.786 | question | 260 | 31 | 19 | false | Trimmable runtime xaml loader | 12,937 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | maxkatz6 | Review this pull request change.
Language: C#
File: src/Markup/Avalonia.Markup.Xaml.Loader/CompilerDynamicDependencies.cs
PR Title: Trimmable runtime xaml loader
BEFORE CODE: [DynamicDependency(XamlAccessible, typeof(Avalonia.Metadata.XmlnsDefinitionAttribute))]
[DynamicDependency(XamlAccessible, typeof(Ava... | `System.Collections.Generic.IReadOnlyList<>` from `AvaloniaXamlIlWellKnownTypes` seems missing (it's very likely kept by another type but let's be sure).
I assume that generating this list wasn't worth the amount of work since it's unlikely to change often? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
using var factory = MicroComRuntime.CreateProxyFor<IDXGIFactory1>(pDxgiFactory, true);
void* pAdapter = null;
// As for now, we only need to redefine default adapter only on ARM64 just in case of Adreno GPU.
var redefineDefaultAdapter = Runt... | Checking for nvidia/amd gpus is probably unwanted there | {
using var factory = MicroComRuntime.CreateProxyFor<IDXGIFactory1>(pDxgiFactory, true);
void* pAdapter = null;
// As for now, we only need to redefine default adapter only on ARM64 just in case of Adreno GPU.
var redefineDefaultAdapter = Runt... | @@ -80,9 +81,17 @@ public static AngleWin32EglDisplay CreateSharedD3D11Display(EglInterface egl)
if (adapters.Count == 0)
throw new OpenGlException("No adapters found");
+
chosenAdapter = adapters
- .OrderByDescending(x => x.nam... | src/Windows/Avalonia.Win32/OpenGl/Angle/AngleWin32EglDisplay.cs | 26 | C# | 0.214 | suggestion | 55 | 51 | 51 | false | Avoid Adreno DXGI adapter on Win-ARM devices | 13,538 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | maxkatz6 | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/OpenGl/Angle/AngleWin32EglDisplay.cs
PR Title: Avoid Adreno DXGI adapter on Win-ARM devices
BEFORE CODE: {
using var factory = MicroComRuntime.CreateProxyFor<IDXGIFactory1>(pDxgiFactory, true);
... | Checking for nvidia/amd gpus is probably unwanted there | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
void* pAdapter = null;
// As for now, we only need to redefine default adapter only on ARM64 just in case of Adreno GPU.
var redefineDefaultAdapter = RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
if (redefineDefaultAdapter)
... | ```suggestion
x.name.Contains("adreno") ? -1 : 0)
``` | void* pAdapter = null;
// As for now, we only need to redefine default adapter only on ARM64 just in case of Adreno GPU.
var redefineDefaultAdapter = RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
if (redefineDefaultAdapter)
... | @@ -80,9 +81,17 @@ public static AngleWin32EglDisplay CreateSharedD3D11Display(EglInterface egl)
if (adapters.Count == 0)
throw new OpenGlException("No adapters found");
+
chosenAdapter = adapters
- .OrderByDescending(x => x.nam... | src/Windows/Avalonia.Win32/OpenGl/Angle/AngleWin32EglDisplay.cs | 26 | C# | 0.571 | suggestion | 83 | 51 | 51 | false | Avoid Adreno DXGI adapter on Win-ARM devices | 13,538 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/OpenGl/Angle/AngleWin32EglDisplay.cs
PR Title: Avoid Adreno DXGI adapter on Win-ARM devices
BEFORE CODE: void* pAdapter = null;
// As for now, we only need to redefine default adapter only on ARM64 just in... | ```suggestion
x.name.Contains("adreno") ? -1 : 0)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Interop.CFOptionFlags.kCFRunLoopAfterWaiting | Interop.CFOptionFlags.kCFRunLoopBeforeSources |
Interop.CFOptionFlags.kCFRunLoopBeforeWaiting,
1, 0, &ObserverCallback, IntPtr.Zero);
Interop.CFRunLoopAddObserver(_mainLoop, observer, Interop.kCFRunLoopDefaultMode);
_tim... | would be better to revert this change | var observer = Interop.CFRunLoopObserverCreate(IntPtr.Zero,
Interop.CFOptionFlags.kCFRunLoopAfterWaiting | Interop.CFOptionFlags.kCFRunLoopBeforeSources |
Interop.CFOptionFlags.kCFRunLoopBeforeWaiting,
1, 0, &ObserverCallback, IntPtr.Zero);
Interop.CFRunLoopAddObserve... | @@ -56,23 +52,23 @@ public bool CurrentThreadIsLoopThread
{
if (_loopThread != null)
return Thread.CurrentThread == _loopThread;
- if (!NSThread.IsMain) | src/iOS/Avalonia.iOS/DispatcherImpl.cs | 26 | C# | 0.143 | suggestion | 37 | 51 | 51 | false | Fix iOS Dispatcher | 13,942 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | maxkatz6 | Review this pull request change.
Language: C#
File: src/iOS/Avalonia.iOS/DispatcherImpl.cs
PR Title: Fix iOS Dispatcher
BEFORE CODE: Interop.CFOptionFlags.kCFRunLoopAfterWaiting | Interop.CFOptionFlags.kCFRunLoopBeforeSources |
Interop.CFOptionFlags.kCFRunLoopBeforeWaiting,
1, 0,... | would be better to revert this change | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// Initializes a new instance of the <see cref="TemplatePartAttribute"/> class.
/// </summary>
/// <param name="name">The part name used by the class to identify a required element in the style.</param>
/// <param name="type">The type of the element that should be... | "Gets or sets a value indicating whether..." is the correct documentation prefix for bool. Some code analyzers will warn if you don't start the summary docs with this.
> Gets or sets a value indicating whether the template part is mandatory to be present in the template. |
/// <summary>
/// Initializes a new instance of the <see cref="TemplatePartAttribute"/> class.
/// </summary>
/// <param name="name">The part name used by the class to identify a required element in the style.</param>
/// <param name="type">The type of the element that should be... | @@ -51,5 +49,10 @@ public TemplatePartAttribute(string name, Type type)
/// in <see cref="Name"/>.
/// </summary>
public Type Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets flag whether template part is mandatory to be present in the template. | src/Avalonia.Base/Controls/Metadata/TemplatePartAttribute.cs | 26 | C# | 0.429 | suggestion | 274 | 31 | 31 | false | TemplatePart XAML diagnostics | 14,180 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Controls/Metadata/TemplatePartAttribute.cs
PR Title: TemplatePart XAML diagnostics
BEFORE CODE:
/// <summary>
/// Initializes a new instance of the <see cref="TemplatePartAttribute"/> class.
/// </summary>
/// <pa... | "Gets or sets a value indicating whether..." is the correct documentation prefix for bool. Some code analyzers will warn if you don't start the summary docs with this.
> Gets or sets a value indicating whether the template part is mandatory to be present in the template. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (attr.Type.Name == "TemplatePartAttribute")
{
if (!attr.Properties.TryGetValue("Name", out var nameObj))
{
nameObj = attr.Parameters.FirstOrDefault();
}
if (!attr.Properties.TryGetValue("Type", out var typeOb... | Consider the following XAML:
```xml
<StackPanel>
<ContentPresenter x:Name="PART_ContentPresenterWithTypo"/>
<ItemsControl>
<ItemsControl.ItemTemplate>
...
<ContentPresenter x:Name="PART_ContentPresenter" />
...
</ItemsControl.ItemTemplate>
</ItemsControl>
... | if (attr.Type.Name == "TemplatePartAttribute")
{
if (!attr.Properties.TryGetValue("Name", out var nameObj))
{
nameObj = attr.Parameters.FirstOrDefault();
}
if (!attr.Properties.TryGetValue("Type", out var typeOb... | @@ -0,0 +1,129 @@
+using System.Collections.Generic;
+using System.Linq;
+using XamlX;
+using XamlX.Ast;
+using XamlX.Transform;
+using XamlX.TypeSystem;
+
+namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers;
+
+internal class AvaloniaXamlIlControlTemplatePartsChecker : IXamlAstTransformer
+{
+ p... | src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlControlTemplatePartsChecker.cs | 26 | C# | 1 | suggestion | 436 | 51 | 51 | false | TemplatePart XAML diagnostics | 14,180 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | maxkatz6 | Review this pull request change.
Language: C#
File: src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlControlTemplatePartsChecker.cs
PR Title: TemplatePart XAML diagnostics
BEFORE CODE: if (attr.Type.Name == "TemplatePartAttribute")
{
if (!a... | Consider the following XAML:
```xml
<StackPanel>
<ContentPresenter x:Name="PART_ContentPresenterWithTypo"/>
<ItemsControl>
<ItemsControl.ItemTemplate>
...
<ContentPresenter x:Name="PART_ContentPresenter" />
...
</ItemsControl.ItemTemplate>
</ItemsControl>
... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
public virtual object TryGetFeature(Type featureType)
{
if (featureType == typeof(INativeControlHostImpl))
{
return _nativeControlHost;
}
if (featureType == typeof(IStorageProvider))
{
return _storag... | Could the Launcher instance be cached? | public AcrylicPlatformCompensationLevels AcrylicCompensationLevels { get; } = new AcrylicPlatformCompensationLevels(1, 0, 0);
public virtual object TryGetFeature(Type featureType)
{
if (featureType == typeof(INativeControlHostImpl))
{
return _nativeControl... | @@ -581,6 +582,11 @@ public virtual object TryGetFeature(Type featureType)
return AvaloniaLocator.Current.GetRequiredService<IClipboard>();
}
+ if (featureType == typeof(ILauncher))
+ {
+ return new BclLauncher(); | src/Avalonia.Native/WindowImplBase.cs | 26 | C# | 0.143 | performance | 38 | 29 | 35 | false | Implement TopLevel.Launcher | 14,320 | AvaloniaUI/Avalonia | 24,333 | C# | affederaffe | maxkatz6 | Review this pull request change.
Language: C#
File: src/Avalonia.Native/WindowImplBase.cs
PR Title: Implement TopLevel.Launcher
BEFORE CODE: public virtual object TryGetFeature(Type featureType)
{
if (featureType == typeof(INativeControlHostImpl))
{
return _na... | Could the Launcher instance be cached? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
OnVisibilityChanged(true);
}
}
internal TopLevelImpl TopLevelImpl => _view;
internal TopLevel? TopLevel => _root;
public object? Content
{
get { return _root.Content; }
set { _root.Content = value; }
}
interna... | Shouldn't it be the other way around? Like we do on other platforms most of the time.
I.e., try to handle it on the Avalonia side, and if not handled - call base implementation.
```suggestion
if (!_view.View.DispatchKeyEvent(e))
return base.DispatchKeyEvent(e);
return tr... | OnVisibilityChanged(true);
}
}
internal TopLevelImpl TopLevelImpl => _view;
internal TopLevel? TopLevel => _root;
public object? Content
{
get { return _root.Content; }
set { _root.Content = value; }
}
interna... | @@ -66,7 +66,9 @@ public object? Content
public override bool DispatchKeyEvent(KeyEvent? e)
{
- return _view.View.DispatchKeyEvent(e);
+ if (!base.DispatchKeyEvent(e))
+ return _view.View.DispatchKeyEvent(e);
+ return true; | src/Android/Avalonia.Android/AvaloniaView.cs | 26 | C# | 1 | suggestion | 328 | 51 | 51 | false | Android - call base dispatch key event before called toplevel's override | 16,969 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | emmauss | Review this pull request change.
Language: C#
File: src/Android/Avalonia.Android/AvaloniaView.cs
PR Title: Android - call base dispatch key event before called toplevel's override
BEFORE CODE: OnVisibilityChanged(true);
}
}
internal TopLevelImpl TopLevelImpl => _view;
... | Shouldn't it be the other way around? Like we do on other platforms most of the time.
I.e., try to handle it on the Avalonia side, and if not handled - call base implementation.
```suggestion
if (!_view.View.DispatchKeyEvent(e))
return base.DispatchKeyEvent(e);
return tr... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Removes child elements from the <see cref="Panel.Children"/> collection.
/// </summary>
/// <param name="index">
/// The beginning index position within the collection at which the first child element is
/// removed.
/// </param>
/// <param name="count">The nu... | Please remove the `protected` modifier, this method shouldn't be exposed as public API. | /// </summary>
/// <param name="index">
/// The beginning index position within the collection at which the first child element is
/// removed.
/// </param>
/// <param name="count">The number of child elements to remove.</param>
protected void RemoveInternalChildR... | @@ -192,6 +194,24 @@ protected void RemoveInternalChildRange(int index, int count)
Children.RemoveRange(index, count);
}
+ /// <summary>
+ /// Gets the index of a content control item contained within this panel that matches the given text search
+ /// </summary>
+ //... | src/Avalonia.Controls/VirtualizingPanel.cs | 26 | C# | 0.429 | suggestion | 87 | 51 | 51 | false | Search all SelectingItemsControl items with TextSearch on key input, not just realized ones | 17,506 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | jonko0493 | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/VirtualizingPanel.cs
PR Title: Search all SelectingItemsControl items with TextSearch on key input, not just realized ones
BEFORE CODE: /// Removes child elements from the <see cref="Panel.Children"/> collection.
/// </summary... | Please remove the `protected` modifier, this method shouldn't be exposed as public API. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <param name="index">
/// The beginning index position within the collection at which the first child element is
/// removed.
/// </param>
/// <param name="count">The number of child elements to remove.</param>
protected void RemoveInternalChildRange(int index, int cou... | Use a single loop, and check each item for `ControlMatchesText` then `ToString()`, keeping the old behavior. | /// The beginning index position within the collection at which the first child element is
/// removed.
/// </param>
/// <param name="count">The number of child elements to remove.</param>
protected void RemoveInternalChildRange(int index, int count)
{
var ite... | @@ -192,6 +194,24 @@ protected void RemoveInternalChildRange(int index, int count)
Children.RemoveRange(index, count);
}
+ /// <summary>
+ /// Gets the index of a content control item contained within this panel that matches the given text search
+ /// </summary>
+ //... | src/Avalonia.Controls/VirtualizingPanel.cs | 26 | C# | 0.571 | suggestion | 108 | 51 | 51 | false | Search all SelectingItemsControl items with TextSearch on key input, not just realized ones | 17,506 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | jonko0493 | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/VirtualizingPanel.cs
PR Title: Search all SelectingItemsControl items with TextSearch on key input, not just realized ones
BEFORE CODE: /// <param name="index">
/// The beginning index position within the collection at which t... | Use a single loop, and check each item for `ControlMatchesText` then `ToString()`, keeping the old behavior. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System;
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Controls.Selection;
using MiniMvvm;
namespace ControlCatalog.ViewModels
{
public class ComboBoxPageViewModel : ViewModelBase
{
private bool _wrapSelection;
public bool WrapSelection
... | In C#, variables generally go near the top of the class and are grouped together. | using System;
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Controls.Selection;
using MiniMvvm;
namespace ControlCatalog.ViewModels
{
public class ComboBoxPageViewModel : ViewModelBase
{
private bool _wrapSelection;
private string _textValue =... | @@ -17,6 +17,20 @@ public bool WrapSelection
set => this.RaiseAndSetIfChanged(ref _wrapSelection, value);
}
+ private string _textValue = string.Empty; | samples/ControlCatalog/ViewModels/ComboBoxPageViewModel.cs | 20 | C# | 0.214 | suggestion | 81 | 45 | 45 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | thevortexcloud | almightyju | Review this pull request change.
Language: C#
File: samples/ControlCatalog/ViewModels/ComboBoxPageViewModel.cs
PR Title: IsEditable combox box
BEFORE CODE: using System;
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Controls.Selection;
using MiniMvvm;
namespace C... | In C#, variables generally go near the top of the class and are grouped together. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
return template;
}
private Popup? _popup;
private object? _selectionBoxItem;
private readonly CompositeDisposable _subscriptionsOnOpen = new CompositeDisposable();
private bool _isEditable;
private TextBox? _inputText;
private BindingEv... | This might be an issue if something is listening for text change events? It might not. I have not tested it. Personally though, I would expect a text change event to only ever be fired when the text actually changes. | return template;
}
private Popup? _popup;
private object? _selectionBoxItem;
private readonly CompositeDisposable _subscriptionsOnOpen = new CompositeDisposable();
private TextBox? _inputTextBox;
private BindingEvaluator<string?>? _textValueBindingEvaluator ... | @@ -103,6 +121,12 @@ static ComboBox()
ItemsPanelProperty.OverrideDefaultValue<ComboBox>(DefaultPanel);
FocusableProperty.OverrideDefaultValue<ComboBox>(true);
IsTextSearchEnabledProperty.OverrideDefaultValue<ComboBox>(true);
+ TextProperty.Changed.AddClassHandler<Combo... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.5 | suggestion | 216 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | thevortexcloud | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: }
return template;
}
private Popup? _popup;
private object? _selectionBoxItem;
private readonly CompositeDisposable _subscriptio... | This might be an issue if something is listening for text change events? It might not. I have not tested it. Personally though, I would expect a text change event to only ever be fired when the text actually changes. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
set => SetValue(PlaceholderForegroundProperty, value);
}
/// <summary>
/// Gets or sets the horizontal alignment of the content within the control.
/// </summary>
public HorizontalAlignment HorizontalContentAlignment
{
get => GetValue(HorizontalCo... | You should document what this does if `IsEditable` is not true. | {
get => GetValue(HorizontalContentAlignmentProperty);
set => SetValue(HorizontalContentAlignmentProperty, value);
}
/// <summary>
/// Gets or sets the vertical alignment of the content within the control.
/// </summary>
public VerticalAlignment V... | @@ -188,6 +221,21 @@ public IDataTemplate? SelectionBoxItemTemplate
set => SetValue(SelectionBoxItemTemplateProperty, value);
}
+ /// <summary>
+ /// Gets or sets the text used when <see cref="IsEditable"/> is true. | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.429 | suggestion | 63 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | thevortexcloud | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: set => SetValue(PlaceholderForegroundProperty, value);
}
/// <summary>
/// Gets or sets the horizontal alignment of the content within the control.
... | You should document what this does if `IsEditable` is not true. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
else
{
e.Handled = true;
}
}
}
/// <inheritdoc/>
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
base.OnPointerPressed(e);
if(!e.Handled && e.S... | How does WPF/winforms do this? I seem to vaguely recall that it actually opens the drop down and filters the list as you type. But it has been a long time, so I could be misremembering. | if(!e.Handled && e.Source is Visual source)
{
if (_popup?.IsInsidePopup(source) == true)
{
e.Handled = true;
return;
}
}
if (IsDropDownOpen)
{
// When a dr... | @@ -315,6 +363,15 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
/// <inheritdoc/>
protected override void OnPointerReleased(PointerReleasedEventArgs e)
{
+ //if the user clicked in the input text we don't want to open the dropdown | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.571 | question | 185 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | thevortexcloud | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: }
else
{
e.Handled = true;
}
}
}
/// <inheritdoc/>
protected ove... | How does WPF/winforms do this? I seem to vaguely recall that it actually opens the drop down and filters the list as you type. But it has been a long time, so I could be misremembering. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
public class ComboBox : SelectingItemsControl
{
internal const string pcDropdownOpen = ":dropdownopen";
interna... | This should be a `StyledProperty` so it can be set in styles. | /// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[TemplatePart("PART_EditableTextBox", typeof(TextBox), IsRequired = false)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
public class ComboBox : SelectingItemsControl
{... | @@ -38,6 +38,14 @@ public class ComboBox : SelectingItemsControl
public static readonly StyledProperty<bool> IsDropDownOpenProperty =
AvaloniaProperty.Register<ComboBox, bool>(nameof(IsDropDownOpen));
+ /// <summary>
+ /// Defines the <see cref="IsEditable"/> property.
+ ///... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.429 | suggestion | 61 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: /// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
... | This should be a `StyledProperty` so it can be set in styles. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
if (template is not null) return template;
if(obj is ComboBox comboBox && template is null)
{
return comboBox.ItemTemplate;
}
return template;
}
private Popup? _popup;
private object? _selectionBoxItem;
... | Use the existing `OnPropertyChanged` override instead of adding class handlers. | if (template is not null) return template;
if(obj is ComboBox comboBox && template is null)
{
return comboBox.ItemTemplate;
}
return template;
}
private Popup? _popup;
private object? _selectionBoxItem;
private ... | @@ -103,6 +121,12 @@ static ComboBox()
ItemsPanelProperty.OverrideDefaultValue<ComboBox>(DefaultPanel);
FocusableProperty.OverrideDefaultValue<ComboBox>(true);
IsTextSearchEnabledProperty.OverrideDefaultValue<ComboBox>(true);
+ TextProperty.Changed.AddClassHandler<Combo... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.571 | suggestion | 79 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: {
if (template is not null) return template;
if(obj is ComboBox comboBox && template is null)
{
return comboBox.ItemTemplate;... | Use the existing `OnPropertyChanged` override instead of adding class handlers. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
public static readonly StyledProperty<string?> TextProperty =
TextBlock.TextProperty.AddOwner<ComboBox>(new(string.Empty, BindingMode.TwoWay));
/// <summary>
/// Defines the <see cref="SelectionBoxItemTemplate"/> property.
/// </summary>
public static readonly Styled... | Nit: rename to `_inputTextBox` (it can be confusing with `Text` which is a string.) | TextBlock.TextProperty.AddOwner<ComboBox>(new(string.Empty, BindingMode.TwoWay));
/// <summary>
/// Defines the <see cref="SelectionBoxItemTemplate"/> property.
/// </summary>
public static readonly StyledProperty<IDataTemplate?> SelectionBoxItemTemplateProperty =
... | @@ -95,6 +109,10 @@ public class ComboBox : SelectingItemsControl
private object? _selectionBoxItem;
private readonly CompositeDisposable _subscriptionsOnOpen = new CompositeDisposable();
+ private bool _isEditable;
+ private TextBox? _inputText; | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.429 | nitpick | 83 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: public static readonly StyledProperty<string?> TextProperty =
TextBlock.TextProperty.AddOwner<ComboBox>(new(string.Empty, BindingMode.TwoWay));
/// <summary... | Nit: rename to `_inputTextBox` (it can be confusing with `Text` which is a string.) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
else if (PseudoClasses.Contains(pcPressed))
{
SetCurrentValue(IsDropDownOpenProperty, !IsDropDownOpen);
e.Handled = true;
}
}
PseudoClasses.Set(pcPressed, false);
base.OnPointer... | Use `.Find()` instead of `Get()`, that template part should stay optional. As far as I can tell, there are already proper null checks everywhere. | }
PseudoClasses.Set(pcPressed, false);
base.OnPointerReleased(e);
}
/// <inheritdoc/>
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
if (_popup != null)
{
_popup.Opened -= PopupOpened;
... | @@ -348,6 +399,8 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
_popup = e.NameScope.Get<Popup>("PART_Popup");
_popup.Opened += PopupOpened;
_popup.Closed += PopupClosed;
+
+ _inputText = e.NameScope.Get<TextBox>("PART_InputText"); | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.714 | suggestion | 145 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: }
else if (PseudoClasses.Contains(pcPressed))
{
SetCurrentValue(IsDropDownOpenProperty, !IsDropDownOpen);
... | Use `.Find()` instead of `Get()`, that template part should stay optional. As far as I can tell, there are already proper null checks everywhere. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
else if (PseudoClasses.Contains(pcPressed))
{
SetCurrentValue(IsDropDownOpenProperty, !IsDropDownOpen);
e.Handled = true;
}
}
PseudoClasses.Set(pcPressed, false);
base.OnPointer... | Add the `[TemplatePart]` attribute to the class. | }
PseudoClasses.Set(pcPressed, false);
base.OnPointerReleased(e);
}
/// <inheritdoc/>
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
if (_popup != null)
{
_popup.Opened -= PopupOpened;
... | @@ -348,6 +399,8 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
_popup = e.NameScope.Get<Popup>("PART_Popup");
_popup.Opened += PopupOpened;
_popup.Closed += PopupClosed;
+
+ _inputText = e.NameScope.Get<TextBox>("PART_InputText"); | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.214 | suggestion | 48 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: }
else if (PseudoClasses.Contains(pcPressed))
{
SetCurrentValue(IsDropDownOpenProperty, !IsDropDownOpen);
... | Add the `[TemplatePart]` attribute to the class. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
else if (PseudoClasses.Contains(pcPressed))
{
SetCurrentValue(IsDropDownOpenProperty, !IsDropDownOpen);
e.Handled = true;
}
}
PseudoClasses.Set(pcPressed, false);
base.OnPointer... | Let's use `PART_EditableTextBox` to match WPF. | }
PseudoClasses.Set(pcPressed, false);
base.OnPointerReleased(e);
}
/// <inheritdoc/>
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
if (_popup != null)
{
_popup.Opened -= PopupOpened;
... | @@ -348,6 +399,8 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
_popup = e.NameScope.Get<Popup>("PART_Popup");
_popup.Opened += PopupOpened;
_popup.Closed += PopupClosed;
+
+ _inputText = e.NameScope.Get<TextBox>("PART_InputText"); | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.286 | suggestion | 46 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: }
else if (PseudoClasses.Contains(pcPressed))
{
SetCurrentValue(IsDropDownOpenProperty, !IsDropDownOpen);
... | Let's use `PART_EditableTextBox` to match WPF. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
private void ItemTextBindingChanged(AvaloniaPropertyChangedEventArgs e)
=> HandleTextValueBindingValueChanged(e, null);
private void DisplayMemberBindingChanged(AvaloniaPropertyChangedEventArgs e)
=> HandleTextValueBindingValueChanged(null, e);
private void ... | Consider using `UpdateBinding` if the `_textValueBindingEvaluator` is already set. | {
return false;
}
}
var item = ItemsView[i];
var container = ContainerFromIndex(i);
if (IsSelectable(item) && IsSelectable(container))
{
S... | @@ -561,5 +632,66 @@ public void Clear()
SelectedItem = null;
SelectedIndex = -1;
}
+
+ private void ItemTextBindingChanged(AvaloniaPropertyChangedEventArgs e)
+ => HandleTextValueBindingValueChanged(e, null);
+
+ private void DisplayMemberBindingChanged(Aval... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.429 | suggestion | 82 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: }
private void ItemTextBindingChanged(AvaloniaPropertyChangedEventArgs e)
=> HandleTextValueBindingValueChanged(e, null);
private void DisplayMemb... | Consider using `UpdateBinding` if the `_textValueBindingEvaluator` is already set. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private void HandleTextValueBindingValueChanged(AvaloniaPropertyChangedEventArgs? textSearchPropChange,
AvaloniaPropertyChangedEventArgs? displayMemberPropChange)
{
IBinding? textValueBinding;
//prioritise using the TextSearch.TextBindingProperty if possible
... | Nit: move that up with the other fields. |
if (IsSelectable(item) && IsSelectable(container))
{
SelectedIndex = i;
return true;
}
}
return false;
}
/// <summary>
/// Clears the selection
/// </summary... | @@ -561,5 +632,66 @@ public void Clear()
SelectedItem = null;
SelectedIndex = -1;
}
+
+ private void ItemTextBindingChanged(AvaloniaPropertyChangedEventArgs e)
+ => HandleTextValueBindingValueChanged(e, null);
+
+ private void DisplayMemberBindingChanged(Aval... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.143 | nitpick | 40 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE:
private void HandleTextValueBindingValueChanged(AvaloniaPropertyChangedEventArgs? textSearchPropChange,
AvaloniaPropertyChangedEventArgs? displayMemberPropChange)
... | Nit: move that up with the other fields. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private bool _skipNextTextChanged = false;
private void TextChanged(AvaloniaPropertyChangedEventArgs e)
{
if (Items == null || !IsEditable || _skipNextTextChanged)
return;
string newVal = e.GetNewValue<string>();
int selectedIdx = -1;
... | Consider reverting the flag inside a `finally` block. | if (textSearchPropChange == null && TextSearch.GetTextBinding(this) is IBinding textSearchBinding)
textValueBinding = textSearchBinding;
else if (textSearchPropChange != null && textSearchPropChange.NewValue is IBinding eventTextSearchBinding)
textValueBinding = ... | @@ -561,5 +632,66 @@ public void Clear()
SelectedItem = null;
SelectedIndex = -1;
}
+
+ private void ItemTextBindingChanged(AvaloniaPropertyChangedEventArgs e)
+ => HandleTextValueBindingValueChanged(e, null);
+
+ private void DisplayMemberBindingChanged(Aval... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.429 | suggestion | 53 | 33 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: private bool _skipNextTextChanged = false;
private void TextChanged(AvaloniaPropertyChangedEventArgs e)
{
if (Items == null || !IsEditable || _skipNe... | Consider reverting the flag inside a `finally` block. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
public class ComboBox : SelectingItemsControl
{
internal const string pcDropdownOpen = ":dropdownopen";
interna... | Tab navigation is broken when `IsEditable = true`: tab first gets to the `ComboBox`, then to the inner `TextBox`. | /// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[TemplatePart("PART_EditableTextBox", typeof(TextBox), IsRequired = false)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
public class ComboBox : SelectingItemsControl
{... | @@ -38,6 +38,14 @@ public class ComboBox : SelectingItemsControl
public static readonly StyledProperty<bool> IsDropDownOpenProperty =
AvaloniaProperty.Register<ComboBox, bool>(nameof(IsDropDownOpen));
+ /// <summary>
+ /// Defines the <see cref="IsEditable"/> property.
+ ///... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.5 | bug | 113 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: /// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
... | Tab navigation is broken when `IsEditable = true`: tab first gets to the `ComboBox`, then to the inner `TextBox`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
public class ComboBox : SelectingItemsControl
{
internal const string pcDropdownOpen = ":dropdownopen";
interna... | Focusing the `ComboBox` when `IsEditable = true` should auto-select the text. (It matches WPF, Win32, and Avalonia's `AutoCompleteBox`). | /// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[TemplatePart("PART_EditableTextBox", typeof(TextBox), IsRequired = false)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
public class ComboBox : SelectingItemsControl
{... | @@ -38,6 +38,14 @@ public class ComboBox : SelectingItemsControl
public static readonly StyledProperty<bool> IsDropDownOpenProperty =
AvaloniaProperty.Register<ComboBox, bool>(nameof(IsDropDownOpen));
+ /// <summary>
+ /// Defines the <see cref="IsEditable"/> property.
+ ///... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.571 | suggestion | 136 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: /// <summary>
/// A drop-down list control.
/// </summary>
[TemplatePart("PART_Popup", typeof(Popup), IsRequired = true)]
[PseudoClasses(pcDropdownOpen, pcPressed)]
... | Focusing the `ComboBox` when `IsEditable = true` should auto-select the text. (It matches WPF, Win32, and Avalonia's `AutoCompleteBox`). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (template is not null) return template;
if(obj is ComboBox comboBox && template is null)
{
return comboBox.ItemTemplate;
}
return template;
}
private Popup? _popup;
private object? _selectionBoxItem;
private ... | Please also move that to `OnPropertyChanged` and avoid instantiating an `AvaloniaPropertyChangedEventArgs` for that - just pass the new text value directly to the `TextChanged` method. | if (template is not null) return template;
if(obj is ComboBox comboBox && template is null)
{
return comboBox.ItemTemplate;
}
return template;
}
private Popup? _popup;
private object? _selectionBoxItem;
private ... | @@ -103,6 +120,9 @@ static ComboBox()
ItemsPanelProperty.OverrideDefaultValue<ComboBox>(DefaultPanel);
FocusableProperty.OverrideDefaultValue<ComboBox>(true);
IsTextSearchEnabledProperty.OverrideDefaultValue<ComboBox>(true);
+ //when the items change we need to simulate... | src/Avalonia.Controls/ComboBox.cs | 26 | C# | 0.571 | suggestion | 184 | 51 | 51 | false | IsEditable combox box | 18,094 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | almightyju | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/ComboBox.cs
PR Title: IsEditable combox box
BEFORE CODE: if (template is not null) return template;
if(obj is ComboBox comboBox && template is null)
{
return comboBox.ItemTemplate;
... | Please also move that to `OnPropertyChanged` and avoid instantiating an `AvaloniaPropertyChangedEventArgs` for that - just pass the new text value directly to the `TextChanged` method. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
void WindowImpl::DoZoom() {
if (_decorations == SystemDecorationsNone ||
_decorations == SystemDecorationsBorderOnly ||
_canResize == false ||
_canMaximize == false) {
[Window setFrame:[Window screen].visibleFrame display:true];
} else {
[Window performZoom:Window];
... | 1) we probably don't need an ARP when we are on the UI thread, since there should be one provided by the event loop
2) use START_COM_ARP_CALL macro that enables both COM-safeguard and an ARP |
void WindowImpl::DoZoom() {
if (_decorations == SystemDecorationsNone ||
_decorations == SystemDecorationsBorderOnly ||
_canResize == false ||
_canMaximize == false) {
[Window setFrame:[Window screen].visibleFrame display:true];
} else {
[Window performZoom:Window];
... | @@ -208,6 +211,26 @@
}
}
+HRESULT WindowImpl::SetCanMinimize(bool value) {
+ START_COM_CALL;
+
+ @autoreleasepool { | native/Avalonia.Native/src/OSX/WindowImpl.mm | 26 | Objective-C++ | 0.571 | suggestion | 191 | 51 | 51 | false | Add Window.CanMinimize/CanMaximize | 18,117 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | MrJul | Review this pull request change.
Language: Objective-C++
File: native/Avalonia.Native/src/OSX/WindowImpl.mm
PR Title: Add Window.CanMinimize/CanMaximize
BEFORE CODE:
void WindowImpl::DoZoom() {
if (_decorations == SystemDecorationsNone ||
_decorations == SystemDecorationsBorderOnly ||
_canResiz... | 1) we probably don't need an ARP when we are on the UI thread, since there should be one provided by the event loop
2) use START_COM_ARP_CALL macro that enables both COM-safeguard and an ARP | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var newParent = change.NewValue as Window;
oldParent?.RemoveChild(this);
newParent?.AddChild(this, _showingAsDialog);
if (PlatformImpl is IWindowImpl impl)
{
impl.SetParent(_showingAsDialog ? newParent?.PlatformImpl! :... | Didn't know it's possible to trigger coercion of another property without changing it. | {
base.OnPropertyChanged(change);
if (change.Property == SystemDecorationsProperty)
{
var (_, typedNewValue) = change.GetOldAndNewValue<SystemDecorations>();
PlatformImpl?.SetSystemDecorations(typedNewValue);
}
else if... | @@ -1185,6 +1228,11 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
impl.SetParent(_showingAsDialog ? newParent?.PlatformImpl! : (newParent?.PlatformImpl ?? null));
}
}
+
+ else if (change.Property == CanResizeProperty)
+ ... | src/Avalonia.Controls/Window.cs | 26 | C# | 0.214 | suggestion | 86 | 41 | 51 | false | Add Window.CanMinimize/CanMaximize | 18,117 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | MrJul | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Window.cs
PR Title: Add Window.CanMinimize/CanMaximize
BEFORE CODE: var newParent = change.NewValue as Window;
oldParent?.RemoveChild(this);
newParent?.AddChild(this, _showingAsDialog);
... | Didn't know it's possible to trigger coercion of another property without changing it. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
// To hide a non-owned window's taskbar icon we need to parent it to a hidden window.
if (_parent is null)
{
SetWindowLongPtr(_hwnd, (int)WindowLongParam.GWL_HWNDPARENT, OffscreenParentWindow.Handle... | I know it's annoying, but we need integration tests for win/mac :) | }
else
{
exStyle &= ~WindowStyles.WS_EX_APPWINDOW;
}
WindowStyles style = WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_OVERLAPPEDWINDOW | WindowStyles.WS_CLIPSIBLINGS;
if (this is EmbeddedWindowImpl)
... | @@ -1440,15 +1460,19 @@ private void UpdateWindowProperties(WindowProperties newProperties, bool forceCh
style |= WindowStyles.WS_VISIBLE;
if (newProperties.IsResizable || newProperties.WindowState == WindowState.Maximized)
- {
style |= WindowS... | src/Windows/Avalonia.Win32/WindowImpl.cs | 26 | C# | 0.214 | suggestion | 66 | 51 | 51 | false | Add Window.CanMinimize/CanMaximize | 18,117 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | MrJul | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/WindowImpl.cs
PR Title: Add Window.CanMinimize/CanMaximize
BEFORE CODE: {
// To hide a non-owned window's taskbar icon we need to parent it to a hidden window.
if (_pare... | I know it's annoying, but we need integration tests for win/mac :) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Icons.ICON_BIG => _iconImpl.LoadBigIcon(scale),
_ => throw new NotImplementedException(),
};
}
return icon;
}
private void RefreshIcon()
{
SendMessage(_hwnd, (int)WindowsMessage.WM_SETICON, (nint)Icons.... | Just a question. Before this PR, developers were likely to call PInvokes directly to set these properties to hide minimize. Would it make sense to read initial values of _windowProperties from the API? It might be tricky, as we don't know at which point these properties are set. |
public void ShowTaskbarIcon(bool value)
{
var newWindowProperties = _windowProperties;
newWindowProperties.ShowInTaskbar = value;
UpdateWindowProperties(newWindowProperties);
}
public void CanResize(bool value)
{
var newWindowPr... | @@ -873,6 +875,24 @@ public void CanResize(bool value)
UpdateWindowProperties(newWindowProperties);
}
+ public void SetCanMinimize(bool value)
+ {
+ var newWindowProperties = _windowProperties;
+
+ newWindowProperties.IsMinimizable = value;
+
+ Upda... | src/Windows/Avalonia.Win32/WindowImpl.cs | 26 | C# | 0.429 | suggestion | 279 | 51 | 51 | false | Add Window.CanMinimize/CanMaximize | 18,117 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | MrJul | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/WindowImpl.cs
PR Title: Add Window.CanMinimize/CanMaximize
BEFORE CODE: Icons.ICON_BIG => _iconImpl.LoadBigIcon(scale),
_ => throw new NotImplementedException(),
};
}
... | Just a question. Before this PR, developers were likely to call PInvokes directly to set these properties to hide minimize. Would it make sense to read initial values of _windowProperties from the API? It might be tricky, as we don't know at which point these properties are set. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return false;
}
}
bool ICollection<KeyValuePair<object, object?>>.IsReadOnly => false;
private Dictionary<object, object?> Inner => _inner ??= new();
public void Add(object key, object? value)
{
Inner.Add(key, value);
... | Do you still need this flag? Only the `Inner` dictionary's indexer is called by this method, which shouldn't trigger any notification directly. | return false;
}
}
bool ICollection<KeyValuePair<object, object?>>.IsReadOnly => false;
private Dictionary<object, object?> Inner => _inner ??= new();
public void Add(object key, object? value)
{
Inner.Add(key, value);
... | @@ -150,6 +151,21 @@ public void AddDeferred(object key, IDeferredContent deferredContent)
public void AddNotSharedDeferred(object key, IDeferredContent deferredContent)
=> Add(key, new NotSharedDeferredItem(deferredContent));
+ public void AddOrUpdateRange(IEnumerable<KeyValuePair<object... | src/Avalonia.Base/Controls/ResourceDictionary.cs | 26 | C# | 0.571 | suggestion | 143 | 51 | 51 | false | Implement SetItems method in ResourceDictionary | 18,354 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | StefanKoell | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Controls/ResourceDictionary.cs
PR Title: Implement SetItems method in ResourceDictionary
BEFORE CODE: return false;
}
}
bool ICollection<KeyValuePair<object, object?>>.IsReadOnly => false;
pri... | Do you still need this flag? Only the `Inner` dictionary's indexer is called by this method, which shouldn't trigger any notification directly. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var focused = new Control();
var root = new TestRoot();
var gotFocusRaised = 0;
var propertyChangedRaised = 0;
focused.GotFocus += (s, e) => ++gotFocusRaised;
target.PropertyChanged += (s, e) =>
{
if (e.PropertyName ==... | Can you add a unit test with focus redirection?
Is it possible by a direct focus in this PR? Or do we need something like this https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.input.gettingfocuseventargs.trysetnewfocusedelement?view=windows-app-sdk-1.6 ? | var focused = new Control();
var root = new TestRoot();
var gotFocusRaised = 0;
var propertyChangedRaised = 0;
focused.GotFocus += (s, e) => ++gotFocusRaised;
target.PropertyChanged += (s, e) =>
{
if (e.PropertyName ==... | @@ -159,5 +159,31 @@ public void Control_Focus_Should_Be_Set_Before_FocusedElement_Raises_PropertyCha
Assert.Equal(1, propertyChangedRaised);
}
+
+ [Fact]
+ public void Cancelled_Focus_Change_Should_Not_Send_Got_Focus_Event() | tests/Avalonia.Base.UnitTests/Input/KeyboardDeviceTests.cs | 26 | C# | 0.5 | question | 292 | 51 | 51 | false | Add ability to cancel focus change | 18,373 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | emmauss | Review this pull request change.
Language: C#
File: tests/Avalonia.Base.UnitTests/Input/KeyboardDeviceTests.cs
PR Title: Add ability to cancel focus change
BEFORE CODE: var focused = new Control();
var root = new TestRoot();
var gotFocusRaised = 0;
var propertyChanged... | Can you add a unit test with focus redirection?
Is it possible by a direct focus in this PR? Or do we need something like this https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.input.gettingfocuseventargs.trysetnewfocusedelement?view=windows-app-sdk-1.6 ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
while (true)
{
if (null == await events.WaitForEventAsync(x =>
x.type == XEventName.PropertyNotify && x.PropertyEvent.atom == property
&& x.PropertyEvent.state == 1, TimeSpan.FromMinutes(1)))
... | Is an `else` missing? This will currently set the property twice (once normally, once with INCR) if the data doesn't need INCR. | while (true)
{
if (null == await events.WaitForEventAsync(x =>
x.type == XEventName.PropertyNotify && x.PropertyEvent.atom == property
&& x.PropertyEvent.state == 1, TimeSpan.FromMinutes(1)))
... | @@ -136,105 +140,78 @@ IntPtr WriteTargetToProperty(IntPtr target, IntPtr window, IntPtr property)
return property;
}
- else if(_x11.Atoms.GetAtomName(target) is { } atomName && _storedDataObject?.Contains(atomName) == true)
+ else if (_x11.Atoms.Get... | src/Avalonia.X11/Clipboard/X11Clipboard.cs | 26 | C# | 0.5 | suggestion | 127 | 51 | 51 | false | [X11] Added INCR support | 18,428 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | kekekeks | Review this pull request change.
Language: C#
File: src/Avalonia.X11/Clipboard/X11Clipboard.cs
PR Title: [X11] Added INCR support
BEFORE CODE: while (true)
{
if (null == await events.WaitForEventAsync(x =>
x.type == XEventName.PropertyNotify && x.Prope... | Is an `else` missing? This will currently set the property twice (once normally, once with INCR) if the data doesn't need INCR. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (filter(xev))
{
_listeners.RemoveAt(i);
i--;
tcs.SetResult(xev);
}
}
}
public Task<XEvent?> WaitForEventAsync(Func<XEvent, bool> predicate, TimeSpan? timeout = null)
{
timeout ??= TimeSpan.FromSeconds(5);... | The `_timeoutTimer` should probably be stopped here. (Currently it will be automatically stopped on next tick since there won't be any listener remaining, but it's better to cleanup asap.) | if (filter(xev))
{
_listeners.RemoveAt(i);
i--;
tcs.SetResult(xev);
}
}
}
public Task<XEvent?> WaitForEventAsync(Func<XEvent, bool> predicate, TimeSpan? timeout = null)
{
timeout ??= TimeSpan.FromSeconds(5);... | @@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Avalonia.Threading;
+
+namespace Avalonia.X11;
+
+internal class EventStreamWindow : IDisposable
+{
+ private readonly AvaloniaX11Platform _platform;
+ private I... | src/Avalonia.X11/Clipboard/EventStreamWindow.cs | 26 | C# | 0.571 | suggestion | 188 | 42 | 45 | false | [X11] Added INCR support | 18,428 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | kekekeks | Review this pull request change.
Language: C#
File: src/Avalonia.X11/Clipboard/EventStreamWindow.cs
PR Title: [X11] Added INCR support
BEFORE CODE: if (filter(xev))
{
_listeners.RemoveAt(i);
i--;
tcs.SetResult(xev);
}
}
... | The `_timeoutTimer` should probably be stopped here. (Currently it will be automatically stopped on next tick since there won't be any listener remaining, but it's better to cleanup asap.) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_textBox.EffectiveViewportChanged -= TextBoxEffectiveViewportChanged;
_textBox.SizeChanged -= TextBox_SizeChanged;
_textBox = null;
}
_presenter = textPresenter;
if (_presenter != null)
{
_textBox = _presen... | As far as I can tell, this new method isn't referenced anywhere? | _textBox.EffectiveViewportChanged -= TextBoxEffectiveViewportChanged;
_textBox.SizeChanged -= TextBox_SizeChanged;
_textBox = null;
}
_presenter = textPresenter;
if (_presenter != null)
{
_textBox = _presen... | @@ -279,21 +294,14 @@ internal void SetPresenter(TextPresenter? textPresenter)
_textBox.SizeChanged += TextBox_SizeChanged;
}
}
- else
- {
- if (_textBox != null)
- {
- _textBox.RemoveHandler(TextBo... | src/Avalonia.Controls/Primitives/TextSelectionCanvas.cs | 26 | C# | 0.214 | question | 64 | 51 | 51 | false | Fix caret handles not updating to the latest caret points | 18,794 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Primitives/TextSelectionCanvas.cs
PR Title: Fix caret handles not updating to the latest caret points
BEFORE CODE: _textBox.EffectiveViewportChanged -= TextBoxEffectiveViewportChanged;
_textBox.SizeChanged -= T... | As far as I can tell, this new method isn't referenced anywhere? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.OpenGL.Surfaces;
using Avalonia.Win32.OpenGl.Angle;
using MicroCom.Runtime;
using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32.DirectX
{
internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase
{
// DXGI_FORMAT_B8G8R8A8_UNORM is target textu... | I was confused by the `ushort` here before realizing that the current parameters had the wrong types.
Please wait for #18991 to get merged, then remove the `ushort`. | using Avalonia.OpenGL.Surfaces;
using Avalonia.Win32.OpenGl.Angle;
using MicroCom.Runtime;
using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32.DirectX
{
internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase
{
// DXGI_FORMAT_B8G8R8A8_UNORM is target textu... | @@ -24,6 +24,14 @@ internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase
private IUnknown? _renderTexture;
private RECT _clientRect;
+ [Flags]
+ enum AssociationFlags : ushort | src/Windows/Avalonia.Win32/DirectX/DxgiRenderTarget.cs | 26 | C# | 0.714 | bug | 166 | 51 | 51 | false | fix: Prevent DXGI from intercepting Alt+Enter and PrintScreen | 18,970 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | M0n7y5 | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/DirectX/DxgiRenderTarget.cs
PR Title: fix: Prevent DXGI from intercepting Alt+Enter and PrintScreen
BEFORE CODE: using Avalonia.OpenGL.Surfaces;
using Avalonia.Win32.OpenGl.Angle;
using MicroCom.Runtime;
using static Avalonia.Win32.Inter... | I was confused by the `ushort` here before realizing that the current parameters had the wrong types.
Please wait for #18991 to get merged, then remove the `ushort`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using Avalonia.OpenGL.Surfaces;
using Avalonia.Win32.OpenGl.Angle;
using MicroCom.Runtime;
using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32.DirectX
{
internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase
{
// DXGI_FORMAT_B8G8R8A8_UNORM is target textu... | Please define this in `DirectXEnums.cs` for consistency (the name could be `DXGI_MWA`).
Also, the second parameter for `MakeWindowAssociation()` in `DirectX.idl` could probably now be typed. | using Avalonia.OpenGL.Surfaces;
using Avalonia.Win32.OpenGl.Angle;
using MicroCom.Runtime;
using static Avalonia.Win32.Interop.UnmanagedMethods;
namespace Avalonia.Win32.DirectX
{
internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase
{
// DXGI_FORMAT_B8G8R8A8_UNORM is target textu... | @@ -24,6 +24,14 @@ internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase
private IUnknown? _renderTexture;
private RECT _clientRect;
+ [Flags]
+ enum AssociationFlags : ushort | src/Windows/Avalonia.Win32/DirectX/DxgiRenderTarget.cs | 26 | C# | 0.714 | suggestion | 191 | 51 | 51 | false | fix: Prevent DXGI from intercepting Alt+Enter and PrintScreen | 18,970 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | M0n7y5 | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/DirectX/DxgiRenderTarget.cs
PR Title: fix: Prevent DXGI from intercepting Alt+Enter and PrintScreen
BEFORE CODE: using Avalonia.OpenGL.Surfaces;
using Avalonia.Win32.OpenGl.Angle;
using MicroCom.Runtime;
using static Avalonia.Win32.Inter... | Please define this in `DirectXEnums.cs` for consistency (the name could be `DXGI_MWA`).
Also, the second parameter for `MakeWindowAssociation()` in `DirectX.idl` could probably now be typed. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_lastMoveTimestamp = null;
}
_inertiaDispatchOperation = null;
}
protected override void PointerReleased(PointerReleasedEventArgs e)
{
if (e.Pointer == _tracking && _scrolling)
{
_inertia = _velocityTracker?.GetF... | You can use TopLevel.RequestAnimationFrame method, as it's a stable API. MediaContext is internal. | Target!.RaiseEvent(new ScrollGestureEndedEventArgs(_gestureId));
_gestureId = 0;
_lastMoveTimestamp = null;
}
}
protected override void PointerReleased(PointerReleasedEventArgs e)
{
if (e.Pointer == _tracking && _scrolling... | @@ -181,53 +191,75 @@ protected override void PointerReleased(PointerReleasedEventArgs e)
else
{
_tracking = null;
- var savedGestureId = _gestureId;
- var st = Stopwatch.StartNew();
- var lastTime = TimeSpan... | src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs | 26 | C# | 0.286 | suggestion | 98 | 51 | 51 | false | Switch to using animation request for scroll inertia dispatch | 18,997 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
PR Title: Switch to using animation request for scroll inertia dispatch
BEFORE CODE: _lastMoveTimestamp = null;
}
_inertiaDispatchOperation = null;
... | You can use TopLevel.RequestAnimationFrame method, as it's a stable API. MediaContext is internal. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (_inertia is { } inertia)
{
_lastTime = timeSpan;
_inertiaStartTime = timeSpan;
_currentInertiaGestureId = _gestureId;
Target!.RaiseEvent(new ScrollGestureInertiaStartingEventArgs(_gestureId, inertia));
MediaCont... | Can you add a comment here, that we actually _want_ InvokeAsync only to raise events with Input priority? | }
private void OnAnimationRequested(TimeSpan _)
{
// Calculate the current speed and dispatch the next inertia event. This is done asynchronously so we have run the events
// with Input priority
Dispatcher.UIThread.InvokeAsync(() =>
{
... | @@ -181,53 +191,75 @@ protected override void PointerReleased(PointerReleasedEventArgs e)
else
{
_tracking = null;
- var savedGestureId = _gestureId;
- var st = Stopwatch.StartNew();
- var lastTime = TimeSpan... | src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs | 26 | C# | 0.357 | question | 106 | 51 | 51 | false | Switch to using animation request for scroll inertia dispatch | 18,997 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
PR Title: Switch to using animation request for scroll inertia dispatch
BEFORE CODE: if (_inertia is { } inertia)
{
_lastTime = timeSpan;
... | Can you add a comment here, that we actually _want_ InvokeAsync only to raise events with Input priority? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_lastMoveTimestamp = null;
}
_inertiaDispatchOperation = null;
}
protected override void PointerReleased(PointerReleasedEventArgs e)
{
if (e.Pointer == _tracking && _scrolling)
{
_inertia = _velocityTracker?.GetF... | I think StartInertial should be called directly from PointerReleased. There is no reason to delay that. | Target!.RaiseEvent(new ScrollGestureEndedEventArgs(_gestureId));
_gestureId = 0;
_lastMoveTimestamp = null;
}
}
protected override void PointerReleased(PointerReleasedEventArgs e)
{
if (e.Pointer == _tracking && _scrolling... | @@ -181,53 +191,75 @@ protected override void PointerReleased(PointerReleasedEventArgs e)
else
{
_tracking = null;
- var savedGestureId = _gestureId;
- var st = Stopwatch.StartNew();
- var lastTime = TimeSpan... | src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs | 26 | C# | 0.429 | suggestion | 103 | 51 | 51 | false | Switch to using animation request for scroll inertia dispatch | 18,997 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
PR Title: Switch to using animation request for scroll inertia dispatch
BEFORE CODE: _lastMoveTimestamp = null;
}
_inertiaDispatchOperation = null;
... | I think StartInertial should be called directly from PointerReleased. There is no reason to delay that. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
}
private void StartInertia(TimeSpan timeSpan)
{
if (_inertia is { } inertia)
{
_lastTime = timeSpan;
_inertiaStartTime = timeSpan;
_currentInertiaGestureId = _gestureId;
Target!.RaiseEvent(new... | All of those calculations should live in `Input` priority callback. The **only** job of animation frame callbacks is to throttle inertia events. `OnAnimationRequested` should just post a callback via dispatcher. | _currentInertiaGestureId = _gestureId;
Target!.RaiseEvent(new ScrollGestureInertiaStartingEventArgs(_gestureId, _inertia.Value));
MediaContext.Instance.RequestAnimationFrame(OnAnimationRequested);
}
}
}
private void... | @@ -181,53 +191,75 @@ protected override void PointerReleased(PointerReleasedEventArgs e)
else
{
_tracking = null;
- var savedGestureId = _gestureId;
- var st = Stopwatch.StartNew();
- var lastTime = TimeSpan... | src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs | 26 | C# | 0.643 | suggestion | 211 | 51 | 51 | false | Switch to using animation request for scroll inertia dispatch | 18,997 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
PR Title: Switch to using animation request for scroll inertia dispatch
BEFORE CODE: }
}
private void StartInertia(TimeSpan timeSpan)
{
if (_iner... | All of those calculations should live in `Input` priority callback. The **only** job of animation frame callbacks is to throttle inertia events. `OnAnimationRequested` should just post a callback via dispatcher. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
canvas.DrawColor(Color.Transparent, PorterDuff.Mode.Clear!);
}
base.DispatchDraw(canvas);
}
protected override bool DispatchGenericPointerEvent(MotionEvent? e)
{
var result = _tl._pointerHelper.DispatchMotionEvent(... | I don't think that `RequestCompositionUpdate` is the best equivalent for "ImmediateRenderRequested, but async". But I think it's close enough for resizing and screen rotation. | var newSize = Size.ToSize(Scaling);
var newScaling = Scaling;
if (newSize != _oldSize)
{
_oldSize = newSize;
_tl.OnResized(newSize);
}
// ReSharper disable once CompareOfFloatsByEqual... | @@ -234,20 +200,40 @@ public override bool DispatchKeyEvent(KeyEvent? e)
return res ?? baseResult;
}
- void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height)
+ public override void SurfaceChanged(ISurfaceHolder holder... | src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs | 26 | C# | 0.5 | suggestion | 175 | 51 | 51 | false | Cleanup InvalidationAwareSurfaceView related code | 19,045 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | maxkatz6 | Review this pull request change.
Language: C#
File: src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
PR Title: Cleanup InvalidationAwareSurfaceView related code
BEFORE CODE: canvas.DrawColor(Color.Transparent, PorterDuff.Mode.Clear!);
}
base.Dis... | I don't think that `RequestCompositionUpdate` is the best equivalent for "ImmediateRenderRequested, but async". But I think it's close enough for resizing and screen rotation. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
case Minimized:
if (currentState == FullScreen) {
ExitFullScreenMode();
} else {
[Window miniaturize:Window];
}
break;
case FullScreen:
if ... | Shouldn't the whole `switch` be skipped if `shouldResize == false`? The `SetWindowState(Maximized, false)` call might move the window otherwise (it's probably a no-op currently though). |
case Minimized:
if (currentState == FullScreen) {
ExitFullScreenMode();
} else {
[Window miniaturize:Window];
}
break;
case Fu... | @@ -517,7 +521,7 @@
ExitFullScreenMode();
}
- if (IsZoomed()) {
+ if (IsZoomed() && shouldResize == true) { | native/Avalonia.Native/src/OSX/WindowImpl.mm | 26 | Objective-C++ | 0.571 | suggestion | 185 | 51 | 51 | false | [Avalonia.Native] Add shouldResize value to SetWindowState, don't resize on Window move | 19,088 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | drasticactions | Review this pull request change.
Language: Objective-C++
File: native/Avalonia.Native/src/OSX/WindowImpl.mm
PR Title: [Avalonia.Native] Add shouldResize value to SetWindowState, don't resize on Window move
BEFORE CODE: case Minimized:
if (currentState == FullScreen) {
... | Shouldn't the whole `switch` be skipped if `shouldResize == false`? The `SetWindowState(Maximized, false)` call might move the window otherwise (it's probably a no-op currently though). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _glyphInfos[index];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set => _glyphInfos[index] = value;
}
public IEnumerator<GlyphInfo> GetEnumerator() => _glyphInfos.GetEnumerator();
... | I'd argue that splitting with a length of 0 should be valid, simply returning the buffer itself (like it's done below when the split position is beyond the length). | {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _glyphInfos[index];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set => _glyphInfos[index] = value;
}
public IEnumerator<GlyphInfo> GetEnumerator() => _glyphInfos.GetEnumerator();
... | @@ -89,90 +90,106 @@ public GlyphInfo this[int index]
public IEnumerator<GlyphInfo> GetEnumerator() => _glyphInfos.GetEnumerator();
+ internal void ResetBidiLevel(sbyte paragraphEmbeddingLevel) => BidiLevel = paragraphEmbeddingLevel;
+
+ int IReadOnlyCollection<GlyphInfo>.Count => _glyphInfos... | src/Avalonia.Base/Media/TextFormatting/ShapedBuffer.cs | 26 | C# | 0.429 | suggestion | 164 | 51 | 51 | false | Properly handle in cluster ShapedBuffer split | 19,090 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | Gillibald | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Media/TextFormatting/ShapedBuffer.cs
PR Title: Properly handle in cluster ShapedBuffer split
BEFORE CODE: {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _glyphInfos[index];
[MethodImpl(Meth... | I'd argue that splitting with a length of 0 should be valid, simply returning the buffer itself (like it's done below when the split position is beyond the length). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
break;
}
case DrawableTextRun drawableTextRun:
{
widthIncludingWhitespace += drawableTextRun.Size.Width;
if (drawableTextRun.Size.Height > height)
{
... | We can avoid this allocation by running the loop in reverse order | height = descent - ascent + lineGap;
}
widthIncludingWhitespace += textRun.Size.Width;
break;
}
case DrawableTextRun drawableTextRun:
{
... | @@ -1408,10 +1409,11 @@ private TextLineMetrics CreateLineMetrics()
}
var width = widthIncludingWhitespace;
+ var modifiedtextRuns = _paragraphProperties.FlowDirection == FlowDirection.RightToLeft ? _textRuns.Reverse().ToArray() : _textRuns; | src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs | 26 | C# | 0.286 | suggestion | 65 | 51 | 51 | false | fix: Selecting multiple lines in RTL textbox | 19,093 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | AhmedZero | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
PR Title: fix: Selecting multiple lines in RTL textbox
BEFORE CODE: break;
}
case DrawableTextRun drawableTextRun:
{
... | We can avoid this allocation by running the loop in reverse order | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return label is Control c ? GetOrCreate(c) : null;
}
protected override string? GetNameCore()
{
var result = AutomationProperties.GetName(Owner);
if (string.IsNullOrWhiteSpace(result) && GetLabeledBy() is AutomationPeer labeledBy)
{
... | Shouldn't this take higher priority than the tooltip fallback above? Validation errors should be one of the first things shown. | return label is Control c ? GetOrCreate(c) : null;
}
protected override string? GetNameCore()
{
var result = AutomationProperties.GetName(Owner);
if (string.IsNullOrWhiteSpace(result) && GetLabeledBy() is AutomationPeer labeledBy)
{
... | @@ -117,15 +117,22 @@ protected override IReadOnlyList<AutomationPeer> GetOrCreateChildrenCore()
return result;
}
protected override string? GetHelpTextCore()
- {
+ {
var result = AutomationProperties.GetHelpText(Owner);
if (string.IsNul... | src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs | 26 | C# | 0.571 | suggestion | 127 | 51 | 51 | false | Feat/19059 add automation for validation error | 19,161 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | longbuibao | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs
PR Title: Feat/19059 add automation for validation error
BEFORE CODE: return label is Control c ? GetOrCreate(c) : null;
}
protected override string? GetNameCore()
... | Shouldn't this take higher priority than the tooltip fallback above? Validation errors should be one of the first things shown. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Reactive;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Templates;
using Avalonia.Data;
using Avalonia.Automation.Peers;
using Avalonia.Controls.Automation.Peers;
namespace Avalonia.Controls
{
/// <summary>
/// A contr... | Newline is in the wrong spot. You shouldn't have usings right next to the class with no space. | using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Reactive;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Templates;
using Avalonia.Data;
namespace Avalonia.Controls
{
/// <summary>
/// A control which displays an error notifier when there is a DataValidationError.
... | @@ -5,7 +5,8 @@
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Templates;
using Avalonia.Data;
-
+using Avalonia.Automation.Peers;
+using Avalonia.Controls.Automation.Peers; | src/Avalonia.Controls/DataValidationErrors.cs | 9 | C# | 0.286 | bug | 94 | 34 | 34 | false | Feat/19059 add automation for validation error | 19,161 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | longbuibao | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/DataValidationErrors.cs
PR Title: Feat/19059 add automation for validation error
BEFORE CODE: using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Reactive;
using Avalonia.Controls.Metadata;
using Avalonia.Control... | Newline is in the wrong spot. You shouldn't have usings right next to the class with no space. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.