File indexing completed on 2024-12-22 04:41:39

0001 /*
0002  * SPDX-FileCopyrightText: 2018 Chansol Yang <CosmicSubspace@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 package org.kde.kdeconnect.Plugins.MousePadPlugin;
0008 
0009 /* Base class for a pointer acceleration profile. */
0010 public abstract class PointerAccelerationProfile {
0011 
0012     /* Class representing a mouse delta, a pair of floats.*/
0013     static class MouseDelta {
0014         public float x, y;
0015 
0016         MouseDelta() {
0017             this(0,0);
0018         }
0019 
0020         MouseDelta(float x, float y) {
0021             this.x = x;
0022             this.y = y;
0023         }
0024     }
0025 
0026     /* Touch coordinate deltas are fed through this method. */
0027     public abstract void touchMoved(float deltaX, float deltaY, long eventTime);
0028 
0029     /* An acceleration profile should 'commit' the processed delta when this method is called.
0030      * The value returned here will be directly sent to the desktop client.
0031      *
0032      * A MouseDelta object can be provided by the caller (or it can be null);
0033      * if not null, subclasses should use and return this object, to reduce object allocations.*/
0034     public abstract MouseDelta commitAcceleratedMouseDelta(MouseDelta reusedObject);
0035 }