Skip to content
Permalink
Browse files

Fixed mingw64 build and warnings

  • Loading branch information
slouken committed Jul 7, 2014
1 parent ac112e5 commit 1ee96bb994ca0d92f0157f1b9d904224240ec17a
$as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h

fi
SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
have_haptic=yes
fi
fi
@@ -2982,7 +2982,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
if test x$have_dinput = xyes; then
AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
have_haptic=yes
fi
fi
@@ -345,7 +345,7 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
/* Check to make sure we have enough variables in the state array */
channels = IMA_ADPCM_state.wavefmt.channels;
if (channels > SDL_arraysize(IMA_ADPCM_state.state)) {
SDL_SetError("IMA ADPCM decoder can only handle %zu channels",
SDL_SetError("IMA ADPCM decoder can only handle %u channels",
SDL_arraysize(IMA_ADPCM_state.state));
return (-1);
}
@@ -204,7 +204,6 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
int posted;
int xrel;
int yrel;
int x_max = 0, y_max = 0;

if (mouse->relative_mode_warp) {
int center_x = 0, center_y = 0;
@@ -21,6 +21,9 @@

#include "../SDL_internal.h"

#ifndef _SDL_syshaptic_h
#define _SDL_syshaptic_h

#include "SDL_haptic.h"


@@ -206,5 +209,7 @@ extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic);
*/
extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);

#endif /* _SDL_syshaptic_h */

/* vi: set ts=4 sw=4 expandtab: */

@@ -105,7 +105,7 @@ SDL_DINPUT_HapticInit(void)
instance = GetModuleHandle(NULL);
if (instance == NULL) {
SDL_SYS_HapticQuit();
return SDL_SetError("GetModuleHandle() failed with error code %d.",
return SDL_SetError("GetModuleHandle() failed with error code %lu.",
GetLastError());
}
ret = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
@@ -24,7 +24,7 @@
#define _SDL_windowshaptic_c_h

#include "SDL_thread.h"

#include "../SDL_syshaptic.h"
#include "../../core/windows/SDL_directx.h"
#include "../../core/windows/SDL_xinput.h"

@@ -258,10 +258,12 @@ ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *gu
*/
ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
{
#if SDL_JOYSTICK_XINPUT
if (SDL_SYS_IsXInputGamepad_DeviceIndex(device_index) && s_pXInputMapping) {
return s_pXInputMapping;
}
else
#endif /* SDL_JOYSTICK_XINPUT */
{
SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index);
return SDL_PrivateGetControllerMappingForGUID(&jGUID);
@@ -231,7 +231,7 @@ SetDIerror(const char *function, HRESULT code)
return SDL_SetError("%s() [%s]: %s", function,
DXGetErrorString9A(code), DXGetErrorDescription9A(code));
*/
return SDL_SetError("%s() DirectX error %d", function, code);
return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code);
}

static SDL_bool
@@ -324,7 +324,7 @@ SDL_DINPUT_JoystickInit(void)
/* Because we used CoCreateInstance, we need to Initialize it, first. */
instance = GetModuleHandle(NULL);
if (instance == NULL) {
return SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError());
return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError());
}
result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);

@@ -21,7 +21,6 @@
#include "../../SDL_internal.h"

#include "SDL_events.h"
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../../core/windows/SDL_windows.h"
#include "../../core/windows/SDL_directx.h"
@@ -234,7 +234,6 @@ UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputS
};
WORD wButtons = pXInputState->Gamepad.wButtons;
Uint8 button;
Uint8 hat = SDL_HAT_CENTERED;

SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX);
SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbLY)));
@@ -379,12 +378,6 @@ SDL_XINPUT_JoystickQuit(void)
{
}

SDL_bool
SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index)
{
return SDL_FALSE;
}

#endif /* SDL_JOYSTICK_XINPUT */

/* vi: set ts=4 sw=4 expandtab: */
@@ -1113,7 +1113,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void
D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
/*D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;*/
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;

if (!texturedata) {
@@ -69,6 +69,7 @@ if (!_this->egl_data->NAME) \
}

/* EGL implementation of SDL OpenGL ES support */
#ifdef EGL_KHR_create_context
static int SDL_EGL_HasExtension(_THIS, const char *ext)
{
int i;
@@ -100,6 +101,7 @@ static int SDL_EGL_HasExtension(_THIS, const char *ext)

return 0;
}
#endif /* EGL_KHR_create_context */

void *
SDL_EGL_GetProcAddress(_THIS, const char *proc)
@@ -552,21 +554,22 @@ SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
EGLSurface *
SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
{
EGLint format;

if (SDL_EGL_ChooseConfig(_this) != 0) {
return EGL_NO_SURFACE;
}

#if __ANDROID__
/* Android docs recommend doing this!
* Ref: http://developer.android.com/reference/android/app/NativeActivity.html
*/
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
_this->egl_data->egl_config,
EGL_NATIVE_VISUAL_ID, &format);
{
/* Android docs recommend doing this!
* Ref: http://developer.android.com/reference/android/app/NativeActivity.html
*/
EGLint format;
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
_this->egl_data->egl_config,
EGL_NATIVE_VISUAL_ID, &format);

ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
}
#endif

return _this->egl_data->eglCreateWindowSurface(
@@ -453,31 +453,30 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* Mouse data */
if (inp.header.dwType == RIM_TYPEMOUSE) {
if (isRelative) {
RAWMOUSE* mouse = &inp.data.mouse;
RAWMOUSE* rawmouse = &inp.data.mouse;

if ((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
} else {
/* synthesize relative moves from the abs position */
static SDL_Point initialMousePoint;
if (initialMousePoint.x == 0 && initialMousePoint.y == 0) {
initialMousePoint.x = mouse->lLastX;
initialMousePoint.y = mouse->lLastY;
initialMousePoint.x = rawmouse->lLastX;
initialMousePoint.y = rawmouse->lLastY;
}

SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y) );

initialMousePoint.x = mouse->lLastX;
initialMousePoint.y = mouse->lLastY;
initialMousePoint.x = rawmouse->lLastX;
initialMousePoint.y = rawmouse->lLastY;
}
WIN_CheckRawMouseButtons( mouse->usButtonFlags, data );
WIN_CheckRawMouseButtons(rawmouse->usButtonFlags, data);
} else if (isCapture) {
/* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */
POINT pt;
HWND hwnd = data->hwnd;
GetCursorPos(&pt);
if (WindowFromPoint(pt) != hwnd) { /* if in the window, WM_MOUSEMOVE, etc, will cover it. */
ScreenToClient(data->hwnd, &pt);
ScreenToClient(hwnd, &pt);
SDL_SendMouseMotion(data->window, 0, 0, (int) pt.x, (int) pt.y);
SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT);
SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT);
@@ -892,7 +891,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_Window *window = data->window;
if (window->hit_test) {
POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) };
if (ScreenToClient(data->hwnd, &winpoint)) {
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);
switch (rc) {
@@ -905,6 +904,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case SDL_HITTEST_RESIZE_BOTTOM: return HTBOTTOM;
case SDL_HITTEST_RESIZE_BOTTOMLEFT: return HTBOTTOMLEFT;
case SDL_HITTEST_RESIZE_LEFT: return HTLEFT;
case SDL_HITTEST_NORMAL: return HTCLIENT;
}
}
/* If we didn't return, this will call DefWindowProc below. */
@@ -750,18 +750,16 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata)
if (cand_list) {
size = ImmGetCandidateListW(himc, 0, cand_list, size);
if (size) {
int i = 0;
int j = 0;
int page_start = 0;
UINT i, j;
UINT page_start = 0;
videodata->ime_candsel = cand_list->dwSelection;
videodata->ime_candcount = cand_list->dwCount;

if (LANG() == LANG_CHS && IME_GetId(videodata, 0)) {
const UINT maxcandchar = 18;
UINT i = 0;
size_t cchars = 0;

for (; i < videodata->ime_candcount; ++i) {
for (i = 0; i < videodata->ime_candcount; ++i) {
size_t len = SDL_wcslen((LPWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i])) + 1;
if (len + cchars > maxcandchar) {
if (i > cand_list->dwSelection)
@@ -775,8 +773,7 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata)
}
}
videodata->ime_candpgsize = i - page_start;
}
else {
} else {
videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST);
page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize;
}
@@ -258,7 +258,6 @@ WIN_CaptureMouse(SDL_Window *window)
if (!window) {
SDL_Window *focusWin = SDL_GetKeyboardFocus();
if (focusWin) {
SDL_WindowData *data = (SDL_WindowData *)focusWin->driverdata;
WIN_OnWindowEnter(SDL_GetVideoDevice(), focusWin); /* make sure WM_MOUSELEAVE messages are (re)enabled. */
}
}

0 comments on commit 1ee96bb

Please sign in to comment.