diff options
| author | Richard M. Stallman | 1994-07-01 00:46:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-07-01 00:46:37 +0000 |
| commit | 118bd8410d176d21bb86722958ce87b509829aef (patch) | |
| tree | 6b0f40cb97ae48a2ea36ad484f78bcab03530ec5 /src | |
| parent | 43b028a0775479ec7805460c535a48c75e52bfa8 (diff) | |
| download | emacs-118bd8410d176d21bb86722958ce87b509829aef.tar.gz emacs-118bd8410d176d21bb86722958ce87b509829aef.zip | |
(x_own_selection, x_get_foreign_selection):
Get rid of spurious X_TOOLKIT conditional.
(x_own_selection): Put the frame in Vselection_alist.
(x_clear_frame_selections): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 76 |
1 files changed, 61 insertions, 15 deletions
diff --git a/src/xselect.c b/src/xselect.c index 47d31e29eb3..e63967ad8e2 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -73,13 +73,14 @@ Lisp_Object Vx_sent_selection_hooks; | |||
| 73 | unsigned long last_event_timestamp; | 73 | unsigned long last_event_timestamp; |
| 74 | 74 | ||
| 75 | /* This is an association list whose elements are of the form | 75 | /* This is an association list whose elements are of the form |
| 76 | ( selection-name selection-value selection-timestamp ) | 76 | ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME) |
| 77 | selection-name is a lisp symbol, whose name is the name of an X Atom. | 77 | SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom. |
| 78 | selection-value is the value that emacs owns for that selection. | 78 | SELECTION-VALUE is the value that emacs owns for that selection. |
| 79 | It may be any kind of Lisp object. | 79 | It may be any kind of Lisp object. |
| 80 | selection-timestamp is the time at which emacs began owning this selection, | 80 | SELECTION-TIMESTAMP is the time at which emacs began owning this selection, |
| 81 | as a cons of two 16-bit numbers (making a 32 bit time.) | 81 | as a cons of two 16-bit numbers (making a 32 bit time.) |
| 82 | If there is an entry in this alist, then it can be assumed that emacs owns | 82 | FRAME is the frame for which we made the selection. |
| 83 | If there is an entry in this alist, then it can be assumed that Emacs owns | ||
| 83 | that selection. | 84 | that selection. |
| 84 | The only (eq) parts of this list that are visible from Lisp are the | 85 | The only (eq) parts of this list that are visible from Lisp are the |
| 85 | selection-values. | 86 | selection-values. |
| @@ -98,7 +99,6 @@ Lisp_Object Vselection_converter_alist; | |||
| 98 | we give up on it. This is in milliseconds (0 = no timeout.) | 99 | we give up on it. This is in milliseconds (0 = no timeout.) |
| 99 | */ | 100 | */ |
| 100 | int x_selection_timeout; | 101 | int x_selection_timeout; |
| 101 | |||
| 102 | 102 | ||
| 103 | /* Utility functions */ | 103 | /* Utility functions */ |
| 104 | 104 | ||
| @@ -237,11 +237,7 @@ x_own_selection (selection_name, selection_value) | |||
| 237 | Lisp_Object selection_name, selection_value; | 237 | Lisp_Object selection_name, selection_value; |
| 238 | { | 238 | { |
| 239 | Display *display = x_current_display; | 239 | Display *display = x_current_display; |
| 240 | #ifdef X_TOOLKIT | ||
| 241 | Window selecting_window = XtWindow (selected_screen->display.x->edit_widget); | ||
| 242 | #else | ||
| 243 | Window selecting_window = FRAME_X_WINDOW (selected_frame); | 240 | Window selecting_window = FRAME_X_WINDOW (selected_frame); |
| 244 | #endif | ||
| 245 | Time time = last_event_timestamp; | 241 | Time time = last_event_timestamp; |
| 246 | Atom selection_atom; | 242 | Atom selection_atom; |
| 247 | 243 | ||
| @@ -264,7 +260,8 @@ x_own_selection (selection_name, selection_value) | |||
| 264 | selection_time = long_to_cons ((unsigned long) time); | 260 | selection_time = long_to_cons ((unsigned long) time); |
| 265 | selection_data = Fcons (selection_name, | 261 | selection_data = Fcons (selection_name, |
| 266 | Fcons (selection_value, | 262 | Fcons (selection_value, |
| 267 | Fcons (selection_time, Qnil))); | 263 | Fcons (selection_time, |
| 264 | Fcons (Fselected_frame (), Qnil)))); | ||
| 268 | prev_value = assq_no_quit (selection_name, Vselection_alist); | 265 | prev_value = assq_no_quit (selection_name, Vselection_alist); |
| 269 | 266 | ||
| 270 | Vselection_alist = Fcons (selection_data, Vselection_alist); | 267 | Vselection_alist = Fcons (selection_data, Vselection_alist); |
| @@ -760,6 +757,59 @@ x_handle_selection_clear (event) | |||
| 760 | } | 757 | } |
| 761 | } | 758 | } |
| 762 | 759 | ||
| 760 | /* Clear all selections that were made from frame F. | ||
| 761 | We do this when about to delete a frame. */ | ||
| 762 | |||
| 763 | void | ||
| 764 | x_clear_frame_selections (f) | ||
| 765 | FRAME_PTR f; | ||
| 766 | { | ||
| 767 | Lisp_Object frame; | ||
| 768 | Lisp_Object rest; | ||
| 769 | |||
| 770 | XSET (frame, Lisp_Frame, f); | ||
| 771 | |||
| 772 | /* Otherwise, we're really honest and truly being told to drop it. | ||
| 773 | Don't use Fdelq as that may QUIT;. */ | ||
| 774 | |||
| 775 | while (!NILP (Vselection_alist) | ||
| 776 | && EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (Vselection_alist))))))) | ||
| 777 | { | ||
| 778 | /* Let random Lisp code notice that the selection has been stolen. */ | ||
| 779 | Lisp_Object hooks, selection_symbol; | ||
| 780 | |||
| 781 | hooks = Vx_lost_selection_hooks; | ||
| 782 | selection_symbol = Fcar (Vselection_alist); | ||
| 783 | |||
| 784 | if (!EQ (hooks, Qunbound)) | ||
| 785 | { | ||
| 786 | for (; CONSP (hooks); hooks = Fcdr (hooks)) | ||
| 787 | call1 (Fcar (hooks), selection_symbol); | ||
| 788 | redisplay_preserve_echo_area (); | ||
| 789 | } | ||
| 790 | |||
| 791 | Vselection_alist = Fcdr (Vselection_alist); | ||
| 792 | } | ||
| 793 | |||
| 794 | for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) | ||
| 795 | if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCONS (rest)->cdr))))))) | ||
| 796 | { | ||
| 797 | /* Let random Lisp code notice that the selection has been stolen. */ | ||
| 798 | Lisp_Object hooks, selection_symbol; | ||
| 799 | |||
| 800 | hooks = Vx_lost_selection_hooks; | ||
| 801 | selection_symbol = Fcar (XCONS (rest)->cdr); | ||
| 802 | |||
| 803 | if (!EQ (hooks, Qunbound)) | ||
| 804 | { | ||
| 805 | for (; CONSP (hooks); hooks = Fcdr (hooks)) | ||
| 806 | call1 (Fcar (hooks), selection_symbol); | ||
| 807 | redisplay_preserve_echo_area (); | ||
| 808 | } | ||
| 809 | XCONS (rest)->cdr = Fcdr (XCONS (rest)->cdr); | ||
| 810 | break; | ||
| 811 | } | ||
| 812 | } | ||
| 763 | 813 | ||
| 764 | /* Nonzero if any properties for DISPLAY and WINDOW | 814 | /* Nonzero if any properties for DISPLAY and WINDOW |
| 765 | are on the list of what we are waiting for. */ | 815 | are on the list of what we are waiting for. */ |
| @@ -980,11 +1030,7 @@ x_get_foreign_selection (selection_symbol, target_type) | |||
| 980 | Lisp_Object selection_symbol, target_type; | 1030 | Lisp_Object selection_symbol, target_type; |
| 981 | { | 1031 | { |
| 982 | Display *display = x_current_display; | 1032 | Display *display = x_current_display; |
| 983 | #ifdef X_TOOLKIT | ||
| 984 | Window requestor_window = XtWindow (selected_screen->display.x->edit_widget); | ||
| 985 | #else | ||
| 986 | Window requestor_window = FRAME_X_WINDOW (selected_frame); | 1033 | Window requestor_window = FRAME_X_WINDOW (selected_frame); |
| 987 | #endif | ||
| 988 | Time requestor_time = last_event_timestamp; | 1034 | Time requestor_time = last_event_timestamp; |
| 989 | Atom target_property = Xatom_EMACS_TMP; | 1035 | Atom target_property = Xatom_EMACS_TMP; |
| 990 | Atom selection_atom = symbol_to_x_atom (display, selection_symbol); | 1036 | Atom selection_atom = symbol_to_x_atom (display, selection_symbol); |