User: aidan
Date: 05/03/02 19:32:00
Modified: xemacs/src ChangeLog select-x.c
Log:
Wrap call to XtRegisterDrawable with check that XtWindowToWidget gives NULL,
document why.
Revision Changes Path
1.801 +6 -0 XEmacs/xemacs/src/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.800
retrieving revision 1.801
diff -u -r1.800 -r1.801
--- ChangeLog 2005/03/02 13:06:38 1.800
+++ ChangeLog 2005/03/02 18:31:55 1.801
@@ -1,5 +1,11 @@
2005-03-02 Aidan Kehoe <kehoea(a)parhasard.net>
+ * select-x.c (x_reply_selection_request): Check that
+ XtWindowToWidget returns NULL before calling XtRegisterDrawable,
+ document why.
+
+2005-03-02 Aidan Kehoe <kehoea(a)parhasard.net>
+
* select-x.c (x_reply_selection_request): Make the error message
in the absence of HAVE_XTREGISTERDRAWABLE more polite, pass a
second argument to invalid_operation to have it actually compile
1.23 +18 -2 XEmacs/xemacs/src/select-x.c
Index: select-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/select-x.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- select-x.c 2005/03/02 13:06:40 1.22
+++ select-x.c 2005/03/02 18:31:57 1.23
@@ -545,8 +545,24 @@
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);
+ 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);