x_decline_selection_request (event)
struct input_event *event;
{
- XSelectionEvent reply;
+ XEvent reply_base;
+ XSelectionEvent *reply = &(reply_base.xselection);
- reply.type = SelectionNotify;
- reply.display = SELECTION_EVENT_DISPLAY (event);
- reply.requestor = SELECTION_EVENT_REQUESTOR (event);
- reply.selection = SELECTION_EVENT_SELECTION (event);
- reply.time = SELECTION_EVENT_TIME (event);
- reply.target = SELECTION_EVENT_TARGET (event);
- reply.property = None;
+ reply->type = SelectionNotify;
+ reply->display = SELECTION_EVENT_DISPLAY (event);
+ reply->requestor = SELECTION_EVENT_REQUESTOR (event);
+ reply->selection = SELECTION_EVENT_SELECTION (event);
+ reply->time = SELECTION_EVENT_TIME (event);
+ reply->target = SELECTION_EVENT_TARGET (event);
+ reply->property = None;
/* The reason for the error may be that the receiver has
died in the meantime. Handle that case. */
BLOCK_INPUT;
- x_catch_errors (reply.display);
- XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply);
- XFlush (reply.display);
+ x_catch_errors (reply->display);
+ XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base);
+ XFlush (reply->display);
x_uncatch_errors ();
UNBLOCK_INPUT;
}
unsigned char *data;
Atom type;
{
- XSelectionEvent reply;
+ XEvent reply_base;
+ XSelectionEvent *reply = &(reply_base.xselection);
Display *display = SELECTION_EVENT_DISPLAY (event);
Window window = SELECTION_EVENT_REQUESTOR (event);
int bytes_remaining;
if (max_bytes > MAX_SELECTION_QUANTUM)
max_bytes = MAX_SELECTION_QUANTUM;
- reply.type = SelectionNotify;
- reply.display = display;
- reply.requestor = window;
- reply.selection = SELECTION_EVENT_SELECTION (event);
- reply.time = SELECTION_EVENT_TIME (event);
- reply.target = SELECTION_EVENT_TARGET (event);
- reply.property = SELECTION_EVENT_PROPERTY (event);
- if (reply.property == None)
- reply.property = reply.target;
+ reply->type = SelectionNotify;
+ reply->display = display;
+ reply->requestor = window;
+ reply->selection = SELECTION_EVENT_SELECTION (event);
+ reply->time = SELECTION_EVENT_TIME (event);
+ reply->target = SELECTION_EVENT_TARGET (event);
+ reply->property = SELECTION_EVENT_PROPERTY (event);
+ if (reply->property == None)
+ reply->property = reply->target;
BLOCK_INPUT;
/* The protected block contains wait_for_property_change, which can
#ifdef TRACE_SELECTION
{
- char *sel = XGetAtomName (display, reply.selection);
- char *tgt = XGetAtomName (display, reply.target);
+ char *sel = XGetAtomName (display, reply->selection);
+ char *tgt = XGetAtomName (display, reply->target);
TRACE3 ("%s, target %s (%d)", sel, tgt, ++x_reply_selection_request_cnt);
if (sel) XFree (sel);
if (tgt) XFree (tgt);
{
/* Send all the data at once, with minimal handshaking. */
TRACE1 ("Sending all %d bytes", bytes_remaining);
- XChangeProperty (display, window, reply.property, type, format,
+ XChangeProperty (display, window, reply->property, type, format,
PropModeReplace, data, size);
/* At this point, the selection was successfully stored; ack it. */
- XSendEvent (display, window, False, 0L, (XEvent *) &reply);
+ XSendEvent (display, window, False, 0L, &reply_base);
}
else
{
error ("Attempt to transfer an INCR to ourself!");
TRACE2 ("Start sending %d bytes incrementally (%s)",
- bytes_remaining, XGetAtomName (display, reply.property));
- wait_object = expect_property_change (display, window, reply.property,
+ bytes_remaining, XGetAtomName (display, reply->property));
+ wait_object = expect_property_change (display, window, reply->property,
PropertyDelete);
TRACE1 ("Set %s to number of bytes to send",
- XGetAtomName (display, reply.property));
+ XGetAtomName (display, reply->property));
{
/* XChangeProperty expects an array of long even if long is more than
32 bits. */
long value[1];
value[0] = bytes_remaining;
- XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR,
+ XChangeProperty (display, window, reply->property, dpyinfo->Xatom_INCR,
32, PropModeReplace,
(unsigned char *) value, 1);
}
/* Tell 'em the INCR data is there... */
TRACE0 ("Send SelectionNotify event");
- XSendEvent (display, window, False, 0L, (XEvent *) &reply);
+ XSendEvent (display, window, False, 0L, &reply_base);
XFlush (display);
had_errors = x_had_errors_p (display);
if (! had_errors)
{
TRACE1 ("Waiting for ACK (deletion of %s)",
- XGetAtomName (display, reply.property));
+ XGetAtomName (display, reply->property));
wait_for_property_change (wait_object);
}
else
BLOCK_INPUT;
wait_object
- = expect_property_change (display, window, reply.property,
+ = expect_property_change (display, window, reply->property,
PropertyDelete);
TRACE1 ("Sending increment of %d elements", i);
TRACE1 ("Set %s to increment data",
- XGetAtomName (display, reply.property));
+ XGetAtomName (display, reply->property));
/* Append the next chunk of data to the property. */
- XChangeProperty (display, window, reply.property, type, format,
+ XChangeProperty (display, window, reply->property, type, format,
PropModeAppend, data, i);
bytes_remaining -= i * format_bytes;
if (format == 32)
/* Now wait for the requester to ack this chunk by deleting the
property. This can run random lisp code or signal. */
TRACE1 ("Waiting for increment ACK (deletion of %s)",
- XGetAtomName (display, reply.property));
+ XGetAtomName (display, reply->property));
wait_for_property_change (wait_object);
}
XSelectInput (display, window, 0L);
TRACE1 ("Set %s to a 0-length chunk to indicate EOF",
- XGetAtomName (display, reply.property));
- XChangeProperty (display, window, reply.property, type, format,
+ XGetAtomName (display, reply->property));
+ XChangeProperty (display, window, reply->property, type, format,
PropModeReplace, data, 0);
TRACE0 ("Done sending incrementally");
}