Index: trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java	(revision 3919)
@@ -116,6 +116,5 @@
         if (layer.isVisible()) {
             prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
-            Main.map.mapView.setCursor
-            (Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+            Main.map.mapView.setNewCursor(Cursor.MOVE_CURSOR, this);
         }
     }
@@ -137,5 +136,5 @@
     @Override public void mouseReleased(MouseEvent e) {
         Main.map.mapView.repaint();
-        Main.map.mapView.setCursor(Cursor.getDefaultCursor());
+        Main.map.mapView.resetCursor(this);
         prevEastNorth = null;
     }
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 3919)
@@ -53,8 +53,4 @@
  */
 public class DeleteAction extends MapMode implements AWTEventListener {
-    //private boolean drawTargetHighlight;
-    private boolean drawTargetCursor;
-    //private Collection<? extends OsmPrimitive> oldPrims = null;
-
     // Cache previous mouse event (needed when only the modifier keys are
     // pressed but the mouse isn't moved)
@@ -80,5 +76,4 @@
         }
     }
-    private DeleteMode currentMode = DeleteMode.none;
 
     private static class DeleteParameters {
@@ -105,6 +100,4 @@
         if (!isEnabled())
             return;
-        //drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true);
-        drawTargetCursor = Main.pref.getBoolean("draw.target-cursor", true);
 
         Main.map.mapView.addMouseListener(this);
@@ -116,6 +109,4 @@
             System.out.println(ex);
         }
-
-        currentMode = DeleteMode.none;
     }
 
@@ -189,33 +180,7 @@
             return;
 
-        // Clean old highlights
-        //cleanOldHighlights();
-
         DeleteParameters parameters = getDeleteParameters(e, modifiers);
-        setCursor(parameters.mode);
-
-        // Needs to implement WaySegment highlight first
-        /*if(drawTargetHighlight) {
-            // Add new highlights
-            for(OsmPrimitive p : prims) {
-                p.highlighted = true;
-            }
-            oldPrims = prims;
-        }*/
-
-        // We only need to repaint if the highlights changed
-        //Main.map.mapView.repaint();
-    }
-
-    /**
-     * Small helper function that cleans old highlights
-     */
-    /*private void cleanOldHighlights() {
-        if(oldPrims == null)
-            return;
-        for(OsmPrimitive p: oldPrims) {
-            p.highlighted = false;
-        }
-    }*/
+        Main.map.mapView.setNewCursor(parameters.mode.cursor(), this);
+    }
 
     /**
@@ -338,28 +303,4 @@
 
     /**
-     * This function sets the given cursor in a safe way. This implementation
-     * differs from the on in DrawAction (it is favorable, too).
-     * FIXME: Update DrawAction to use this "setCursor-style" and move function
-     * to MapMode.
-     * @param c
-     */
-    private void setCursor(final DeleteMode c) {
-        if(currentMode.equals(c) || (!drawTargetCursor && currentMode.equals(DeleteMode.none)))
-            return;
-        // We invoke this to prevent strange things from happening
-        EventQueue.invokeLater(new Runnable() {
-            public void run() {
-                // Don't change cursor when mode has changed already
-                if(!(Main.map.mapMode instanceof DeleteAction))
-                    return;
-
-                Main.map.mapView.setCursor(c.cursor());
-                //System.out.println("Set cursor to: " + c.name());
-            }
-        });
-        currentMode = c;
-    }
-
-    /**
      * This is required to update the cursors when ctrl/shift/alt is pressed
      */
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 3919)
@@ -62,9 +62,6 @@
     //static private final Logger logger = Logger.getLogger(DrawAction.class.getName());
 
-    final private Cursor cursorCrosshair;
     final private Cursor cursorJoinNode;
     final private Cursor cursorJoinWay;
-    enum Cursors { crosshair, node, way }
-    private Cursors currCursor = Cursors.crosshair;
 
     private Node lastUsedNode = null;
@@ -80,5 +77,4 @@
     private boolean wayIsFinished = false;
     private boolean drawTargetHighlight;
