mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
Copy from Jeremy's fork PR
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
[Synchronization]
|
||||
public partial class ResultListBox
|
||||
{
|
||||
protected object _lock = new object();
|
||||
private Point _lastpos;
|
||||
private ListBoxItem curItem = null;
|
||||
public ResultListBox()
|
||||
@@ -25,25 +24,34 @@ namespace Wox
|
||||
|
||||
private void OnMouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
curItem = (ListBoxItem)sender;
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
_lastpos = p;
|
||||
lock(_lock)
|
||||
{
|
||||
curItem = (ListBoxItem)sender;
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
_lastpos = p;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
if (_lastpos != p)
|
||||
lock(_lock)
|
||||
{
|
||||
((ListBoxItem) sender).IsSelected = true;
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
if (_lastpos != p)
|
||||
{
|
||||
((ListBoxItem)sender).IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (curItem != null)
|
||||
lock(_lock)
|
||||
{
|
||||
curItem.IsSelected = true;
|
||||
if (curItem != null)
|
||||
{
|
||||
curItem.IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user