changeset 9257:7bbdd20fec30

8089884: TextInputControls capturing function key events
author leifs
date Thu, 17 Sep 2015 20:35:30 -0700
parents 60da505acaea
children d015af1e73c5
files modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java	Thu Sep 17 19:30:54 2015 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java	Thu Sep 17 20:35:30 2015 -0700
@@ -128,6 +128,8 @@
         final Predicate<KeyEvent> validOnWindows = e -> !PlatformUtil.isWindows();
         final Predicate<KeyEvent> validOnLinux = e -> !PlatformUtil.isLinux();
 
+        KeyMapping consumeMostPressedEventsMapping;
+
         // create a child input map for mappings which are applicable on all
         // platforms, and regardless of editing state
         addDefaultMapping(inputMap,
@@ -183,7 +185,6 @@
 
                 // The following keys are forwarded to the parent container
                 new KeyMapping(ESCAPE, this::cancelEdit),
-                new KeyMapping(F10, this::forwardToParent),
 
                 // Linux specific mappings
                 keyMapping(new KeyBinding(Z).ctrl(), e -> undo(), validOnLinux),
@@ -201,8 +202,9 @@
 
                 // However, we want to consume other key press / release events too, for
                 // things that would have been handled by the InputCharacter normally
-                keyMapping(new KeyBinding(null, KEY_PRESSED).shift(OptionalBoolean.ANY),
-                           e -> e.consume()),
+                consumeMostPressedEventsMapping =
+                    keyMapping(new KeyBinding(null, KEY_PRESSED).shift(OptionalBoolean.ANY),
+                               e -> { if (!e.getCode().isFunctionKey()) e.consume(); }),
 
                 // VK
                 new KeyMapping(new KeyBinding(DIGIT9).ctrl().shift(), e -> {
@@ -220,6 +222,8 @@
                 }
         );
 
+        consumeMostPressedEventsMapping.setAutoConsume(false);
+
         // mac os specific mappings
         InputMap<T> macOsInputMap = new InputMap<>(c);
         macOsInputMap.setInterceptor(e -> !PlatformUtil.isMac());