diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-03-19 00:46:42 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-03-19 00:46:42 +0000 |
commit | 3b8dcf5ebbc1e8f53ff17eb769e553cf01a63655 (patch) | |
tree | 6dc379a5fea379995dbb57063da8265fff0b2b31 /uisimulator/x11 | |
parent | 74b731edc6e0495d43a37412c60cd23a24789679 (diff) | |
download | rockbox-3b8dcf5ebbc1e8f53ff17eb769e553cf01a63655.tar.gz rockbox-3b8dcf5ebbc1e8f53ff17eb769e553cf01a63655.zip |
X11 simulator: Always restore the x11 button autorepeat setting, regardless at which point exit() is called.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6216 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11')
-rw-r--r-- | uisimulator/x11/screenhack.c | 11 |
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) | |||
241 | static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW; | 241 | static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW; |
242 | 242 | ||
243 | 243 | ||
244 | void kb_disable_auto_repeat(bool on) | 244 | static 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 | ||
252 | static 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; |