Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594
This commit is contained in:
parent
14b902faca
commit
5750bcb174
781 changed files with 51659 additions and 55763 deletions
|
@ -36,35 +36,32 @@
|
|||
|
||||
/* Initialization/Query functions */
|
||||
static int Emscripten_VideoInit(_THIS);
|
||||
static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||
static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
|
||||
static void Emscripten_VideoQuit(_THIS);
|
||||
static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
|
||||
static int Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi);
|
||||
static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
|
||||
static int Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi);
|
||||
|
||||
static int Emscripten_CreateWindow(_THIS, SDL_Window * window);
|
||||
static void Emscripten_SetWindowSize(_THIS, SDL_Window * window);
|
||||
static void Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h);
|
||||
static void Emscripten_DestroyWindow(_THIS, SDL_Window * window);
|
||||
static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
|
||||
static int Emscripten_CreateWindow(_THIS, SDL_Window *window);
|
||||
static void Emscripten_SetWindowSize(_THIS, SDL_Window *window);
|
||||
static void Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h);
|
||||
static void Emscripten_DestroyWindow(_THIS, SDL_Window *window);
|
||||
static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
|
||||
static void Emscripten_PumpEvents(_THIS);
|
||||
static void Emscripten_SetWindowTitle(_THIS, SDL_Window * window);
|
||||
|
||||
static void Emscripten_SetWindowTitle(_THIS, SDL_Window *window);
|
||||
|
||||
/* Emscripten driver bootstrap functions */
|
||||
|
||||
static void
|
||||
Emscripten_DeleteDevice(SDL_VideoDevice * device)
|
||||
static void Emscripten_DeleteDevice(SDL_VideoDevice *device)
|
||||
{
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_VideoDevice *
|
||||
Emscripten_CreateDevice(void)
|
||||
static SDL_VideoDevice *Emscripten_CreateDevice(void)
|
||||
{
|
||||
SDL_VideoDevice *device;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||
device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||
if (device == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
|
@ -73,7 +70,7 @@ Emscripten_CreateDevice(void)
|
|||
/* Firefox sends blur event which would otherwise prevent full screen
|
||||
* when the user clicks to allow full screen.
|
||||
* See https://bugzilla.mozilla.org/show_bug.cgi?id=1144964
|
||||
*/
|
||||
*/
|
||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -83,7 +80,6 @@ Emscripten_CreateDevice(void)
|
|||
device->GetDisplayDPI = Emscripten_GetDisplayDPI;
|
||||
device->SetDisplayMode = Emscripten_SetDisplayMode;
|
||||
|
||||
|
||||
device->PumpEvents = Emscripten_PumpEvents;
|
||||
|
||||
device->CreateSDLWindow = Emscripten_CreateWindow;
|
||||
|
@ -126,9 +122,7 @@ VideoBootStrap Emscripten_bootstrap = {
|
|||
Emscripten_CreateDevice
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
Emscripten_VideoInit(_THIS)
|
||||
int Emscripten_VideoInit(_THIS)
|
||||
{
|
||||
SDL_DisplayMode mode;
|
||||
|
||||
|
@ -150,21 +144,18 @@ Emscripten_VideoInit(_THIS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||
static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
|
||||
{
|
||||
/* can't do this */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
Emscripten_VideoQuit(_THIS)
|
||||
static void Emscripten_VideoQuit(_THIS)
|
||||
{
|
||||
Emscripten_FiniMouse();
|
||||
}
|
||||
|
||||
static int
|
||||
Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
|
||||
static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
|
||||
{
|
||||
if (rect) {
|
||||
rect->x = 0;
|
||||
|
@ -179,8 +170,7 @@ Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect *
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, float * hdpi_out, float * vdpi_out)
|
||||
static int Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi_out, float *hdpi_out, float *vdpi_out)
|
||||
{
|
||||
const float dpi_reference = 96.0f;
|
||||
float dpi;
|
||||
|
@ -200,14 +190,12 @@ Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, fl
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
Emscripten_PumpEvents(_THIS)
|
||||
static void Emscripten_PumpEvents(_THIS)
|
||||
{
|
||||
/* do nothing. */
|
||||
}
|
||||
|
||||
static int
|
||||
Emscripten_CreateWindow(_THIS, SDL_Window * window)
|
||||
static int Emscripten_CreateWindow(_THIS, SDL_Window *window)
|
||||
{
|
||||
SDL_WindowData *wdata;
|
||||
double scaled_w, scaled_h;
|
||||
|
@ -215,7 +203,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window)
|
|||
const char *selector;
|
||||
|
||||
/* Allocate window internal data */
|
||||
wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
|
||||
wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
|
||||
if (wdata == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
@ -274,12 +262,12 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void Emscripten_SetWindowSize(_THIS, SDL_Window * window)
|
||||
static void Emscripten_SetWindowSize(_THIS, SDL_Window *window)
|
||||
{
|
||||
SDL_WindowData *data;
|
||||
|
||||
if (window->driverdata) {
|
||||
data = (SDL_WindowData *) window->driverdata;
|
||||
data = (SDL_WindowData *)window->driverdata;
|
||||
/* update pixel ratio */
|
||||
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
||||
data->pixel_ratio = emscripten_get_device_pixel_ratio();
|
||||
|
@ -293,25 +281,22 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h)
|
||||
static void Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h)
|
||||
{
|
||||
SDL_WindowData *data;
|
||||
if (window->driverdata) {
|
||||
data = (SDL_WindowData *) window->driverdata;
|
||||
data = (SDL_WindowData *)window->driverdata;
|
||||
*w = window->w * data->pixel_ratio;
|
||||
*h = window->h * data->pixel_ratio;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Emscripten_DestroyWindow(_THIS, SDL_Window * window)
|
||||
static void Emscripten_DestroyWindow(_THIS, SDL_Window *window)
|
||||
{
|
||||
SDL_WindowData *data;
|
||||
|
||||
if (window->driverdata) {
|
||||
data = (SDL_WindowData *) window->driverdata;
|
||||
data = (SDL_WindowData *)window->driverdata;
|
||||
|
||||
Emscripten_UnregisterEventHandlers(data);
|
||||
|
||||
|
@ -324,12 +309,11 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
|
||||
static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
|
||||
{
|
||||
SDL_WindowData *data;
|
||||
if (window->driverdata) {
|
||||
data = (SDL_WindowData *) window->driverdata;
|
||||
data = (SDL_WindowData *)window->driverdata;
|
||||
|
||||
if (fullscreen) {
|
||||
EmscriptenFullscreenStrategy strategy;
|
||||
|
@ -364,8 +348,8 @@ Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * di
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Emscripten_SetWindowTitle(_THIS, SDL_Window * window) {
|
||||
static void Emscripten_SetWindowTitle(_THIS, SDL_Window *window)
|
||||
{
|
||||
emscripten_set_window_title(window->title);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue