Mercurial > hg > xemacs-beta
changeset 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 | 63a49b9b070c |
children | 1ea43ec83f12 |
files | src/ChangeLog src/select-x.c |
diffstat | 2 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Mar 02 17:55:25 2005 +0000 +++ b/src/ChangeLog Wed Mar 02 18:31:57 2005 +0000 @@ -1,3 +1,9 @@ +2005-03-02 Aidan Kehoe <kehoea@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@parhasard.net> * select-x.c (x_reply_selection_request): Make the error message
--- 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);