mirror of
https://github.com/love2d/love.git
synced 2026-08-21 13:09:56 +02:00
replace some macOS-specific event code with more generic code.
This commit is contained in:
@@ -61,7 +61,6 @@ static void clampToWindow(double *x, double *y)
|
||||
window->clampPositionInWindow(x, y);
|
||||
}
|
||||
|
||||
#ifndef LOVE_MACOS
|
||||
static void normalizedToDPICoords(double *x, double *y)
|
||||
{
|
||||
double w = 1.0, h = 1.0;
|
||||
@@ -79,7 +78,6 @@ static void normalizedToDPICoords(double *x, double *y)
|
||||
if (y)
|
||||
*y = ((*y) * h);
|
||||
}
|
||||
#endif
|
||||
|
||||
// SDL's event watch callbacks trigger when the event is actually posted inside
|
||||
// SDL, unlike with SDL_PollEvents. This is useful for some events which require
|
||||
@@ -201,10 +199,8 @@ Message *Event::convert(const SDL_Event &e)
|
||||
const char *txt;
|
||||
const char *txt2;
|
||||
|
||||
#ifndef LOVE_MACOS
|
||||
love::touch::sdl::Touch *touchmodule = nullptr;
|
||||
love::touch::Touch::TouchInfo touchinfo = {};
|
||||
#endif
|
||||
|
||||
switch (e.type)
|
||||
{
|
||||
@@ -321,11 +317,9 @@ Message *Event::convert(const SDL_Event &e)
|
||||
case SDL_EVENT_FINGER_DOWN:
|
||||
case SDL_EVENT_FINGER_UP:
|
||||
case SDL_EVENT_FINGER_MOTION:
|
||||
// Touch events are disabled in OS X because we only actually want touch
|
||||
// screen events, but most touch devices in OS X aren't touch screens
|
||||
// (and SDL doesn't differentiate.) Non-screen touch devices like Mac
|
||||
// trackpads won't give touch coords in the window's coordinate-space.
|
||||
#ifndef LOVE_MACOS
|
||||
// TODO: Expose APIs to enable different touch device types.
|
||||
if (SDL_GetTouchDeviceType(e.tfinger.touchID) == SDL_TOUCH_DEVICE_DIRECT)
|
||||
{
|
||||
touchinfo.id = (int64) e.tfinger.fingerID;
|
||||
touchinfo.x = e.tfinger.x;
|
||||
touchinfo.y = e.tfinger.y;
|
||||
@@ -361,7 +355,7 @@ Message *Event::convert(const SDL_Event &e)
|
||||
else
|
||||
txt = "touchmoved";
|
||||
msg = new Message(txt, vargs);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
||||
case SDL_EVENT_JOYSTICK_BUTTON_UP:
|
||||
|
||||
Reference in New Issue
Block a user