summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-12-21 10:03:54 +0000
committersabetts <sabetts>2001-12-21 10:03:54 +0000
commitd3fa9b288a8113cec4fbcc45c2a6f8df9ea7f7ef (patch)
tree65249ab131cf8444f30755459578631ba8033b02 /src/main.c
parenta43d89a4ac9080ba0fe48d574e604260413ef2f9 (diff)
downloadratpoison-d3fa9b288a8113cec4fbcc45c2a6f8df9ea7f7ef.zip
* src/data.h (rp_error_msg): new global extern
* src/main.c (rp_error_msg): new global variable * src/events.c (get_event): If there is an X11 error message to print, print it. * src/main.c (handler): record the error in rp_error_msg
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 9671399..b25a163 100644
--- a/src/main.c
+++ b/src/main.c
@@ -77,6 +77,8 @@ int rp_honour_normal_raise = 1;
int rp_honour_transient_map = 1;
int rp_honour_normal_map = 1;
+char *rp_error_msg = NULL;
+
/* Command line options */
static struct option ratpoison_longopts[] =
{ {"help", no_argument, 0, 'h'},
@@ -152,14 +154,15 @@ handler (Display *d, XErrorEvent *e)
if (ignore_badwindow && e->error_code == BadWindow) return 0;
- strcpy (error_msg, "ERROR: ");
-
XGetErrorText (d, e->error_code, error_msg + 7, sizeof (error_msg) - 7);
- fprintf (stderr, "ratpoison: %s!\n", error_msg);
+ fprintf (stderr, "ratpoison: ERROR: %s!\n", error_msg);
- // marked_message (error_msg, 0, strlen (error_msg));
+ /* If there is already an error to report, replace it with this new
+ one. */
+ if (rp_error_msg)
+ free (rp_error_msg);
+ rp_error_msg = xstrdup (error_msg);
-/* exit (EXIT_FAILURE); */
return 0;
}