summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/x11/screenhack.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/uisimulator/x11/screenhack.c b/uisimulator/x11/screenhack.c
index d8731e4125..fb0f5637e5 100644
--- a/uisimulator/x11/screenhack.c
+++ b/uisimulator/x11/screenhack.c
@@ -241,7 +241,7 @@ static Bool MapNotify_event_p (Display *dpy, XEvent *event, XPointer window)
241static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW; 241static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW;
242 242
243 243
244void kb_disable_auto_repeat(bool on) 244static void kb_disable_auto_repeat(bool on)
245{ 245{
246 XKeyboardControl kb; 246 XKeyboardControl kb;
247 247
@@ -249,6 +249,12 @@ void kb_disable_auto_repeat(bool on)
249 XChangeKeyboardControl(dpy, KBAutoRepeatMode, &kb); 249 XChangeKeyboardControl(dpy, KBAutoRepeatMode, &kb);
250} 250}
251 251
252static void kb_restore_auto_repeat(void) /* registered as an exit handler */
253{
254 kb_disable_auto_repeat(false);
255 XSync(dpy, false); /* force the X server to process that */
256}
257
252/* Dead-trivial event handling. 258/* Dead-trivial event handling.
253 Exit if the WM_PROTOCOLS WM_DELETE_WINDOW ClientMessage is received. 259 Exit if the WM_PROTOCOLS WM_DELETE_WINDOW ClientMessage is received.
254 */ 260 */
@@ -312,8 +318,6 @@ int screenhack_handle_event(XEvent *event, bool *release)
312 progname, s1, s2); 318 progname, s1, s2);
313 } 319 }
314 else { 320 else {
315 kb_disable_auto_repeat(false);
316 XSync(dpy, false); /* force the X server to process that */
317 exit (0); 321 exit (0);
318 } 322 }
319 break; 323 break;
@@ -569,6 +573,7 @@ int main (int argc, char **argv)
569 573
570 XSync (dpy, False); 574 XSync (dpy, False);
571 575
576 atexit(kb_restore_auto_repeat);
572 kb_disable_auto_repeat(true); 577 kb_disable_auto_repeat(true);
573 screenhack(); /* doesn't return */ 578 screenhack(); /* doesn't return */
574 return 0; 579 return 0;