committed by
GitHub
59 changed files with 1032 additions and 338 deletions
@ -0,0 +1,76 @@ |
|||
# Contributor Covenant Code of Conduct |
|||
|
|||
## Our Pledge |
|||
|
|||
In the interest of fostering an open and welcoming environment, we as |
|||
contributors and maintainers pledge to making participation in our project and |
|||
our community a harassment-free experience for everyone, regardless of age, body |
|||
size, disability, ethnicity, sex characteristics, gender identity and expression, |
|||
level of experience, education, socio-economic status, nationality, personal |
|||
appearance, race, religion, or sexual identity and orientation. |
|||
|
|||
## Our Standards |
|||
|
|||
Examples of behavior that contributes to creating a positive environment |
|||
include: |
|||
|
|||
* Using welcoming and inclusive language |
|||
* Being respectful of differing viewpoints and experiences |
|||
* Gracefully accepting constructive criticism |
|||
* Focusing on what is best for the community |
|||
* Showing empathy towards other community members |
|||
|
|||
Examples of unacceptable behavior by participants include: |
|||
|
|||
* The use of sexualized language or imagery and unwelcome sexual attention or |
|||
advances |
|||
* Trolling, insulting/derogatory comments, and personal or political attacks |
|||
* Public or private harassment |
|||
* Publishing others' private information, such as a physical or electronic |
|||
address, without explicit permission |
|||
* Other conduct which could reasonably be considered inappropriate in a |
|||
professional setting |
|||
|
|||
## Our Responsibilities |
|||
|
|||
Project maintainers are responsible for clarifying the standards of acceptable |
|||
behavior and are expected to take appropriate and fair corrective action in |
|||
response to any instances of unacceptable behavior. |
|||
|
|||
Project maintainers have the right and responsibility to remove, edit, or |
|||
reject comments, commits, code, wiki edits, issues, and other contributions |
|||
that are not aligned to this Code of Conduct, or to ban temporarily or |
|||
permanently any contributor for other behaviors that they deem inappropriate, |
|||
threatening, offensive, or harmful. |
|||
|
|||
## Scope |
|||
|
|||
This Code of Conduct applies both within project spaces and in public spaces |
|||
when an individual is representing the project or its community. Examples of |
|||
representing a project or community include using an official project e-mail |
|||
address, posting via an official social media account, or acting as an appointed |
|||
representative at an online or offline event. Representation of a project may be |
|||
further defined and clarified by project maintainers. |
|||
|
|||
## Enforcement |
|||
|
|||
Instances of abusive, harassing, or otherwise unacceptable behavior may be |
|||
reported by contacting the project team at steven@avaloniaui.net. All |
|||
complaints will be reviewed and investigated and will result in a response that |
|||
is deemed necessary and appropriate to the circumstances. The project team is |
|||
obligated to maintain confidentiality with regard to the reporter of an incident. |
|||
Further details of specific enforcement policies may be posted separately. |
|||
|
|||
Project maintainers who do not follow or enforce the Code of Conduct in good |
|||
faith may face temporary or permanent repercussions as determined by other |
|||
members of the project's leadership. |
|||
|
|||
## Attribution |
|||
|
|||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, |
|||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html |
|||
|
|||
[homepage]: https://www.contributor-covenant.org |
|||
|
|||
For answers to common questions about this code of conduct, see |
|||
https://www.contributor-covenant.org/faq |
|||
@ -1,5 +1,6 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="System.ValueTuple" Version="4.5.0" /> |
|||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.6.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,128 +1,140 @@ |
|||
<Styles xmlns="https://github.com/avaloniaui"> |
|||
<Style Selector="ScrollBar"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
|||
<Grid RowDefinitions="Auto,*,Auto"> |
|||
<RepeatButton Name="PART_LineUpButton" |
|||
Classes="repeat" |
|||
Grid.Row="0" |
|||
Grid.Column="0" |
|||
Focusable="False"> |
|||
<Path Data="M 0,4 C0,4 0,6 0,6 0,6 3.5,2.5 3.5,2.5 3.5,2.5 7,6 7,6 7,6 7,4 7,4 7,4 3.5,0.5 3.5,0.5 3.5,0.5 0,4 0,4 z" |
|||
Stretch="Uniform" |
|||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
|||
</RepeatButton> |
|||
<Track Grid.Row="1" |
|||
Grid.Column="1" |
|||
Minimum="{TemplateBinding Minimum}" |
|||
Maximum="{TemplateBinding Maximum}" |
|||
Value="{TemplateBinding Value, Mode=TwoWay}" |
|||
ViewportSize="{TemplateBinding ViewportSize}" |
|||
Orientation="{TemplateBinding Orientation}" |
|||
IsDirectionReversed="True"> |
|||
<Track.DecreaseButton> |
|||
<RepeatButton Name="PART_PageUpButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.DecreaseButton> |
|||
<Track.IncreaseButton> |
|||
<RepeatButton Name="PART_PageDownButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.IncreaseButton> |
|||
<Thumb Name="thumb"/> |
|||
</Track> |
|||
<RepeatButton Name="PART_LineDownButton" |
|||
Classes="repeat" |
|||
Grid.Row="2" |
|||
Grid.Column="2" |
|||
Focusable="False"> |
|||
<Path Data="M 0,2.5 C0,2.5 0,0.5 0,0.5 0,0.5 3.5,4 3.5,4 3.5,4 7,0.5 7,0.5 7,0.5 7,2.5 7,2.5 7,2.5 3.5,6 3.5,6 3.5,6 0,2.5 0,2.5 z" |
|||
Stretch="Uniform" |
|||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
|||
</RepeatButton> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="ScrollBar:horizontal"> |
|||
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" /> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
|||
<Grid ColumnDefinitions="Auto,*,Auto"> |
|||
<RepeatButton Name="PART_LineUpButton" |
|||
Classes="repeat" |
|||
Grid.Row="0" |
|||
Grid.Column="0" |
|||
Focusable="False"> |
|||
<Path Data="M 3.18,7 C3.18,7 5,7 5,7 5,7 1.81,3.5 1.81,3.5 1.81,3.5 5,0 5,0 5,0 3.18,0 3.18,0 3.18,0 0,3.5 0,3.5 0,3.5 3.18,7 3.18,7 z" |
|||
Stretch="Uniform" |
|||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
|||
</RepeatButton> |
|||
<Track Grid.Row="1" |
|||
Grid.Column="1" |
|||
Minimum="{TemplateBinding Minimum}" |
|||
Maximum="{TemplateBinding Maximum}" |
|||
Value="{TemplateBinding Value, Mode=TwoWay}" |
|||
ViewportSize="{TemplateBinding ViewportSize}" |
|||
Orientation="{TemplateBinding Orientation}"> |
|||
<Track.DecreaseButton> |
|||
<RepeatButton Name="PART_PageUpButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.DecreaseButton> |
|||
<Track.IncreaseButton> |
|||
<RepeatButton Name="PART_PageDownButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.IncreaseButton> |
|||
<Thumb Name="thumb"/> |
|||
</Track> |
|||
<RepeatButton Name="PART_LineDownButton" |
|||
Classes="repeat" |
|||
Grid.Row="2" |
|||
Grid.Column="2" |
|||
Focusable="False"> |
|||
<Path Data="M 1.81,7 C1.81,7 0,7 0,7 0,7 3.18,3.5 3.18,3.5 3.18,3.5 0,0 0,0 0,0 1.81,0 1.81,0 1.81,0 5,3.5 5,3.5 5,3.5 1.81,7 1.81,7 z" |
|||
Stretch="Uniform" |
|||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
|||
</RepeatButton> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ Thumb#thumb"> |
|||
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}"/> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="ScrollBar:horizontal /template/ Thumb#thumb"> |
|||
<Setter Property="MinWidth" Value="{DynamicResource ScrollBarThickness}" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar:vertical"> |
|||
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar:vertical /template/ Thumb#thumb"> |
|||
<Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ RepeatButton.repeat"> |
|||
<Setter Property="Padding" Value="2" /> |
|||
<Setter Property="BorderThickness" Value="0" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ RepeatButton.repeattrack"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}" /> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="ScrollBar"> |
|||
<Setter Property="Cursor" Value="Arrow" /> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
|||
<Grid RowDefinitions="Auto,*,Auto"> |
|||
<RepeatButton Name="PART_LineUpButton" HorizontalAlignment="Center" |
|||
Classes="repeat" |
|||
Grid.Row="0" |
|||
Focusable="False" |
|||
MinHeight="{DynamicResource ScrollBarThickness}"> |
|||
<Path Data="M 0 4 L 8 4 L 4 0 Z" /> |
|||
</RepeatButton> |
|||
<Track Grid.Row="1" |
|||
Grid.Column="1" |
|||
Minimum="{TemplateBinding Minimum}" |
|||
Maximum="{TemplateBinding Maximum}" |
|||
Value="{TemplateBinding Value, Mode=TwoWay}" |
|||
ViewportSize="{TemplateBinding ViewportSize}" |
|||
Orientation="{TemplateBinding Orientation}" |
|||
IsDirectionReversed="True"> |
|||
<Track.DecreaseButton> |
|||
<RepeatButton Name="PART_PageUpButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.DecreaseButton> |
|||
<Track.IncreaseButton> |
|||
<RepeatButton Name="PART_PageDownButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.IncreaseButton> |
|||
<Thumb Name="thumb"/> |
|||
</Track> |
|||
<RepeatButton Name="PART_LineDownButton" HorizontalAlignment="Center" |
|||
Classes="repeat" |
|||
Grid.Row="2" |
|||
Grid.Column="2" |
|||
Focusable="False" |
|||
MinHeight="{DynamicResource ScrollBarThickness}"> |
|||
<Path Data="M 0 0 L 4 4 L 8 0 Z" /> |
|||
</RepeatButton> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="ScrollBar:horizontal"> |
|||
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" /> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
|||
<Grid ColumnDefinitions="Auto,*,Auto"> |
|||
<RepeatButton Name="PART_LineUpButton" VerticalAlignment="Center" |
|||
Classes="repeat" |
|||
Grid.Row="0" |
|||
Grid.Column="0" |
|||
Focusable="False" |
|||
MinWidth="{DynamicResource ScrollBarThickness}"> |
|||
<Path Data="M 4 0 L 4 8 L 0 4 Z" /> |
|||
</RepeatButton> |
|||
<Track Grid.Row="1" |
|||
Grid.Column="1" |
|||
Minimum="{TemplateBinding Minimum}" |
|||
Maximum="{TemplateBinding Maximum}" |
|||
Value="{TemplateBinding Value, Mode=TwoWay}" |
|||
ViewportSize="{TemplateBinding ViewportSize}" |
|||
Orientation="{TemplateBinding Orientation}"> |
|||
<Track.DecreaseButton> |
|||
<RepeatButton Name="PART_PageUpButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.DecreaseButton> |
|||
<Track.IncreaseButton> |
|||
<RepeatButton Name="PART_PageDownButton" |
|||
Classes="repeattrack" |
|||
Focusable="False"/> |
|||
</Track.IncreaseButton> |
|||
<Thumb Name="thumb"/> |
|||
</Track> |
|||
<RepeatButton Name="PART_LineDownButton" VerticalAlignment="Center" |
|||
Classes="repeat" |
|||
Grid.Row="2" |
|||
Grid.Column="2" |
|||
Focusable="False" |
|||
MinWidth="{DynamicResource ScrollBarThickness}"> |
|||
<Path Data="M 0 0 L 4 4 L 0 8 Z" /> |
|||
</RepeatButton> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ Thumb#thumb"> |
|||
<Setter Property="Background" Value="{DynamicResource ThemeControlMidHighBrush}"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}"/> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ Thumb#thumb:pointerover"> |
|||
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ Thumb#thumb:pressed"> |
|||
<Setter Property="Background" Value="{DynamicResource ThemeControlVeryHighBrush}"/> |
|||
</Style> |
|||
<Style Selector="ScrollBar:horizontal /template/ Thumb#thumb"> |
|||
<Setter Property="MinWidth" Value="{DynamicResource ScrollBarThickness}" /> |
|||
<Setter Property="Height" Value="{DynamicResource ScrollBarThumbThickness}" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar:vertical"> |
|||
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar:vertical /template/ Thumb#thumb"> |
|||
<Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" /> |
|||
<Setter Property="Width" Value="{DynamicResource ScrollBarThumbThickness}" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ RepeatButton.repeat"> |
|||
<Setter Property="Padding" Value="2" /> |
|||
<Setter Property="BorderThickness" Value="0" /> |
|||
</Style> |
|||
<Style Selector="ScrollBar /template/ RepeatButton.repeattrack"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}" /> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style Selector="ScrollBar /template/ RepeatButton > Path"> |
|||
<Setter Property="Fill" Value="{DynamicResource ThemeForegroundLowBrush}" /> |
|||
</Style> |
|||
|
|||
<Style Selector="ScrollBar /template/ RepeatButton:pointerover > Path"> |
|||
<Setter Property="Fill" Value="{DynamicResource ThemeAccentBrush}" /> |
|||
</Style> |
|||
</Styles> |
|||
|
|||
@ -1 +1 @@ |
|||
Subproject commit c7155c5f6c1a5153ee2d8cd78e5d1524dd6744cf |
|||
Subproject commit ad9915e19398a49c5a11b66000c361659ca692b3 |
|||
@ -0,0 +1,90 @@ |
|||
using Avalonia.Input.Raw; |
|||
using Avalonia.Interactivity; |
|||
using Moq; |
|||
using Xunit; |
|||
|
|||
namespace Avalonia.Input.UnitTests |
|||
{ |
|||
public class KeyboardDeviceTests |
|||
{ |
|||
[Fact] |
|||
public void Keypresses_Should_Be_Sent_To_Root_If_No_Focused_Element() |
|||
{ |
|||
var target = new KeyboardDevice(); |
|||
var root = new Mock<IInputRoot>(); |
|||
|
|||
target.ProcessRawEvent( |
|||
new RawKeyEventArgs( |
|||
target, |
|||
0, |
|||
root.Object, |
|||
RawKeyEventType.KeyDown, |
|||
Key.A, |
|||
RawInputModifiers.None)); |
|||
|
|||
root.Verify(x => x.RaiseEvent(It.IsAny<KeyEventArgs>())); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Keypresses_Should_Be_Sent_To_Focused_Element() |
|||
{ |
|||
var target = new KeyboardDevice(); |
|||
var focused = new Mock<IInputElement>(); |
|||
var root = Mock.Of<IInputRoot>(); |
|||
|
|||
target.SetFocusedElement( |
|||
focused.Object, |
|||
NavigationMethod.Unspecified, |
|||
InputModifiers.None); |
|||
|
|||
target.ProcessRawEvent( |
|||
new RawKeyEventArgs( |
|||
target, |
|||
0, |
|||
root, |
|||
RawKeyEventType.KeyDown, |
|||
Key.A, |
|||
RawInputModifiers.None)); |
|||
|
|||
focused.Verify(x => x.RaiseEvent(It.IsAny<KeyEventArgs>())); |
|||
} |
|||
|
|||
[Fact] |
|||
public void TextInput_Should_Be_Sent_To_Root_If_No_Focused_Element() |
|||
{ |
|||
var target = new KeyboardDevice(); |
|||
var root = new Mock<IInputRoot>(); |
|||
|
|||
target.ProcessRawEvent( |
|||
new RawTextInputEventArgs( |
|||
target, |
|||
0, |
|||
root.Object, |
|||
"Foo")); |
|||
|
|||
root.Verify(x => x.RaiseEvent(It.IsAny<TextInputEventArgs>())); |
|||
} |
|||
|
|||
[Fact] |
|||
public void TextInput_Should_Be_Sent_To_Focused_Element() |
|||
{ |
|||
var target = new KeyboardDevice(); |
|||
var focused = new Mock<IInputElement>(); |
|||
var root = Mock.Of<IInputRoot>(); |
|||
|
|||
target.SetFocusedElement( |
|||
focused.Object, |
|||
NavigationMethod.Unspecified, |
|||
InputModifiers.None); |
|||
|
|||
target.ProcessRawEvent( |
|||
new RawTextInputEventArgs( |
|||
target, |
|||
0, |
|||
root, |
|||
"Foo")); |
|||
|
|||
focused.Verify(x => x.RaiseEvent(It.IsAny<TextInputEventArgs>())); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue