Disable linux key repeat while Keyboard is created - match win32 behavior

This commit is contained in:
Elias Naur 2003-03-08 18:47:34 +00:00
parent c6c2cdcafc
commit 374334e7d3
1 changed files with 7 additions and 0 deletions

View File

@ -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
* Method: nCreate
@ -159,6 +164,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nCreate
memset(key_buf, 0, KEYBOARD_SIZE*sizeof(unsigned char));
created = true;
setRepeatMode(AutoRepeatModeOff);
return JNI_TRUE;
}
@ -173,6 +179,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy
if (keyboard_grabbed)
ungrabKeyboard();
created = false;
setRepeatMode(AutoRepeatModeDefault);
}
static XKeyEvent *nextEventElement(void) {