Changeset 8691


Ignore:
Timestamp:
03/03/05 19:12:46 (16 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/j/DescribeKeyDialog.java

    r8686 r8691  
    33 *
    44 * Copyright (C) 2000-2005 Peter Graves
    5  * $Id: DescribeKeyDialog.java,v 1.7 2005-03-03 14:05:00 piso Exp $
     5 * $Id: DescribeKeyDialog.java,v 1.8 2005-03-03 19:12:46 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3838    private JTextField textField;
    3939    private boolean seenKeyPressed;
     40    private String lastKeyText;
    4041    private String keyStrokeText;
    4142    private boolean eventHandled;
    42     private boolean failed;
    4343    private boolean disposed;
    4444    private KeyMap requestedKeyMap;
     
    6868        seenKeyPressed = true;
    6969        final int modifiers = e.getModifiers();
     70        KeyMapping mapping = new KeyMapping(keycode, modifiers, null);
     71        lastKeyText = mapping.getKeyText();
    7072        Object command = describeKey(e.getKeyChar(), keycode, modifiers);
    71         if (eventHandled || failed) {
    72             KeyMapping mapping = new KeyMapping(keycode, modifiers, null);
     73        if (eventHandled) {
    7374            if (keyStrokeText == null)
    74                 keyStrokeText = mapping.getKeyText();
     75                keyStrokeText = lastKeyText;
    7576            else
    76                 keyStrokeText = keyStrokeText + " " + mapping.getKeyText();
     77                keyStrokeText = keyStrokeText + " " + lastKeyText;
    7778            textField.setText(keyStrokeText);
    7879        }
     
    100101            }
    101102            Object command = describeKey(c, e.getKeyCode(), modifiers);
    102             if (!eventHandled) {
    103                 Log.debug("failed => true");
    104                 failed = true;
    105             }
    106103            if (command != null)
    107104                report(command);
     
    115112            keycode == KeyEvent.VK_ALT || keycode == KeyEvent.VK_META)
    116113            return;
    117         if (failed && !disposed) {
     114        if (seenKeyPressed && !eventHandled && !disposed) {
    118115            dispose();
     116            if (keyStrokeText == null)
     117                keyStrokeText = lastKeyText;
    119118            // Use invokeLater() so message dialog will get focus.
    120119            Runnable r = new Runnable() {
Note: See TracChangeset for help on using the changeset viewer.