JBR-7484 Update the cursor on mouse entered/exited

AppKit resets the cursor on native mouse entered/exited events. Depending on the order of events, it may end up setting the wrong cursor. So update it forcibly on such events.

(cherry picked from commit 2de56405aa)
This commit is contained in:
Sergei Tachenov
2024-09-03 10:31:57 +03:00
committed by jbrbot
parent fc85684c7c
commit 3754345840
2 changed files with 10 additions and 0 deletions

View File

@@ -67,6 +67,11 @@ final class CCursorManager extends LWCursorManager {
return;
}
currentCursor = cursor;
setCurrentCursor();
}
void setCurrentCursor() {
Cursor cursor = currentCursor;
if (cursor == null) {
nativeSetBuiltInCursor(Cursor.DEFAULT_CURSOR, null);

View File

@@ -117,6 +117,11 @@ final class CPlatformResponder {
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers, jeventType);
if (jeventType == MouseEvent.MOUSE_ENTERED || jeventType == MouseEvent.MOUSE_EXITED) {
// JBR-7484: AppKit resets the cursor we set previously on entered/exit events, so we re-set it.
CCursorManager.getInstance().setCurrentCursor();
}
eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
x, y, absX, absY, jmodifiers, jclickCount,
jpopupTrigger, null);