/* Check and report errors with the above calls. */
x_check_errors (dpy, "can't set cursor shape: %s");
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
{
XColor fore_color, back_color;
/* Child of win. */
&child);
error_p = x_had_errors_p (FRAME_X_DISPLAY (f));
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
if (! error_p)
{
x_catch_errors (display);
XSetSelectionOwner (display, selection_atom, selecting_window, timestamp);
x_check_errors (display, "Can't set selection: %s");
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
unblock_input ();
/* Now update the local cache */
XConvertSelection (display, selection_atom, type_atom, target_property,
requestor_window, requestor_time);
x_check_errors (display, "Can't convert selection: %s");
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
/* Prepare to block until the reply has been read. */
reading_selection_window = requestor_window;
x_catch_errors (dpy);
name = atom ? XGetAtomName (dpy, atom) : empty;
had_errors_p = x_had_errors_p (dpy);
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
if (!had_errors_p)
ret = build_string (name);
if (x_had_errors_p (FRAME_X_DISPLAY (*fp)))
f1 = 0;
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
/* If not, is it one of our scroll bars? */
if (! f1)
Calling x_check_errors signals an Emacs error if an X error has
occurred since the last call to x_catch_errors or x_check_errors.
- Calling x_uncatch_errors resumes the normal error handling. */
+ Calling x_uncatch_errors resumes the normal error handling.
+ Calling x_uncatch_errors_after_check is similar, but skips an XSync
+ to the server, and should be used only immediately after
+ x_had_errors_p or x_check_errors. */
void
x_catch_errors (Display *dpy)
x_error_message = data;
}
+/* Undo the last x_catch_errors call.
+ DPY should be the display that was passed to x_catch_errors.
+
+ This version should be used only if the immediately preceding
+ X-protocol-related thing was x_check_errors or x_had_error_p, both
+ of which issue XSync calls, so we don't need to re-sync here. */
+
+void
+x_uncatch_errors_after_check (void)
+{
+ struct x_error_message_stack *tmp;
+
+ block_input ();
+ tmp = x_error_message;
+ x_error_message = x_error_message->prev;
+ xfree (tmp);
+ unblock_input ();
+}
+
/* Undo the last x_catch_errors call.
DPY should be the display that was passed to x_catch_errors. */
XSelectInput (dpy, wmcheck_window, StructureNotifyMask);
if (x_had_errors_p (dpy))
{
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
unblock_input ();
return false;
}
ATTRIBUTE_FORMAT_PRINTF (2, 0);
extern bool x_had_errors_p (Display *);
extern void x_uncatch_errors (void);
+extern void x_uncatch_errors_after_check (void);
extern void x_clear_errors (Display *);
extern void xembed_request_focus (struct frame *);
extern void x_ewmh_activate_frame (struct frame *);