summaryrefslogtreecommitdiff
path: root/src/xselect.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1999-01-24 20:06:34 +0000
committerRichard M. Stallman <rms@gnu.org>1999-01-24 20:06:34 +0000
commite18e6130fad63fdf7de2367578826028f654314f (patch)
treebcddfaed7f3cda7acd39d2df90542e0c9e2cf29d /src/xselect.c
parent3e9c24f68b5452cd86e3f4dd224e9d09490bc6a7 (diff)
downloademacs-e18e6130fad63fdf7de2367578826028f654314f.tar.gz
(x_handle_selection_clear): Don't clear the
selection if Emacs still owns it through a different display.
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/xselect.c b/src/xselect.c
index 309e203c8bc..6219483eac7 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -755,7 +755,7 @@ x_handle_selection_request (event)
}
}
-/* Handle a SelectionClear event EVENT, which indicates that some other
+/* Handle a SelectionClear event EVENT, which indicates that some
client cleared out our previously asserted selection.
This is called from keyboard.c when such an event is found in the queue. */
@@ -770,6 +770,26 @@ x_handle_selection_clear (event)
Lisp_Object selection_symbol, local_selection_data;
Time local_selection_time;
struct x_display_info *dpyinfo = x_display_info_for_display (display);
+ struct x_display_info *t_dpyinfo;
+
+ /* If the new selection owner is also Emacs,
+ don't clear the new selection. */
+ BLOCK_INPUT;
+ /* Check each display on the same terminal,
+ to see if this Emacs job now owns the selection
+ through that display. */
+ for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next)
+ if (t_dpyinfo->kboard == dpyinfo->kboard)
+ {
+ Window owner_window
+ = XGetSelectionOwner (t_dpyinfo->display, selection);
+ if (x_window_to_frame (t_dpyinfo, owner_window) != 0)
+ {
+ UNBLOCK_INPUT;
+ return;
+ }
+ }
+ UNBLOCK_INPUT;
selection_symbol = x_atom_to_symbol (dpyinfo, display, selection);