summaryrefslogtreecommitdiff
path: root/src/events.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/events.c')
-rw-r--r--src/events.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/events.c b/src/events.c
index a207de7..5921244 100644
--- a/src/events.c
+++ b/src/events.c
@@ -886,6 +886,20 @@ handle_signals ()
chld_signalled = 0;
}
+ if (rp_exec_newwm)
+ {
+ PRINT_DEBUG (("Switching to %s\n", rp_exec_newwm));
+
+ putenv(current_screen()->display_string);
+ execlp(rp_exec_newwm, rp_exec_newwm, 0);
+
+ /* Failed. Clean up. */
+ PRINT_ERROR (("exec %s ", rp_exec_newwm));
+ perror(" failed");
+ free (rp_exec_newwm);
+ rp_exec_newwm = NULL;
+ }
+
if (hup_signalled > 0)
{
PRINT_DEBUG (("Restarting\n"));
@@ -901,6 +915,14 @@ handle_signals ()
clean_up ();
exit (EXIT_SUCCESS);
}
+
+ /* Report any X11 errors that have occurred. */
+ if (rp_error_msg)
+ {
+ marked_message_printf (0, 6, "ERROR: %s", rp_error_msg);
+ free (rp_error_msg);
+ rp_error_msg = NULL;
+ }
}
/* The main loop. */
@@ -918,14 +940,6 @@ listen_for_events ()
{
handle_signals ();
- /* Report any X11 errors that have occurred. */
- if (rp_error_msg)
- {
- marked_message_printf (0, 6, "ERROR: %s", rp_error_msg);
- free (rp_error_msg);
- rp_error_msg = NULL;
- }
-
/* Handle the next event. */
FD_SET (x_fd, &fds);
XFlush(dpy);
@@ -935,6 +949,7 @@ listen_for_events ()
{
XNextEvent (dpy, &rp_current_event);
delegate_event (&rp_current_event);
+ XSync(dpy, False);
}
}
}