Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
2628:63a49b9b070c | 2629:140bb0f4da00 |
---|---|
543 | 543 |
544 /* Tell Xt not to drop PropertyNotify events that arrive for the | 544 /* Tell Xt not to drop PropertyNotify events that arrive for the |
545 target window, rather, pass them to us. This would be a hack, but | 545 target window, rather, pass them to us. This would be a hack, but |
546 the Xt selection routines are broken for our purposes--we can't | 546 the Xt selection routines are broken for our purposes--we can't |
547 pass them callbacks from Lisp, for example. Let's call it a | 547 pass them callbacks from Lisp, for example. Let's call it a |
548 workaround. */ | 548 workaround. |
549 XtRegisterDrawable(display, (Drawable)window, widget); | 549 |
550 The call to wait_for_property_change means we can break out of that | |
551 function, switch to another frame on the same display (which will | |
552 be another Xt widget), select a huge amount of text, and have the | |
553 same (foreign) app ask for another incremental selection | |
554 transfer. Programming like X11 made sense, would mean that, in that | |
555 case, XtRegisterDrawable is called twice with different widgets. | |
556 | |
557 Since the results of calling XtRegisterDrawable when the drawable | |
558 is already registered with another widget are undefined, we want to | |
559 avoid that--so, only call it when XtWindowToWidget returns NULL, | |
560 which it will only do with a valid Window if it's not already | |
561 registered. */ | |
562 if (NULL == XtWindowToWidget(display, window)) | |
563 { | |
564 XtRegisterDrawable(display, (Drawable)window, widget); | |
565 } | |
550 | 566 |
551 prop_id = expect_property_change (display, window, reply.property, | 567 prop_id = expect_property_change (display, window, reply.property, |
552 PropertyDelete); | 568 PropertyDelete); |
553 | 569 |
554 XChangeProperty (display, window, reply.property, DEVICE_XATOM_INCR (d), | 570 XChangeProperty (display, window, reply.property, DEVICE_XATOM_INCR (d), |