JetBrains / JetBrains/JetBrainsRuntime

JetBrains Runtime Issue with Touch Events on Windows

Open
#482 2 comments 0 reactions 1 assignee Claimed by @OnePatchGuy View on GitHub
Dominant language
Java
Stars
2k
Forks
269
Avg merge
1h 18m
Merged PRs (30d)
1

Description

Dear JetBrains Team,

I develop the open-source mind map editor [Freeplane](https://github.com/freeplane/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](https://github.com/freeplane/freeplane/issues/2125) 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:

````java
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 https://github.com/JetBrains/JetBrainsRuntime/issues/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](https://youtrack.jetbrains.com/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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.