Handle errors sending selection decline events asynchronously
* src/xselect.c (x_decline_selection_request): Handle errors asynchronously. * src/xterm.c (x_ignore_errors_for_next_request) (x_stop_ignoring_errors): Export functions. * src/xterm.h: Update prototypes.
This commit is contained in:
parent
b283e36cf1
commit
d9464d7fe5
3 changed files with 21 additions and 10 deletions
|
@ -437,10 +437,19 @@ static void
|
|||
x_decline_selection_request (struct selection_input_event *event)
|
||||
{
|
||||
XEvent reply_base;
|
||||
XSelectionEvent *reply = &(reply_base.xselection);
|
||||
XSelectionEvent *reply;
|
||||
Display *dpy;
|
||||
struct x_display_info *dpyinfo;
|
||||
|
||||
reply = &(reply_base.xselection);
|
||||
dpy = SELECTION_EVENT_DISPLAY (event);
|
||||
dpyinfo = x_display_info_for_display (dpy);
|
||||
|
||||
if (!dpyinfo)
|
||||
return;
|
||||
|
||||
reply->type = SelectionNotify;
|
||||
reply->display = SELECTION_EVENT_DISPLAY (event);
|
||||
reply->display = dpy;
|
||||
reply->requestor = SELECTION_EVENT_REQUESTOR (event);
|
||||
reply->selection = SELECTION_EVENT_SELECTION (event);
|
||||
reply->time = SELECTION_EVENT_TIME (event);
|
||||
|
@ -450,10 +459,12 @@ x_decline_selection_request (struct selection_input_event *event)
|
|||
/* The reason for the error may be that the receiver has
|
||||
died in the meantime. Handle that case. */
|
||||
block_input ();
|
||||
x_catch_errors (reply->display);
|
||||
XSendEvent (reply->display, reply->requestor, False, 0, &reply_base);
|
||||
XFlush (reply->display);
|
||||
x_uncatch_errors ();
|
||||
x_ignore_errors_for_next_request (dpyinfo);
|
||||
XSendEvent (dpyinfo->display, reply->requestor,
|
||||
False, 0, &reply_base);
|
||||
x_stop_ignoring_errors (dpyinfo);
|
||||
|
||||
XFlush (dpyinfo->display);
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1121,8 +1121,6 @@ static void x_scroll_bar_end_update (struct x_display_info *, struct scroll_bar
|
|||
#ifdef HAVE_X_I18N
|
||||
static int x_filter_event (struct x_display_info *, XEvent *);
|
||||
#endif
|
||||
static void x_ignore_errors_for_next_request (struct x_display_info *);
|
||||
static void x_stop_ignoring_errors (struct x_display_info *);
|
||||
static void x_clean_failable_requests (struct x_display_info *);
|
||||
|
||||
static struct frame *x_tooltip_window_to_frame (struct x_display_info *,
|
||||
|
@ -23039,7 +23037,7 @@ x_clean_failable_requests (struct x_display_info *dpyinfo)
|
|||
+ (last - first));
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
x_ignore_errors_for_next_request (struct x_display_info *dpyinfo)
|
||||
{
|
||||
struct x_failable_request *request, *max;
|
||||
|
@ -23092,7 +23090,7 @@ x_ignore_errors_for_next_request (struct x_display_info *dpyinfo)
|
|||
dpyinfo->next_failable_request++;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
x_stop_ignoring_errors (struct x_display_info *dpyinfo)
|
||||
{
|
||||
struct x_failable_request *range;
|
||||
|
|
|
@ -1463,6 +1463,8 @@ extern bool x_had_errors_p (Display *);
|
|||
extern void x_unwind_errors_to (int);
|
||||
extern void x_uncatch_errors (void);
|
||||
extern void x_uncatch_errors_after_check (void);
|
||||
extern void x_ignore_errors_for_next_request (struct x_display_info *);
|
||||
extern void x_stop_ignoring_errors (struct x_display_info *);
|
||||
extern void x_clear_errors (Display *);
|
||||
extern void x_set_window_size (struct frame *, bool, int, int);
|
||||
extern void x_set_last_user_time_from_lisp (struct x_display_info *, Time);
|
||||
|
|
Loading…
Add table
Reference in a new issue