diff 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
line wrap: on
line diff
--- a/src/select-x.c	Mon Aug 13 11:40:56 2007 +0200
+++ b/src/select-x.c	Mon Aug 13 11:41:24 2007 +0200
@@ -46,7 +46,8 @@
 static void hack_motif_clipboard_selection (Atom selection_atom,
 					    Lisp_Object selection_value,
 					    Time thyme, Display *display,
-					    Window selecting_window);
+					    Window selecting_window,
+					    int owned_p);
 #endif
 
 #define CUT_BUFFER_SUPPORT
@@ -74,6 +75,9 @@
  */
 int x_selection_timeout;
 
+/* Enable motif selection optimizations. */
+int x_selection_strict_motif_ownership;
+
 
 /* Utility functions */
 
@@ -201,7 +205,8 @@
  */
 static Lisp_Object
 x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
-		 Lisp_Object how_to_add, Lisp_Object selection_type)
+		 Lisp_Object how_to_add, Lisp_Object selection_type,
+		 int owned_p)
 {
   struct device *d = decode_x_device (Qnil);
   Display *display = DEVICE_X_DISPLAY (d);
@@ -233,7 +238,7 @@
 
 #ifdef MOTIF_CLIPBOARDS
   hack_motif_clipboard_selection (selection_atom, selection_value,
-				  thyme, display, selecting_window);
+				  thyme, display, selecting_window, owned_p);
 #endif
   return selection_time;
 }
@@ -249,8 +254,8 @@
 				Lisp_Object selection_value,
 				Time thyme,
 				Display *display,
-				Window selecting_window)
-     /*				Bool owned_p)*/
+				Window selecting_window,
+				int owned_p)
 {
   struct device *d = get_device_from_display (display);
   /* Those Motif wankers can't be bothered to follow the ICCCM, and do
@@ -270,7 +275,10 @@
 	 to look up the new value, and you can't Copy from a buffer, Paste
 	 into a text field, then Copy something else from the buffer and
 	 paste it into the text field -- it pastes the first thing again. */
-/*      && !owned_p */
+      && (!owned_p 
+	  /* Selectively re-enable this because for most users its
+	     just too painful - especially over a remote link. */
+	  || x_selection_strict_motif_ownership)
       )
     {
 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
@@ -1772,6 +1780,17 @@
 \"*selectionTimeout\" resource (which is expressed in milliseconds).
 */ );
   x_selection_timeout = 0;
+
+  DEFVAR_BOOL ("x-selection-strict-motif-ownership", &x_selection_strict_motif_ownership /*
+*If true and XEmacs already owns the clipboard, don't own it again in the
+Motif way. Owning the selection on the Motif way does a huge amount of
+X protocol, and it makes killing text incredibly slow when using an
+X terminal.  However, when enabled Motif text fields don't bother to look up
+the new value, and you can't Copy from a buffer, Paste into a text
+field, then Copy something else from the buffer and paste it into the
+text field; it pastes the first thing again.
+*/ );
+  x_selection_strict_motif_ownership = 1;
 }
 
 void