aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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)
755 } 755 }
756} 756}
757 757
758/* Handle a SelectionClear event EVENT, which indicates that some other 758/* Handle a SelectionClear event EVENT, which indicates that some
759 client cleared out our previously asserted selection. 759 client cleared out our previously asserted selection.
760 This is called from keyboard.c when such an event is found in the queue. */ 760 This is called from keyboard.c when such an event is found in the queue. */
761 761
@@ -770,6 +770,26 @@ x_handle_selection_clear (event)
770 Lisp_Object selection_symbol, local_selection_data; 770 Lisp_Object selection_symbol, local_selection_data;
771 Time local_selection_time; 771 Time local_selection_time;
772 struct x_display_info *dpyinfo = x_display_info_for_display (display); 772 struct x_display_info *dpyinfo = x_display_info_for_display (display);
773 struct x_display_info *t_dpyinfo;
774
775 /* If the new selection owner is also Emacs,
776 don't clear the new selection. */
777 BLOCK_INPUT;
778 /* Check each display on the same terminal,
779 to see if this Emacs job now owns the selection
780 through that display. */
781 for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next)
782 if (t_dpyinfo->kboard == dpyinfo->kboard)
783 {
784 Window owner_window
785 = XGetSelectionOwner (t_dpyinfo->display, selection);
786 if (x_window_to_frame (t_dpyinfo, owner_window) != 0)
787 {
788 UNBLOCK_INPUT;
789 return;
790 }
791 }
792 UNBLOCK_INPUT;
773 793
774 selection_symbol = x_atom_to_symbol (dpyinfo, display, selection); 794 selection_symbol = x_atom_to_symbol (dpyinfo, display, selection);
775 795