Disable linux key repeat while Keyboard is created - match win32 behavior
This commit is contained in:
parent
c6c2cdcafc
commit
374334e7d3
|
@ -123,6 +123,11 @@ static void updateGrab(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setRepeatMode(int mode) {
|
||||||
|
XKeyboardControl repeat_mode;
|
||||||
|
repeat_mode.auto_repeat_mode = mode;
|
||||||
|
XChangeKeyboardControl(disp, KBAutoRepeatMode, &repeat_mode);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_input_Keyboard
|
* Class: org_lwjgl_input_Keyboard
|
||||||
* Method: nCreate
|
* Method: nCreate
|
||||||
|
@ -159,6 +164,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nCreate
|
||||||
|
|
||||||
memset(key_buf, 0, KEYBOARD_SIZE*sizeof(unsigned char));
|
memset(key_buf, 0, KEYBOARD_SIZE*sizeof(unsigned char));
|
||||||
created = true;
|
created = true;
|
||||||
|
setRepeatMode(AutoRepeatModeOff);
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +179,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy
|
||||||
if (keyboard_grabbed)
|
if (keyboard_grabbed)
|
||||||
ungrabKeyboard();
|
ungrabKeyboard();
|
||||||
created = false;
|
created = false;
|
||||||
|
setRepeatMode(AutoRepeatModeDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
static XKeyEvent *nextEventElement(void) {
|
static XKeyEvent *nextEventElement(void) {
|
||||||
|
|
Loading…
Reference in New Issue