This is mostly for Steve’s, and SXEmacs’, benefit, but it would be a
reasonable bug fix to apply to 21.4.
ChangeLog addition:
2005-03-12 Aidan Kehoe <kehoea(a)parhasard.net>
* configure: Regenerate.
* configure.in (XE_COMPUTE_RUNPATH): Check XtRegisterDrawable
availability.
src/ChangeLog addition:
2005-03-12 Aidan Kehoe <kehoea(a)parhasard.net>
* config.h.in: Make HAVE_XTREGISTERDRAWABLE available.
* select-x.c (x_reply_selection_request): Use it; fix the bug we
were seeing with incremental selection transfer failing.
XEmacs Stable source patch:
Diff command: cvs -q diff -u
Files affected: src/select-x.c src/config.h.in configure.in configure
Index: configure
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/configure,v
retrieving revision 1.147.2.32
diff -u -u -r1.147.2.32 configure
--- configure 2005/01/31 03:06:14 1.147.2.32
+++ configure 2005/03/12 21:33:14
@@ -6847,7 +6847,7 @@
esac
fi
- for ac_func in XConvertCase
+ for ac_func in XConvertCase XtRegisterDrawable
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6854: checking for $ac_func" >&5
Index: configure.in
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/configure.in,v
retrieving revision 1.151.2.31
diff -u -u -r1.151.2.31 configure.in
--- configure.in 2005/01/31 02:54:47 1.151.2.31
+++ configure.in 2005/03/12 21:33:18
@@ -2913,7 +2913,7 @@
esac
fi
- AC_CHECK_FUNCS(XConvertCase)
+ AC_CHECK_FUNCS(XConvertCase XtRegisterDrawable)
AC_CHECK_HEADERS(X11/Xlocale.h)
Index: src/config.h.in
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/config.h.in,v
retrieving revision 1.61.2.7
diff -u -u -r1.61.2.7 config.h.in
--- src/config.h.in 2003/08/18 01:42:10 1.61.2.7
+++ src/config.h.in 2005/03/12 21:33:22
@@ -205,6 +205,7 @@
#undef THIS_IS_X11R6
#undef HAVE_XCONVERTCASE
+#undef HAVE_XTREGISTERDRAWABLE
#undef HAVE_BALLOON_HELP
Index: src/select-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/select-x.c,v
retrieving revision 1.2.2.2
diff -u -u -r1.2.2.2 select-x.c
--- src/select-x.c 2005/01/31 02:55:31 1.2.2.2
+++ src/select-x.c 2005/03/12 21:33:23
@@ -509,14 +509,41 @@
}
else
{
+#ifndef HAVE_XTREGISTERDRAWABLE
+ invalid_operation("Copying that much data requires X11R6.", Qunbound);
+#else
/* Send an INCR selection. */
int prop_id;
+ Widget widget = FRAME_X_TEXT_WIDGET (XFRAME(DEVICE_SELECTED_FRAME(d)));
if (x_window_to_frame (d, window)) /* #### debug */
error ("attempt to transfer an INCR to ourself!");
#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.
+
+ The call to wait_for_property_change means we can break out of that
+ function, switch to another frame on the same display (which will
+ be another Xt widget), select a huge amount of text, and have the
+ same (foreign) app ask for another incremental selection
+ transfer. Programming like X11 made sense, would mean that, in that
+ case, XtRegisterDrawable is called twice with different widgets.
+
+ Since the results of calling XtRegisterDrawable when the drawable
+ is already registered with another widget are undefined, we want to
+ avoid that--so, only call it when XtWindowToWidget returns NULL,
+ which it will only do with a valid Window if it's not already
+ registered. */
+ if (NULL == XtWindowToWidget(display, window))
+ {
+ XtRegisterDrawable(display, (Drawable)window, widget);
+ }
+
prop_id = expect_property_change (display, window, reply.property,
PropertyDelete);
@@ -560,10 +587,14 @@
stderr_out (" INCR done\n");
#endif
if (! waiting_for_other_props_on_window (display, window))
- XSelectInput (display, window, 0L);
+ {
+ XSelectInput (display, window, 0L);
+ XtUnregisterDrawable(display, (Drawable)window);
+ }
XChangeProperty (display, window, reply.property, type, format,
PropModeReplace, data, 0);
+#endif /* HAVE_XTREGISTERDRAWABLE */
}
}
--
“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