Repository: libsdl-org/SDL
File: src/events/SDL_mouse.c (C)

Code before:
    SDL_RemoveHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS,
                        SDL_MouseTouchEventsChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_PEN_MOUSE_EVENTS,
                        SDL_PenMouseEventsChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_PEN_TOUCH_EVENTS,
                        SDL_PenTouchEventsChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE,
                        SDL_MouseAutoCaptureChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_MOUSE_RELATIVE_WARP_MOTION,
                        SDL_MouseRelativeWarpMotionChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE,
                        SDL_MouseRelativeCursorVisibleChanged, mouse);

    for (int i = SDL_mouse_count; i--; ) {
        SDL_RemoveMouse(SDL_mice[i].instance_id, false);
    }
    SDL_free(SDL_mice);
    SDL_mice = NULL;
}

void SDL_SetRelativeMouseTransform(const void *transform, void *userdata) {
    SDL_Mouse *mouse = SDL_GetMouse();
    mouse->InputTransform = (SDL_InputTransform)transform;
    mouse->input_transform_data = userdata;
}

SDL_MouseButtonFlags SDL_GetMouseState(float *x, float *y)
{
    SDL_Mouse *mouse = SDL_GetMouse();

    if (x) {
        *x = mouse->x;
    }
    if (y) {
        *y = mouse->y;
    }
    return SDL_GetMouseButtonState(mouse, SDL_GLOBAL_MOUSE_ID, true);
}

SDL_MouseButtonFlags SDL_GetRelativeMouseState(float *x, float *y)
{
    SDL_Mouse *mouse = SDL_GetMouse();

    if (x) {
        *x = mouse->x_accu;
    }

Review comment (suggestion):
```suggestion
void SDL_SetRelativeMouseTransform(const void *transform, void *userdata)
{
```

Code after:
    SDL_RemoveHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS,
                        SDL_MouseTouchEventsChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_PEN_MOUSE_EVENTS,
                        SDL_PenMouseEventsChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_PEN_TOUCH_EVENTS,
                        SDL_PenTouchEventsChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE,
                        SDL_MouseAutoCaptureChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_MOUSE_RELATIVE_WARP_MOTION,
                        SDL_MouseRelativeWarpMotionChanged, mouse);

    SDL_RemoveHintCallback(SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE,
                        SDL_MouseRelativeCursorVisibleChanged, mouse);

    for (int i = SDL_mouse_count; i--; ) {
        SDL_RemoveMouse(SDL_mice[i].instance_id, false);
    }
    SDL_free(SDL_mice);
    SDL_mice = NULL;
}

bool SDL_SetRelativeMouseTransform(SDL_MouseMotionTransformCallback transform, void *userdata)
{
    SDL_Mouse *mouse = SDL_GetMouse();
    if (mouse->relative_mode) {
        return SDL_SetError("Can't set mouse transform while relative mode is active");
    }
    mouse->InputTransform = transform;
    mouse->input_transform_data = userdata;
    return true;
}

SDL_MouseButtonFlags SDL_GetMouseState(float *x, float *y)
{
    SDL_Mouse *mouse = SDL_GetMouse();

    if (x) {
        *x = mouse->x;
    }
    if (y) {
        *y = mouse->y;
    }
    return SDL_GetMouseButtonState(mouse, SDL_GLOBAL_MOUSE_ID, true);
}

SDL_MouseButtonFlags SDL_GetRelativeMouseState(float *x, float *y)
{