diff options
| author | Richard M. Stallman | 1994-07-27 00:12:34 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-07-27 00:12:34 +0000 |
| commit | 09756a8501b8b543b59ba30eef1f3f3cfc835499 (patch) | |
| tree | 6fc83f9d9f99f482819b655110b409a02668cba2 /src | |
| parent | 11c05cd6a8558f56a79ea0ba7f323321fa66fb5d (diff) | |
| download | emacs-09756a8501b8b543b59ba30eef1f3f3cfc835499.tar.gz emacs-09756a8501b8b543b59ba30eef1f3f3cfc835499.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 94 |
1 files changed, 79 insertions, 15 deletions
diff --git a/src/xterm.c b/src/xterm.c index 5501f563819..d2b26b9e79e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3333,7 +3333,68 @@ process_expose_from_menu (event) | |||
| 3333 | 3333 | ||
| 3334 | UNBLOCK_INPUT; | 3334 | UNBLOCK_INPUT; |
| 3335 | } | 3335 | } |
| 3336 | |||
| 3337 | /* Define a queue to save up SelectionRequest events for later handling. */ | ||
| 3338 | |||
| 3339 | struct selection_event_queue | ||
| 3340 | { | ||
| 3341 | XEvent event; | ||
| 3342 | struct selection_event_queue *next; | ||
| 3343 | }; | ||
| 3344 | |||
| 3345 | static struct selection_event_queue *queue; | ||
| 3346 | |||
| 3347 | /* Nonzero means queue up certain events--don't process them yet. */ | ||
| 3348 | static int x_queue_selection_requests; | ||
| 3349 | |||
| 3350 | /* Queue up an X event *EVENT, to be processed later. */ | ||
| 3336 | 3351 | ||
| 3352 | static void | ||
| 3353 | x_queue_event (event) | ||
| 3354 | XEvent *event; | ||
| 3355 | { | ||
| 3356 | struct selection_event_queue *queue_tmp | ||
| 3357 | = (struct selection_event_queue *) malloc (sizeof (struct selection_event_queue)); | ||
| 3358 | |||
| 3359 | if (queue_tmp != NULL) | ||
| 3360 | { | ||
| 3361 | queue_tmp->event = *event; | ||
| 3362 | queue_tmp->next = queue; | ||
| 3363 | queue = queue_tmp; | ||
| 3364 | } | ||
| 3365 | } | ||
| 3366 | |||
| 3367 | /* Take all the queued events and put them back | ||
| 3368 | so that they get processed afresh. */ | ||
| 3369 | |||
| 3370 | static void | ||
| 3371 | x_unqueue_events () | ||
| 3372 | { | ||
| 3373 | while (queue != NULL) | ||
| 3374 | { | ||
| 3375 | struct selection_event_queue *queue_tmp = queue; | ||
| 3376 | XPutBackEvent (XDISPLAY &queue_tmp->event); | ||
| 3377 | queue = queue_tmp->next; | ||
| 3378 | free ((char *)queue_tmp); | ||
| 3379 | } | ||
| 3380 | } | ||
| 3381 | |||
| 3382 | /* Start queuing SelectionRequest events. */ | ||
| 3383 | |||
| 3384 | void | ||
| 3385 | x_start_queuing_selection_requests () | ||
| 3386 | { | ||
| 3387 | x_queue_selection_requests++; | ||
| 3388 | } | ||
| 3389 | |||
| 3390 | /* Stop queuing SelectionRequest events. */ | ||
| 3391 | |||
| 3392 | void | ||
| 3393 | x_stop_queuing_selection_requests () | ||
| 3394 | { | ||
| 3395 | x_queue_selection_requests--; | ||
| 3396 | x_unqueue_events (); | ||
| 3397 | } | ||
| 3337 | 3398 | ||
| 3338 | /* The main X event-reading loop - XTread_socket. */ | 3399 | /* The main X event-reading loop - XTread_socket. */ |
| 3339 | 3400 | ||
| @@ -3564,24 +3625,27 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 3564 | if (!x_window_to_frame (event.xselectionrequest.owner)) | 3625 | if (!x_window_to_frame (event.xselectionrequest.owner)) |
| 3565 | goto OTHER; | 3626 | goto OTHER; |
| 3566 | #endif /* USE_X_TOOLKIT */ | 3627 | #endif /* USE_X_TOOLKIT */ |
| 3567 | { | 3628 | if (x_queue_selection_requests) |
| 3568 | XSelectionRequestEvent *eventp = (XSelectionRequestEvent *) &event; | 3629 | x_queue_event (&event); |
| 3630 | else | ||
| 3631 | { | ||
| 3632 | XSelectionRequestEvent *eventp = (XSelectionRequestEvent *) &event; | ||
| 3569 | 3633 | ||
| 3570 | if (numchars == 0) | 3634 | if (numchars == 0) |
| 3571 | abort (); | 3635 | abort (); |
| 3572 | 3636 | ||
| 3573 | bufp->kind = selection_request_event; | 3637 | bufp->kind = selection_request_event; |
| 3574 | SELECTION_EVENT_DISPLAY (bufp) = eventp->display; | 3638 | SELECTION_EVENT_DISPLAY (bufp) = eventp->display; |
| 3575 | SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; | 3639 | SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; |
| 3576 | SELECTION_EVENT_SELECTION (bufp) = eventp->selection; | 3640 | SELECTION_EVENT_SELECTION (bufp) = eventp->selection; |
| 3577 | SELECTION_EVENT_TARGET (bufp) = eventp->target; | 3641 | SELECTION_EVENT_TARGET (bufp) = eventp->target; |
| 3578 | SELECTION_EVENT_PROPERTY (bufp) = eventp->property; | 3642 | SELECTION_EVENT_PROPERTY (bufp) = eventp->property; |
| 3579 | SELECTION_EVENT_TIME (bufp) = eventp->time; | 3643 | SELECTION_EVENT_TIME (bufp) = eventp->time; |
| 3580 | bufp++; | 3644 | bufp++; |
| 3581 | 3645 | ||
| 3582 | count += 1; | 3646 | count += 1; |
| 3583 | numchars -= 1; | 3647 | numchars -= 1; |
| 3584 | } | 3648 | } |
| 3585 | break; | 3649 | break; |
| 3586 | 3650 | ||
| 3587 | case PropertyNotify: | 3651 | case PropertyNotify: |