summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--src/data.h3
-rw-r--r--src/events.c8
-rw-r--r--src/main.c13
4 files changed, 30 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 7dbbfe6..f859f64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-12-21 shawn <sabetts@vcn.bc.ca>
+
+ * 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
+
2001-12-20 shawn <sabetts@vcn.bc.ca>
* src/manage.c (maximize_transient): always honour the current
diff --git a/src/data.h b/src/data.h
index b427810..fed8992 100644
--- a/src/data.h
+++ b/src/data.h
@@ -252,4 +252,7 @@ extern int rp_honour_normal_raise;
extern int rp_honour_transient_map;
extern int rp_honour_normal_map;
+/* Keep track of X11 error messages. */
+extern char *rp_error_msg;
+
#endif /* _RATPOISON_DATA_H */
diff --git a/src/events.c b/src/events.c
index acc936f..4c4a5f3 100644
--- a/src/events.c
+++ b/src/events.c
@@ -816,6 +816,14 @@ get_event (XEvent *ev)
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;
+ }
+
/* Is there anything in the event qeue? */
if (QLength (dpy) > 0)
{
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;
}