Changeset 5960 in josm


Ignore:
Timestamp:
2013-05-14T21:33:44+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8710 - Inconsistent MapMode focus behaviour: fix core mapmodes

Location:
trunk/src/org/openstreetmap/josm/actions/mapmode
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r5747 r5960  
    237237        if (e.getButton() != MouseEvent.BUTTON1)
    238238            return;
    239 
     239       
     240        requestFocusInMapView();
    240241        updateKeyModifiers(e);
    241242       
  • trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

    r5460 r5960  
    4949    }
    5050
     51    /**
     52     * Makes this map mode active.
     53     */
    5154    public void enterMode() {
    5255        putValue("active", true);
     
    5457        updateStatusLine();
    5558    }
     59   
     60    /**
     61     * Makes this map mode inactive.
     62     */
    5663    public void exitMode() {
    5764        putValue("active", false);
     
    95102        shift = (modifiers & ActionEvent.SHIFT_MASK) != 0;
    96103    }
     104   
     105    protected void requestFocusInMapView() {
     106        if (isEnabled()) {
     107            // request focus in order to enable the expected keyboard shortcuts (see #8710)
     108            Main.map.mapView.requestFocus();
     109        }
     110    }
    97111
    98     public void mouseReleased(MouseEvent e) {}
     112    public void mouseReleased(MouseEvent e) {requestFocusInMapView();}
    99113    public void mouseExited(MouseEvent e) {}
    100     public void mousePressed(MouseEvent e) {}
     114    public void mousePressed(MouseEvent e) {requestFocusInMapView();}
    101115    public void mouseClicked(MouseEvent e) {}
    102116    public void mouseEntered(MouseEvent e) {}
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r4982 r5960  
    291291    @Override
    292292    public void mousePressed(MouseEvent e) {
     293        requestFocusInMapView();
    293294        updateModifiersState(e);
    294295        // Other buttons are off limit, but we still get events.
  • trunk/src/org/openstreetmap/josm/actions/mapmode/PlayHeadDragMode.java

    r4327 r5960  
    2525    private PlayHeadMarker playHeadMarker = null;
    2626
     27    /**
     28     * Constructs a new {@code PlayHeadDragMode}.
     29     * @param m Audio marker
     30     */
    2731    public PlayHeadDragMode(PlayHeadMarker m) {
    2832        super(tr("Drag play head"), "playheaddrag", tr("Drag play head"), null,
     
    6872            return;
    6973
     74        requestFocusInMapView();
    7075        updateKeyModifiers(ev);
    7176
Note: See TracChangeset for help on using the changeset viewer.