Looks like incremental selection transfers have been broken since we moved
to the Xt event loop, eight or so years ago. Esben’s bug report in
4203d4a0$0$237$edfadb0f(a)dread11.news.tele.dk was just a symptom.
The below fix would be a hack, were Xt not written in the grand spirit of
X11.
Vin, you may want to wait until it’s been running on 21.5 for a few months
before applying it to 21.4--I do believe it is worth applying there,
though. It doesn’t apply quite cleanly, only because of Ben’s error ->
invalid_operation change on line 527. Tested on trunk and 21.4.17.
To test it yourself, make a selection greater than 262040 octets (assuming
standard max request sizes for your display) in XEmacs, and middle click in
another app. XEmacs would hang until you C-g’ed before the below patch.
Have we any sort of test infrastucture for X11 IPC, btw?
src/ChangeLog addition:
2005-02-25 Aidan Kehoe <kehoea(a)parhasard.net>
* select-x.c (x_reply_selection_request): Use XtRegisterDrawable
to tell Xt not to drop PropertyChange events destined for the
selection request target window. This makes incremental selection
transfer work, instead of looping until interrupted.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/select-x.c
Index: src/select-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/select-x.c,v
retrieving revision 1.17
diff -u -u -r1.17 select-x.c
--- src/select-x.c 2005/01/24 23:34:09 1.17
+++ src/select-x.c 2005/02/25 21:17:29
@@ -521,12 +521,22 @@
{
/* Send an INCR selection. */
int prop_id;
+ Widget widget = FRAME_X_TEXT_WIDGET (selected_frame());
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);
}
--
“I, for instance, am gung-ho about open source because my family is being
held hostage in Rob Malda’s basement. But who fact-checks me, or Enderle,
when we say something in public? No-one!” -- Danny O’Brien
Show replies by date