mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
SDL: Enable precise (smooth touchpad) scrolling.
Made possible by #17329
This commit is contained in:
parent
3d8d7a3ccb
commit
0f107e102e
@ -1170,6 +1170,19 @@ int main(int argc, char *argv[]) {
|
||||
KeyInput key;
|
||||
key.deviceId = DEVICE_ID_MOUSE;
|
||||
key.flags = KEY_DOWN;
|
||||
if (event.wheel.preciseY != 0.0f) {
|
||||
// Should the scale be DPI-driven?
|
||||
const float scale = 30.0f;
|
||||
key.keyCode = event.wheel.preciseY > 0 ? NKCODE_EXT_MOUSEWHEEL_UP : NKCODE_EXT_MOUSEWHEEL_DOWN;
|
||||
key.flags |= KEY_HASWHEELDELTA;
|
||||
int wheelDelta = event.wheel.preciseY * scale;
|
||||
if (event.wheel.preciseY < 0) {
|
||||
wheelDelta = -wheelDelta;
|
||||
}
|
||||
key.flags |= wheelDelta << 16;
|
||||
NativeKey(key);
|
||||
break;
|
||||
}
|
||||
if (event.wheel.y > 0) {
|
||||
key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP;
|
||||
mouseWheelMovedUpFrames = 5;
|
||||
|
Loading…
Reference in New Issue
Block a user