[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d9464d7fe5: Handle errors sending selection decline events asynch
From: |
Po Lu |
Subject: |
master d9464d7fe5: Handle errors sending selection decline events asynchronously |
Date: |
Sun, 10 Jul 2022 22:07:34 -0400 (EDT) |
branch: master
commit d9464d7fe5d21bd46254bbb691f5d3db34fe6324
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
src/xselect.c | 23 +++++++++++++++++------
src/xterm.c | 6 ++----
src/xterm.h | 2 ++
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/xselect.c b/src/xselect.c
index 80db0d1fe2..25a75aec91 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -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 ();
}
diff --git a/src/xterm.c b/src/xterm.c
index ac4e210786..39ce415472 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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;
diff --git a/src/xterm.h b/src/xterm.h
index 92e88bb50f..a1ddf13463 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master d9464d7fe5: Handle errors sending selection decline events asynchronously,
Po Lu <=