Browse Source
Merge branch 'master' into fixes/osx-implement-default-app-menu
pull/3220/head
Jumar Macato
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
41 additions and
26 deletions
-
src/Avalonia.Controls/ListBox.cs
-
src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
-
src/Avalonia.Controls/Primitives/TabStrip.cs
-
src/Avalonia.Controls/Primitives/Thumb.cs
-
src/Avalonia.Controls/TextBox.cs
-
src/Avalonia.Controls/TreeView.cs
-
src/Avalonia.Input/AccessKeyHandler.cs
-
src/Avalonia.Input/FocusManager.cs
|
|
|
@ -7,6 +7,7 @@ using Avalonia.Controls.Presenters; |
|
|
|
using Avalonia.Controls.Primitives; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.VisualTree; |
|
|
|
|
|
|
|
namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
@ -132,14 +133,19 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
base.OnPointerPressed(e); |
|
|
|
|
|
|
|
if (e.MouseButton == MouseButton.Left || e.MouseButton == MouseButton.Right) |
|
|
|
if (e.Source is IVisual source) |
|
|
|
{ |
|
|
|
e.Handled = UpdateSelectionFromEventSource( |
|
|
|
e.Source, |
|
|
|
true, |
|
|
|
(e.InputModifiers & InputModifiers.Shift) != 0, |
|
|
|
(e.InputModifiers & InputModifiers.Control) != 0, |
|
|
|
e.MouseButton == MouseButton.Right); |
|
|
|
var point = e.GetCurrentPoint(source); |
|
|
|
|
|
|
|
if (point.Properties.IsLeftButtonPressed || point.Properties.IsRightButtonPressed) |
|
|
|
{ |
|
|
|
e.Handled = UpdateSelectionFromEventSource( |
|
|
|
e.Source, |
|
|
|
true, |
|
|
|
(e.KeyModifiers & KeyModifiers.Shift) != 0, |
|
|
|
(e.KeyModifiers & KeyModifiers.Control) != 0, |
|
|
|
point.Properties.IsRightButtonPressed); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -804,9 +804,9 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
private void TextBoxOnPointerPressed(object sender, PointerPressedEventArgs e) |
|
|
|
{ |
|
|
|
if (e.Device.Captured != Spinner) |
|
|
|
if (e.Pointer.Captured != Spinner) |
|
|
|
{ |
|
|
|
Dispatcher.UIThread.InvokeAsync(() => { e.Device.Capture(Spinner); }, DispatcherPriority.Input); |
|
|
|
Dispatcher.UIThread.InvokeAsync(() => { e.Pointer.Capture(Spinner); }, DispatcherPriority.Input); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -5,6 +5,7 @@ using Avalonia.Controls.Generators; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Layout; |
|
|
|
using Avalonia.VisualTree; |
|
|
|
|
|
|
|
namespace Avalonia.Controls.Primitives |
|
|
|
{ |
|
|
|
@ -44,9 +45,14 @@ namespace Avalonia.Controls.Primitives |
|
|
|
{ |
|
|
|
base.OnPointerPressed(e); |
|
|
|
|
|
|
|
if (e.MouseButton == MouseButton.Left) |
|
|
|
if (e.Source is IVisual source) |
|
|
|
{ |
|
|
|
e.Handled = UpdateSelectionFromEventSource(e.Source); |
|
|
|
var point = e.GetCurrentPoint(source); |
|
|
|
|
|
|
|
if (point.Properties.IsLeftButtonPressed) |
|
|
|
{ |
|
|
|
e.Handled = UpdateSelectionFromEventSource(e.Source); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -73,7 +73,6 @@ namespace Avalonia.Controls.Primitives |
|
|
|
|
|
|
|
protected override void OnPointerPressed(PointerPressedEventArgs e) |
|
|
|
{ |
|
|
|
e.Device.Capture(this); |
|
|
|
e.Handled = true; |
|
|
|
_lastPoint = e.GetPosition(this); |
|
|
|
|
|
|
|
@ -92,7 +91,6 @@ namespace Avalonia.Controls.Primitives |
|
|
|
{ |
|
|
|
if (_lastPoint.HasValue) |
|
|
|
{ |
|
|
|
e.Device.Capture(null); |
|
|
|
e.Handled = true; |
|
|
|
_lastPoint = null; |
|
|
|
|
|
|
|
|
|
|
|
@ -677,13 +677,13 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
e.Device.Capture(_presenter); |
|
|
|
e.Pointer.Capture(_presenter); |
|
|
|
e.Handled = true; |
|
|
|
} |
|
|
|
|
|
|
|
protected override void OnPointerMoved(PointerEventArgs e) |
|
|
|
{ |
|
|
|
if (_presenter != null && e.Device.Captured == _presenter) |
|
|
|
if (_presenter != null && e.Pointer.Captured == _presenter) |
|
|
|
{ |
|
|
|
var point = e.GetPosition(_presenter); |
|
|
|
|
|
|
|
@ -694,9 +694,9 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
protected override void OnPointerReleased(PointerReleasedEventArgs e) |
|
|
|
{ |
|
|
|
if (_presenter != null && e.Device.Captured == _presenter) |
|
|
|
if (_presenter != null && e.Pointer.Captured == _presenter) |
|
|
|
{ |
|
|
|
e.Device.Capture(null); |
|
|
|
e.Pointer.Capture(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -507,14 +507,19 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
base.OnPointerPressed(e); |
|
|
|
|
|
|
|
if (e.MouseButton == MouseButton.Left || e.MouseButton == MouseButton.Right) |
|
|
|
if (e.Source is IVisual source) |
|
|
|
{ |
|
|
|
e.Handled = UpdateSelectionFromEventSource( |
|
|
|
e.Source, |
|
|
|
true, |
|
|
|
(e.InputModifiers & InputModifiers.Shift) != 0, |
|
|
|
(e.InputModifiers & InputModifiers.Control) != 0, |
|
|
|
e.MouseButton == MouseButton.Right); |
|
|
|
var point = e.GetCurrentPoint(source); |
|
|
|
|
|
|
|
if (point.Properties.IsLeftButtonPressed || point.Properties.IsRightButtonPressed) |
|
|
|
{ |
|
|
|
e.Handled = UpdateSelectionFromEventSource( |
|
|
|
e.Source, |
|
|
|
true, |
|
|
|
(e.KeyModifiers & KeyModifiers.Shift) != 0, |
|
|
|
(e.KeyModifiers & KeyModifiers.Control) != 0, |
|
|
|
point.Properties.IsRightButtonPressed); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -182,7 +182,7 @@ namespace Avalonia.Input |
|
|
|
{ |
|
|
|
bool menuIsOpen = MainMenu?.IsOpen == true; |
|
|
|
|
|
|
|
if ((e.Modifiers & InputModifiers.Alt) != 0 || menuIsOpen) |
|
|
|
if ((e.KeyModifiers & KeyModifiers.Alt) != 0 || menuIsOpen) |
|
|
|
{ |
|
|
|
// If any other key is pressed with the Alt key held down, or the main menu is open,
|
|
|
|
// find all controls who have registered that access key.
|
|
|
|
|
|
|
|
@ -180,7 +180,7 @@ namespace Avalonia.Input |
|
|
|
|
|
|
|
if (sender == e.Source && ev.MouseButton == MouseButton.Left) |
|
|
|
{ |
|
|
|
var element = (ev.Device?.Captured as IInputElement) ?? (e.Source as IInputElement); |
|
|
|
var element = (ev.Pointer?.Captured as IInputElement) ?? (e.Source as IInputElement); |
|
|
|
|
|
|
|
if (element == null || !CanFocus(element)) |
|
|
|
{ |
|
|
|
|