From ce673390d3dcaf5b3112171d0b154495e0c4bd8f Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 28 Jun 2005 15:19:32 +0000 Subject: [PATCH] Linux: Added library unload destructor that resets keyboard repeat mode --- src/native/linux/org_lwjgl_opengl_Display.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/native/linux/org_lwjgl_opengl_Display.c b/src/native/linux/org_lwjgl_opengl_Display.c index 5f533229..91905b30 100644 --- a/src/native/linux/org_lwjgl_opengl_Display.c +++ b/src/native/linux/org_lwjgl_opengl_Display.c @@ -163,7 +163,7 @@ static void setRepeatMode(JNIEnv *env, int mode) { XKeyboardControl repeat_mode; repeat_mode.auto_repeat_mode = mode; Display *disp = XOpenDisplay(NULL); - if (disp == NULL) { + if (disp == NULL && env != NULL) { printfDebugJava(env, "Could not open display to set repeat mode"); return; } @@ -171,6 +171,10 @@ static void setRepeatMode(JNIEnv *env, int mode) { XCloseDisplay(disp); } +void __attribute__ ((destructor)) my_fini(void) { + setRepeatMode(NULL, AutoRepeatModeDefault); +} + static void setDecorations(int dec) { Atom motif_hints_atom = XInternAtom(getDisplay(), "_MOTIF_WM_HINTS", False); MotifWmHints motif_hints;