Linux: Added library unload destructor that resets keyboard repeat mode

This commit is contained in:
Elias Naur 2005-06-28 15:19:32 +00:00
parent 839306597b
commit ce673390d3
1 changed files with 5 additions and 1 deletions

View File

@ -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;