-    private boolean drawTargetCursor;
     private Point mousePos;
     private Point oldMousePos;
@@ -93,5 +89,5 @@
         super(tr("Draw"), "node/autonode", tr("Draw nodes"),
                 Shortcut.registerShortcut("mapmode:draw", tr("Mode: {0}", tr("Draw")), KeyEvent.VK_A, Shortcut.GROUP_EDIT),
-                mapFrame, getCursor());
+                mapFrame, ImageProvider.getCursor("crosshair", null));
 
         // Add extra shortcut N
@@ -99,44 +95,6 @@
         Main.registerActionShortcut(this, extraShortcut);
 
-        cursorCrosshair = getCursor();
         cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode");
         cursorJoinWay = ImageProvider.getCursor("crosshair", "joinway");
-    }
-
-    private static Cursor getCursor() {
-        try {
-            return ImageProvider.getCursor("crosshair", null);
-        } catch (Exception e) {
-        }
-        return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
-    }
-
-    /**
-     * Displays the given cursor instead of the normal one
-     * @param Cursors One of the available cursors
-     */
-    private void setCursor(final Cursors c) {
-        if(currCursor.equals(c) || (!drawTargetCursor && currCursor.equals(Cursors.crosshair)))
-            return;
-        // We invoke this to prevent strange things from happening
-        EventQueue.invokeLater(new Runnable() {
-            public void run() {
-                // Don't change cursor when mode has changed already
-                if(!(Main.map.mapMode instanceof DrawAction))
-                    return;
-                switch(c) {
-                case way:
-                    Main.map.mapView.setCursor(cursorJoinWay);
-                    break;
-                case node:
-                    Main.map.mapView.setCursor(cursorJoinNode);
-                    break;
-                default:
-                    Main.map.mapView.setCursor(cursorCrosshair);
-                    break;
-                }
-            }
-        });
-        currCursor = c;
     }
 
@@ -158,5 +116,5 @@
         // if ctrl key is held ("no join"), don't highlight anything
         if (ctrl) {
-            setCursor(Cursors.crosshair);
+            Main.map.mapView.setNewCursor(cursor, this);
             return;
         }
@@ -169,5 +127,5 @@
 
         if (mouseOnExistingNode != null) {
-            setCursor(Cursors.node);
+            Main.map.mapView.setNewCursor(cursorJoinNode, this);
             // We also need this list for the statusbar help text
             oldHighlights.add(mouseOnExistingNode);
@@ -180,9 +138,9 @@
         // Insert the node into all the nearby way segments
         if (mouseOnExistingWays.size() == 0) {
-            setCursor(Cursors.crosshair);
-            return;
-        }
-
-        setCursor(Cursors.way);
+            Main.map.mapView.setNewCursor(cursor, this);
+            return;
+        }
+
+        Main.map.mapView.setNewCursor(cursorJoinWay, this);
 
         // We also need this list for the statusbar help text
@@ -208,9 +166,7 @@
             return;
         super.enterMode();
-        currCursor = Cursors.crosshair;
         selectedColor =PaintColors.SELECTED.get();
         drawHelperLine = Main.pref.getBoolean("draw.helper-line", true);
         drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true);
-        drawTargetCursor = Main.pref.getBoolean("draw.target-cursor", true);
         wayIsFinished = false;
 
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 3919)
@@ -74,8 +74,4 @@
 
     /**
-     * The old cursor before the user pressed the mouse button.
-     */
-    private Cursor oldCursor;
-    /**
      * The position of the mouse cursor when the drag action was initiated.
      */
@@ -110,5 +106,5 @@
                 Shortcut.registerShortcut("mapmode:extrude", tr("Mode: {0}", tr("Extrude")), KeyEvent.VK_X, Shortcut.GROUP_EDIT),
                 mapFrame,
-                getCursor("normal", "rectangle", Cursor.DEFAULT_CURSOR));
+                ImageProvider.getCursor("normal", "rectangle"));
         putValue("help", ht("/Action/Extrude"));
         initialMoveDelay = Main.pref.getInteger("edit.initial-move-delay",200);
