Ticket #11209: ButTheBugIsStillPresent2.patch

File ButTheBugIsStillPresent2.patch, 2.9 KB (added by akks, 11 years ago)

I tried disabling AdvancedKeyDetector completely and replacing EditTagDialog with simple mock JOptionPane.showInputDialog/ The bug is the same! It is not related to ialog specifics - any frequently opened and closed dialog with text input can hang the keyboard.

  • src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

     
    147147    * @since 5653
    148148    */
    149149    public void editTag(final int row, boolean focusOnKey) {
    150         changedKey = null;
    151         sel = Main.main.getInProgressSelection();
    152         if (sel == null || sel.isEmpty()) return;
    153 
    154         String key = tagData.getValueAt(row, 0).toString();
    155         objKey=key;
    156 
    157         @SuppressWarnings("unchecked")
    158         final EditTagDialog editDialog = new EditTagDialog(key,
    159                 (Map<String, Integer>) tagData.getValueAt(row, 1), focusOnKey);
    160         editDialog.showDialog();
    161         if (editDialog.getValue() != 1) return;
    162         editDialog.performTagEdit();
     150        String inputValue = JOptionPane.showInputDialog("Please input a value");
    163151    }
    164152
    165153    /**
  • src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java

     
    7777     * Register this object as AWTEventListener
    7878     */
    7979    public void register() {
    80         try {
    81             Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
    82         } catch (SecurityException ex) {
    83             Main.warn(ex);
    84         }
    85         timer = new Timer(0, new ActionListener() {
    86             @Override
    87             public void actionPerformed(ActionEvent e) {
    88                 timer.stop();
    89                 if (set.remove(releaseEvent.getKeyCode()) && enabled) {
    90                     if (isFocusInMainWindow()) {
    91                         for (KeyPressReleaseListener q: keyListeners) {
    92                             q.doKeyReleased(releaseEvent);
    93                         }
    94                     }
    95                 }
    96             }
    97         });
    9880    }
    9981
    10082    /**
     
    10284     * lists of listeners are not cleared!
    10385     */
    10486    public void unregister() {
    105         timer.stop();
    106         set.clear();
    107         if (!keyListeners.isEmpty()) {
    108             Main.warn(tr("Some of the key listeners forgot to remove themselves: {0}"), keyListeners.toString());
    109         }
    110         if (!modifierListeners.isEmpty()) {
    111             Main.warn(tr("Some of the key modifier listeners forgot to remove themselves: {0}"), modifierListeners.toString());
    112         }
    113         try {
    114             Toolkit.getDefaultToolkit().removeAWTEventListener(this);
    115         } catch (SecurityException ex) {
    116             Main.warn(ex);
    117         }
    11887    }
    11988
    12089    private void processKeyEvent(KeyEvent e) {