Fix C89 build errors in Windows builds
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index 477f4e9..51f6c77 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -1079,7 +1079,13 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
if (data->drawstate.viewport_dirty) {
const SDL_Rect *viewport = &data->drawstate.viewport;
- const D3DVIEWPORT9 d3dviewport = { viewport->x, viewport->y, viewport->w, viewport->h, 0.0f, 1.0f };
+ D3DVIEWPORT9 d3dviewport;
+ d3dviewport.X = viewport->x;
+ d3dviewport.Y = viewport->y;
+ d3dviewport.Width = viewport->w;
+ d3dviewport.Height = viewport->h;
+ d3dviewport.MinZ = 0.0f;
+ d3dviewport.MaxZ = 1.0f;
IDirect3DDevice9_SetViewport(data->device, &d3dviewport);
/* Set an orthographic projection matrix */
@@ -1106,7 +1112,11 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
if (data->drawstate.cliprect_dirty) {
const SDL_Rect *viewport = &data->drawstate.viewport;
const SDL_Rect *rect = &data->drawstate.cliprect;
- const RECT d3drect = { viewport->x + rect->x, viewport->y + rect->y, viewport->x + rect->x + rect->w, viewport->y + rect->y + rect->h };
+ RECT d3drect;
+ d3drect.left = viewport->x + rect->x;
+ d3drect.top = viewport->y + rect->y;
+ d3drect.right = viewport->x + rect->x + rect->w;
+ d3drect.bottom = viewport->y + rect->y + rect->h;
IDirect3DDevice9_SetScissorRect(data->device, &d3drect);
data->drawstate.cliprect_dirty = SDL_FALSE;
}
@@ -1221,7 +1231,9 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
} else {
/* Clear is defined to clear the entire render target */
- const D3DVIEWPORT9 wholeviewport = { 0, 0, backw, backh, 0.0f, 1.0f };
+ D3DVIEWPORT9 wholeviewport = { 0, 0, 0, 0, 0.0f, 1.0f };
+ wholeviewport.Width = backw;
+ wholeviewport.Height = backh;
IDirect3DDevice9_SetViewport(data->device, &wholeviewport);
data->drawstate.viewport_dirty = SDL_TRUE; /* we still need to (re)set orthographic projection, so always mark it dirty. */
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index e62fe99..ce9a213 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -1250,10 +1250,12 @@ EGLSurface
SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height)
{
EGLint attributes[] = {
- EGL_WIDTH, width,
- EGL_HEIGHT, height,
+ EGL_WIDTH, 0,
+ EGL_HEIGHT, 0,
EGL_NONE
};
+ attributes[1] = width;
+ attributes[3] = height;
if (SDL_EGL_ChooseConfig(_this) != 0) {
return EGL_NO_SURFACE;
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index cf6a7c5..084bb9a 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -1371,10 +1371,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
SDL_Window *window = data->window;
if (window->hit_test) {
- POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ POINT winpoint;
+ winpoint.x = GET_X_LPARAM(lParam);
+ winpoint.y = GET_Y_LPARAM(lParam);
if (ScreenToClient(hwnd, &winpoint)) {
- const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
- const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
+ SDL_Point point;
+ SDL_HitTestResult rc;
+ point.x = winpoint.x;
+ point.y = winpoint.y;
+ rc = window->hit_test(window, &point, window->hit_test_data);
switch (rc) {
#define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; }
case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION);