Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8232826

Any JavaFX app on macOS Catalina shows a warning to receive keystrokes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: openjfx13
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      ADDITIONAL SYSTEM INFORMATION :
      macOS 10.15 Catalina (19A602 - final build with supplemental update)
      OpenJFX8, OpenJFX13

      A DESCRIPTION OF THE PROBLEM :
      This is an update to the bug mentioned in JDK-8231513.
      Since we couldn't post updates to that issue, we had to create this duplicate ticket.

      Our research showed that the issue comes from calling "CGEventTapCreate" here:
      https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/native-glass/mac/GlassTouches.m#L198

      Building the JavaFX with that logic commented out fixed the problem - but of course it's not a proper fix, just a proof of theory.

      Idea for looking at "CGEventTapCreate" was taken from following comment:
      https://www.reddit.com/r/privacy/comments/cw8772/backup_and_sync_from_google_would_like_to_receive/f3p0c29/

      Background for the issue once again:
      due to stricter security measures in macOS 10.15 Catalina, launching JavaFX app causes OS to show following prompt:

      "{appname}" would like to receive keystrokes from any application.
      Grant access to this application in Security & Privacy preferences, located in System Preferences

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Launch any JavaFX app that shows a Stage on macOS 10.15 Catalina

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      macOS doesn't show a prompt to ask for permission to receive keystrokes when JavaFX app doesn't need it
      ACTUAL -
      macOS shows a prompt to ask for permission to receive keystrokes when JavaFX app doesn't need it

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class HelloWorld extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              primaryStage.setTitle("Hello World!");
              StackPane root = new StackPane();
              primaryStage.setScene(new Scene(root, 300, 250));
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Comment out logic that uses "CGEventTapCreate" here:
      https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/native-glass/mac/GlassTouches.m#L198

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: