Mercurial > emacs
changeset 8353:525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
(x_start_queuing_selection_requests): New function.
(x_stop_queuing_selection_requests): New function.
(XTread_socket): Queue up SelectionRequest events sometimes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 27 Jul 1994 00:12:34 +0000 |
parents | 9e9987dda110 |
children | df850e171c61 |
files | src/xterm.c |
diffstat | 1 files changed, 83 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Tue Jul 26 21:31:13 1994 +0000 +++ b/src/xterm.c Wed Jul 27 00:12:34 1994 +0000 @@ -3333,7 +3333,68 @@ UNBLOCK_INPUT; } - + +/* Define a queue to save up SelectionRequest events for later handling. */ + +struct selection_event_queue + { + XEvent event; + struct selection_event_queue *next; + }; + +static struct selection_event_queue *queue; + +/* Nonzero means queue up certain events--don't process them yet. */ +static int x_queue_selection_requests; + +/* Queue up an X event *EVENT, to be processed later. */ + +static void +x_queue_event (event) + XEvent *event; +{ + struct selection_event_queue *queue_tmp + = (struct selection_event_queue *) malloc (sizeof (struct selection_event_queue)); + + if (queue_tmp != NULL) + { + queue_tmp->event = *event; + queue_tmp->next = queue; + queue = queue_tmp; + } +} + +/* Take all the queued events and put them back + so that they get processed afresh. */ + +static void +x_unqueue_events () +{ + while (queue != NULL) + { + struct selection_event_queue *queue_tmp = queue; + XPutBackEvent (XDISPLAY &queue_tmp->event); + queue = queue_tmp->next; + free ((char *)queue_tmp); + } +} + +/* Start queuing SelectionRequest events. */ + +void +x_start_queuing_selection_requests () +{ + x_queue_selection_requests++; +} + +/* Stop queuing SelectionRequest events. */ + +void +x_stop_queuing_selection_requests () +{ + x_queue_selection_requests--; + x_unqueue_events (); +} /* The main X event-reading loop - XTread_socket. */ @@ -3564,24 +3625,27 @@ if (!x_window_to_frame (event.xselectionrequest.owner)) goto OTHER; #endif /* USE_X_TOOLKIT */ - { - XSelectionRequestEvent *eventp = (XSelectionRequestEvent *) &event; - - if (numchars == 0) - abort (); - - bufp->kind = selection_request_event; - SELECTION_EVENT_DISPLAY (bufp) = eventp->display; - SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; - SELECTION_EVENT_SELECTION (bufp) = eventp->selection; - SELECTION_EVENT_TARGET (bufp) = eventp->target; - SELECTION_EVENT_PROPERTY (bufp) = eventp->property; - SELECTION_EVENT_TIME (bufp) = eventp->time; - bufp++; - - count += 1; - numchars -= 1; - } + if (x_queue_selection_requests) + x_queue_event (&event); + else + { + XSelectionRequestEvent *eventp = (XSelectionRequestEvent *) &event; + + if (numchars == 0) + abort (); + + bufp->kind = selection_request_event; + SELECTION_EVENT_DISPLAY (bufp) = eventp->display; + SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; + SELECTION_EVENT_SELECTION (bufp) = eventp->selection; + SELECTION_EVENT_TARGET (bufp) = eventp->target; + SELECTION_EVENT_PROPERTY (bufp) = eventp->property; + SELECTION_EVENT_TIME (bufp) = eventp->time; + bufp++; + + count += 1; + numchars -= 1; + } break; case PropertyNotify: