Pass the OS event timestamp for keyboard, mouse, and touch events where possible

Currently implemented for Windows and Apple platforms
This commit is contained in:
Sam Lantinga
2022-12-02 09:03:13 -08:00
parent 1f4cc733a1
commit 0a3262e819
62 changed files with 441 additions and 313 deletions

View File

@@ -254,12 +254,12 @@ class SDL_BApp : public BApplication
SDL_GetWindowPosition(win, &winPosX, &winPosY);
int dx = x - (winWidth / 2);
int dy = y - (winHeight / 2);
SDL_SendMouseMotion(win, 0, SDL_GetMouse()->relative_mode, dx, dy);
SDL_SendMouseMotion(0, win, 0, SDL_GetMouse()->relative_mode, dx, dy);
set_mouse_position((winPosX + winWidth / 2), (winPosY + winHeight / 2));
if (!be_app->IsCursorHidden())
be_app->HideCursor();
} else {
SDL_SendMouseMotion(win, 0, 0, x, y);
SDL_SendMouseMotion(0, win, 0, 0, x, y);
if (SDL_ShowCursor(-1) && be_app->IsCursorHidden())
be_app->ShowCursor();
}
@@ -277,7 +277,7 @@ class SDL_BApp : public BApplication
return;
}
win = GetSDLWindow(winID);
SDL_SendMouseButton(win, 0, state, button);
SDL_SendMouseButton(0, win, 0, state, button);
}
void _HandleMouseWheel(BMessage *msg)
@@ -292,7 +292,7 @@ class SDL_BApp : public BApplication
return;
}
win = GetSDLWindow(winID);
SDL_SendMouseWheel(win, 0, xTicks, -yTicks, SDL_MOUSEWHEEL_NORMAL);
SDL_SendMouseWheel(0, win, 0, xTicks, -yTicks, SDL_MOUSEWHEEL_NORMAL);
}
void _HandleKey(BMessage *msg)
@@ -309,7 +309,7 @@ class SDL_BApp : public BApplication
return;
}
HAIKU_SetKeyState(scancode, state);
SDL_SendKeyboardKey(state, HAIKU_GetScancodeFromBeKey(scancode));
SDL_SendKeyboardKey(0, state, HAIKU_GetScancodeFromBeKey(scancode));
if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
const int8 *keyUtf8;