mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
IDEA-229135: Fling animation stop on tap
(cherry picked from commit 7ce0f79561)
This commit is contained in:
committed by
alexey.ushakov@jetbrains.com
parent
880d806283
commit
c86b793165
@@ -82,7 +82,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
private static int touchBeginX = 0, touchBeginY = 0;
|
||||
private static int trackingId = 0;
|
||||
private static boolean isTouchScroll = false;
|
||||
private static final int TOUCH_CLICK_RADIUS = 3;
|
||||
private static final int TOUCH_CLICK_RADIUS = 10;
|
||||
// all touch scrolls are measured in pixels
|
||||
private static final int TOUCH_BEGIN = 2;
|
||||
private static final int TOUCH_UPDATE = 3;
|
||||
@@ -825,16 +825,13 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
isTouchScroll = false;
|
||||
touchBeginX = x;
|
||||
touchBeginY = y;
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, touchBeginX, touchBeginY, TOUCH_BEGIN, 1);
|
||||
break;
|
||||
case XConstants.XI_TouchUpdate:
|
||||
if (isInsideTouchClickBoundaries(x, y)) {
|
||||
if (!isTouchScroll && isInsideTouchClickBoundaries(x, y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isTouchScroll) {
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, touchBeginX, touchBeginY, TOUCH_BEGIN, 1);
|
||||
isTouchScroll = true;
|
||||
}
|
||||
isTouchScroll = true;
|
||||
|
||||
if (lastY - y != 0) {
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, x, y, TOUCH_UPDATE, lastY - y);
|
||||
@@ -846,9 +843,8 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
}
|
||||
break;
|
||||
case XConstants.XI_TouchEnd:
|
||||
if (isTouchScroll) {
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, x, y, TOUCH_END, 1);
|
||||
} else {
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, x, y, TOUCH_END, 1);
|
||||
if (!isTouchScroll) {
|
||||
sendMouseEventFromTouch(dev, MouseEvent.MOUSE_PRESSED, jWhen, modifiers, touchBeginX, touchBeginY, button);
|
||||
sendMouseEventFromTouch(dev, MouseEvent.MOUSE_RELEASED, jWhen, modifiers, touchBeginX, touchBeginY, button);
|
||||
sendMouseEventFromTouch(dev, MouseEvent.MOUSE_CLICKED, jWhen, modifiers, touchBeginX, touchBeginY, button);
|
||||
|
||||
@@ -2403,15 +2403,12 @@ void AwtComponent::WmTouchHandler(const TOUCHINPUT& touchInput)
|
||||
m_touchDownPoint = p;
|
||||
m_lastTouchPoint = p;
|
||||
m_isTouchScroll = FALSE;
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_BEGIN, 1);
|
||||
} else if (touchInput.dwFlags & TOUCHEVENTF_MOVE) {
|
||||
if (IsInsideTouchClickBoundaries(p)) {
|
||||
if (!m_isTouchScroll && IsInsideTouchClickBoundaries(p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_isTouchScroll) {
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_BEGIN, 1);
|
||||
m_isTouchScroll = TRUE;
|
||||
}
|
||||
m_isTouchScroll = TRUE;
|
||||
|
||||
const int deltaY = ScaleDownY(static_cast<int>(m_lastTouchPoint.y - p.y));
|
||||
if (abs(deltaY) != 0) {
|
||||
@@ -2426,9 +2423,9 @@ void AwtComponent::WmTouchHandler(const TOUCHINPUT& touchInput)
|
||||
|
||||
m_lastTouchPoint = p;
|
||||
} else if (touchInput.dwFlags & TOUCHEVENTF_UP) {
|
||||
if (m_isTouchScroll) {
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_END, 1);
|
||||
} else {
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_END, 1);
|
||||
|
||||
if (!m_isTouchScroll) {
|
||||
SendMouseEventFromTouch(java_awt_event_MouseEvent_MOUSE_PRESSED, p, modifiers);
|
||||
SendMouseEventFromTouch(java_awt_event_MouseEvent_MOUSE_RELEASED, p, modifiers);
|
||||
SendMouseEventFromTouch(java_awt_event_MouseEvent_MOUSE_CLICKED, p, modifiers);
|
||||
|
||||
Reference in New Issue
Block a user