This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 244023
Collapse All | Expand All

(-)a/editor.lib/src/org/netbeans/editor/MultiKeymap.java (+8 lines)
Lines 61-66 Link Here
61
import javax.swing.Action;
61
import javax.swing.Action;
62
import javax.swing.AbstractAction;
62
import javax.swing.AbstractAction;
63
import org.openide.awt.StatusDisplayer;
63
import org.openide.awt.StatusDisplayer;
64
import org.openide.util.BaseUtilities;
64
import org.openide.util.Lookup;
65
import org.openide.util.Lookup;
65
66
66
/**
67
/**
Lines 373-378 Link Here
373
                if (context != null) { // Already in a non-empty context
374
                if (context != null) { // Already in a non-empty context
374
                    ignoreNextTyped = true;
375
                    ignoreNextTyped = true;
375
376
377
                } else if (BaseUtilities.isMac()) {
378
                    if (ret != null
379
                        && key.getKeyEventType() == KeyEvent.KEY_PRESSED
380
                        && (key.getModifiers() & InputEvent.ALT_MASK) != 0
381
                        && (key.getModifiers() & InputEvent.CTRL_MASK) == 0) {
382
                        ignoreNextTyped = true;
383
                    }
376
                } else if (compatibleIgnoreNextTyped) {
384
                } else if (compatibleIgnoreNextTyped) {
377
                    // #44307 = disabled extra ignoreNextTyped patches for past JDKs
385
                    // #44307 = disabled extra ignoreNextTyped patches for past JDKs
378
                    if ( // Explicit patch for the keyTyped sent after Alt+key
386
                    if ( // Explicit patch for the keyTyped sent after Alt+key
(-)a/openide.text/src/org/openide/text/QuietEditorPane.java (+48 lines)
Lines 60-65 Link Here
60
import java.awt.dnd.DropTargetEvent;
60
import java.awt.dnd.DropTargetEvent;
61
import java.awt.dnd.DropTargetListener;
61
import java.awt.dnd.DropTargetListener;
62
import java.awt.event.InputEvent;
62
import java.awt.event.InputEvent;
63
import java.awt.event.KeyEvent;
63
import java.awt.im.InputContext;
64
import java.awt.im.InputContext;
64
import java.lang.reflect.Field;
65
import java.lang.reflect.Field;
65
import java.lang.reflect.InvocationTargetException;
66
import java.lang.reflect.InvocationTargetException;
Lines 84-89 Link Here
84
import javax.swing.text.JTextComponent;
85
import javax.swing.text.JTextComponent;
85
import org.openide.util.Lookup;
86
import org.openide.util.Lookup;
86
import org.openide.util.NbBundle;
87
import org.openide.util.NbBundle;
88
import org.openide.util.Utilities;
87
import org.openide.windows.ExternalDropHandler;
89
import org.openide.windows.ExternalDropHandler;
88
import org.openide.windows.TopComponent;
90
import org.openide.windows.TopComponent;
89
91
Lines 121-126 Link Here
121
    private int fontHeight;
123
    private int fontHeight;
122
    private int charWidth;
124
    private int charWidth;
123
125
126
    private static enum AltStatus {
127
        DEFAULT,
128
        MAY_CONSUME_ALT_PRESSED,
129
        IGNORE_NEXT_TYPED,
130
    }
131
132
    private AltStatus altStatus = AltStatus.DEFAULT;
133
124
    /**
134
    /**
125
     * consturctor sets the initial values for horizontal
135
     * consturctor sets the initial values for horizontal
126
     * and vertical scroll units.
136
     * and vertical scroll units.
Lines 129-134 Link Here
129
    public QuietEditorPane() {
139
    public QuietEditorPane() {
130
        setFontHeightWidth(getFont());
140
        setFontHeightWidth(getFont());
131
    }
141
    }
142
143
    @Override
144
    protected void processKeyEvent(KeyEvent e) {
145
        if (Utilities.isMac()) {
146
            if (e.getID() == KeyEvent.KEY_PRESSED
147
                && (e.getModifiers() & KeyEvent.ALT_MASK) != 0
148
                && (e.getModifiers() & KeyEvent.CTRL_MASK) == 0) {
149
                altStatus = AltStatus.MAY_CONSUME_ALT_PRESSED;
150
            }
151
            super.processKeyEvent(e);
152
            if (altStatus == AltStatus.MAY_CONSUME_ALT_PRESSED) {
153
                altStatus = AltStatus.IGNORE_NEXT_TYPED;
154
                LOG.fine("Ignore next typed.");
155
            }
156
        } else {
157
            super.processKeyEvent(e);
158
        }
159
    }
160
161
    @Override
162
    protected void processComponentKeyEvent(KeyEvent e) {
163
        // JComponent#processKeyEvent call this method if key event is not consumed at listeners.
164
        switch (altStatus) {
165
        case MAY_CONSUME_ALT_PRESSED:
166
            altStatus = AltStatus.DEFAULT;
167
            break;
168
        case IGNORE_NEXT_TYPED:
169
            if (e.getID() == KeyEvent.KEY_TYPED) {
170
                e.consume();
171
                LOG.fine("Ignored: [" + e.getKeyChar() + "]");
172
            }
173
            altStatus = AltStatus.DEFAULT;
174
            break;
175
        default:
176
            break;
177
        }
178
    }
179
132
    
180
    
133
    public AccessibleContext getAccessibleContext() {
181
    public AccessibleContext getAccessibleContext() {
134
        AccessibleContext ctx = super.getAccessibleContext();
182
        AccessibleContext ctx = super.getAccessibleContext();
(-)a/openide.util.ui/src/org/openide/util/Utilities.java (+13 lines)
Lines 211-216 Link Here
211
    /** A height of the Mac OS X's menu */
