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"> |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
<ItemGroup> |
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" /> |
<PackageReference Include="System.ValueTuple" Version="4.5.0" /> |
||||
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.6.0" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -1,128 +1,140 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui"> |
||||
<Style Selector="ScrollBar"> |
<Style Selector="ScrollBar"> |
||||
<Setter Property="Template"> |
<Setter Property="Cursor" Value="Arrow" /> |
||||
<ControlTemplate> |
<Setter Property="Template"> |
||||
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
<ControlTemplate> |
||||
<Grid RowDefinitions="Auto,*,Auto"> |
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
||||
<RepeatButton Name="PART_LineUpButton" |
<Grid RowDefinitions="Auto,*,Auto"> |
||||
Classes="repeat" |
<RepeatButton Name="PART_LineUpButton" HorizontalAlignment="Center" |
||||
Grid.Row="0" |
Classes="repeat" |
||||
Grid.Column="0" |
Grid.Row="0" |
||||
Focusable="False"> |
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" |
MinHeight="{DynamicResource ScrollBarThickness}"> |
||||
Stretch="Uniform" |
<Path Data="M 0 4 L 8 4 L 4 0 Z" /> |
||||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
</RepeatButton> |
||||
</RepeatButton> |
<Track Grid.Row="1" |
||||
<Track Grid.Row="1" |
Grid.Column="1" |
||||
Grid.Column="1" |
Minimum="{TemplateBinding Minimum}" |
||||
Minimum="{TemplateBinding Minimum}" |
Maximum="{TemplateBinding Maximum}" |
||||
Maximum="{TemplateBinding Maximum}" |
Value="{TemplateBinding Value, Mode=TwoWay}" |
||||
Value="{TemplateBinding Value, Mode=TwoWay}" |
ViewportSize="{TemplateBinding ViewportSize}" |
||||
ViewportSize="{TemplateBinding ViewportSize}" |
Orientation="{TemplateBinding Orientation}" |
||||
Orientation="{TemplateBinding Orientation}" |
IsDirectionReversed="True"> |
||||
IsDirectionReversed="True"> |
<Track.DecreaseButton> |
||||
<Track.DecreaseButton> |
<RepeatButton Name="PART_PageUpButton" |
||||
<RepeatButton Name="PART_PageUpButton" |
Classes="repeattrack" |
||||
Classes="repeattrack" |
Focusable="False"/> |
||||
Focusable="False"/> |
</Track.DecreaseButton> |
||||
</Track.DecreaseButton> |
<Track.IncreaseButton> |
||||
<Track.IncreaseButton> |
<RepeatButton Name="PART_PageDownButton" |
||||
<RepeatButton Name="PART_PageDownButton" |
Classes="repeattrack" |
||||
Classes="repeattrack" |
Focusable="False"/> |
||||
Focusable="False"/> |
</Track.IncreaseButton> |
||||
</Track.IncreaseButton> |
<Thumb Name="thumb"/> |
||||
<Thumb Name="thumb"/> |
</Track> |
||||
</Track> |
<RepeatButton Name="PART_LineDownButton" HorizontalAlignment="Center" |
||||
<RepeatButton Name="PART_LineDownButton" |
Classes="repeat" |
||||
Classes="repeat" |
Grid.Row="2" |
||||
Grid.Row="2" |
Grid.Column="2" |
||||
Grid.Column="2" |
Focusable="False" |
||||
Focusable="False"> |
MinHeight="{DynamicResource ScrollBarThickness}"> |
||||
<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" |
<Path Data="M 0 0 L 4 4 L 8 0 Z" /> |
||||
Stretch="Uniform" |
</RepeatButton> |
||||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
</Grid> |
||||
</RepeatButton> |
</Border> |
||||
</Grid> |
</ControlTemplate> |
||||
</Border> |
</Setter> |
||||
</ControlTemplate> |
</Style> |
||||
</Setter> |
<Style Selector="ScrollBar:horizontal"> |
||||
</Style> |
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" /> |
||||
<Style Selector="ScrollBar:horizontal"> |
<Setter Property="Template"> |
||||
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" /> |
<ControlTemplate> |
||||
<Setter Property="Template"> |
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
||||
<ControlTemplate> |
<Grid ColumnDefinitions="Auto,*,Auto"> |
||||
<Border Background="{DynamicResource ThemeControlMidBrush}"> |
<RepeatButton Name="PART_LineUpButton" VerticalAlignment="Center" |
||||
<Grid ColumnDefinitions="Auto,*,Auto"> |
Classes="repeat" |
||||
<RepeatButton Name="PART_LineUpButton" |
Grid.Row="0" |
||||
Classes="repeat" |
Grid.Column="0" |
||||
Grid.Row="0" |
Focusable="False" |
||||
Grid.Column="0" |
MinWidth="{DynamicResource ScrollBarThickness}"> |
||||
Focusable="False"> |
<Path Data="M 4 0 L 4 8 L 0 4 Z" /> |
||||
<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" |
</RepeatButton> |
||||
Stretch="Uniform" |
<Track Grid.Row="1" |
||||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
Grid.Column="1" |
||||
</RepeatButton> |
Minimum="{TemplateBinding Minimum}" |
||||
<Track Grid.Row="1" |
Maximum="{TemplateBinding Maximum}" |
||||
Grid.Column="1" |
Value="{TemplateBinding Value, Mode=TwoWay}" |
||||
Minimum="{TemplateBinding Minimum}" |
ViewportSize="{TemplateBinding ViewportSize}" |
||||
Maximum="{TemplateBinding Maximum}" |
Orientation="{TemplateBinding Orientation}"> |
||||
Value="{TemplateBinding Value, Mode=TwoWay}" |
<Track.DecreaseButton> |
||||
ViewportSize="{TemplateBinding ViewportSize}" |
<RepeatButton Name="PART_PageUpButton" |
||||
Orientation="{TemplateBinding Orientation}"> |
Classes="repeattrack" |
||||
<Track.DecreaseButton> |
Focusable="False"/> |
||||
<RepeatButton Name="PART_PageUpButton" |
</Track.DecreaseButton> |
||||
Classes="repeattrack" |
<Track.IncreaseButton> |
||||
Focusable="False"/> |
<RepeatButton Name="PART_PageDownButton" |
||||
</Track.DecreaseButton> |
Classes="repeattrack" |
||||
<Track.IncreaseButton> |
Focusable="False"/> |
||||
<RepeatButton Name="PART_PageDownButton" |
</Track.IncreaseButton> |
||||
Classes="repeattrack" |
<Thumb Name="thumb"/> |
||||
Focusable="False"/> |
</Track> |
||||
</Track.IncreaseButton> |
<RepeatButton Name="PART_LineDownButton" VerticalAlignment="Center" |
||||
<Thumb Name="thumb"/> |
Classes="repeat" |
||||
</Track> |
Grid.Row="2" |
||||
<RepeatButton Name="PART_LineDownButton" |
Grid.Column="2" |
||||
Classes="repeat" |
Focusable="False" |
||||
Grid.Row="2" |
MinWidth="{DynamicResource ScrollBarThickness}"> |
||||
Grid.Column="2" |
<Path Data="M 0 0 L 4 4 L 0 8 Z" /> |
||||
Focusable="False"> |
</RepeatButton> |
||||
<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" |
</Grid> |
||||
Stretch="Uniform" |
</Border> |
||||
Fill="{DynamicResource ThemeForegroundLowBrush}" /> |
</ControlTemplate> |
||||
</RepeatButton> |
</Setter> |
||||
</Grid> |
</Style> |
||||
</Border> |
<Style Selector="ScrollBar /template/ Thumb#thumb"> |
||||
</ControlTemplate> |
<Setter Property="Background" Value="{DynamicResource ThemeControlMidHighBrush}"/> |
||||
</Setter> |
<Setter Property="Template"> |
||||
</Style> |
<Setter.Value> |
||||
<Style Selector="ScrollBar /template/ Thumb#thumb"> |
<ControlTemplate> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> |
<Border Background="{TemplateBinding Background}"/> |
||||
<Setter Property="Template"> |
</ControlTemplate> |
||||
<Setter.Value> |
</Setter.Value> |
||||
<ControlTemplate> |
</Setter> |
||||
<Border Background="{TemplateBinding Background}"/> |
</Style> |
||||
</ControlTemplate> |
<Style Selector="ScrollBar /template/ Thumb#thumb:pointerover"> |
||||
</Setter.Value> |
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> |
||||
</Setter> |
</Style> |
||||
</Style> |
<Style Selector="ScrollBar /template/ Thumb#thumb:pressed"> |
||||
<Style Selector="ScrollBar:horizontal /template/ Thumb#thumb"> |
<Setter Property="Background" Value="{DynamicResource ThemeControlVeryHighBrush}"/> |
||||
<Setter Property="MinWidth" Value="{DynamicResource ScrollBarThickness}" /> |
</Style> |
||||
</Style> |
<Style Selector="ScrollBar:horizontal /template/ Thumb#thumb"> |
||||
<Style Selector="ScrollBar:vertical"> |
<Setter Property="MinWidth" Value="{DynamicResource ScrollBarThickness}" /> |
||||
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" /> |
<Setter Property="Height" Value="{DynamicResource ScrollBarThumbThickness}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ScrollBar:vertical /template/ Thumb#thumb"> |
<Style Selector="ScrollBar:vertical"> |
||||
<Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" /> |
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ScrollBar /template/ RepeatButton.repeat"> |
<Style Selector="ScrollBar:vertical /template/ Thumb#thumb"> |
||||
<Setter Property="Padding" Value="2" /> |
<Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" /> |
||||
<Setter Property="BorderThickness" Value="0" /> |
<Setter Property="Width" Value="{DynamicResource ScrollBarThumbThickness}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ScrollBar /template/ RepeatButton.repeattrack"> |
<Style Selector="ScrollBar /template/ RepeatButton.repeat"> |
||||
<Setter Property="Template"> |
<Setter Property="Padding" Value="2" /> |
||||
<ControlTemplate> |
<Setter Property="BorderThickness" Value="0" /> |
||||
<Border Background="{TemplateBinding Background}" /> |
</Style> |
||||
</ControlTemplate> |
<Style Selector="ScrollBar /template/ RepeatButton.repeattrack"> |
||||
</Setter> |
<Setter Property="Template"> |
||||
</Style> |
<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> |
</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