From e1cc9b05ac70f5ada04ef3f4e04511d79a7f96cb Mon Sep 17 00:00:00 2001
From: Michael Zangl <michael.zangl@student.kit.edu>
Date: Mon, 19 Oct 2015 15:25:52 +0200
Subject: [PATCH] Fix #11989: MouseState not containing mousePos
---
src/org/openstreetmap/josm/gui/MapStatus.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/org/openstreetmap/josm/gui/MapStatus.java b/src/org/openstreetmap/josm/gui/MapStatus.java
index b8db1a4..0c7693d 100644
|
a
|
b
|
public class MapStatus extends JPanel implements Helpful, Destroyable, Preferenc
|
| 650 | 650 | * @param modifiers The new modifiers. |
| 651 | 651 | */ |
| 652 | 652 | public synchronized void updateMousePosition(Point mousePos, int modifiers) { |
| 653 | | MouseState ms = new MouseState(); |
| 654 | | if (mousePos == null) { |
| 655 | | ms.mousePos = lastMousePos; |
| 656 | | } else { |
| | 653 | if (mousePos != null) { |
| 657 | 654 | lastMousePos = mousePos; |
| 658 | 655 | } |
| | 656 | MouseState ms = new MouseState(lastMousePos, modifiers); |
| 659 | 657 | // remove mouse states that are in the queue. Our mouse state is newer. |
| 660 | 658 | incommingMouseState.clear(); |
| 661 | 659 | incommingMouseState.offer(ms); |
| … |
… |
public class MapStatus extends JPanel implements Helpful, Destroyable, Preferenc
|
| 666 | 664 | * Everything, the collector is interested of. Access must be synchronized. |
| 667 | 665 | * @author imi |
| 668 | 666 | */ |
| 669 | | static class MouseState { |
| 670 | | private Point mousePos; |
| 671 | | private int modifiers; |
| | 667 | private static class MouseState { |
| | 668 | private final Point mousePos; |
| | 669 | private final int modifiers; |
| | 670 | |
| | 671 | MouseState(Point mousePos, int modifiers) { |
| | 672 | this.mousePos = mousePos; |
| | 673 | this.modifiers = modifiers; |
| | 674 | } |
| 672 | 675 | } |
| 673 | 676 | |
| 674 | 677 | private transient AWTEventListener awtListener = new AWTEventListener() { |