IDEA-152991 ignore mouse motion event if mouse location on screen is not really changed

This commit is contained in:
Sergey Malenkov
2016-03-16 19:44:27 +03:00
parent 77227fc3da
commit df2244ebf0
2 changed files with 23 additions and 0 deletions
@@ -439,9 +439,20 @@ public class ListPopupImpl extends WizardPopup implements ListPopup {
private class MyMouseMotionListener extends MouseMotionAdapter {
private int myLastSelectedIndex = -2;
private Point myLastMouseLocation;
private boolean isMouseMoved(Point location) {
if (myLastMouseLocation == null) {
myLastMouseLocation = location;
return false;
}
return !myLastMouseLocation.equals(location);
}
@Override
public void mouseMoved(MouseEvent e) {
if (!isMouseMoved(e.getLocationOnScreen())) return;
Point point = e.getPoint();
int index = myList.locationToIndex(point);
@@ -249,8 +249,20 @@ public class TreePopupImpl extends WizardPopup implements TreePopup {
}
private class MyMouseMotionListener extends MouseMotionAdapter {
private Point myLastMouseLocation;
private boolean isMouseMoved(Point location) {
if (myLastMouseLocation == null) {
myLastMouseLocation = location;
return false;
}
return !myLastMouseLocation.equals(location);
}
@Override
public void mouseMoved(MouseEvent e) {
if (!isMouseMoved(e.getLocationOnScreen())) return;
final TreePath path = getPath(e);
if (path != null) {
myWizardTree.setSelectionPath(path);