@@ -263,5 +259,5 @@
             updateStatusLine();
 
-            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+            Main.map.mapView.setNewCursor(Cursor.MOVE_CURSOR, this);
 
             if (mode == Mode.extrude) {
@@ -354,5 +350,5 @@
 
             // Switch back into select mode
-            restoreCursor();
+            Main.map.mapView.setNewCursor(cursor, this);
             Main.map.mapView.removeTemporaryLayer(this);
             selectedSegment = null;
@@ -528,25 +524,3 @@
         }
     }
-
-    private static Cursor getCursor(String name, String mod, int def) {
-        try {
-            return ImageProvider.getCursor(name, mod);
-        } catch (Exception e) {
-        }
-        return Cursor.getPredefinedCursor(def);
-    }
-
-    private void setCursor(Cursor c) {
-        if (oldCursor == null) {
-            oldCursor = Main.map.mapView.getCursor();
-            Main.map.mapView.setCursor(c);
-        }
-    }
-
-    private void restoreCursor() {
-        if (oldCursor != null) {
-            Main.map.mapView.setCursor(oldCursor);
-            oldCursor = null;
-        }
-    }
 }
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java	(revision 3919)
@@ -24,6 +24,5 @@
  */
 abstract public class MapMode extends JosmAction implements MouseListener, MouseMotionListener {
-    private final Cursor cursor;
-    private Cursor oldCursor;
+    protected final Cursor cursor;
 
     /**
@@ -48,11 +47,10 @@
     public void enterMode() {
         putValue("active", true);
-        oldCursor = Main.map.mapView.getCursor();
-        Main.map.mapView.setCursor(cursor);
+        Main.map.mapView.setNewCursor(cursor, this);
         updateStatusLine();
     }
     public void exitMode() {
         putValue("active", false);
-        Main.map.mapView.setCursor(oldCursor);
+        Main.map.mapView.resetCursor(this);
     }
 
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 3919)
@@ -76,8 +76,4 @@
      * The old cursor before the user pressed the mouse button.
      */
-    private Cursor oldCursor;
-    /**
-     * The position of the mouse before the user starts to drag it while pressing a button.
-     */
     private Point startingDraggingPos;
     /**
@@ -109,5 +105,5 @@
                 Shortcut.registerShortcut("mapmode:select", tr("Mode: {0}", tr("Select")), KeyEvent.VK_S, Shortcut.GROUP_EDIT),
                 mapFrame,
-                getCursor("normal", "selection", Cursor.DEFAULT_CURSOR));
+                ImageProvider.getCursor("normal", "selection"));
         mv = mapFrame.mapView;
         putValue("help", ht("/Action/Move/Move"));
@@ -115,26 +111,4 @@
         initialMoveDelay = Main.pref.getInteger("edit.initial-move-delay", 200);
         initialMoveThreshold = Main.pref.getInteger("edit.initial-move-threshold", 5);
-    }
-
-    private static Cursor getCursor(String name, String mod, int def) {
-        try {
-            return ImageProvider.getCursor(name, mod);
-        } catch (Exception e) {
-        }
-        return Cursor.getPredefinedCursor(def);
-    }
-
-    private void setCursor(Cursor c) {
-        if (oldCursor == null) {
-            oldCursor = mv.getCursor();
-            mv.setCursor(c);
-        }
-    }
-
-    private void restoreCursor() {
-        if (oldCursor != null) {
-            mv.setCursor(oldCursor);
-            oldCursor = null;
-        }
     }
 
@@ -182,5 +156,5 @@
 
         if (mode == Mode.move) {
-            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+            mv.setNewCursor(Cursor.MOVE_CURSOR, this);
         }
 
@@ -257,5 +231,5 @@
                                 tr("Warning"),
                                 JOptionPane.WARNING_MESSAGE);
-                        restoreCursor();
+                        mv.setNewCursor(cursor, this);
                         return;
                     }
@@ -457,5 +431,5 @@
             // Mode.move   redraws when mouseDragged is called
             // Mode.rotate redraws here
-            setCursor(ImageProvider.getCursor("rotate", null));
+            mv.setNewCursor(ImageProvider.getCursor("rotate", null), this);
             mv.repaint();
         } else if (alt && ctrl) {
@@ -469,5 +443,5 @@
             // Mode.move   redraws when mouseDragged is called
             // Mode.scale redraws here
-            setCursor(ImageProvider.getCursor("scale", null));
+            mv.setNewCursor(ImageProvider.getCursor("scale", null), this);
             mv.repaint();
         } else if (!c.isEmpty()) {
@@ -482,5 +456,4 @@
             mode = Mode.select;
 
-            oldCursor = mv.getCursor();
             selectionManager.register(mv);
             selectionManager.mousePressed(e);
@@ -500,5 +473,5 @@
         startingDraggingPos = null;
 
-        restoreCursor();
+        mv.setNewCursor(cursor, this);
         if (mode == Mode.select) {
             selectionManager.unregister(mv);
Index: trunk/src/org/openstreetmap/josm/gui/MapMover.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MapMover.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/gui/MapMover.java	(revision 3919)
@@ -67,8 +67,4 @@
      */
     private final NavigatableComponent nc;
-    /**
-     * The old cursor when we changed it to movement cursor.
-     */
-    private Cursor oldCursor;
 
     private boolean movementInPlace = false;
@@ -167,6 +163,5 @@
         movementInPlace = true;
         mousePosMove = nc.getEastNorth(e.getX(), e.getY());
-        oldCursor = nc.getCursor();
-        nc.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+        nc.setNewCursor(Cursor.MOVE_CURSOR, this);
     }
 
