early-access version 2847
This commit is contained in:
19
externals/SDL/src/core/android/SDL_android.c
vendored
19
externals/SDL/src/core/android/SDL_android.c
vendored
@@ -511,9 +511,8 @@ register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, i
|
||||
/* Library init */
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
mJavaVM = vm;
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
if ((*mJavaVM)->GetEnv(mJavaVM, (void **)&env, JNI_VERSION_1_4) != JNI_OK) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to get JNI Env");
|
||||
@@ -1010,7 +1009,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j
|
||||
{
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
if (Android_Window)
|
||||
{
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
@@ -1023,7 +1021,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j
|
||||
|
||||
/* GL Context handling is done in the event loop because this function is run from the Java thread */
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
}
|
||||
@@ -1054,12 +1051,10 @@ retry:
|
||||
}
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
if (data->egl_surface != EGL_NO_SURFACE) {
|
||||
SDL_EGL_DestroySurface(_this, data->egl_surface);
|
||||
data->egl_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (data->native_window) {
|
||||
ANativeWindow_release(data->native_window);
|
||||
@@ -2131,15 +2126,6 @@ void Android_JNI_HapticStop(int device_id)
|
||||
/* See SDLActivity.java for constants. */
|
||||
#define COMMAND_SET_KEEP_SCREEN_ON 5
|
||||
|
||||
|
||||
int SDL_AndroidSendMessage(Uint32 command, int param)
|
||||
{
|
||||
if (command >= 0x8000) {
|
||||
return Android_JNI_SendMessage(command, param);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* sends message to be handled on the UI event dispatch thread */
|
||||
int Android_JNI_SendMessage(int command, int param)
|
||||
{
|
||||
@@ -2554,7 +2540,6 @@ SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled)
|
||||
SDL_bool Android_JNI_RequestPermission(const char *permission)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
jstring jpermission;
|
||||
const int requestCode = 1;
|
||||
|
||||
/* Wait for any pending request on another thread */
|
||||
@@ -2563,7 +2548,7 @@ SDL_bool Android_JNI_RequestPermission(const char *permission)
|
||||
}
|
||||
SDL_AtomicSet(&bPermissionRequestPending, SDL_TRUE);
|
||||
|
||||
jpermission = (*env)->NewStringUTF(env, permission);
|
||||
jstring jpermission = (*env)->NewStringUTF(env, permission);
|
||||
(*env)->CallStaticVoidMethod(env, mActivityClass, midRequestPermission, jpermission, requestCode);
|
||||
(*env)->DeleteLocalRef(env, jpermission);
|
||||
|
||||
|
1
externals/SDL/src/core/linux/SDL_dbus.c
vendored
1
externals/SDL/src/core/linux/SDL_dbus.c
vendored
@@ -22,7 +22,6 @@
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_dbus.h"
|
||||
#include "SDL_atomic.h"
|
||||
#include "../../stdlib/SDL_vacopy.h"
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
/* we never link directly to libdbus. */
|
||||
|
94
externals/SDL/src/core/linux/SDL_fcitx.c
vendored
94
externals/SDL/src/core/linux/SDL_fcitx.c
vendored
@@ -85,22 +85,14 @@ GetAppName()
|
||||
}
|
||||
|
||||
static size_t
|
||||
Fcitx_GetPreeditString(SDL_DBusContext *dbus,
|
||||
DBusMessage *msg,
|
||||
char **ret,
|
||||
Sint32 *start_pos,
|
||||
Sint32 *end_pos)
|
||||
{
|
||||
Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) {
|
||||
char *text = NULL, *subtext;
|
||||
size_t text_bytes = 0;
|
||||
DBusMessageIter iter, array, sub;
|
||||
Sint32 p_start_pos = -1;
|
||||
Sint32 p_end_pos = -1;
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
/* Message type is a(si)i, we only need string part */
|
||||
if (dbus->message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
||||
size_t pos = 0;
|
||||
/* First pass: calculate string length */
|
||||
dbus->message_iter_recurse(&iter, &array);
|
||||
while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) {
|
||||
@@ -111,29 +103,7 @@ Fcitx_GetPreeditString(SDL_DBusContext *dbus,
|
||||
text_bytes += SDL_strlen(subtext);
|
||||
}
|
||||
}
|
||||
dbus->message_iter_next(&sub);
|
||||
if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_INT32 && p_end_pos == -1) {
|
||||
/* Type is a bit field defined as follows: */
|
||||
/* bit 3: Underline, bit 4: HighLight, bit 5: DontCommit, */
|
||||
/* bit 6: Bold, bit 7: Strike, bit 8: Italic */
|
||||
Sint32 type;
|
||||
dbus->message_iter_get_basic(&sub, &type);
|
||||
/* We only consider highlight */
|
||||
if (type & (1 << 4)) {
|
||||
if (p_start_pos == -1) {
|
||||
p_start_pos = pos;
|
||||
}
|
||||
} else if (p_start_pos != -1 && p_end_pos == -1) {
|
||||
p_end_pos = pos;
|
||||
}
|
||||
}
|
||||
dbus->message_iter_next(&array);
|
||||
if (subtext && *subtext) {
|
||||
pos += SDL_utf8strlen(subtext);
|
||||
}
|
||||
}
|
||||
if (p_start_pos != -1 && p_end_pos == -1) {
|
||||
p_end_pos = pos;
|
||||
}
|
||||
if (text_bytes) {
|
||||
text = SDL_malloc(text_bytes + 1);
|
||||
@@ -159,32 +129,10 @@ Fcitx_GetPreeditString(SDL_DBusContext *dbus,
|
||||
text_bytes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
*ret = text;
|
||||
*start_pos = p_start_pos;
|
||||
*end_pos = p_end_pos;
|
||||
*ret= text;
|
||||
return text_bytes;
|
||||
}
|
||||
|
||||
static Sint32
|
||||
Fcitx_GetPreeditCursorByte(SDL_DBusContext *dbus, DBusMessage *msg)
|
||||
{
|
||||
Sint32 byte = -1;
|
||||
DBusMessageIter iter;
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
|
||||
dbus->message_iter_next(&iter);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
dbus->message_iter_get_basic(&iter, &byte);
|
||||
|
||||
return byte;
|
||||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
{
|
||||
@@ -214,28 +162,20 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
|
||||
if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdateFormattedPreedit")) {
|
||||
char *text = NULL;
|
||||
Sint32 start_pos, end_pos;
|
||||
size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text, &start_pos, &end_pos);
|
||||
size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text);
|
||||
if (text_bytes) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) {
|
||||
if (start_pos == -1) {
|
||||
Sint32 byte_pos = Fcitx_GetPreeditCursorByte(dbus, msg);
|
||||
start_pos = byte_pos >= 0 ? SDL_utf8strnlen(text, byte_pos) : -1;
|
||||
}
|
||||
SDL_SendEditingText(text, start_pos, end_pos >= 0 ? end_pos - start_pos : -1);
|
||||
} else {
|
||||
char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
|
||||
size_t i = 0;
|
||||
size_t cursor = 0;
|
||||
while (i < text_bytes) {
|
||||
const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf));
|
||||
const size_t chars = SDL_utf8strlen(buf);
|
||||
char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
|
||||
size_t i = 0;
|
||||
size_t cursor = 0;
|
||||
|
||||
SDL_SendEditingText(buf, cursor, chars);
|
||||
while (i < text_bytes) {
|
||||
const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf));
|
||||
const size_t chars = SDL_utf8strlen(buf);
|
||||
|
||||
i += sz;
|
||||
cursor += chars;
|
||||
}
|
||||
SDL_SendEditingText(buf, cursor, chars);
|
||||
|
||||
i += sz;
|
||||
cursor += chars;
|
||||
}
|
||||
SDL_free(text);
|
||||
} else {
|
||||
@@ -399,11 +339,11 @@ SDL_Fcitx_Reset(void)
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
|
||||
{
|
||||
Uint32 mod_state = Fcitx_ModState();
|
||||
Uint32 state = Fcitx_ModState();
|
||||
Uint32 handled = SDL_FALSE;
|
||||
Uint32 is_release = (state == SDL_RELEASED);
|
||||
Uint32 is_release = SDL_FALSE;
|
||||
Uint32 event_time = 0;
|
||||
|
||||
if (!fcitx_client.ic_path) {
|
||||
@@ -411,7 +351,7 @@ SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
}
|
||||
|
||||
if (SDL_DBus_CallMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent",
|
||||
DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mod_state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) {
|
||||
if (handled) {
|
||||
SDL_Fcitx_UpdateTextRect(NULL);
|
||||
|
2
externals/SDL/src/core/linux/SDL_fcitx.h
vendored
2
externals/SDL/src/core/linux/SDL_fcitx.h
vendored
@@ -31,7 +31,7 @@ extern SDL_bool SDL_Fcitx_Init(void);
|
||||
extern void SDL_Fcitx_Quit(void);
|
||||
extern void SDL_Fcitx_SetFocus(SDL_bool focused);
|
||||
extern void SDL_Fcitx_Reset(void);
|
||||
extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
|
||||
extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect);
|
||||
extern void SDL_Fcitx_PumpEvents(void);
|
||||
|
||||
|
224
externals/SDL/src/core/linux/SDL_ibus.c
vendored
224
externals/SDL/src/core/linux/SDL_ibus.c
vendored
@@ -22,7 +22,6 @@
|
||||
|
||||
#ifdef HAVE_IBUS_IBUS_H
|
||||
#include "SDL.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "SDL_ibus.h"
|
||||
#include "SDL_dbus.h"
|
||||
@@ -67,217 +66,107 @@ IBus_ModState(void)
|
||||
return ibus_mods;
|
||||
}
|
||||
|
||||
static SDL_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;
|
||||
}
|
||||
|
||||
dbus->message_iter_recurse(iter, &sub);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
dbus->message_iter_recurse(&sub, inside);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(inside) != DBUS_TYPE_STRING) {
|
||||
return SDL_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 SDL_TRUE;
|
||||
}
|
||||
|
||||
static SDL_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;
|
||||
}
|
||||
|
||||
dbus->message_iter_next(&sub1);
|
||||
dbus->message_iter_next(&sub1);
|
||||
dbus->message_iter_next(&sub1);
|
||||
|
||||
if (!IBus_EnterVariant(conn, &sub1, dbus, &sub2, "IBusAttrList", sizeof("IBusAttrList"))) {
|
||||
return SDL_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;
|
||||
}
|
||||
|
||||
dbus->message_iter_recurse(&sub2, &array);
|
||||
|
||||
while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_VARIANT) {
|
||||
DBusMessageIter sub;
|
||||
if (IBus_EnterVariant(conn, &array, dbus, &sub, "IBusAttribute", sizeof("IBusAttribute"))) {
|
||||
Uint32 type;
|
||||
|
||||
dbus->message_iter_next(&sub);
|
||||
dbus->message_iter_next(&sub);
|
||||
|
||||
/* From here on, the structure looks like this: */
|
||||
/* Uint32 type: 1=underline, 2=foreground, 3=background */
|
||||
/* Uint32 value: for underline it's 0=NONE, 1=SINGLE, 2=DOUBLE, */
|
||||
/* 3=LOW, 4=ERROR */
|
||||
/* for foreground and background it's a color */
|
||||
/* Uint32 start_index: starting position for the style (utf8-char) */
|
||||
/* Uint32 end_index: end position for the style (utf8-char) */
|
||||
|
||||
dbus->message_iter_get_basic(&sub, &type);
|
||||
/* We only use the background type to determine the selection */
|
||||
if (type == 3) {
|
||||
Uint32 start = -1;
|
||||
dbus->message_iter_next(&sub);
|
||||
dbus->message_iter_next(&sub);
|
||||
if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) {
|
||||
dbus->message_iter_get_basic(&sub, &start);
|
||||
dbus->message_iter_next(&sub);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dbus->message_iter_next(&array);
|
||||
}
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus)
|
||||
{
|
||||
/* The text we need is nested weirdly, use dbus-monitor to see the structure better */
|
||||
const char *text = NULL;
|
||||
DBusMessageIter sub;
|
||||
const char *struct_id = NULL;
|
||||
DBusMessageIter sub1, sub2;
|
||||
|
||||
if (!IBus_EnterVariant(conn, iter, dbus, &sub, "IBusText", sizeof("IBusText"))) {
|
||||
if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dbus->message_iter_next(&sub);
|
||||
dbus->message_iter_next(&sub);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) {
|
||||
|
||||
dbus->message_iter_recurse(iter, &sub1);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) {
|
||||
return NULL;
|
||||
}
|
||||
dbus->message_iter_get_basic(&sub, &text);
|
||||
|
||||
|
||||
dbus->message_iter_recurse(&sub1, &sub2);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dbus->message_iter_get_basic(&sub2, &struct_id);
|
||||
if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dbus->message_iter_next(&sub2);
|
||||
dbus->message_iter_next(&sub2);
|
||||
|
||||
if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dbus->message_iter_get_basic(&sub2, &text);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
static SDL_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;
|
||||
}
|
||||
|
||||
dbus->message_iter_get_basic(iter, pos);
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data)
|
||||
{
|
||||
SDL_DBusContext *dbus = (SDL_DBusContext *)user_data;
|
||||
|
||||
|
||||
if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) {
|
||||
DBusMessageIter iter;
|
||||
const char *text;
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
|
||||
text = IBus_GetVariantText(conn, &iter, dbus);
|
||||
|
||||
if (text && *text) {
|
||||
char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
||||
size_t text_bytes = SDL_strlen(text), i = 0;
|
||||
|
||||
|
||||
while (i < text_bytes) {
|
||||
size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
|
||||
SDL_SendKeyboardText(buf);
|
||||
|
||||
|
||||
i += sz;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) {
|
||||
DBusMessageIter iter;
|
||||
const char *text;
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
text = IBus_GetVariantText(conn, &iter, dbus);
|
||||
|
||||
|
||||
if (text) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) {
|
||||
Uint32 pos, start_pos, end_pos;
|
||||
SDL_bool has_pos = SDL_FALSE;
|
||||
SDL_bool has_dec_pos = SDL_FALSE;
|
||||
char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
|
||||
size_t text_bytes = SDL_strlen(text), i = 0;
|
||||
size_t cursor = 0;
|
||||
|
||||
do {
|
||||
const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
|
||||
const size_t chars = SDL_utf8strlen(buf);
|
||||
|
||||
SDL_SendEditingText(buf, cursor, chars);
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
has_dec_pos = IBus_GetDecorationPosition(conn, &iter, dbus, &start_pos, &end_pos);
|
||||
if (!has_dec_pos)
|
||||
{
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
has_pos = IBus_GetVariantCursorPos(conn, &iter, dbus, &pos);
|
||||
}
|
||||
|
||||
if(has_dec_pos) {
|
||||
SDL_SendEditingText(text, start_pos, end_pos - start_pos);
|
||||
} else if (has_pos) {
|
||||
SDL_SendEditingText(text, pos, -1);
|
||||
} else {
|
||||
SDL_SendEditingText(text, -1, -1);
|
||||
}
|
||||
} else {
|
||||
char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
|
||||
size_t text_bytes = SDL_strlen(text), i = 0;
|
||||
size_t cursor = 0;
|
||||
|
||||
do {
|
||||
const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
|
||||
const size_t chars = SDL_utf8strlen(buf);
|
||||
|
||||
SDL_SendEditingText(buf, cursor, chars);
|
||||
i += sz;
|
||||
cursor += chars;
|
||||
} while (i < text_bytes);
|
||||
}
|
||||
i += sz;
|
||||
cursor += chars;
|
||||
} while (i < text_bytes);
|
||||
}
|
||||
|
||||
|
||||
SDL_IBus_UpdateTextRect(NULL);
|
||||
|
||||
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) {
|
||||
SDL_SendEditingText("", 0, 0);
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
}
|
||||
|
||||
@@ -614,20 +503,15 @@ SDL_IBus_Reset(void)
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
|
||||
{
|
||||
Uint32 result = 0;
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
|
||||
|
||||
|
||||
if (IBus_CheckConnection(dbus)) {
|
||||
Uint32 mods = IBus_ModState();
|
||||
Uint32 ibus_keycode = keycode - 8;
|
||||
if (state == SDL_RELEASED) {
|
||||
mods |= (1 << 30); // IBUS_RELEASE_MASK
|
||||
}
|
||||
if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent",
|
||||
DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &ibus_keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) {
|
||||
result = 0;
|
||||
}
|
||||
|
2
externals/SDL/src/core/linux/SDL_ibus.h
vendored
2
externals/SDL/src/core/linux/SDL_ibus.h
vendored
@@ -41,7 +41,7 @@ extern void SDL_IBus_Reset(void);
|
||||
/* Sends a keypress event to IBus, returns SDL_TRUE if IBus used this event to
|
||||
update its candidate list or change input methods. PumpEvents should be
|
||||
called some time after this, to recieve the TextInput / TextEditing event back. */
|
||||
extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
|
||||
|
||||
/* 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. */
|
||||
|
6
externals/SDL/src/core/linux/SDL_ime.c
vendored
6
externals/SDL/src/core/linux/SDL_ime.c
vendored
@@ -27,7 +27,7 @@ typedef SDL_bool (*_SDL_IME_Init)(void);
|
||||
typedef void (*_SDL_IME_Quit)(void);
|
||||
typedef void (*_SDL_IME_SetFocus)(SDL_bool);
|
||||
typedef void (*_SDL_IME_Reset)(void);
|
||||
typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32, Uint8 state);
|
||||
typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32);
|
||||
typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *);
|
||||
typedef void (*_SDL_IME_PumpEvents)(void);
|
||||
|
||||
@@ -127,10 +127,10 @@ SDL_IME_Reset(void)
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
|
||||
{
|
||||
if (SDL_IME_ProcessKeyEvent_Real)
|
||||
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state);
|
||||
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode);
|
||||
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
2
externals/SDL/src/core/linux/SDL_ime.h
vendored
2
externals/SDL/src/core/linux/SDL_ime.h
vendored
@@ -31,7 +31,7 @@ extern SDL_bool SDL_IME_Init(void);
|
||||
extern void SDL_IME_Quit(void);
|
||||
extern void SDL_IME_SetFocus(SDL_bool focused);
|
||||
extern void SDL_IME_Reset(void);
|
||||
extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
|
||||
extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
|
||||
extern void SDL_IME_UpdateTextRect(SDL_Rect *rect);
|
||||
extern void SDL_IME_PumpEvents(void);
|
||||
|
||||
|
@@ -394,7 +394,6 @@ typedef struct {
|
||||
unsigned int text_len;
|
||||
keysym_t composebuffer[2];
|
||||
unsigned char composelen;
|
||||
int type;
|
||||
} SDL_WSCONS_input_data;
|
||||
|
||||
static SDL_WSCONS_input_data* inputs[4] = {NULL, NULL, NULL, NULL};
|
||||
@@ -433,7 +432,6 @@ static SDL_WSCONS_input_data* SDL_WSCONS_Init_Keyboard(const char* dev)
|
||||
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETLEDS, &input->ledstate));
|
||||
input->origledstate = input->ledstate;
|
||||
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETENCODING, &input->encoding));
|
||||
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GTYPE, &input->type));
|
||||
#ifdef WSKBDIO_SETVERSION
|
||||
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_SETVERSION, &version));
|
||||
#endif
|
||||
@@ -727,12 +725,7 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (input->type == WSKBD_TYPE_USB && events[i].value <= 0xE7)
|
||||
SDL_SendKeyboardKey(type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)events[i].value);
|
||||
else
|
||||
Translate_to_keycode(input, type, events[i].value);
|
||||
|
||||
Translate_to_keycode(input, type, events[i].value);
|
||||
if (type == WSCONS_EVENT_KEY_UP) continue;
|
||||
|
||||
if (IS_ALTGR_MODE && !IS_CONTROL_HELD)
|
||||
|
29
externals/SDL/src/core/os2/geniconv/geniconv.c
vendored
29
externals/SDL/src/core/os2/geniconv/geniconv.c
vendored
@@ -46,17 +46,17 @@ extern size_t _System os2_iconv (iconv_t cd,
|
||||
char **outbuf, size_t *outbytesleft);
|
||||
extern int _System os2_iconv_close (iconv_t cd);
|
||||
|
||||
/* Functions pointers */
|
||||
/* Functions pointers types */
|
||||
typedef iconv_t (_System *FNICONV_OPEN)(const char*, const char*);
|
||||
typedef size_t (_System *FNICONV) (iconv_t, char **, size_t *, char **, size_t *);
|
||||
typedef int (_System *FNICONV_CLOSE)(iconv_t);
|
||||
|
||||
/* Used DLL module handle */
|
||||
static HMODULE hmIconv = NULLHANDLE;
|
||||
static FNICONV_OPEN fn_iconv_open = os2_iconv_open;
|
||||
static FNICONV fn_iconv = os2_iconv;
|
||||
static FNICONV_CLOSE fn_iconv_close = os2_iconv_close;
|
||||
|
||||
static int geniconv_init = 0;
|
||||
/* Functions pointers */
|
||||
static FNICONV_OPEN fn_iconv_open = NULL;
|
||||
static FNICONV fn_iconv = NULL;
|
||||
static FNICONV_CLOSE fn_iconv_close = NULL;
|
||||
|
||||
|
||||
static BOOL _loadDLL(const char *dllname,
|
||||
@@ -102,12 +102,10 @@ static BOOL _loadDLL(const char *dllname,
|
||||
|
||||
static void _init(void)
|
||||
{
|
||||
if (geniconv_init) {
|
||||
if (fn_iconv_open != NULL) {
|
||||
return; /* Already initialized */
|
||||
}
|
||||
|
||||
geniconv_init = 1;
|
||||
|
||||
/* Try to load kiconv.dll, iconv2.dll or iconv.dll */
|
||||
if (!_loadDLL("KICONV", "_libiconv_open", "_libiconv", "_libiconv_close") &&
|
||||
!_loadDLL("ICONV2", "_libiconv_open", "_libiconv", "_libiconv_close") &&
|
||||
@@ -125,19 +123,16 @@ static void _init(void)
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* function to unload the used iconv dynamic library */
|
||||
/* Non-standard function for iconv to unload the used dynamic library */
|
||||
void libiconv_clean(void)
|
||||
{
|
||||
geniconv_init = 0;
|
||||
|
||||
/* reset the function pointers. */
|
||||
fn_iconv_open = os2_iconv_open;
|
||||
fn_iconv = os2_iconv;
|
||||
fn_iconv_close = os2_iconv_close;
|
||||
|
||||
if (hmIconv != NULLHANDLE) {
|
||||
DosFreeModule(hmIconv);
|
||||
hmIconv = NULLHANDLE;
|
||||
|
||||
fn_iconv_open = NULL;
|
||||
fn_iconv = NULL;
|
||||
fn_iconv_close = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
8
externals/SDL/src/core/windows/SDL_hid.c
vendored
8
externals/SDL/src/core/windows/SDL_hid.c
vendored
@@ -27,6 +27,8 @@
|
||||
|
||||
HidD_GetString_t SDL_HidD_GetManufacturerString;
|
||||
HidD_GetString_t SDL_HidD_GetProductString;
|
||||
HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData;
|
||||
HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData;
|
||||
HidP_GetCaps_t SDL_HidP_GetCaps;
|
||||
HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps;
|
||||
HidP_GetValueCaps_t SDL_HidP_GetValueCaps;
|
||||
@@ -56,13 +58,15 @@ WIN_LoadHIDDLL(void)
|
||||
|
||||
SDL_HidD_GetManufacturerString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetManufacturerString");
|
||||
SDL_HidD_GetProductString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetProductString");
|
||||
SDL_HidD_GetPreparsedData = (HidD_GetPreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_GetPreparsedData");
|
||||
SDL_HidD_FreePreparsedData = (HidD_FreePreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_FreePreparsedData");
|
||||
SDL_HidP_GetCaps = (HidP_GetCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetCaps");
|
||||
SDL_HidP_GetButtonCaps = (HidP_GetButtonCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetButtonCaps");
|
||||
SDL_HidP_GetValueCaps = (HidP_GetValueCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetValueCaps");
|
||||
SDL_HidP_MaxDataListLength = (HidP_MaxDataListLength_t)GetProcAddress(s_pHIDDLL, "HidP_MaxDataListLength");
|
||||
SDL_HidP_GetData = (HidP_GetData_t)GetProcAddress(s_pHIDDLL, "HidP_GetData");
|
||||
if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString ||
|
||||
!SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps ||
|
||||
if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || !SDL_HidD_GetPreparsedData ||
|
||||
!SDL_HidD_FreePreparsedData || !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps ||
|
||||
!SDL_HidP_GetValueCaps || !SDL_HidP_MaxDataListLength || !SDL_HidP_GetData) {
|
||||
WIN_UnloadHIDDLL();
|
||||
return -1;
|
||||
|
4
externals/SDL/src/core/windows/SDL_hid.h
vendored
4
externals/SDL/src/core/windows/SDL_hid.h
vendored
@@ -183,6 +183,8 @@ extern int WIN_LoadHIDDLL(void);
|
||||
extern void WIN_UnloadHIDDLL(void);
|
||||
|
||||
typedef BOOLEAN (WINAPI *HidD_GetString_t)(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength);
|
||||
typedef BOOLEAN (WINAPI *HidD_GetPreparsedData_t)(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData);
|
||||
typedef BOOLEAN (WINAPI *HidD_FreePreparsedData_t)(PHIDP_PREPARSED_DATA PreparsedData);
|
||||
typedef NTSTATUS (WINAPI *HidP_GetCaps_t)(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities);
|
||||
typedef NTSTATUS (WINAPI *HidP_GetButtonCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
|
||||
typedef NTSTATUS (WINAPI *HidP_GetValueCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
|
||||
@@ -191,6 +193,8 @@ typedef NTSTATUS (WINAPI *HidP_GetData_t)(HIDP_REPORT_TYPE ReportType, PHIDP_DAT
|
||||
|
||||
extern HidD_GetString_t SDL_HidD_GetManufacturerString;
|
||||
extern HidD_GetString_t SDL_HidD_GetProductString;
|
||||
extern HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData;
|
||||
extern HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData;
|
||||
extern HidP_GetCaps_t SDL_HidP_GetCaps;
|
||||
extern HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps;
|
||||
extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps;
|
||||
|
73
externals/SDL/src/core/windows/SDL_windows.c
vendored
73
externals/SDL/src/core/windows/SDL_windows.c
vendored
@@ -25,15 +25,7 @@
|
||||
#include "SDL_windows.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
|
||||
#if defined(HAVE_ROAPI_H)
|
||||
#include <roapi.h> /* For RoInitialize/RoUninitialize (Win32 only) */
|
||||
#else
|
||||
typedef enum RO_INIT_TYPE {
|
||||
RO_INIT_SINGLETHREADED = 0,
|
||||
RO_INIT_MULTITHREADED = 1
|
||||
} RO_INIT_TYPE;
|
||||
#endif
|
||||
#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
|
||||
|
||||
#ifndef _WIN32_WINNT_VISTA
|
||||
#define _WIN32_WINNT_VISTA 0x0600
|
||||
@@ -45,10 +37,6 @@ typedef enum RO_INIT_TYPE {
|
||||
#define _WIN32_WINNT_WIN8 0x0602
|
||||
#endif
|
||||
|
||||
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
|
||||
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
|
||||
#endif
|
||||
|
||||
|
||||
/* Sets an error message based on an HRESULT */
|
||||
int
|
||||
@@ -120,65 +108,6 @@ WIN_CoUninitialize(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __WINRT__
|
||||
void *
|
||||
WIN_LoadComBaseFunction(const char *name)
|
||||
{
|
||||
static SDL_bool s_bLoaded;
|
||||
static HMODULE s_hComBase;
|
||||
|
||||
if (!s_bLoaded) {
|
||||
s_hComBase = LoadLibraryEx(TEXT("combase.dll"), NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
s_bLoaded = SDL_TRUE;
|
||||
}
|
||||
if (s_hComBase) {
|
||||
return GetProcAddress(s_hComBase, name);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT
|
||||
WIN_RoInitialize(void)
|
||||
{
|
||||
#ifdef __WINRT__
|
||||
return S_OK;
|
||||
#else
|
||||
typedef HRESULT (WINAPI *RoInitialize_t)(RO_INIT_TYPE initType);
|
||||
RoInitialize_t RoInitializeFunc = (RoInitialize_t)WIN_LoadComBaseFunction("RoInitialize");
|
||||
if (RoInitializeFunc) {
|
||||
/* RO_INIT_SINGLETHREADED is equivalent to COINIT_APARTMENTTHREADED */
|
||||
HRESULT hr = RoInitializeFunc(RO_INIT_SINGLETHREADED);
|
||||
if (hr == RPC_E_CHANGED_MODE) {
|
||||
hr = RoInitializeFunc(RO_INIT_MULTITHREADED);
|
||||
}
|
||||
|
||||
/* S_FALSE means success, but someone else already initialized. */
|
||||
/* You still need to call RoUninitialize in this case! */
|
||||
if (hr == S_FALSE) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return hr;
|
||||
} else {
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
WIN_RoUninitialize(void)
|
||||
{
|
||||
#ifndef __WINRT__
|
||||
typedef void (WINAPI *RoUninitialize_t)(void);
|
||||
RoUninitialize_t RoUninitializeFunc = (RoUninitialize_t)WIN_LoadComBaseFunction("RoUninitialize");
|
||||
if (RoUninitializeFunc) {
|
||||
RoUninitializeFunc();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __WINRT__
|
||||
static BOOL
|
||||
IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
|
||||
|
15
externals/SDL/src/core/windows/SDL_windows.h
vendored
15
externals/SDL/src/core/windows/SDL_windows.h
vendored
@@ -30,14 +30,8 @@
|
||||
#ifndef UNICODE
|
||||
#define UNICODE 1
|
||||
#endif
|
||||
#undef WINVER
|
||||
#define WINVER 0x0501
|
||||
#undef _WIN32_WINNT
|
||||
#if !defined(SDL_VIDEO_RENDER_D3D12)
|
||||
#define _WIN32_WINNT 0x501 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */
|
||||
#else
|
||||
#define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
@@ -69,19 +63,10 @@ extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
|
||||
/* Sets an error message based on GetLastError(). Always return -1. */
|
||||
extern int WIN_SetError(const char *prefix);
|
||||
|
||||
#if !defined(__WINRT__)
|
||||
/* Load a function from combase.dll */
|
||||
void *WIN_LoadComBaseFunction(const char *name);
|
||||
#endif
|
||||
|
||||
/* Wrap up the oddities of CoInitialize() into a common function. */
|
||||
extern HRESULT WIN_CoInitialize(void);
|
||||
extern void WIN_CoUninitialize(void);
|
||||
|
||||
/* Wrap up the oddities of RoInitialize() into a common function. */
|
||||
extern HRESULT WIN_RoInitialize(void);
|
||||
extern void WIN_RoUninitialize(void);
|
||||
|
||||
/* Returns SDL_TRUE if we're running on Windows Vista and newer */
|
||||
extern BOOL WIN_IsWindowsVistaOrGreater(void);
|
||||
|
||||
|
3
externals/SDL/src/core/windows/SDL_xinput.c
vendored
3
externals/SDL/src/core/windows/SDL_xinput.c
vendored
@@ -23,6 +23,8 @@
|
||||
#include "SDL_xinput.h"
|
||||
|
||||
|
||||
#ifdef HAVE_XINPUT_H
|
||||
|
||||
XInputGetState_t SDL_XInputGetState = NULL;
|
||||
XInputSetState_t SDL_XInputSetState = NULL;
|
||||
XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL;
|
||||
@@ -135,5 +137,6 @@ WIN_UnloadXInputDLL(void)
|
||||
}
|
||||
|
||||
#endif /* __WINRT__ */
|
||||
#endif /* HAVE_XINPUT_H */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
84
externals/SDL/src/core/windows/SDL_xinput.h
vendored
84
externals/SDL/src/core/windows/SDL_xinput.h
vendored
@@ -23,11 +23,10 @@
|
||||
#ifndef SDL_xinput_h_
|
||||
#define SDL_xinput_h_
|
||||
|
||||
#include "SDL_windows.h"
|
||||
|
||||
#ifdef HAVE_XINPUT_H
|
||||
|
||||
#include "SDL_windows.h"
|
||||
#include <xinput.h>
|
||||
#endif /* HAVE_XINPUT_H */
|
||||
|
||||
#ifndef XUSER_MAX_COUNT
|
||||
#define XUSER_MAX_COUNT 4
|
||||
@@ -73,53 +72,6 @@
|
||||
#define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13
|
||||
#endif
|
||||
|
||||
#ifndef XINPUT_FLAG_GAMEPAD
|
||||
#define XINPUT_FLAG_GAMEPAD 0x01
|
||||
#endif
|
||||
|
||||
#ifndef XINPUT_GAMEPAD_DPAD_UP
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_DPAD_DOWN
|
||||
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_DPAD_LEFT
|
||||
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_DPAD_RIGHT
|
||||
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_START
|
||||
#define XINPUT_GAMEPAD_START 0x0010
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_BACK
|
||||
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_LEFT_THUMB
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_RIGHT_THUMB
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_LEFT_SHOULDER
|
||||
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_RIGHT_SHOULDER
|
||||
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_A
|
||||
#define XINPUT_GAMEPAD_A 0x1000
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_B
|
||||
#define XINPUT_GAMEPAD_B 0x2000
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_X
|
||||
#define XINPUT_GAMEPAD_X 0x4000
|
||||
#endif
|
||||
#ifndef XINPUT_GAMEPAD_Y
|
||||
#define XINPUT_GAMEPAD_Y 0x8000
|
||||
#endif
|
||||
|
||||
#ifndef XINPUT_GAMEPAD_GUIDE
|
||||
#define XINPUT_GAMEPAD_GUIDE 0x0400
|
||||
#endif
|
||||
@@ -177,36 +129,6 @@ typedef struct
|
||||
BYTE BatteryLevel;
|
||||
} XINPUT_BATTERY_INFORMATION_EX;
|
||||
|
||||
#ifndef HAVE_XINPUT_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD wButtons;
|
||||
BYTE bLeftTrigger;
|
||||
BYTE bRightTrigger;
|
||||
SHORT sThumbLX;
|
||||
SHORT sThumbLY;
|
||||
SHORT sThumbRX;
|
||||
SHORT sThumbRY;
|
||||
} XINPUT_GAMEPAD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD wLeftMotorSpeed;
|
||||
WORD wRightMotorSpeed;
|
||||
} XINPUT_VIBRATION;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE Type;
|
||||
BYTE SubType;
|
||||
WORD Flags;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
XINPUT_VIBRATION Vibration;
|
||||
} XINPUT_CAPABILITIES;
|
||||
|
||||
#endif /* HAVE_XINPUT_H */
|
||||
|
||||
/* Forward decl's for XInput API's we load dynamically and use if available */
|
||||
typedef DWORD (WINAPI *XInputGetState_t)
|
||||
(
|
||||
@@ -248,6 +170,8 @@ extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
|
||||
#define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities
|
||||
#define XINPUTGETBATTERYINFORMATION SDL_XInputGetBatteryInformation
|
||||
|
||||
#endif /* HAVE_XINPUT_H */
|
||||
|
||||
#endif /* SDL_xinput_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
@@ -115,7 +115,7 @@ SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAs
|
||||
|
||||
// Make sure we have a valid XAML element (to draw onto):
|
||||
if ( ! backgroundPanelAsIInspectable) {
|
||||
return SDL_InvalidParamError("backgroundPanelAsIInspectable");
|
||||
return SDL_SetError("'backgroundPanelAsIInspectable' can't be NULL");
|
||||
}
|
||||
|
||||
Platform::Object ^ backgroundPanel = reinterpret_cast<Object ^>((IInspectable *) backgroundPanelAsIInspectable);
|
||||
|
Reference in New Issue
Block a user