Removed SDL_TEXTINPUTEVENT_TEXT_SIZE
parent
fa236f169b
commit
6443c75eda
|
@ -317,7 +317,7 @@ The timestamp_us member of the sensor events has been renamed sensor_timestamp a
|
||||||
|
|
||||||
You should set the event.common.timestamp field before passing an event to SDL_PushEvent(). If the timestamp is 0 it will be filled in with SDL_GetTicksNS().
|
You should set the event.common.timestamp field before passing an event to SDL_PushEvent(). If the timestamp is 0 it will be filled in with SDL_GetTicksNS().
|
||||||
|
|
||||||
Event memory is now managed by SDL, so you should not free the data in SDL_EVENT_DROP_FILE, and if you want to hold onto the text in SDL_EVENT_TEXT_EDITING and SDL_EVENT_TEXT_INPUT events, you should make a copy of it.
|
Event memory is now managed by SDL, so you should not free the data in SDL_EVENT_DROP_FILE, and if you want to hold onto the text in SDL_EVENT_TEXT_EDITING and SDL_EVENT_TEXT_INPUT events, you should make a copy of it. SDL_TEXTINPUTEVENT_TEXT_SIZE is no longer necessary and has been removed.
|
||||||
|
|
||||||
Mouse events use floating point values for mouse coordinates and relative motion values. You can get sub-pixel motion depending on the platform and display scaling.
|
Mouse events use floating point values for mouse coordinates and relative motion values. You can get sub-pixel motion depending on the platform and display scaling.
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,6 @@ typedef struct SDL_TextEditingEvent
|
||||||
Sint32 length; /**< The length of selected editing text */
|
Sint32 length; /**< The length of selected editing text */
|
||||||
} SDL_TextEditingEvent;
|
} SDL_TextEditingEvent;
|
||||||
|
|
||||||
#define SDL_TEXTINPUTEVENT_TEXT_SIZE 64
|
|
||||||
/**
|
/**
|
||||||
* Keyboard text input event structure (event.text.*)
|
* Keyboard text input event structure (event.text.*)
|
||||||
*
|
*
|
||||||
|
|
|
@ -310,7 +310,7 @@ class SDL_BLooper : public BLooper
|
||||||
const int8 *keyUtf8;
|
const int8 *keyUtf8;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
|
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
|
||||||
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
char text[64];
|
||||||
SDL_zeroa(text);
|
SDL_zeroa(text);
|
||||||
SDL_memcpy(text, keyUtf8, count);
|
SDL_memcpy(text, keyUtf8, count);
|
||||||
SDL_SendKeyboardText(text);
|
SDL_SendKeyboardText(text);
|
||||||
|
|
|
@ -191,17 +191,7 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m
|
||||||
dbus->message_iter_init(msg, &iter);
|
dbus->message_iter_init(msg, &iter);
|
||||||
dbus->message_iter_get_basic(&iter, &text);
|
dbus->message_iter_get_basic(&iter, &text);
|
||||||
|
|
||||||
if (text && *text) {
|
SDL_SendKeyboardText(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;
|
return DBUS_HANDLER_RESULT_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,17 +228,7 @@ static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *
|
||||||
dbus->message_iter_init(msg, &iter);
|
dbus->message_iter_init(msg, &iter);
|
||||||
text = IBus_GetVariantText(conn, &iter, dbus);
|
text = IBus_GetVariantText(conn, &iter, dbus);
|
||||||
|
|
||||||
if (text && *text) {
|
SDL_SendKeyboardText(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;
|
return DBUS_HANDLER_RESULT_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1184,6 +1184,10 @@ int SDL_SendKeyboardText(const char *text)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!text || !*text) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't post text events for unprintable characters */
|
/* Don't post text events for unprintable characters */
|
||||||
if (SDL_iscntrl((unsigned char)*text)) {
|
if (SDL_iscntrl((unsigned char)*text)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1218,6 +1222,10 @@ int SDL_SendEditingText(const char *text, int start, int length)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_EVENT_TEXT_EDITING)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_EDITING)) {
|
||||||
|
|
|
@ -2320,17 +2320,7 @@ static void text_input_commit_string(void *data,
|
||||||
struct zwp_text_input_v3 *zwp_text_input_v3,
|
struct zwp_text_input_v3 *zwp_text_input_v3,
|
||||||
const char *text)
|
const char *text)
|
||||||
{
|
{
|
||||||
if (text && *text) {
|
SDL_SendKeyboardText(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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void text_input_delete_surrounding_text(void *data,
|
static void text_input_delete_surrounding_text(void *data,
|
||||||
|
|
|
@ -838,7 +838,7 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
|
||||||
Display *display = videodata->display;
|
Display *display = videodata->display;
|
||||||
KeyCode keycode = xevent->xkey.keycode;
|
KeyCode keycode = xevent->xkey.keycode;
|
||||||
KeySym keysym = NoSymbol;
|
KeySym keysym = NoSymbol;
|
||||||
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
char text[64];
|
||||||
Status status = 0;
|
Status status = 0;
|
||||||
SDL_bool handled_by_ime = SDL_FALSE;
|
SDL_bool handled_by_ime = SDL_FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue