modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassViewEventHandler.java
Print this page
*** 344,358 ****
boolean altDown = (modifiers & KeyEvent.MODIFIER_ALT) != 0;
boolean metaDown = (modifiers & KeyEvent.MODIFIER_WINDOWS) != 0;
boolean primaryButtonDown = (modifiers & KeyEvent.MODIFIER_BUTTON_PRIMARY) != 0;
boolean middleButtonDown = (modifiers & KeyEvent.MODIFIER_BUTTON_MIDDLE) != 0;
boolean secondaryButtonDown = (modifiers & KeyEvent.MODIFIER_BUTTON_SECONDARY) != 0;
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
scene.sceneListener.mouseEvent(mouseEventType(type),
! x / pScale, y / pScale, xAbs / pScale, yAbs / pScale,
mouseEventButton(button), isPopupTrigger, isSynthesized,
shiftDown, controlDown, altDown, metaDown,
primaryButtonDown, middleButtonDown, secondaryButtonDown);
}
} finally {
--- 344,359 ----
boolean altDown = (modifiers & KeyEvent.MODIFIER_ALT) != 0;
boolean metaDown = (modifiers & KeyEvent.MODIFIER_WINDOWS) != 0;
boolean primaryButtonDown = (modifiers & KeyEvent.MODIFIER_BUTTON_PRIMARY) != 0;
boolean middleButtonDown = (modifiers & KeyEvent.MODIFIER_BUTTON_MIDDLE) != 0;
boolean secondaryButtonDown = (modifiers & KeyEvent.MODIFIER_BUTTON_SECONDARY) != 0;
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
scene.sceneListener.mouseEvent(mouseEventType(type),
! x / pScaleX, y / pScaleY, xAbs / pScaleX, yAbs / pScaleY,
mouseEventButton(button), isPopupTrigger, isSynthesized,
shiftDown, controlDown, altDown, metaDown,
primaryButtonDown, middleButtonDown, secondaryButtonDown);
}
} finally {
*** 402,415 ****
stage.setInEventHandler(true);
}
QuantumToolkit.runWithoutRenderLock(() -> {
return AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if (scene.sceneListener != null) {
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
! scene.sceneListener.menuEvent(x / pScale, y / pScale,
! xAbs / pScale, yAbs / pScale,
isKeyboardTrigger);
}
return null;
}, scene.getAccessControlContext());
});
--- 403,417 ----
stage.setInEventHandler(true);
}
QuantumToolkit.runWithoutRenderLock(() -> {
return AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if (scene.sceneListener != null) {
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
! scene.sceneListener.menuEvent(x / pScaleX, y / pScaleY,
! xAbs / pScaleX, yAbs / pScaleY,
isKeyboardTrigger);
}
return null;
}, scene.getAccessControlContext());
});
*** 439,456 ****
stage.setInEventHandler(true);
}
QuantumToolkit.runWithoutRenderLock(() -> {
return AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if (scene.sceneListener != null) {
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
scene.sceneListener.scrollEvent(ScrollEvent.SCROLL,
! deltaX / pScale, deltaY / pScale, 0, 0,
xMultiplier, yMultiplier,
0, // touchCount
chars, lines, defaultChars, defaultLines,
! x / pScale, y / pScale, xAbs / pScale, yAbs / pScale,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
false, // this is always indirect
--- 441,459 ----
stage.setInEventHandler(true);
}
QuantumToolkit.runWithoutRenderLock(() -> {
return AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if (scene.sceneListener != null) {
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
scene.sceneListener.scrollEvent(ScrollEvent.SCROLL,
! deltaX / pScaleX, deltaY / pScaleY, 0, 0,
xMultiplier, yMultiplier,
0, // touchCount
chars, lines, defaultChars, defaultLines,
! x / pScaleX, y / pScaleY, xAbs / pScaleX, yAbs / pScaleY,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
false, // this is always indirect
*** 771,784 ****
}
scene.entireSceneNeedsRepaint();
break;
}
case ViewEvent.RESIZE: {
! Window w = view.getWindow();
! float pScale = (w == null) ? 1.0f : w.getPlatformScale();
! scene.sceneListener.changedSize(view.getWidth() / pScale,
! view.getHeight() / pScale);
scene.entireSceneNeedsRepaint();
QuantumToolkit.runWithRenderLock(() -> {
scene.updateSceneState();
return null;
});
--- 774,788 ----
}
scene.entireSceneNeedsRepaint();
break;
}
case ViewEvent.RESIZE: {
! final Window w = view.getWindow();
! float pScaleX = (w == null) ? 1.0f : w.getPlatformScaleX();
! float pScaleY = (w == null) ? 1.0f : w.getPlatformScaleY();
! scene.sceneListener.changedSize(view.getWidth() / pScaleX,
! view.getHeight() / pScaleY);
scene.entireSceneNeedsRepaint();
QuantumToolkit.runWithRenderLock(() -> {
scene.updateSceneState();
return null;
});
*** 791,804 ****
break;
}
case ViewEvent.MOVE: {
// MOVE events can be "synthesized" and the window will
// be null if this is synthesized during a "REMOVE" event
! Window w = view.getWindow();
! float pScale = (w == null) ? 1.0f : w.getPlatformScale();
! scene.sceneListener.changedLocation(view.getX() / pScale,
! view.getY() / pScale);
break;
}
case ViewEvent.FULLSCREEN_ENTER:
case ViewEvent.FULLSCREEN_EXIT:
if (scene.getWindowStage() != null) {
--- 795,809 ----
break;
}
case ViewEvent.MOVE: {
// MOVE events can be "synthesized" and the window will
// be null if this is synthesized during a "REMOVE" event
! final Window w = view.getWindow();
! float pScaleX = (w == null) ? 1.0f : w.getPlatformScaleX();
! float pScaleY = (w == null) ? 1.0f : w.getPlatformScaleY();
! scene.sceneListener.changedLocation(view.getX() / pScaleX,
! view.getY() / pScaleY);
break;
}
case ViewEvent.FULLSCREEN_ENTER:
case ViewEvent.FULLSCREEN_EXIT:
if (scene.getWindowStage() != null) {
*** 864,884 ****
eventType = ScrollEvent.SCROLL_FINISHED;
break;
default:
throw new RuntimeException("Unknown scroll event type: " + type);
}
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
scene.sceneListener.scrollEvent(eventType,
! dx / pScale, dy / pScale, totaldx / pScale, totaldy / pScale,
multiplierX, multiplierY,
touchCount,
0, 0, 0, 0,
! x == View.GESTURE_NO_VALUE ? Double.NaN : x / pScale,
! y == View.GESTURE_NO_VALUE ? Double.NaN : y / pScale,
! xAbs == View.GESTURE_NO_VALUE ? Double.NaN : xAbs / pScale,
! yAbs == View.GESTURE_NO_VALUE ? Double.NaN : yAbs / pScale,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect, isInertia);
--- 869,890 ----
eventType = ScrollEvent.SCROLL_FINISHED;
break;
default:
throw new RuntimeException("Unknown scroll event type: " + type);
}
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
scene.sceneListener.scrollEvent(eventType,
! dx / pScaleX, dy / pScaleY, totaldx / pScaleX, totaldy / pScaleY,
multiplierX, multiplierY,
touchCount,
0, 0, 0, 0,
! x == View.GESTURE_NO_VALUE ? Double.NaN : x / pScaleX,
! y == View.GESTURE_NO_VALUE ? Double.NaN : y / pScaleY,
! xAbs == View.GESTURE_NO_VALUE ? Double.NaN : xAbs / pScaleX,
! yAbs == View.GESTURE_NO_VALUE ? Double.NaN : yAbs / pScaleY,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect, isInertia);
*** 927,944 ****
eventType = ZoomEvent.ZOOM_FINISHED;
break;
default:
throw new RuntimeException("Unknown scroll event type: " + type);
}
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
// REMIND: Scale the [total]scale params too?
scene.sceneListener.zoomEvent(eventType, scale, totalscale,
! originx == View.GESTURE_NO_VALUE ? Double.NaN : originx / pScale,
! originy == View.GESTURE_NO_VALUE ? Double.NaN : originy / pScale,
! originxAbs == View.GESTURE_NO_VALUE ? Double.NaN : originxAbs / pScale,
! originyAbs == View.GESTURE_NO_VALUE ? Double.NaN : originyAbs / pScale,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect, isInertia);
--- 933,951 ----
eventType = ZoomEvent.ZOOM_FINISHED;
break;
default:
throw new RuntimeException("Unknown scroll event type: " + type);
}
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
// REMIND: Scale the [total]scale params too?
scene.sceneListener.zoomEvent(eventType, scale, totalscale,
! originx == View.GESTURE_NO_VALUE ? Double.NaN : originx / pScaleX,
! originy == View.GESTURE_NO_VALUE ? Double.NaN : originy / pScaleY,
! originxAbs == View.GESTURE_NO_VALUE ? Double.NaN : originxAbs / pScaleX,
! originyAbs == View.GESTURE_NO_VALUE ? Double.NaN : originyAbs / pScaleY,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect, isInertia);
*** 986,1002 ****
eventType = RotateEvent.ROTATION_FINISHED;
break;
default:
throw new RuntimeException("Unknown scroll event type: " + type);
}
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
scene.sceneListener.rotateEvent(eventType, dangle, totalangle,
! originx == View.GESTURE_NO_VALUE ? Double.NaN : originx / pScale,
! originy == View.GESTURE_NO_VALUE ? Double.NaN : originy / pScale,
! originxAbs == View.GESTURE_NO_VALUE ? Double.NaN : originxAbs / pScale,
! originyAbs == View.GESTURE_NO_VALUE ? Double.NaN : originyAbs / pScale,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect, isInertia);
--- 993,1010 ----
eventType = RotateEvent.ROTATION_FINISHED;
break;
default:
throw new RuntimeException("Unknown scroll event type: " + type);
}
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
scene.sceneListener.rotateEvent(eventType, dangle, totalangle,
! originx == View.GESTURE_NO_VALUE ? Double.NaN : originx / pScaleX,
! originy == View.GESTURE_NO_VALUE ? Double.NaN : originy / pScaleY,
! originxAbs == View.GESTURE_NO_VALUE ? Double.NaN : originxAbs / pScaleX,
! originyAbs == View.GESTURE_NO_VALUE ? Double.NaN : originyAbs / pScaleY,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect, isInertia);
*** 1046,1062 ****
eventType = SwipeEvent.SWIPE_RIGHT;
break;
default:
throw new RuntimeException("Unknown swipe event direction: " + dir);
}
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
scene.sceneListener.swipeEvent(eventType, touchCount,
! x == View.GESTURE_NO_VALUE ? Double.NaN : x / pScale,
! y == View.GESTURE_NO_VALUE ? Double.NaN : y / pScale,
! xAbs == View.GESTURE_NO_VALUE ? Double.NaN : xAbs / pScale,
! yAbs == View.GESTURE_NO_VALUE ? Double.NaN : yAbs / pScale,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect);
--- 1054,1071 ----
eventType = SwipeEvent.SWIPE_RIGHT;
break;
default:
throw new RuntimeException("Unknown swipe event direction: " + dir);
}
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
scene.sceneListener.swipeEvent(eventType, touchCount,
! x == View.GESTURE_NO_VALUE ? Double.NaN : x / pScaleX,
! y == View.GESTURE_NO_VALUE ? Double.NaN : y / pScaleY,
! xAbs == View.GESTURE_NO_VALUE ? Double.NaN : xAbs / pScaleX,
! yAbs == View.GESTURE_NO_VALUE ? Double.NaN : yAbs / pScaleY,
(modifiers & KeyEvent.MODIFIER_SHIFT) != 0,
(modifiers & KeyEvent.MODIFIER_CONTROL) != 0,
(modifiers & KeyEvent.MODIFIER_ALT) != 0,
(modifiers & KeyEvent.MODIFIER_WINDOWS) != 0,
isDirect);
*** 1141,1154 ****
state = TouchPoint.State.RELEASED;
break;
default:
throw new RuntimeException("Unknown touch state: " + type);
}
! Window w = view.getWindow();
! double pScale = (w == null) ? 1.0 : w.getPlatformScale();
scene.sceneListener.touchEventNext(state, touchId,
! x / pScale, y / pScale, xAbs / pScale, yAbs / pScale);
}
return null;
}, scene.getAccessControlContext());
});
} finally {
--- 1150,1164 ----
state = TouchPoint.State.RELEASED;
break;
default:
throw new RuntimeException("Unknown touch state: " + type);
}
! final Window w = view.getWindow();
! double pScaleX = (w == null) ? 1.0 : w.getPlatformScaleX();
! double pScaleY = (w == null) ? 1.0 : w.getPlatformScaleY();
scene.sceneListener.touchEventNext(state, touchId,
! x / pScaleX, y / pScaleY, xAbs / pScaleX, yAbs / pScaleY);
}
return null;
}, scene.getAccessControlContext());
});
} finally {