mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
removing locks from the ResultListBox code behind file. All callbacks are accessed from the Main/UI thread.
This commit is contained in:
@@ -6,7 +6,6 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
public partial class ResultListBox
|
public partial class ResultListBox
|
||||||
{
|
{
|
||||||
protected object _lock = new object();
|
|
||||||
private Point _lastpos;
|
private Point _lastpos;
|
||||||
private ListBoxItem curItem = null;
|
private ListBoxItem curItem = null;
|
||||||
public ResultListBox()
|
public ResultListBox()
|
||||||
@@ -24,34 +23,25 @@ namespace Wox
|
|||||||
|
|
||||||
private void OnMouseEnter(object sender, MouseEventArgs e)
|
private void OnMouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
lock(_lock)
|
curItem = (ListBoxItem)sender;
|
||||||
{
|
var p = e.GetPosition((IInputElement)sender);
|
||||||
curItem = (ListBoxItem)sender;
|
_lastpos = p;
|
||||||
var p = e.GetPosition((IInputElement)sender);
|
|
||||||
_lastpos = p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMouseMove(object sender, MouseEventArgs e)
|
private void OnMouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
lock(_lock)
|
var p = e.GetPosition((IInputElement)sender);
|
||||||
|
if (_lastpos != p)
|
||||||
{
|
{
|
||||||
var p = e.GetPosition((IInputElement)sender);
|
((ListBoxItem)sender).IsSelected = true;
|
||||||
if (_lastpos != p)
|
|
||||||
{
|
|
||||||
((ListBoxItem)sender).IsSelected = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
lock(_lock)
|
if (curItem != null)
|
||||||
{
|
{
|
||||||
if (curItem != null)
|
curItem.IsSelected = true;
|
||||||
{
|
|
||||||
curItem.IsSelected = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user