Minor linux keyboard input fixes
This commit is contained in:
parent
2040638c26
commit
22de5b7660
|
@ -143,30 +143,27 @@ static void putKeyboardEvent(jint keycode, jint state, jint ch) {
|
||||||
putEvent(&event_queue, event_list);
|
putEvent(&event_queue, event_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int translateEvent(XKeyEvent *event, jint keycode, jint state) {
|
static void translateEvent(XKeyEvent *event, jint keycode, jint state) {
|
||||||
static char temp_translation_buffer[KEYBOARD_BUFFER_SIZE];
|
|
||||||
static XComposeStatus status;
|
static XComposeStatus status;
|
||||||
|
char temp_translation_buffer[KEYBOARD_BUFFER_SIZE];
|
||||||
int num_chars, i;
|
int num_chars, i;
|
||||||
jint ch;
|
jint ch;
|
||||||
|
|
||||||
if (!translation_enabled || event->type == KeyRelease) {
|
if (!translation_enabled || event->type == KeyRelease) {
|
||||||
putKeyboardEvent(keycode, state, 0);
|
putKeyboardEvent(keycode, state, 0);
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
num_chars = XLookupString(event, temp_translation_buffer, KEYBOARD_BUFFER_SIZE, NULL, &status);
|
num_chars = XLookupString(event, temp_translation_buffer, KEYBOARD_BUFFER_SIZE, NULL, &status);
|
||||||
if (num_chars > 0) {
|
if (num_chars > 0) {
|
||||||
num_chars--;
|
ch = ((jint)temp_translation_buffer[0]) & 0xFF;
|
||||||
/* Assume little endian byte order */
|
|
||||||
ch = (jint)temp_translation_buffer[0] & 0xFF;
|
|
||||||
putKeyboardEvent(keycode, state, ch);
|
putKeyboardEvent(keycode, state, ch);
|
||||||
for (i = 0; i < num_chars; i++) {
|
for (i = 1; i < num_chars; i++) {
|
||||||
ch = ((jint)temp_translation_buffer[i + 1]) & 0xFF;
|
ch = ((jint)temp_translation_buffer[i]) & 0xFF;
|
||||||
putKeyboardEvent(0, 0, ch);
|
putKeyboardEvent(0, 0, ch);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
putKeyboardEvent(keycode, state, 0);
|
putKeyboardEvent(keycode, state, 0);
|
||||||
}
|
}
|
||||||
return num_chars;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char eventState(XKeyEvent *event) {
|
static unsigned char eventState(XKeyEvent *event) {
|
||||||
|
|
Loading…
Reference in New Issue