Skip to content
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

JetBrains Runtime Issue with Touch Events on Windows #482

Open
dpolivaev opened this issue Dec 7, 2024 · 0 comments
Open

JetBrains Runtime Issue with Touch Events on Windows #482

dpolivaev opened this issue Dec 7, 2024 · 0 comments
Assignees

Comments

@dpolivaev
Copy link

dpolivaev commented Dec 7, 2024

Dear JetBrains Team,

I develop the open-source mind map editor Freeplane. Recently, I embedded JetBrains Java Runtime into the Windows version due to its better emoji font support. However, during preview testing, a user reported losing touch functionality with their Surface Pro 7, affecting both pen and finger inputs.

To investigate, I wrote a minimal Java app to log mouse events. Testing revealed the following:

  • Using Azul Zulu Java Runtime v21.0.5, touch inputs were correctly mapped to mouse events.
  • With JetBrains Runtime 21.0.5b509.30 and 21.0.5b631.16, only pure mouse events were logged; no touch events were detected.

The app requires the following Java option:

--add-exports java.desktop/sun.awt=ALL-UNNAMED

This is necessary to access the internal sun.awt APIs, specifically for detecting whether a MouseEvent was caused by a touch event.

Code:

package com.example;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.util.logging.Logger;
import sun.awt.AWTAccessor;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class TouchMouseEventExample {
    private static final Logger logger = Logger.getLogger(TouchMouseEventExample.class.getName());
    public static void main(String[] args) {
        logger.info("Java Version: " + System.getProperty("java.version"));
        logger.info("Java Vendor: " + System.getProperty("java.vendor"));
        JFrame frame = new JFrame("Touch Event Simulation");
        JPanel panel = new JPanel();

        panel.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                printEvent(e);
            }

            @Override
            public void mouseReleased(MouseEvent e) {
                printEvent(e);
            }

            @Override
            public void mouseClicked(MouseEvent e) {
                printEvent(e);
            }
        });

        panel.addMouseMotionListener(new MouseMotionAdapter() {
            @Override
            public void mouseDragged(MouseEvent e) {
                printEvent(e);
            }
        });

        frame.add(panel);
        frame.setSize(400, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }

    private static void printEvent(MouseEvent e) {
        boolean isCausedByTouchEvent = AWTAccessor.getMouseEventAccessor().isCausedByTouchEvent(e);
        logger.info(e.toString() + "\n"
                + "Modifiers: " + e.getModifiersEx() + (isCausedByTouchEvent ? "caused by Touch Event" : ""));
    }
}

System Details:

  • OS: Windows 11 Home, Version 10.0.26100, Italian localization
  • Device: Microsoft Surface Pro 7
  • CPU: Intel Core i5-1035G4, 4 cores, 8 logical processors

Relationship to Existing Issues:

This issue seems related to the previously reported #467. It demonstrates that the problem is broader and not tied to a specific library. The findings can extend and complement the existing YouTrack issue JBR-7716, created by @vprovodin, to address issue #467.

I kindly request that this issue be given higher priority due to its significant impact on Java applications running on devices with touch input.

Best regards,
Dimitry Polivaev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants