From 1903d7b1bf6c73ef23e4d6934c9fec5246dd0b2e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 11 Jul 2023 10:50:43 -0700
Subject: [PATCH] RAWINPUT_RegisterNotifications() should return int, for
consistency
---
src/joystick/windows/SDL_rawinputjoystick.c | 11 +++++------
src/joystick/windows/SDL_rawinputjoystick_c.h | 2 +-
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c
index 122bdc757c0c..fd2e84249ce4 100644
--- a/src/joystick/windows/SDL_rawinputjoystick.c
+++ b/src/joystick/windows/SDL_rawinputjoystick.c
@@ -2065,13 +2065,13 @@ static void RAWINPUT_JoystickClose(SDL_Joystick *joystick)
}
}
-SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd)
+int RAWINPUT_RegisterNotifications(HWND hWnd)
{
int i;
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
if (!SDL_RAWINPUT_inited) {
- return SDL_TRUE;
+ return 0;
}
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
@@ -2082,10 +2082,9 @@ SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd)
}
if (!RegisterRawInputDevices(rid, SDL_arraysize(rid), sizeof(RAWINPUTDEVICE))) {
- SDL_SetError("Couldn't register for raw input events");
- return SDL_FALSE;
+ return SDL_SetError("Couldn't register for raw input events");
}
- return SDL_TRUE;
+ return 0;
}
int RAWINPUT_UnregisterNotifications()
@@ -2094,7 +2093,7 @@ int RAWINPUT_UnregisterNotifications()
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
if (!SDL_RAWINPUT_inited) {
- return SDL_TRUE;
+ return 0;
}
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
diff --git a/src/joystick/windows/SDL_rawinputjoystick_c.h b/src/joystick/windows/SDL_rawinputjoystick_c.h
index 71226fe486f4..534ae08824cf 100644
--- a/src/joystick/windows/SDL_rawinputjoystick_c.h
+++ b/src/joystick/windows/SDL_rawinputjoystick_c.h
@@ -28,7 +28,7 @@ extern SDL_bool RAWINPUT_IsEnabled();
extern SDL_bool RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name);
/* Registers for input events */
-extern SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd);
+extern int RAWINPUT_RegisterNotifications(HWND hWnd);
extern int RAWINPUT_UnregisterNotifications();
/* Returns 0 if message was handled */