--- vim73.orig/src/ui.c Sun Aug 8 16:17:30 2010 +++ vim73/src/ui.c Tue Aug 31 20:39:59 2010 @@ -1947,54 +1947,10 @@ static void clip_x11_lose_ownership_cb __ARGS((Widget, Atom *)); -static void clip_x11_timestamp_cb __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont)); - -/* - * Property callback to get a timestamp for XtOwnSelection. - */ - static void -clip_x11_timestamp_cb(w, n, event, cont) - Widget w; - XtPointer n UNUSED; - XEvent *event; - Boolean *cont UNUSED; -{ - Atom actual_type; - int format; - unsigned long nitems, bytes_after; - unsigned char *prop=NULL; - XPropertyEvent *xproperty=&event->xproperty; - - /* Must be a property notify, state can't be Delete (True), has to be - * one of the supported selection types. */ - if (event->type != PropertyNotify || xproperty->state - || (xproperty->atom != clip_star.sel_atom - && xproperty->atom != clip_plus.sel_atom)) - return; - - if (XGetWindowProperty(xproperty->display, xproperty->window, - xproperty->atom, 0, 0, False, timestamp_atom, &actual_type, &format, - &nitems, &bytes_after, &prop)) - return; - - if (prop) - XFree(prop); - - /* Make sure the property type is "TIMESTAMP" and it's 32 bits. */ - if (actual_type != timestamp_atom || format != 32) - return; - - /* Get the selection, using the event timestamp. */ - XtOwnSelection(w, xproperty->atom, xproperty->time, - clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb, NULL); -} - void x11_setup_selection(w) Widget w; { - XtAddEventHandler(w, PropertyChangeMask, False, - /*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL); } static void clip_x11_request_selection_cb __ARGS((Widget, XtPointer, Atom *, Atom *, XtPointer, long_u *, int *)); @@ -2347,10 +2303,10 @@ Widget myShell; VimClipboard *cbd; { - /* Get the time by a zero-length append, clip_x11_timestamp_cb will be - * called with the current timestamp. */ - if (!XChangeProperty(XtDisplay(myShell), XtWindow(myShell), cbd->sel_atom, - timestamp_atom, 32, PropModeAppend, NULL, 0)) + if (XtOwnSelection(myShell, cbd->sel_atom, + XtLastTimestampProcessed(XtDisplay(myShell)), + clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb, + NULL) == False) return FAIL; /* Flush is required in a terminal as nothing else is doing it. */ XFlush(XtDisplay(myShell));