Mercurial > hg > xemacs-beta
comparison src/select-x.c @ 456:e7ef97881643 r21-2-43
Import from CVS: tag r21-2-43
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:41:24 +0200 |
parents | 576fb035e263 |
children | c33ae14dd6d0 |
comparison
equal
deleted
inserted
replaced
455:5b97c1cd6ed0 | 456:e7ef97881643 |
---|---|
44 #ifdef MOTIF_CLIPBOARDS | 44 #ifdef MOTIF_CLIPBOARDS |
45 # include <Xm/CutPaste.h> | 45 # include <Xm/CutPaste.h> |
46 static void hack_motif_clipboard_selection (Atom selection_atom, | 46 static void hack_motif_clipboard_selection (Atom selection_atom, |
47 Lisp_Object selection_value, | 47 Lisp_Object selection_value, |
48 Time thyme, Display *display, | 48 Time thyme, Display *display, |
49 Window selecting_window); | 49 Window selecting_window, |
50 int owned_p); | |
50 #endif | 51 #endif |
51 | 52 |
52 #define CUT_BUFFER_SUPPORT | 53 #define CUT_BUFFER_SUPPORT |
53 | 54 |
54 #ifdef CUT_BUFFER_SUPPORT | 55 #ifdef CUT_BUFFER_SUPPORT |
71 | 72 |
72 /* If the selection owner takes too long to reply to a selection request, | 73 /* If the selection owner takes too long to reply to a selection request, |
73 we give up on it. This is in seconds (0 = no timeout). | 74 we give up on it. This is in seconds (0 = no timeout). |
74 */ | 75 */ |
75 int x_selection_timeout; | 76 int x_selection_timeout; |
77 | |
78 /* Enable motif selection optimizations. */ | |
79 int x_selection_strict_motif_ownership; | |
76 | 80 |
77 | 81 |
78 /* Utility functions */ | 82 /* Utility functions */ |
79 | 83 |
80 static void lisp_data_to_selection_data (struct device *, | 84 static void lisp_data_to_selection_data (struct device *, |
199 | 203 |
200 /* Do protocol to assert ourself as a selection owner. | 204 /* Do protocol to assert ourself as a selection owner. |
201 */ | 205 */ |
202 static Lisp_Object | 206 static Lisp_Object |
203 x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, | 207 x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, |
204 Lisp_Object how_to_add, Lisp_Object selection_type) | 208 Lisp_Object how_to_add, Lisp_Object selection_type, |
209 int owned_p) | |
205 { | 210 { |
206 struct device *d = decode_x_device (Qnil); | 211 struct device *d = decode_x_device (Qnil); |
207 Display *display = DEVICE_X_DISPLAY (d); | 212 Display *display = DEVICE_X_DISPLAY (d); |
208 struct frame *sel_frame = selected_frame (); | 213 struct frame *sel_frame = selected_frame (); |
209 Window selecting_window = XtWindow (FRAME_X_TEXT_WIDGET (sel_frame)); | 214 Window selecting_window = XtWindow (FRAME_X_TEXT_WIDGET (sel_frame)); |
231 */ | 236 */ |
232 selection_time = make_opaque (&thyme, sizeof (thyme)); | 237 selection_time = make_opaque (&thyme, sizeof (thyme)); |
233 | 238 |
234 #ifdef MOTIF_CLIPBOARDS | 239 #ifdef MOTIF_CLIPBOARDS |
235 hack_motif_clipboard_selection (selection_atom, selection_value, | 240 hack_motif_clipboard_selection (selection_atom, selection_value, |
236 thyme, display, selecting_window); | 241 thyme, display, selecting_window, owned_p); |
237 #endif | 242 #endif |
238 return selection_time; | 243 return selection_time; |
239 } | 244 } |
240 | 245 |
241 #ifdef MOTIF_CLIPBOARDS /* Bend over baby. Take it and like it. */ | 246 #ifdef MOTIF_CLIPBOARDS /* Bend over baby. Take it and like it. */ |
247 static void | 252 static void |
248 hack_motif_clipboard_selection (Atom selection_atom, | 253 hack_motif_clipboard_selection (Atom selection_atom, |
249 Lisp_Object selection_value, | 254 Lisp_Object selection_value, |
250 Time thyme, | 255 Time thyme, |
251 Display *display, | 256 Display *display, |
252 Window selecting_window) | 257 Window selecting_window, |
253 /* Bool owned_p)*/ | 258 int owned_p) |
254 { | 259 { |
255 struct device *d = get_device_from_display (display); | 260 struct device *d = get_device_from_display (display); |
256 /* Those Motif wankers can't be bothered to follow the ICCCM, and do | 261 /* Those Motif wankers can't be bothered to follow the ICCCM, and do |
257 their own non-Xlib non-Xt clipboard processing. So we have to do | 262 their own non-Xlib non-Xt clipboard processing. So we have to do |
258 this so that linked-in Motif widgets don't get themselves wedged. | 263 this so that linked-in Motif widgets don't get themselves wedged. |
268 */ | 273 */ |
269 /* No, this is no good, because then Motif text fields don't bother | 274 /* No, this is no good, because then Motif text fields don't bother |
270 to look up the new value, and you can't Copy from a buffer, Paste | 275 to look up the new value, and you can't Copy from a buffer, Paste |
271 into a text field, then Copy something else from the buffer and | 276 into a text field, then Copy something else from the buffer and |
272 paste it into the text field -- it pastes the first thing again. */ | 277 paste it into the text field -- it pastes the first thing again. */ |
273 /* && !owned_p */ | 278 && (!owned_p |
279 /* Selectively re-enable this because for most users its | |
280 just too painful - especially over a remote link. */ | |
281 || x_selection_strict_motif_ownership) | |
274 ) | 282 ) |
275 { | 283 { |
276 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK | 284 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK |
277 Widget widget = FRAME_X_TEXT_WIDGET (selected_frame()); | 285 Widget widget = FRAME_X_TEXT_WIDGET (selected_frame()); |
278 #endif | 286 #endif |
1770 If the selection owner doesn't reply in this many seconds, we give up. | 1778 If the selection owner doesn't reply in this many seconds, we give up. |
1771 A value of 0 means wait as long as necessary. This is initialized from the | 1779 A value of 0 means wait as long as necessary. This is initialized from the |
1772 \"*selectionTimeout\" resource (which is expressed in milliseconds). | 1780 \"*selectionTimeout\" resource (which is expressed in milliseconds). |
1773 */ ); | 1781 */ ); |
1774 x_selection_timeout = 0; | 1782 x_selection_timeout = 0; |
1783 | |
1784 DEFVAR_BOOL ("x-selection-strict-motif-ownership", &x_selection_strict_motif_ownership /* | |
1785 *If true and XEmacs already owns the clipboard, don't own it again in the | |
1786 Motif way. Owning the selection on the Motif way does a huge amount of | |
1787 X protocol, and it makes killing text incredibly slow when using an | |
1788 X terminal. However, when enabled Motif text fields don't bother to look up | |
1789 the new value, and you can't Copy from a buffer, Paste into a text | |
1790 field, then Copy something else from the buffer and paste it into the | |
1791 text field; it pastes the first thing again. | |
1792 */ ); | |
1793 x_selection_strict_motif_ownership = 1; | |
1775 } | 1794 } |
1776 | 1795 |
1777 void | 1796 void |
1778 Xatoms_of_select_x (struct device *d) | 1797 Xatoms_of_select_x (struct device *d) |
1779 { | 1798 { |