X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fselect-x.c;h=2ab3161ee2687878ecdb576684d0e8ba01c788ec;hp=21332fdf43e21eaef0c2a3e2fd8cee49e9fff962;hb=14ac73276fa152e8f0b74602792afc0b9c3236c9;hpb=ee38d21b330f5001b47a577cefb5ba7b82a3b7d3 diff --git a/src/select-x.c b/src/select-x.c index 21332fd..2ab3161 100644 --- a/src/select-x.c +++ b/src/select-x.c @@ -509,14 +509,41 @@ x_reply_selection_request (XSelectionRequestEvent *event, int format, } 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 @@ x_reply_selection_request (XSelectionRequestEvent *event, int format, 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 */ } } @@ -1628,6 +1659,14 @@ Set the value of the named CUTBUFFER (typically CUT_BUFFER0) to STRING. continue; } +#ifdef UTF2000 + if ((*ptr) <= 0xC3) + { + chartypes = LATIN_1; + ptr += 2; + continue; + } +#else if ((*ptr) == LEADING_BYTE_LATIN_ISO8859_1 || (*ptr) == LEADING_BYTE_CONTROL_1) { @@ -1635,6 +1674,7 @@ Set the value of the named CUTBUFFER (typically CUT_BUFFER0) to STRING. ptr += 2; continue; } +#endif chartypes = WORLD; break;