mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 14:55:39 +00:00
Use C99 bool internally in SDL
This commit is contained in:
@@ -128,7 +128,7 @@ static SDL_SpinLock spinlock_dbus_init = 0;
|
||||
// you must hold spinlock_dbus_init before calling this!
|
||||
static void SDL_DBus_Init_Spinlocked(void)
|
||||
{
|
||||
static SDL_bool is_dbus_available = SDL_TRUE;
|
||||
static bool is_dbus_available = true;
|
||||
if (!is_dbus_available) {
|
||||
return; // don't keep trying if this fails.
|
||||
}
|
||||
@@ -137,12 +137,12 @@ static void SDL_DBus_Init_Spinlocked(void)
|
||||
DBusError err;
|
||||
|
||||
if (LoadDBUSLibrary() == -1) {
|
||||
is_dbus_available = SDL_FALSE; // can't load at all? Don't keep trying.
|
||||
is_dbus_available = false; // can't load at all? Don't keep trying.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dbus.threads_init_default()) {
|
||||
is_dbus_available = SDL_FALSE;
|
||||
is_dbus_available = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ static void SDL_DBus_Init_Spinlocked(void)
|
||||
if (dbus.error_is_set(&err)) {
|
||||
dbus.error_free(&err);
|
||||
SDL_DBus_Quit();
|
||||
is_dbus_available = SDL_FALSE;
|
||||
is_dbus_available = false;
|
||||
return; // oh well
|
||||
}
|
||||
dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0);
|
||||
@@ -186,7 +186,7 @@ void SDL_DBus_Quit(void)
|
||||
dbus.connection_unref(dbus.session_conn);
|
||||
}
|
||||
|
||||
if (SDL_GetHintBoolean(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, SDL_FALSE)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, false)) {
|
||||
if (dbus.shutdown) {
|
||||
dbus.shutdown();
|
||||
}
|
||||
@@ -207,9 +207,9 @@ SDL_DBusContext *SDL_DBus_GetContext(void)
|
||||
return (dbus_handle && dbus.session_conn) ? &dbus : NULL;
|
||||
}
|
||||
|
||||
static SDL_bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap)
|
||||
static bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
bool retval = false;
|
||||
|
||||
if (conn) {
|
||||
DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method);
|
||||
@@ -237,7 +237,7 @@ static SDL_bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *no
|
||||
}
|
||||
firstarg = va_arg(ap_reply, int);
|
||||
if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_get_args_valist(reply, NULL, firstarg, ap_reply)) {
|
||||
retval = SDL_TRUE;
|
||||
retval = true;
|
||||
}
|
||||
dbus.message_unref(reply);
|
||||
}
|
||||
@@ -250,9 +250,9 @@ static SDL_bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *no
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
bool retval;
|
||||
va_list ap;
|
||||
va_start(ap, method);
|
||||
retval = SDL_DBus_CallMethodInternal(conn, node, path, interface, method, ap);
|
||||
@@ -260,9 +260,9 @@ SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node,
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
bool retval;
|
||||
va_list ap;
|
||||
va_start(ap, method);
|
||||
retval = SDL_DBus_CallMethodInternal(dbus.session_conn, node, path, interface, method, ap);
|
||||
@@ -270,9 +270,9 @@ SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *int
|
||||
return retval;
|
||||
}
|
||||
|
||||
static SDL_bool SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap)
|
||||
static bool SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
bool retval = false;
|
||||
|
||||
if (conn) {
|
||||
DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method);
|
||||
@@ -281,7 +281,7 @@ static SDL_bool SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char
|
||||
if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) {
|
||||
if (dbus.connection_send(conn, msg, NULL)) {
|
||||
dbus.connection_flush(conn);
|
||||
retval = SDL_TRUE;
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,9 +292,9 @@ static SDL_bool SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char
|
||||
return retval;
|
||||
}
|
||||
|
||||
static SDL_bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *msg, const int expectedtype, void *result)
|
||||
static bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *msg, const int expectedtype, void *result)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
bool retval = false;
|
||||
|
||||
DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL);
|
||||
if (reply) {
|
||||
@@ -308,7 +308,7 @@ static SDL_bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *m
|
||||
|
||||
if (dbus.message_iter_get_arg_type(&actual_iter) == expectedtype) {
|
||||
dbus.message_iter_get_basic(&actual_iter, result);
|
||||
retval = SDL_TRUE;
|
||||
retval = true;
|
||||
}
|
||||
|
||||
dbus.message_unref(reply);
|
||||
@@ -317,9 +317,9 @@ static SDL_bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *m
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
bool retval;
|
||||
va_list ap;
|
||||
va_start(ap, method);
|
||||
retval = SDL_DBus_CallVoidMethodInternal(conn, node, path, interface, method, ap);
|
||||
@@ -327,9 +327,9 @@ SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *n
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
bool retval;
|
||||
va_list ap;
|
||||
va_start(ap, method);
|
||||
retval = SDL_DBus_CallVoidMethodInternal(dbus.session_conn, node, path, interface, method, ap);
|
||||
@@ -337,9 +337,9 @@ SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
bool retval = false;
|
||||
|
||||
if (conn) {
|
||||
DBusMessage *msg = dbus.message_new_method_call(node, path, "org.freedesktop.DBus.Properties", "Get");
|
||||
@@ -354,7 +354,7 @@ SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *no
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
{
|
||||
return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result);
|
||||
}
|
||||
@@ -368,7 +368,7 @@ void SDL_DBus_ScreensaverTickle(void)
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool SDL_DBus_AppendDictWithKeysAndValues(DBusMessageIter *iterInit, const char **keys, const char **values, int count)
|
||||
static bool SDL_DBus_AppendDictWithKeysAndValues(DBusMessageIter *iterInit, const char **keys, const char **values, int count)
|
||||
{
|
||||
DBusMessageIter iterDict;
|
||||
|
||||
@@ -406,16 +406,16 @@ static SDL_bool SDL_DBus_AppendDictWithKeysAndValues(DBusMessageIter *iterInit,
|
||||
goto failed;
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
|
||||
failed:
|
||||
/* message_iter_abandon_container_if_open() and message_iter_abandon_container() might be
|
||||
* missing if libdbus is too old. Instead, we just return without cleaning up any eventual
|
||||
* open container */
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static SDL_bool SDL_DBus_AppendDictWithKeyValue(DBusMessageIter *iterInit, const char *key, const char *value)
|
||||
static bool SDL_DBus_AppendDictWithKeyValue(DBusMessageIter *iterInit, const char *key, const char *value)
|
||||
{
|
||||
const char *keys[1];
|
||||
const char *values[1];
|
||||
@@ -425,18 +425,18 @@ static SDL_bool SDL_DBus_AppendDictWithKeyValue(DBusMessageIter *iterInit, const
|
||||
return SDL_DBus_AppendDictWithKeysAndValues(iterInit, keys, values, 1);
|
||||
}
|
||||
|
||||
SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
bool SDL_DBus_ScreensaverInhibit(bool inhibit)
|
||||
{
|
||||
const char *default_inhibit_reason = "Playing a game";
|
||||
|
||||
if ((inhibit && (screensaver_cookie != 0 || inhibit_handle)) || (!inhibit && (screensaver_cookie == 0 && !inhibit_handle))) {
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!dbus.session_conn) {
|
||||
/* We either lost connection to the session bus or were not able to
|
||||
* load the D-Bus library at all. */
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SDL_DetectSandbox() != SDL_SANDBOX_NONE) {
|
||||
@@ -449,7 +449,7 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
|
||||
if (inhibit) {
|
||||
DBusMessage *msg;
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
bool retval = false;
|
||||
const char *key = "reason";
|
||||
const char *reply = NULL;
|
||||
const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME);
|
||||
@@ -459,12 +459,12 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
|
||||
msg = dbus.message_new_method_call(bus_name, path, interface, "Inhibit");
|
||||
if (!msg) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!dbus.message_append_args(msg, DBUS_TYPE_STRING, &window, DBUS_TYPE_UINT32, &INHIBIT_IDLE, DBUS_TYPE_INVALID)) {
|
||||
dbus.message_unref(msg);
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus.message_iter_init_append(msg, &iterInit);
|
||||
@@ -472,19 +472,19 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
// a{sv}
|
||||
if (!SDL_DBus_AppendDictWithKeyValue(&iterInit, key, reason)) {
|
||||
dbus.message_unref(msg);
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SDL_DBus_CallWithBasicReply(dbus.session_conn, msg, DBUS_TYPE_OBJECT_PATH, &reply)) {
|
||||
inhibit_handle = SDL_strdup(reply);
|
||||
retval = SDL_TRUE;
|
||||
retval = true;
|
||||
}
|
||||
|
||||
dbus.message_unref(msg);
|
||||
return retval;
|
||||
} else {
|
||||
if (!SDL_DBus_CallVoidMethod(bus_name, inhibit_handle, "org.freedesktop.portal.Request", "Close", DBUS_TYPE_INVALID)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
SDL_free(inhibit_handle);
|
||||
inhibit_handle = NULL;
|
||||
@@ -504,18 +504,18 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
if (!SDL_DBus_CallMethod(bus_name, path, interface, "Inhibit",
|
||||
DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
return (screensaver_cookie != 0);
|
||||
} else {
|
||||
if (!SDL_DBus_CallVoidMethod(bus_name, path, interface, "UnInhibit", DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
screensaver_cookie = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SDL_DBus_PumpEvents(void)
|
||||
|
||||
@@ -92,17 +92,17 @@ extern void SDL_DBus_Quit(void);
|
||||
extern SDL_DBusContext *SDL_DBus_GetContext(void);
|
||||
|
||||
// These use the built-in Session connection.
|
||||
extern SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
|
||||
extern bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
|
||||
|
||||
// These use whatever connection you like.
|
||||
extern SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
|
||||
extern bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
|
||||
extern bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
|
||||
|
||||
extern void SDL_DBus_ScreensaverTickle(void);
|
||||
extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit);
|
||||
extern bool SDL_DBus_ScreensaverInhibit(bool inhibit);
|
||||
|
||||
extern void SDL_DBus_PumpEvents(void);
|
||||
extern char *SDL_DBus_GetLocalMachineId(void);
|
||||
|
||||
@@ -76,12 +76,12 @@ typedef struct SDL_evdevlist_item
|
||||
int udev_class;
|
||||
|
||||
// TODO: use this for every device, not just touchscreen
|
||||
SDL_bool out_of_sync;
|
||||
bool out_of_sync;
|
||||
|
||||
/* TODO: expand on this to have data for every possible class (mouse,
|
||||
keyboard, touchpad, etc.). Also there's probably some things in here we
|
||||
can pull out to the SDL_evdevlist_item i.e. name */
|
||||
SDL_bool is_touchscreen;
|
||||
bool is_touchscreen;
|
||||
struct
|
||||
{
|
||||
char *name;
|
||||
@@ -108,9 +108,9 @@ typedef struct SDL_evdevlist_item
|
||||
} *touchscreen_data;
|
||||
|
||||
// Mouse state
|
||||
SDL_bool high_res_wheel;
|
||||
SDL_bool high_res_hwheel;
|
||||
SDL_bool relative_mouse;
|
||||
bool high_res_wheel;
|
||||
bool high_res_hwheel;
|
||||
bool relative_mouse;
|
||||
int mouse_x, mouse_y;
|
||||
int mouse_wheel, mouse_hwheel;
|
||||
int min_x, max_x, range_x;
|
||||
@@ -150,7 +150,7 @@ static Uint8 EVDEV_MouseButtons[] = {
|
||||
SDL_BUTTON_X2 + 3 // BTN_TASK 0x117
|
||||
};
|
||||
|
||||
static int SDL_EVDEV_SetRelativeMouseMode(SDL_bool enabled)
|
||||
static int SDL_EVDEV_SetRelativeMouseMode(bool enabled)
|
||||
{
|
||||
// Mice already send relative events through this interface
|
||||
return 0;
|
||||
@@ -159,9 +159,9 @@ static int SDL_EVDEV_SetRelativeMouseMode(SDL_bool enabled)
|
||||
static void SDL_EVDEV_UpdateKeyboardMute(void)
|
||||
{
|
||||
if (SDL_EVDEV_GetDeviceCount(SDL_UDEV_DEVICE_KEYBOARD) > 0) {
|
||||
SDL_EVDEV_kbd_set_muted(_this->kbd, SDL_TRUE);
|
||||
SDL_EVDEV_kbd_set_muted(_this->kbd, true);
|
||||
} else {
|
||||
SDL_EVDEV_kbd_set_muted(_this->kbd, SDL_FALSE);
|
||||
SDL_EVDEV_kbd_set_muted(_this->kbd, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,11 +544,11 @@ void SDL_EVDEV_Poll(void)
|
||||
* be window-relative in that case. */
|
||||
switch (item->touchscreen_data->slots[j].delta) {
|
||||
case EVDEV_TOUCH_SLOTDELTA_DOWN:
|
||||
SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_TRUE, norm_x, norm_y, norm_pressure);
|
||||
SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, true, norm_x, norm_y, norm_pressure);
|
||||
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
|
||||
break;
|
||||
case EVDEV_TOUCH_SLOTDELTA_UP:
|
||||
SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_FALSE, norm_x, norm_y, norm_pressure);
|
||||
SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, false, norm_x, norm_y, norm_pressure);
|
||||
item->touchscreen_data->slots[j].tracking_id = 0;
|
||||
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
|
||||
break;
|
||||
@@ -562,12 +562,12 @@ void SDL_EVDEV_Poll(void)
|
||||
}
|
||||
|
||||
if (item->out_of_sync) {
|
||||
item->out_of_sync = SDL_FALSE;
|
||||
item->out_of_sync = false;
|
||||
}
|
||||
break;
|
||||
case SYN_DROPPED:
|
||||
if (item->is_touchscreen) {
|
||||
item->out_of_sync = SDL_TRUE;
|
||||
item->out_of_sync = true;
|
||||
}
|
||||
SDL_EVDEV_sync_device(item);
|
||||
break;
|
||||
@@ -610,14 +610,14 @@ static int SDL_EVDEV_init_keyboard(SDL_evdevlist_item *item, int udev_class)
|
||||
name[0] = '\0';
|
||||
ioctl(item->fd, EVIOCGNAME(sizeof(name)), name);
|
||||
|
||||
SDL_AddKeyboard((SDL_KeyboardID)item->fd, name, SDL_TRUE);
|
||||
SDL_AddKeyboard((SDL_KeyboardID)item->fd, name, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SDL_EVDEV_destroy_keyboard(SDL_evdevlist_item *item)
|
||||
{
|
||||
SDL_RemoveKeyboard((SDL_KeyboardID)item->fd, SDL_TRUE);
|
||||
SDL_RemoveKeyboard((SDL_KeyboardID)item->fd, true);
|
||||
}
|
||||
|
||||
static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
|
||||
@@ -629,7 +629,7 @@ static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
|
||||
name[0] = '\0';
|
||||
ioctl(item->fd, EVIOCGNAME(sizeof(name)), name);
|
||||
|
||||
SDL_AddMouse((SDL_MouseID)item->fd, name, SDL_TRUE);
|
||||
SDL_AddMouse((SDL_MouseID)item->fd, name, true);
|
||||
|
||||
ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info);
|
||||
if (ret < 0) {
|
||||
@@ -654,7 +654,7 @@ static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
|
||||
|
||||
static void SDL_EVDEV_destroy_mouse(SDL_evdevlist_item *item)
|
||||
{
|
||||
SDL_RemoveMouse((SDL_MouseID)item->fd, SDL_TRUE);
|
||||
SDL_RemoveMouse((SDL_MouseID)item->fd, true);
|
||||
}
|
||||
|
||||
static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
|
||||
@@ -932,7 +932,7 @@ static int SDL_EVDEV_device_added(const char *dev_path, int udev_class)
|
||||
// For now, we just treat a touchpad like a touchscreen
|
||||
if (udev_class & (SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD)) {
|
||||
int ret;
|
||||
item->is_touchscreen = SDL_TRUE;
|
||||
item->is_touchscreen = true;
|
||||
ret = SDL_EVDEV_init_touchscreen(item, udev_class);
|
||||
if (ret < 0) {
|
||||
close(item->fd);
|
||||
|
||||
@@ -84,15 +84,15 @@ static fn_handler_fn *fn_handler[] = {
|
||||
struct SDL_EVDEV_keyboard_state
|
||||
{
|
||||
int console_fd;
|
||||
SDL_bool muted;
|
||||
bool muted;
|
||||
int old_kbd_mode;
|
||||
unsigned short **key_maps;
|
||||
unsigned char shift_down[NR_SHIFT]; // shift state counters..
|
||||
SDL_bool dead_key_next;
|
||||
bool dead_key_next;
|
||||
int npadch; // -1 or number assembled on pad
|
||||
struct kbdiacrs *accents;
|
||||
unsigned int diacr;
|
||||
SDL_bool rep; // flag telling character repeat
|
||||
bool rep; // flag telling character repeat
|
||||
unsigned char lockstate;
|
||||
unsigned char slockstate;
|
||||
unsigned char ledflagstate;
|
||||
@@ -321,7 +321,7 @@ static void kbd_vt_acquire_signal_action(int signum)
|
||||
SDL_AtomicSet(&vt_signal_pending, VT_SIGNAL_ACQUIRE);
|
||||
}
|
||||
|
||||
static SDL_bool setup_vt_signal(int signum, signal_handler handler)
|
||||
static bool setup_vt_signal(int signum, signal_handler handler)
|
||||
{
|
||||
struct sigaction *old_action_p;
|
||||
struct sigaction new_action;
|
||||
@@ -330,14 +330,14 @@ static SDL_bool setup_vt_signal(int signum, signal_handler handler)
|
||||
new_action.sa_handler = handler;
|
||||
new_action.sa_flags = SA_RESTART;
|
||||
if (sigaction(signum, &new_action, old_action_p) < 0) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
if (old_action_p->sa_handler != SIG_DFL) {
|
||||
// This signal is already in use
|
||||
sigaction(signum, old_action_p, NULL);
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int find_free_signal(signal_handler handler)
|
||||
@@ -462,7 +462,7 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
|
||||
return kbd;
|
||||
}
|
||||
|
||||
void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted)
|
||||
void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted)
|
||||
{
|
||||
if (!state) {
|
||||
return;
|
||||
@@ -473,7 +473,7 @@ void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted)
|
||||
}
|
||||
|
||||
if (muted) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_MUTE_CONSOLE_KEYBOARD, SDL_TRUE)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_MUTE_CONSOLE_KEYBOARD, true)) {
|
||||
/* Mute the keyboard so keystrokes only generate evdev events
|
||||
* and do not leak through to the console
|
||||
*/
|
||||
@@ -482,7 +482,7 @@ void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted)
|
||||
/* Make sure to restore keyboard if application fails to call
|
||||
* SDL_Quit before exit or fatal signal is raised.
|
||||
*/
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) {
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, false)) {
|
||||
kbd_register_emerg_cleanup(state);
|
||||
}
|
||||
}
|
||||
@@ -522,7 +522,7 @@ void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state)
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_EVDEV_kbd_set_muted(state, SDL_FALSE);
|
||||
SDL_EVDEV_kbd_set_muted(state, false);
|
||||
|
||||
kbd_vt_quit(state->console_fd);
|
||||
|
||||
@@ -690,7 +690,7 @@ static void fn_num(SDL_EVDEV_keyboard_state *kbd)
|
||||
|
||||
static void fn_compose(SDL_EVDEV_keyboard_state *kbd)
|
||||
{
|
||||
kbd->dead_key_next = SDL_TRUE;
|
||||
kbd->dead_key_next = true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -729,7 +729,7 @@ static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_f
|
||||
}
|
||||
|
||||
if (kbd->dead_key_next) {
|
||||
kbd->dead_key_next = SDL_FALSE;
|
||||
kbd->dead_key_next = false;
|
||||
kbd->diacr = value;
|
||||
return;
|
||||
}
|
||||
@@ -974,7 +974,7 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted)
|
||||
void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ struct SDL_EVDEV_keyboard_state;
|
||||
typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state;
|
||||
|
||||
extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void);
|
||||
extern void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted);
|
||||
extern void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted);
|
||||
extern void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data);
|
||||
extern void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state);
|
||||
extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down);
|
||||
|
||||
@@ -249,10 +249,10 @@ static void SDLCALL Fcitx_SetCapabilities(void *data,
|
||||
SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, client->ic_path, FCITX_IC_DBUS_INTERFACE, "SetCapability", DBUS_TYPE_UINT64, &caps, DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
static SDL_bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appname, char **ic_path)
|
||||
static bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appname, char **ic_path)
|
||||
{
|
||||
const char *program = "program";
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
bool retval = false;
|
||||
|
||||
if (dbus && dbus->session_conn) {
|
||||
DBusMessage *msg = dbus->message_new_method_call(FCITX_DBUS_SERVICE, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateInputContext");
|
||||
@@ -269,7 +269,7 @@ static SDL_bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appna
|
||||
reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, 300, NULL);
|
||||
if (reply) {
|
||||
if (dbus->message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, ic_path, DBUS_TYPE_INVALID)) {
|
||||
retval = SDL_TRUE;
|
||||
retval = true;
|
||||
}
|
||||
dbus->message_unref(reply);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ static SDL_bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appna
|
||||
return retval;
|
||||
}
|
||||
|
||||
static SDL_bool FcitxClientCreateIC(FcitxClient *client)
|
||||
static bool FcitxClientCreateIC(FcitxClient *client)
|
||||
{
|
||||
char *appname = GetAppName();
|
||||
char *ic_path = NULL;
|
||||
@@ -305,10 +305,10 @@ static SDL_bool FcitxClientCreateIC(FcitxClient *client)
|
||||
dbus->connection_flush(dbus->session_conn);
|
||||
|
||||
SDL_AddHintCallback(SDL_HINT_IME_IMPLEMENTED_UI, Fcitx_SetCapabilities, client);
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static Uint32 Fcitx_ModState(void)
|
||||
@@ -344,7 +344,7 @@ static Uint32 Fcitx_ModState(void)
|
||||
return fcitx_mods;
|
||||
}
|
||||
|
||||
SDL_bool SDL_Fcitx_Init(void)
|
||||
bool SDL_Fcitx_Init(void)
|
||||
{
|
||||
fcitx_client.dbus = SDL_DBus_GetContext();
|
||||
|
||||
@@ -365,7 +365,7 @@ void SDL_Fcitx_Quit(void)
|
||||
}
|
||||
}
|
||||
|
||||
void SDL_Fcitx_SetFocus(SDL_bool focused)
|
||||
void SDL_Fcitx_SetFocus(bool focused)
|
||||
{
|
||||
if (focused) {
|
||||
FcitxClientICCallMethod(&fcitx_client, "FocusIn");
|
||||
@@ -379,15 +379,15 @@ void SDL_Fcitx_Reset(void)
|
||||
FcitxClientICCallMethod(&fcitx_client, "Reset");
|
||||
}
|
||||
|
||||
SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
{
|
||||
Uint32 mod_state = Fcitx_ModState();
|
||||
Uint32 handled = SDL_FALSE;
|
||||
Uint32 handled = false;
|
||||
Uint32 is_release = (state == SDL_RELEASED);
|
||||
Uint32 event_time = 0;
|
||||
|
||||
if (!fcitx_client.ic_path) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SDL_DBus_CallMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent",
|
||||
@@ -395,11 +395,11 @@ SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) {
|
||||
if (handled) {
|
||||
SDL_Fcitx_UpdateTextInputArea(SDL_GetKeyboardFocus());
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SDL_Fcitx_UpdateTextInputArea(SDL_Window *window)
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
|
||||
#include "SDL_internal.h"
|
||||
|
||||
extern SDL_bool SDL_Fcitx_Init(void);
|
||||
extern bool SDL_Fcitx_Init(void);
|
||||
extern void SDL_Fcitx_Quit(void);
|
||||
extern void SDL_Fcitx_SetFocus(SDL_bool focused);
|
||||
extern void SDL_Fcitx_SetFocus(bool focused);
|
||||
extern void SDL_Fcitx_Reset(void);
|
||||
extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern void SDL_Fcitx_UpdateTextInputArea(SDL_Window *window);
|
||||
extern void SDL_Fcitx_PumpEvents(void);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ static const char *ibus_input_interface = NULL;
|
||||
static char *input_ctx_path = NULL;
|
||||
static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 };
|
||||
static DBusConnection *ibus_conn = NULL;
|
||||
static SDL_bool ibus_is_portal_interface = SDL_FALSE;
|
||||
static bool ibus_is_portal_interface = false;
|
||||
static char *ibus_addr_file = NULL;
|
||||
static int inotify_fd = -1, inotify_wd = -1;
|
||||
|
||||
@@ -91,40 +91,40 @@ static Uint32 IBus_ModState(void)
|
||||
return ibus_mods;
|
||||
}
|
||||
|
||||
static SDL_bool IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus,
|
||||
static bool IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus,
|
||||
DBusMessageIter *inside, const char *struct_id, size_t id_size)
|
||||
{
|
||||
DBusMessageIter sub;
|
||||
if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->message_iter_recurse(iter, &sub);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->message_iter_recurse(&sub, inside);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(inside) != DBUS_TYPE_STRING) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->message_iter_get_basic(inside, &struct_id);
|
||||
if (!struct_id || SDL_strncmp(struct_id, struct_id, id_size) != 0) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static SDL_bool IBus_GetDecorationPosition(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus,
|
||||
static bool IBus_GetDecorationPosition(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus,
|
||||
Uint32 *start_pos, Uint32 *end_pos)
|
||||
{
|
||||
DBusMessageIter sub1, sub2, array;
|
||||
|
||||
if (!IBus_EnterVariant(conn, iter, dbus, &sub1, "IBusText", sizeof("IBusText"))) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->message_iter_next(&sub1);
|
||||
@@ -132,14 +132,14 @@ static SDL_bool IBus_GetDecorationPosition(DBusConnection *conn, DBusMessageIter
|
||||
dbus->message_iter_next(&sub1);
|
||||
|
||||
if (!IBus_EnterVariant(conn, &sub1, dbus, &sub2, "IBusAttrList", sizeof("IBusAttrList"))) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->message_iter_next(&sub2);
|
||||
dbus->message_iter_next(&sub2);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_ARRAY) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->message_iter_recurse(&sub2, &array);
|
||||
@@ -172,14 +172,14 @@ static SDL_bool IBus_GetDecorationPosition(DBusConnection *conn, DBusMessageIter
|
||||
if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) {
|
||||
dbus->message_iter_get_basic(&sub, end_pos);
|
||||
*start_pos = start;
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dbus->message_iter_next(&array);
|
||||
}
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char *IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus)
|
||||
@@ -203,18 +203,18 @@ static const char *IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *it
|
||||
return text;
|
||||
}
|
||||
|
||||
static SDL_bool IBus_GetVariantCursorPos(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus,
|
||||
static bool IBus_GetVariantCursorPos(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus,
|
||||
Uint32 *pos)
|
||||
{
|
||||
dbus->message_iter_next(iter);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_UINT32) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->message_iter_get_basic(iter, pos);
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data)
|
||||
@@ -242,8 +242,8 @@ static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *
|
||||
|
||||
if (text) {
|
||||
Uint32 pos, start_pos, end_pos;
|
||||
SDL_bool has_pos = SDL_FALSE;
|
||||
SDL_bool has_dec_pos = SDL_FALSE;
|
||||
bool has_pos = false;
|
||||
bool has_dec_pos = false;
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
has_dec_pos = IBus_GetDecorationPosition(conn, &iter, dbus, &start_pos, &end_pos);
|
||||
@@ -277,7 +277,7 @@ static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *
|
||||
static char *IBus_ReadAddressFromFile(const char *file_path)
|
||||
{
|
||||
char addr_buf[1024];
|
||||
SDL_bool success = SDL_FALSE;
|
||||
bool success = false;
|
||||
FILE *addr_file;
|
||||
|
||||
addr_file = fopen(file_path, "r");
|
||||
@@ -294,7 +294,7 @@ static char *IBus_ReadAddressFromFile(const char *file_path)
|
||||
if (addr_buf[sz - 2] == '\r') {
|
||||
addr_buf[sz - 2] = 0;
|
||||
}
|
||||
success = SDL_TRUE;
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -401,7 +401,7 @@ static char *IBus_GetDBusAddressFilename(void)
|
||||
return SDL_strdup(file_path);
|
||||
}
|
||||
|
||||
static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus);
|
||||
static bool IBus_CheckConnection(SDL_DBusContext *dbus);
|
||||
|
||||
static void SDLCALL IBus_SetCapabilities(void *data, const char *name, const char *old_val,
|
||||
const char *hint)
|
||||
@@ -423,11 +423,11 @@ static void SDLCALL IBus_SetCapabilities(void *data, const char *name, const cha
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
|
||||
static bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
|
||||
{
|
||||
const char *client_name = "SDL3_Application";
|
||||
const char *path = NULL;
|
||||
SDL_bool result = SDL_FALSE;
|
||||
bool result = false;
|
||||
DBusObjectPathVTable ibus_vtable;
|
||||
|
||||
SDL_zero(ibus_vtable);
|
||||
@@ -436,7 +436,7 @@ static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
|
||||
/* try the portal interface first. Modern systems have this in general,
|
||||
and sandbox things like FlakPak and Snaps, etc, require it. */
|
||||
|
||||
ibus_is_portal_interface = SDL_TRUE;
|
||||
ibus_is_portal_interface = true;
|
||||
ibus_service = IBUS_PORTAL_SERVICE;
|
||||
ibus_interface = IBUS_PORTAL_INTERFACE;
|
||||
ibus_input_interface = IBUS_PORTAL_INPUT_INTERFACE;
|
||||
@@ -446,21 +446,21 @@ static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
|
||||
DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
|
||||
if (!result) {
|
||||
ibus_is_portal_interface = SDL_FALSE;
|
||||
ibus_is_portal_interface = false;
|
||||
ibus_service = IBUS_SERVICE;
|
||||
ibus_interface = IBUS_INTERFACE;
|
||||
ibus_input_interface = IBUS_INPUT_INTERFACE;
|
||||
ibus_conn = dbus->connection_open_private(addr, NULL);
|
||||
|
||||
if (!ibus_conn) {
|
||||
return SDL_FALSE; // oh well.
|
||||
return false; // oh well.
|
||||
}
|
||||
|
||||
dbus->connection_flush(ibus_conn);
|
||||
|
||||
if (!dbus->bus_register(ibus_conn, NULL)) {
|
||||
ibus_conn = NULL;
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus->connection_flush(ibus_conn);
|
||||
@@ -486,22 +486,22 @@ static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
|
||||
|
||||
SDL_Window *window = SDL_GetKeyboardFocus();
|
||||
if (SDL_TextInputActive(window)) {
|
||||
SDL_IBus_SetFocus(SDL_TRUE);
|
||||
SDL_IBus_SetFocus(true);
|
||||
SDL_IBus_UpdateTextInputArea(window);
|
||||
} else {
|
||||
SDL_IBus_SetFocus(SDL_FALSE);
|
||||
SDL_IBus_SetFocus(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus)
|
||||
static bool IBus_CheckConnection(SDL_DBusContext *dbus)
|
||||
{
|
||||
if (!dbus) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ibus_conn && dbus->connection_get_is_connected(ibus_conn)) {
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (inotify_fd > 0 && inotify_wd > 0) {
|
||||
@@ -510,18 +510,18 @@ static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus)
|
||||
if (readsize > 0) {
|
||||
|
||||
char *p;
|
||||
SDL_bool file_updated = SDL_FALSE;
|
||||
bool file_updated = false;
|
||||
|
||||
for (p = buf; p < buf + readsize; /**/) {
|
||||
struct inotify_event *event = (struct inotify_event *)p;
|
||||
if (event->len > 0) {
|
||||
char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/');
|
||||
if (!addr_file_no_path) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SDL_strcmp(addr_file_no_path + 1, event->name) == 0) {
|
||||
file_updated = SDL_TRUE;
|
||||
file_updated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -532,7 +532,7 @@ static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus)
|
||||
if (file_updated) {
|
||||
char *addr = IBus_ReadAddressFromFile(ibus_addr_file);
|
||||
if (addr) {
|
||||
SDL_bool result = IBus_SetupConnection(dbus, addr);
|
||||
bool result = IBus_SetupConnection(dbus, addr);
|
||||
SDL_free(addr);
|
||||
return result;
|
||||
}
|
||||
@@ -540,12 +540,12 @@ static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus)
|
||||
}
|
||||
}
|
||||
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_bool SDL_IBus_Init(void)
|
||||
bool SDL_IBus_Init(void)
|
||||
{
|
||||
SDL_bool result = SDL_FALSE;
|
||||
bool result = false;
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
|
||||
if (dbus) {
|
||||
@@ -554,13 +554,13 @@ SDL_bool SDL_IBus_Init(void)
|
||||
char *addr_file_dir;
|
||||
|
||||
if (!addr_file) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
addr = IBus_ReadAddressFromFile(addr_file);
|
||||
if (!addr) {
|
||||
SDL_free(addr_file);
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ibus_addr_file) {
|
||||
@@ -626,7 +626,7 @@ void SDL_IBus_Quit(void)
|
||||
ibus_service = NULL;
|
||||
ibus_interface = NULL;
|
||||
ibus_input_interface = NULL;
|
||||
ibus_is_portal_interface = SDL_FALSE;
|
||||
ibus_is_portal_interface = false;
|
||||
|
||||
if (inotify_fd > 0 && inotify_wd > 0) {
|
||||
inotify_rm_watch(inotify_fd, inotify_wd);
|
||||
@@ -649,7 +649,7 @@ static void IBus_SimpleMessage(const char *method)
|
||||
}
|
||||
}
|
||||
|
||||
void SDL_IBus_SetFocus(SDL_bool focused)
|
||||
void SDL_IBus_SetFocus(bool focused)
|
||||
{
|
||||
const char *method = focused ? "FocusIn" : "FocusOut";
|
||||
IBus_SimpleMessage(method);
|
||||
@@ -660,7 +660,7 @@ void SDL_IBus_Reset(void)
|
||||
IBus_SimpleMessage("Reset");
|
||||
}
|
||||
|
||||
SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
{
|
||||
Uint32 result = 0;
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
#define SDL_USE_IBUS 1
|
||||
#include <ibus.h>
|
||||
|
||||
extern SDL_bool SDL_IBus_Init(void);
|
||||
extern bool SDL_IBus_Init(void);
|
||||
extern void SDL_IBus_Quit(void);
|
||||
|
||||
// Lets the IBus server know about changes in window focus
|
||||
extern void SDL_IBus_SetFocus(SDL_bool focused);
|
||||
extern void SDL_IBus_SetFocus(bool focused);
|
||||
|
||||
// Closes the candidate list and resets any text currently being edited
|
||||
extern void SDL_IBus_Reset(void);
|
||||
|
||||
/* Sends a keypress event to IBus, returns SDL_TRUE if IBus used this event to
|
||||
/* Sends a keypress event to IBus, returns true if IBus used this event to
|
||||
update its candidate list or change input methods. PumpEvents should be
|
||||
called some time after this, to receive the TextInput / TextEditing event back. */
|
||||
extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
|
||||
/* Update the position of IBus' candidate list. If rect is NULL then this will
|
||||
just reposition it relative to the focused window's new position. */
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#include "SDL_ibus.h"
|
||||
#include "SDL_fcitx.h"
|
||||
|
||||
typedef SDL_bool (*SDL_IME_Init_t)(void);
|
||||
typedef bool (*SDL_IME_Init_t)(void);
|
||||
typedef void (*SDL_IME_Quit_t)(void);
|
||||
typedef void (*SDL_IME_SetFocus_t)(SDL_bool);
|
||||
typedef void (*SDL_IME_SetFocus_t)(bool);
|
||||
typedef void (*SDL_IME_Reset_t)(void);
|
||||
typedef SDL_bool (*SDL_IME_ProcessKeyEvent_t)(Uint32, Uint32, Uint8 state);
|
||||
typedef bool (*SDL_IME_ProcessKeyEvent_t)(Uint32, Uint32, Uint8 state);
|
||||
typedef void (*SDL_IME_UpdateTextInputArea_t)(SDL_Window *window);
|
||||
typedef void (*SDL_IME_PumpEvents_t)(void);
|
||||
|
||||
@@ -42,17 +42,17 @@ static SDL_IME_PumpEvents_t SDL_IME_PumpEvents_Real = NULL;
|
||||
|
||||
static void InitIME(void)
|
||||
{
|
||||
static SDL_bool inited = SDL_FALSE;
|
||||
static bool inited = false;
|
||||
#ifdef HAVE_FCITX
|
||||
const char *im_module = SDL_getenv("SDL_IM_MODULE");
|
||||
const char *xmodifiers = SDL_getenv("XMODIFIERS");
|
||||
#endif
|
||||
|
||||
if (inited == SDL_TRUE) {
|
||||
if (inited == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
inited = SDL_TRUE;
|
||||
inited = true;
|
||||
|
||||
// See if fcitx IME support is being requested
|
||||
#ifdef HAVE_FCITX
|
||||
@@ -83,13 +83,13 @@ static void InitIME(void)
|
||||
#endif // HAVE_IBUS_IBUS_H
|
||||
}
|
||||
|
||||
SDL_bool SDL_IME_Init(void)
|
||||
bool SDL_IME_Init(void)
|
||||
{
|
||||
InitIME();
|
||||
|
||||
if (SDL_IME_Init_Real) {
|
||||
if (SDL_IME_Init_Real()) {
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// uhoh, the IME implementation's init failed! Disable IME support.
|
||||
@@ -102,7 +102,7 @@ SDL_bool SDL_IME_Init(void)
|
||||
SDL_IME_PumpEvents_Real = NULL;
|
||||
}
|
||||
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SDL_IME_Quit(void)
|
||||
@@ -112,7 +112,7 @@ void SDL_IME_Quit(void)
|
||||
}
|
||||
}
|
||||
|
||||
void SDL_IME_SetFocus(SDL_bool focused)
|
||||
void SDL_IME_SetFocus(bool focused)
|
||||
{
|
||||
if (SDL_IME_SetFocus_Real) {
|
||||
SDL_IME_SetFocus_Real(focused);
|
||||
@@ -126,13 +126,13 @@ void SDL_IME_Reset(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
{
|
||||
if (SDL_IME_ProcessKeyEvent_Real) {
|
||||
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state);
|
||||
}
|
||||
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SDL_IME_UpdateTextInputArea(SDL_Window *window)
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
|
||||
#include "SDL_internal.h"
|
||||
|
||||
extern SDL_bool SDL_IME_Init(void);
|
||||
extern bool SDL_IME_Init(void);
|
||||
extern void SDL_IME_Quit(void);
|
||||
extern void SDL_IME_SetFocus(SDL_bool focused);
|
||||
extern void SDL_IME_SetFocus(bool focused);
|
||||
extern void SDL_IME_Reset(void);
|
||||
extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern void SDL_IME_UpdateTextInputArea(SDL_Window *window);
|
||||
extern void SDL_IME_PumpEvents(void);
|
||||
|
||||
|
||||
@@ -44,16 +44,16 @@ typedef struct SystemThemeData
|
||||
|
||||
static SystemThemeData system_theme_data;
|
||||
|
||||
static SDL_bool DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
|
||||
static bool DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
|
||||
SDL_DBusContext *dbus = system_theme_data.dbus;
|
||||
Uint32 color_scheme;
|
||||
DBusMessageIter variant_iter;
|
||||
|
||||
if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT)
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
dbus->message_iter_recurse(iter, &variant_iter);
|
||||
if (dbus->message_iter_get_arg_type(&variant_iter) != DBUS_TYPE_UINT32)
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
dbus->message_iter_get_basic(&variant_iter, &color_scheme);
|
||||
switch (color_scheme) {
|
||||
case 0:
|
||||
@@ -66,7 +66,7 @@ static SDL_bool DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme
|
||||
*theme = SDL_SYSTEM_THEME_LIGHT;
|
||||
break;
|
||||
}
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) {
|
||||
@@ -106,7 +106,7 @@ not_our_signal:
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
}
|
||||
|
||||
SDL_bool SDL_SystemTheme_Init(void)
|
||||
bool SDL_SystemTheme_Init(void)
|
||||
{
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
DBusMessage *msg;
|
||||
@@ -116,7 +116,7 @@ SDL_bool SDL_SystemTheme_Init(void)
|
||||
system_theme_data.theme = SDL_SYSTEM_THEME_UNKNOWN;
|
||||
system_theme_data.dbus = dbus;
|
||||
if (!dbus) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
msg = dbus->message_new_method_call(PORTAL_DESTINATION, PORTAL_PATH, PORTAL_INTERFACE, PORTAL_METHOD);
|
||||
@@ -147,7 +147,7 @@ incorrect_type:
|
||||
dbus->connection_add_filter(dbus->session_conn,
|
||||
&DBus_MessageFilter, dbus, NULL);
|
||||
dbus->connection_flush(dbus->session_conn);
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
SDL_SystemTheme SDL_SystemTheme_Get(void)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "SDL_internal.h"
|
||||
|
||||
extern SDL_bool SDL_SystemTheme_Init(void);
|
||||
extern bool SDL_SystemTheme_Init(void);
|
||||
extern SDL_SystemTheme SDL_SystemTheme_Get(void);
|
||||
|
||||
#endif // SDL_system_theme_h_
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#define XDG_PORTAL_DBUS_PATH "/org/freedesktop/portal/desktop"
|
||||
#define XDG_PORTAL_DBUS_INTERFACE "org.freedesktop.portal.Realtime"
|
||||
|
||||
static SDL_bool rtkit_use_session_conn;
|
||||
static bool rtkit_use_session_conn;
|
||||
static const char *rtkit_dbus_node;
|
||||
static const char *rtkit_dbus_path;
|
||||
static const char *rtkit_dbus_interface;
|
||||
@@ -67,7 +67,7 @@ static Sint64 rtkit_max_rttime_usec = 200000;
|
||||
* - The desktop portal exists and supports the realtime interface.
|
||||
* - The realtime interface is new enough to have the required bug fixes applied.
|
||||
*/
|
||||
static SDL_bool realtime_portal_supported(DBusConnection *conn)
|
||||
static bool realtime_portal_supported(DBusConnection *conn)
|
||||
{
|
||||
Sint64 res;
|
||||
return SDL_DBus_QueryPropertyOnConnection(conn, XDG_PORTAL_DBUS_NODE, XDG_PORTAL_DBUS_PATH, XDG_PORTAL_DBUS_INTERFACE,
|
||||
@@ -80,12 +80,12 @@ static void set_rtkit_interface(void)
|
||||
|
||||
// xdg-desktop-portal works in all instances, so check for it first.
|
||||
if (dbus && realtime_portal_supported(dbus->session_conn)) {
|
||||
rtkit_use_session_conn = SDL_TRUE;
|
||||
rtkit_use_session_conn = true;
|
||||
rtkit_dbus_node = XDG_PORTAL_DBUS_NODE;
|
||||
rtkit_dbus_path = XDG_PORTAL_DBUS_PATH;
|
||||
rtkit_dbus_interface = XDG_PORTAL_DBUS_INTERFACE;
|
||||
} else { // Fall back to the standard rtkit interface in all other cases.
|
||||
rtkit_use_session_conn = SDL_FALSE;
|
||||
rtkit_use_session_conn = false;
|
||||
rtkit_dbus_node = RTKIT_DBUS_NODE;
|
||||
rtkit_dbus_path = RTKIT_DBUS_PATH;
|
||||
rtkit_dbus_interface = RTKIT_DBUS_INTERFACE;
|
||||
@@ -129,7 +129,7 @@ static void rtkit_initialize(void)
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool rtkit_initialize_realtime_thread(void)
|
||||
static bool rtkit_initialize_realtime_thread(void)
|
||||
{
|
||||
// Following is an excerpt from rtkit README that outlines the requirements
|
||||
// a thread must meet before making rtkit requests:
|
||||
@@ -163,7 +163,7 @@ static SDL_bool rtkit_initialize_realtime_thread(void)
|
||||
// Requirement #1: Set RLIMIT_RTTIME
|
||||
err = getrlimit(nLimit, &rlimit);
|
||||
if (err) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Current rtkit allows a max of 200ms right now
|
||||
@@ -171,24 +171,24 @@ static SDL_bool rtkit_initialize_realtime_thread(void)
|
||||
rlimit.rlim_cur = rlimit.rlim_max / 2;
|
||||
err = setrlimit(nLimit, &rlimit);
|
||||
if (err) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Requirement #2: Add SCHED_RESET_ON_FORK to the scheduler policy
|
||||
err = sched_getparam(nPid, &schedParam);
|
||||
if (err) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
err = sched_setscheduler(nPid, nSchedPolicy, &schedParam);
|
||||
if (err) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static SDL_bool rtkit_setpriority_nice(pid_t thread, int nice_level)
|
||||
static bool rtkit_setpriority_nice(pid_t thread, int nice_level)
|
||||
{
|
||||
DBusConnection *dbus_conn;
|
||||
Uint64 pid = (Uint64)getpid();
|
||||
@@ -206,12 +206,12 @@ static SDL_bool rtkit_setpriority_nice(pid_t thread, int nice_level)
|
||||
rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadHighPriorityWithPID",
|
||||
DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_INT32, &nice, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority)
|
||||
static bool rtkit_setpriority_realtime(pid_t thread, int rt_priority)
|
||||
{
|
||||
DBusConnection *dbus_conn;
|
||||
Uint64 pid = (Uint64)getpid();
|
||||
@@ -237,9 +237,9 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority)
|
||||
rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadRealtimeWithPID",
|
||||
DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_UINT32, &priority, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
@@ -40,23 +40,23 @@ static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" };
|
||||
|
||||
static SDL_UDEV_PrivateData *_this = NULL;
|
||||
|
||||
static SDL_bool SDL_UDEV_load_sym(const char *fn, void **addr);
|
||||
static bool SDL_UDEV_load_sym(const char *fn, void **addr);
|
||||
static int SDL_UDEV_load_syms(void);
|
||||
static SDL_bool SDL_UDEV_hotplug_update_available(void);
|
||||
static bool SDL_UDEV_hotplug_update_available(void);
|
||||
static void get_caps(struct udev_device *dev, struct udev_device *pdev, const char *attr, unsigned long *bitmask, size_t bitmask_len);
|
||||
static int guess_device_class(struct udev_device *dev);
|
||||
static int device_class(struct udev_device *dev);
|
||||
static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev);
|
||||
|
||||
static SDL_bool SDL_UDEV_load_sym(const char *fn, void **addr)
|
||||
static bool SDL_UDEV_load_sym(const char *fn, void **addr)
|
||||
{
|
||||
*addr = SDL_LoadFunction(_this->udev_handle, fn);
|
||||
if (!*addr) {
|
||||
// Don't call SDL_SetError(): SDL_LoadFunction already did.
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int SDL_UDEV_load_syms(void)
|
||||
@@ -98,15 +98,15 @@ static int SDL_UDEV_load_syms(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SDL_bool SDL_UDEV_hotplug_update_available(void)
|
||||
static bool SDL_UDEV_hotplug_update_available(void)
|
||||
{
|
||||
if (_this->udev_mon) {
|
||||
const int fd = _this->syms.udev_monitor_get_fd(_this->udev_mon);
|
||||
if (SDL_IOReady(fd, SDL_IOR_READ, 0)) {
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
int SDL_UDEV_Init(void)
|
||||
@@ -222,7 +222,7 @@ int SDL_UDEV_Scan(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class)
|
||||
bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class)
|
||||
{
|
||||
struct stat statbuf;
|
||||
char type;
|
||||
@@ -231,11 +231,11 @@ SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16
|
||||
int class_temp;
|
||||
|
||||
if (!_this) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stat(device_path, &statbuf) == -1) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (S_ISBLK(statbuf.st_mode)) {
|
||||
@@ -245,13 +245,13 @@ SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16
|
||||
type = 'c';
|
||||
}
|
||||
else {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
dev = _this->syms.udev_device_new_from_devnum(_this->udev, type, statbuf.st_rdev);
|
||||
|
||||
if (!dev) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
val = _this->syms.udev_device_get_property_value(dev, "ID_VENDOR_ID");
|
||||
@@ -276,7 +276,7 @@ SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16
|
||||
|
||||
_this->syms.udev_device_unref(dev);
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SDL_UDEV_UnloadLibrary(void)
|
||||
|
||||
@@ -102,7 +102,7 @@ extern void SDL_UDEV_UnloadLibrary(void);
|
||||
extern int SDL_UDEV_LoadLibrary(void);
|
||||
extern void SDL_UDEV_Poll(void);
|
||||
extern int SDL_UDEV_Scan(void);
|
||||
extern SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class);
|
||||
extern bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class);
|
||||
extern int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb);
|
||||
extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb);
|
||||
extern const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void);
|
||||
|
||||
Reference in New Issue
Block a user