Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'

This commit is contained in:
2024-01-17 17:02:59 +01:00
1244 changed files with 50102 additions and 28146 deletions

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,5 @@
#include "SDL_rpivideo.h"
void RPI_PumpEvents(SDL_VideoDevice *_this);
void RPI_EventInit(SDL_VideoDevice *_this);
void RPI_EventQuit(SDL_VideoDevice *_this);
#endif /* SDL_rpievents_c_h_ */

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -65,13 +65,11 @@ static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
SDL_assert(surface->pitch == surface->w * 4);
cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor));
if (cursor == NULL) {
SDL_OutOfMemory();
if (!cursor) {
return NULL;
}
curdata = (RPI_CursorData *)SDL_calloc(1, sizeof(*curdata));
if (curdata == NULL) {
SDL_OutOfMemory();
if (!curdata) {
SDL_free(cursor);
return NULL;
}
@@ -113,12 +111,12 @@ static int RPI_ShowCursor(SDL_Cursor *cursor)
const char *env;
mouse = SDL_GetMouse();
if (mouse == NULL) {
if (!mouse) {
return -1;
}
if (cursor != global_cursor) {
if (global_cursor != NULL) {
if (global_cursor) {
curdata = (RPI_CursorData *)global_cursor->driverdata;
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
update = vc_dispmanx_update_start(0);
@@ -133,21 +131,21 @@ static int RPI_ShowCursor(SDL_Cursor *cursor)
global_cursor = cursor;
}
if (cursor == NULL) {
if (!cursor) {
return 0;
}
curdata = (RPI_CursorData *)cursor->driverdata;
if (curdata == NULL) {
if (!curdata) {
return -1;
}
if (mouse->focus == NULL) {
if (!mouse->focus) {
return -1;
}
data = SDL_GetDisplayDriverDataForWindow(mouse->focus);
if (data == NULL) {
if (!data) {
return -1;
}
@@ -188,10 +186,10 @@ static void RPI_FreeCursor(SDL_Cursor *cursor)
DISPMANX_UPDATE_HANDLE_T update;
RPI_CursorData *curdata;
if (cursor != NULL) {
if (cursor) {
curdata = (RPI_CursorData *)cursor->driverdata;
if (curdata != NULL) {
if (curdata) {
if (curdata->element != DISPMANX_NO_HANDLE) {
update = vc_dispmanx_update_start(0);
SDL_assert(update);
@@ -224,7 +222,7 @@ static int RPI_WarpMouseGlobalGraphically(float x, float y)
VC_RECT_T src_rect;
SDL_Mouse *mouse = SDL_GetMouse();
if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) {
return 0;
}
@@ -273,7 +271,7 @@ static int RPI_WarpMouseGlobal(float x, float y)
{
SDL_Mouse *mouse = SDL_GetMouse();
if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) {
return 0;
}

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -35,8 +35,6 @@
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include <SDL3/SDL_syswm.h>
#ifdef SDL_INPUT_LINUXEV
#include "../../core/linux/SDL_evdev.h"
#endif
@@ -78,15 +76,13 @@ static SDL_VideoDevice *RPI_Create()
/* Initialize SDL_VideoDevice structure */
device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
if (device == NULL) {
SDL_OutOfMemory();
if (!device) {
return NULL;
}
/* Initialize internal data */
phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData));
if (phdata == NULL) {
SDL_OutOfMemory();
if (!phdata) {
SDL_free(device);
return NULL;
}
@@ -103,7 +99,6 @@ static SDL_VideoDevice *RPI_Create()
device->VideoInit = RPI_VideoInit;
device->VideoQuit = RPI_VideoQuit;
device->CreateSDLWindow = RPI_CreateWindow;
device->CreateSDLWindowFrom = RPI_CreateWindowFrom;
device->SetWindowTitle = RPI_SetWindowTitle;
device->SetWindowPosition = RPI_SetWindowPosition;
device->SetWindowSize = RPI_SetWindowSize;
@@ -172,7 +167,7 @@ static void AddDispManXDisplay(const int display_id)
/* Allocate display internal data */
data = (SDL_DisplayData *)SDL_calloc(1, sizeof(SDL_DisplayData));
if (data == NULL) {
if (!data) {
vc_dispmanx_display_close(handle);
return; /* oh well */
}
@@ -219,7 +214,7 @@ static void RPI_vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data)
SDL_UnlockMutex(wdata->vsync_cond_mutex);
}
int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
{
SDL_WindowData *wdata;
SDL_VideoDisplay *display;
@@ -238,8 +233,8 @@ int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
/* Allocate window internal data */
wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
if (wdata == NULL) {
return SDL_OutOfMemory();
if (!wdata) {
return -1;
}
display = SDL_GetVideoDisplayForWindow(window);
displaydata = display->driverdata;
@@ -341,11 +336,6 @@ void RPI_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
}
int RPI_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window *window, const void *data)
{
return -1;
}
void RPI_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
{
}

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -63,8 +63,7 @@ int RPI_VideoInit(SDL_VideoDevice *_this);
void RPI_VideoQuit(SDL_VideoDevice *_this);
int RPI_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
int RPI_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
int RPI_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window *window, const void *data);
int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props);
void RPI_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
int RPI_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window);
void RPI_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);