From df2244ebf06681ad24aae3269d4804c6547ae931 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 16 Mar 2016 19:15:04 +0300 Subject: [PATCH] IDEA-152991 ignore mouse motion event if mouse location on screen is not really changed --- .../com/intellij/ui/popup/list/ListPopupImpl.java | 11 +++++++++++ .../com/intellij/ui/popup/tree/TreePopupImpl.java | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java b/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java index 045fe1ee9926..f1b05106ac98 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java b/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java index c48c39b27a8c..2748bc2525bf 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java @@ -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);