Mercurial > hg > xemacs-beta
diff src/select-x.c @ 2629:140bb0f4da00
[xemacs-hg @ 2005-03-02 18:31:55 by aidan]
Wrap call to XtRegisterDrawable with check that XtWindowToWidget gives NULL,
document why.
author | aidan |
---|---|
date | Wed, 02 Mar 2005 18:31:57 +0000 |
parents | cf6ef27aa9a7 |
children | 2b1e7cb9ae2c |
line wrap: on
line diff
--- a/src/select-x.c Wed Mar 02 17:55:25 2005 +0000 +++ b/src/select-x.c Wed Mar 02 18:31:57 2005 +0000 @@ -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);