@@ -178,10 +173,6 @@
             return;
         movementInPlace = false;
-        if (oldCursor != null)
-            nc.setCursor(oldCursor);
-        else
-            nc.setCursor(Cursor.getDefaultCursor());
+        nc.resetCursor(this);
         mousePosMove = null;
-        oldCursor = null;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 3918)
+++ trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 3919)
@@ -4,4 +4,5 @@
 import static org.openstreetmap.josm.tools.I18n.marktr;
 
+import java.awt.Cursor;
 import java.awt.Point;
 import java.awt.Rectangle;
@@ -1213,3 +1214,57 @@
         SYSTEMS_OF_MEASUREMENT.put(marktr("Imperial"), IMPERIAL_SOM);
     }
+
+    private class CursorInfo {
+        public Cursor cursor;
+        public Object object;
+        public CursorInfo(Cursor c, Object o) {
+            cursor = c;
+            object = o;
+        }
+    }
+
+    private LinkedList<CursorInfo> Cursors = new LinkedList<CursorInfo>();
+    /**
+     * Set new cursor.
+     */
+    public void setNewCursor(Cursor cursor, Object reference) {
+        if(Cursors.size() > 0) {
+            CursorInfo l = Cursors.getLast();
+            if(l != null && l.cursor == cursor && l.object == reference) {
+                return;
+            }
+            stripCursors(reference);
+        }
+        Cursors.add(new CursorInfo(cursor, reference));
+        setCursor(cursor);
+    }
+    public void setNewCursor(int cursor, Object reference) {
+        setNewCursor(Cursor.getPredefinedCursor(cursor), reference);
+    }
+    /**
+     * Remove the new cursor and reset to previous
+     */
+    public void resetCursor(Object reference) {
+        if(Cursors.size() == 0) {
+            setCursor(null);
+            return;
+        }
+        CursorInfo l = Cursors.getLast();
+        stripCursors(reference);
+        if(l != null && l.object == reference) {
+            if(Cursors.size() == 0)
+                setCursor(null);
+            else
+                setCursor(Cursors.getLast().cursor);
+        }
+    }
+
+    private void stripCursors(Object reference) {
+        LinkedList<CursorInfo> c = new LinkedList<CursorInfo>();
+        for(CursorInfo i : Cursors) {
+            if(i.object != reference)
+                c.add(i);
+        }
+        Cursors = c;
+    }
 }
