/* X Selection processing for Emacs.
- Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000 Free Software Foundation.
This file is part of GNU Emacs.
It is set to zero when the request is fully processed. */
static struct input_event *x_selection_current_request;
+/* Display info in x_selection_request. */
+
+static struct x_display_info *selection_request_dpyinfo;
+
/* Used as an unwind-protect clause so that, if a selection-converter signals
an error, we tell the requester that we were unable to do what they wanted
before we throw to top-level or go into the debugger or whatever. */
x_selection_request_lisp_error (ignore)
Lisp_Object ignore;
{
- if (x_selection_current_request != 0)
+ if (x_selection_current_request != 0
+ && selection_request_dpyinfo->display)
x_decline_selection_request (x_selection_current_request);
return Qnil;
}
PropModeReplace, data, 0);
}
+ /* The window we're communicating with may have been deleted
+ in the meantime (that's a real situation from a bug report).
+ In this case, there may be events in the event queue still
+ refering to the deleted window, and we'll get a BadWindow error
+ in XTread_socket when processing the events. I don't have
+ an idea how to fix that. gerd, 2001-01-98. */
XFlush (display);
x_uncatch_errors (display, count);
UNBLOCK_INPUT;
goto DONE;
}
- count = specpdl_ptr - specpdl;
x_selection_current_request = event;
+ count = BINDING_STACK_SIZE ();
+ selection_request_dpyinfo = dpyinfo;
record_unwind_protect (x_selection_request_lisp_error, Qnil);
target_symbol = x_atom_to_symbol (dpyinfo, SELECTION_EVENT_DISPLAY (event),
for (; CONSP (rest); rest = Fcdr (rest))
call1 (Fcar (rest), selection_symbol);
prepare_menu_bars ();
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (20);
}
}
}
#if 0 /* This can crash when deleting a frame
from x_connection_closed. Anyway, it seems unnecessary;
something else should cause a redisplay. */
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (21);
#endif
}
for (; CONSP (hooks); hooks = Fcdr (hooks))
call1 (Fcar (hooks), selection_symbol);
#if 0 /* See above */
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (22);
#endif
}
XCDR (rest) = Fcdr (XCDR (rest));