211
    /** A height of the Mac OS X's menu */
212
    private static final int TYPICAL_MACOSX_MENU_HEIGHT = 24;
212
    private static final int TYPICAL_MACOSX_MENU_HEIGHT = 24;
213
213
214
    // Ignore extended key code if it is greater or equal then the following value on Mac.
215
    private static final int MIN_IGNORE_EXTENDED_KEY_CODE = 0x1000000;
216
214
    private static Timer clearIntrospector;
217
    private static Timer clearIntrospector;
215
    private static ActionListener doClear;
218
    private static ActionListener doClear;
216
    private static final int CTRL_WILDCARD_MASK = 32768;
219
    private static final int CTRL_WILDCARD_MASK = 32768;
Lines 1167-1172 Link Here
1167
    }
1170
    }
1168
1171
1169
    /**
1172
    /**
1173
     * Test whether extended key code is available.
1174
     *
1175
     * @param keyCode extended key code
1176
     * @return <code>true</code> if it is available.
1177
     */
1178
    public static boolean isAvailableExtendedKeyCode(int keyCode) {
1179
        return keyCode != KeyEvent.VK_UNDEFINED && (!Utilities.isMac() || keyCode >= MIN_IGNORE_EXTENDED_KEY_CODE);
1180
    }
1181
1182
    /**
1170
     * Finds out the monitor where the user currently has the input focus.
1183
     * Finds out the monitor where the user currently has the input focus.
1171
     * This method is usually used to help the client code to figure out on
1184
     * This method is usually used to help the client code to figure out on
1172
     * which monitor it should place newly created windows/frames/dialogs.
1185
     * which monitor it should place newly created windows/frames/dialogs.
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/ShortcutListener.java (-1 / +1 lines)
Lines 107-113 Link Here
107
        if (keyEvent_getExtendedKeyCode != null) {
107
        if (keyEvent_getExtendedKeyCode != null) {
108
            try {
108
            try {
109
                int ecode = (int)(Integer)keyEvent_getExtendedKeyCode.invoke(e);
109
                int ecode = (int)(Integer)keyEvent_getExtendedKeyCode.invoke(e);
110
                if (ecode != KeyEvent.VK_UNDEFINED) {
110
                if (Utilities.isAvailableExtendedKeyCode(ecode)) {
111
                    code = ecode;
111
                    code = ecode;
112
                }
112
                }
113
            } catch (IllegalAccessException ex) {
113
            } catch (IllegalAccessException ex) {

Return to bug 244023