diff options
| author | Po Lu | 2022-06-11 09:12:44 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-11 09:12:44 +0800 |
| commit | 7def8baa086451450f8bb34b07febb232f9c148d (patch) | |
| tree | ea84710579367217cc4bb29d198c6e8d10cc2092 /src | |
| parent | cb0c697e21f710cb8df56c33d951f780a2a1e40e (diff) | |
| download | emacs-7def8baa086451450f8bb34b07febb232f9c148d.tar.gz emacs-7def8baa086451450f8bb34b07febb232f9c148d.zip | |
Fix cancelling DND upon a regular X error
* src/xterm.c (x_connection_closed): The display isn't dead upon
a non-IO error, so don't avoid sending messages to clean stuff
up.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 86 |
1 files changed, 45 insertions, 41 deletions
diff --git a/src/xterm.c b/src/xterm.c index 30322b0c09b..ad925755b50 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -22379,51 +22379,55 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror) | |||
| 22379 | 22379 | ||
| 22380 | if (x_dnd_in_progress || x_dnd_waiting_for_finish) | 22380 | if (x_dnd_in_progress || x_dnd_waiting_for_finish) |
| 22381 | { | 22381 | { |
| 22382 | /* Handle display disconnect errors here because this function | 22382 | if (!ioerror) |
| 22383 | is not reentrant at this particular spot. */ | ||
| 22384 | io_error_handler = XSetIOErrorHandler (x_dnd_io_error_handler); | ||
| 22385 | |||
| 22386 | if (!sigsetjmp (x_dnd_disconnect_handler, 1) | ||
| 22387 | && x_dnd_in_progress | ||
| 22388 | && dpy != (x_dnd_waiting_for_finish | ||
| 22389 | ? x_dnd_finish_display | ||
| 22390 | : FRAME_X_DISPLAY (x_dnd_frame))) | ||
| 22391 | { | 22383 | { |
| 22392 | /* Clean up drag and drop if the drag frame's display isn't | 22384 | /* Handle display disconnect errors here because this function |
| 22393 | the one being disconnected. */ | 22385 | is not reentrant at this particular spot. */ |
| 22394 | f = x_dnd_frame; | 22386 | io_error_handler = XSetIOErrorHandler (x_dnd_io_error_handler); |
| 22395 | 22387 | ||
| 22396 | if (x_dnd_last_seen_window != None | 22388 | if (!!sigsetjmp (x_dnd_disconnect_handler, 1) |
| 22397 | && x_dnd_last_protocol_version != -1) | 22389 | && x_dnd_in_progress |
| 22398 | x_dnd_send_leave (x_dnd_frame, | 22390 | && dpy == (x_dnd_waiting_for_finish |
| 22399 | x_dnd_last_seen_window); | 22391 | ? x_dnd_finish_display |
| 22400 | else if (x_dnd_last_seen_window != None | 22392 | : FRAME_X_DISPLAY (x_dnd_frame))) |
| 22401 | && !XM_DRAG_STYLE_IS_DROP_ONLY (x_dnd_last_motif_style) | ||
| 22402 | && x_dnd_last_motif_style != XM_DRAG_STYLE_NONE | ||
| 22403 | && x_dnd_motif_setup_p) | ||
| 22404 | { | 22393 | { |
| 22405 | dmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR, | 22394 | /* Clean up drag and drop if the drag frame's display isn't |
| 22406 | XM_DRAG_REASON_DROP_START); | 22395 | the one being disconnected. */ |
| 22407 | dmsg.byte_order = XM_BYTE_ORDER_CUR_FIRST; | 22396 | f = x_dnd_frame; |
| 22408 | dmsg.timestamp = FRAME_DISPLAY_INFO (f)->last_user_time; | 22397 | |
| 22409 | dmsg.side_effects | 22398 | if (x_dnd_last_seen_window != None |
| 22410 | = XM_DRAG_SIDE_EFFECT (xm_side_effect_from_action (FRAME_DISPLAY_INFO (f), | 22399 | && x_dnd_last_protocol_version != -1) |
| 22411 | x_dnd_wanted_action), | 22400 | x_dnd_send_leave (x_dnd_frame, |
| 22412 | XM_DROP_SITE_VALID, x_dnd_motif_operations, | 22401 | x_dnd_last_seen_window); |
| 22413 | XM_DROP_ACTION_DROP_CANCEL); | 22402 | else if (x_dnd_last_seen_window != None |
| 22414 | dmsg.x = 0; | 22403 | && !XM_DRAG_STYLE_IS_DROP_ONLY (x_dnd_last_motif_style) |
| 22415 | dmsg.y = 0; | 22404 | && x_dnd_last_motif_style != XM_DRAG_STYLE_NONE |
| 22416 | dmsg.index_atom = FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection; | 22405 | && x_dnd_motif_setup_p) |
| 22417 | dmsg.source_window = FRAME_X_WINDOW (f); | 22406 | { |
| 22418 | 22407 | dmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR, | |
| 22419 | x_dnd_send_xm_leave_for_drop (FRAME_DISPLAY_INFO (f), f, | 22408 | XM_DRAG_REASON_DROP_START); |
| 22420 | x_dnd_last_seen_window, 0); | 22409 | dmsg.byte_order = XM_BYTE_ORDER_CUR_FIRST; |
| 22421 | xm_send_drop_message (FRAME_DISPLAY_INFO (f), FRAME_X_WINDOW (f), | 22410 | dmsg.timestamp = FRAME_DISPLAY_INFO (f)->last_user_time; |
| 22422 | x_dnd_last_seen_window, &dmsg); | 22411 | dmsg.side_effects |
| 22412 | = XM_DRAG_SIDE_EFFECT (xm_side_effect_from_action (FRAME_DISPLAY_INFO (f), | ||
| 22413 | x_dnd_wanted_action), | ||
| 22414 | XM_DROP_SITE_VALID, x_dnd_motif_operations, | ||
| 22415 | XM_DROP_ACTION_DROP_CANCEL); | ||
| 22416 | dmsg.x = 0; | ||
| 22417 | dmsg.y = 0; | ||
| 22418 | dmsg.index_atom = FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection; | ||
| 22419 | dmsg.source_window = FRAME_X_WINDOW (f); | ||
| 22420 | |||
| 22421 | x_dnd_send_xm_leave_for_drop (FRAME_DISPLAY_INFO (f), f, | ||
| 22422 | x_dnd_last_seen_window, 0); | ||
| 22423 | xm_send_drop_message (FRAME_DISPLAY_INFO (f), FRAME_X_WINDOW (f), | ||
| 22424 | x_dnd_last_seen_window, &dmsg); | ||
| 22425 | } | ||
| 22423 | } | 22426 | } |
| 22427 | |||
| 22428 | XSetIOErrorHandler (io_error_handler); | ||
| 22424 | } | 22429 | } |
| 22425 | 22430 | ||
| 22426 | XSetIOErrorHandler (io_error_handler); | ||
| 22427 | dpyinfo = x_display_info_for_display (dpy); | 22431 | dpyinfo = x_display_info_for_display (dpy); |
| 22428 | 22432 | ||
| 22429 | x_dnd_last_seen_window = None; | 22433 | x_dnd_last_seen_window = None; |
| @@ -22432,7 +22436,7 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror) | |||
| 22432 | x_dnd_waiting_for_finish = false; | 22436 | x_dnd_waiting_for_finish = false; |
| 22433 | 22437 | ||
| 22434 | if (x_dnd_use_toplevels) | 22438 | if (x_dnd_use_toplevels) |
| 22435 | x_dnd_free_toplevels (false); | 22439 | x_dnd_free_toplevels (!ioerror); |
| 22436 | 22440 | ||
| 22437 | x_dnd_return_frame_object = NULL; | 22441 | x_dnd_return_frame_object = NULL; |
| 22438 | x_dnd_movement_frame = NULL; | 22442 | x_dnd_movement_frame = NULL; |