-
Notifications
You must be signed in to change notification settings - Fork 538
8273743: KeyCharacterCombination for "+" does not work on US QWERTY keyboard layout #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9c5dcbc
New KeyCharacterCombination implementation
beldenfox 7cb6c5b
Added manual test for KeyCharacterCombination matching
beldenfox bd1e4a0
Merge remote-tracking branch 'upstream/master' into scancode
beldenfox 5cd7e9a
New Linux implementation of getKeyCanGenerateCharacter that is more p…
beldenfox ddaf808
Updating classpath for Eclipse users
beldenfox 27e6499
Added comments providing instructions.
beldenfox dc5c636
Merge remote-tracking branch 'upstream/master' into scancode
beldenfox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
modules/javafx.graphics/src/main/java/com/sun/javafx/scene/input/KeyEventHelper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
package com.sun.javafx.scene.input; | ||
|
||
import com.sun.javafx.util.Utils; | ||
import javafx.scene.input.KeyEvent; | ||
|
||
/** | ||
* Used to access internal methods of KeyEvent. | ||
*/ | ||
public class KeyEventHelper { | ||
|
||
private static KeyEventAccessor keyEventAccessor; | ||
|
||
static { | ||
Utils.forceInit(KeyEvent.class); | ||
} | ||
|
||
private KeyEventHelper() { | ||
} | ||
|
||
public static void setHardwareCode(KeyEvent keyEvent, int hardwareCode) { | ||
keyEventAccessor.setHardwareCode(keyEvent, hardwareCode); | ||
} | ||
|
||
public static int getHardwareCode(KeyEvent keyEvent) { | ||
return keyEventAccessor.getHardwareCode(keyEvent); | ||
} | ||
|
||
public static void setKeyEventAccessor(final KeyEventAccessor newAccessor) { | ||
if (keyEventAccessor != null) { | ||
throw new IllegalStateException(); | ||
} | ||
|
||
keyEventAccessor = newAccessor; | ||
} | ||
|
||
public interface KeyEventAccessor { | ||
void setHardwareCode(KeyEvent keyEvent, int hardwareCode); | ||
int getHardwareCode(KeyEvent keyEvent); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,8 +63,11 @@ public void mouseEvent(EventType<MouseEvent> type, double x, double y, double sc | |
|
||
/** | ||
* Pass a key event to the scene to handle | ||
* | ||
* @param keyEvent The key event | ||
* @return true iff the event was consumed | ||
*/ | ||
public void keyEvent(KeyEvent keyEvent); | ||
public boolean keyEvent(KeyEvent keyEvent); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we update javadoc to explain when it returns true? |
||
|
||
/** | ||
* Pass an input method event to the scene to handle | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
import com.sun.javafx.css.StyleManager; | ||
import com.sun.javafx.cursor.CursorFrame; | ||
import com.sun.javafx.event.EventQueue; | ||
import com.sun.javafx.event.EventUtil; | ||
import com.sun.javafx.geom.PickRay; | ||
import com.sun.javafx.geom.Vec3d; | ||
import com.sun.javafx.geom.transform.BaseTransform; | ||
|
@@ -397,8 +398,8 @@ public void enableInputMethodEvents(Scene scene, boolean enable) { | |
} | ||
|
||
@Override | ||
public void processKeyEvent(Scene scene, KeyEvent e) { | ||
scene.processKeyEvent(e); | ||
public boolean processKeyEvent(Scene scene, KeyEvent e) { | ||
return scene.processKeyEvent(e); | ||
} | ||
|
||
@Override | ||
|
@@ -2178,7 +2179,10 @@ private void focusIneligible(Node node) { | |
traverse(node, Direction.NEXT, TraversalMethod.DEFAULT); | ||
} | ||
|
||
void processKeyEvent(KeyEvent e) { | ||
/** | ||
* @return true iff the event was consumed | ||
*/ | ||
boolean processKeyEvent(KeyEvent e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be nice to have a one-line javadoc explaining when it returns true |
||
if (dndGesture != null) { | ||
if (!dndGesture.processKey(e)) { | ||
dndGesture = null; | ||
|
@@ -2191,7 +2195,7 @@ void processKeyEvent(KeyEvent e) { | |
|
||
// send the key event to the current focus owner or to scene if | ||
// the focus owner is not set | ||
Event.fireEvent(eventTarget, e); | ||
return EventUtil.fireEvent(eventTarget, e) == null; | ||
} | ||
|
||
void requestFocus(Node node, boolean focusVisible) { | ||
|
@@ -2710,9 +2714,9 @@ public void mouseEvent(EventType<MouseEvent> type, double x, double y, double sc | |
|
||
|
||
@Override | ||
public void keyEvent(KeyEvent keyEvent) | ||
public boolean keyEvent(KeyEvent keyEvent) | ||
{ | ||
processKeyEvent(keyEvent); | ||
return processKeyEvent(keyEvent); | ||
} | ||
|
||
@Override | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some places where it's written "iff", I'm not sure if it's intentional or a typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iff is an abbreviation for "if and only if". It's a bit formal but I noticed it was used in other internal API comments and JavaDocs. I think I removed all of these when I resubmitted this code as part of #1126.