summaryrefslogtreecommitdiffstats
path: root/uisimulator/x11
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-03-19 00:46:42 +0000
committerJens Arnold <amiconn@rockbox.org>2005-03-19 00:46:42 +0000
commit3b8dcf5ebbc1e8f53ff17eb769e553cf01a63655 (patch)
tree6dc379a5fea379995dbb57063da8265fff0b2b31 /uisimulator/x11
parent74b731edc6e0495d43a37412c60cd23a24789679 (diff)
downloadrockbox-3b8dcf5ebbc1e8f53ff17eb769e553cf01a63655.tar.gz
rockbox-3b8dcf5ebbc1e8f53ff17eb769e553cf01a63655.tar.bz2
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.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)
static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW;
-void kb_disable_auto_repeat(bool on)
+static void kb_disable_auto_repeat(bool on)
{
XKeyboardControl kb;
@@ -249,6 +249,12 @@ void kb_disable_auto_repeat(bool on)
XChangeKeyboardControl(dpy, KBAutoRepeatMode, &kb);
}
+static void kb_restore_auto_repeat(void) /* registered as an exit handler */
+{
+ kb_disable_auto_repeat(false);
+ XSync(dpy, false); /* force the X server to process that */
+}
+
/* Dead-trivial event handling.
Exit if the WM_PROTOCOLS WM_DELETE_WINDOW ClientMessage is received.
*/
@@ -312,8 +318,6 @@ int screenhack_handle_event(XEvent *event, bool *release)
progname, s1, s2);
}
else {
- kb_disable_auto_repeat(false);
- XSync(dpy, false); /* force the X server to process that */
exit (0);
}
break;
@@ -569,6 +573,7 @@ int main (int argc, char **argv)
XSync (dpy, False);
+ atexit(kb_restore_auto_repeat);
kb_disable_auto_repeat(true);
screenhack(); /* doesn't return */
return 0;