diff src/select-x.c @ 2619:935833be8506

[xemacs-hg @ 2005-02-28 17:02:09 by aidan] Register the source window as an Xt drawable when receiving an incremental selection transfer. This stops XEmacs looping until interrupted.
author aidan
date Mon, 28 Feb 2005 17:02:10 +0000
parents 3d8143fc88e1
children 5e906dd5c3e9
line wrap: on
line diff
--- a/src/select-x.c	Mon Feb 28 07:43:18 2005 +0000
+++ b/src/select-x.c	Mon Feb 28 17:02:10 2005 +0000
@@ -521,12 +521,22 @@
     {
       /* Send an INCR selection. */
       int prop_id;
+      Widget widget = FRAME_X_TEXT_WIDGET (DEVICE_SELECTED_FRAME(d));
 
       if (x_window_to_frame (d, window)) /* #### debug */
- invalid_operation ("attempt to transfer an INCR to ourself!", Qunbound);
+	invalid_operation ("attempt to transfer an INCR to ourself!",
+			   Qunbound);
 #if 0
       stderr_out ("\nINCR %d\n", bytes_remaining);
 #endif
+
+      /* Tell Xt not to drop PropertyNotify events that arrive for the
+         target window, rather, pass them to us. This would be a hack, but
+         the Xt selection routines are broken for our purposes--we can't
+         pass them callbacks from Lisp, for example. Let's call it a
+         workaround. */
+      XtRegisterDrawable(display, (Drawable)window, widget);
+
       prop_id = expect_property_change (display, window, reply.property,
 					PropertyDelete);
 
@@ -570,8 +580,10 @@
       stderr_out ("  INCR done\n");
 #endif
       if (! waiting_for_other_props_on_window (display, window))
+      {
 	XSelectInput (display, window, 0L);
-
+	XtUnregisterDrawable(display, (Drawable)window);
+      }
       XChangeProperty (display, window, reply.property, type, format,
 		       PropModeReplace, data, 0);
     }