# HG changeset patch # User Kim F. Storm # Date 1100006818 0 # Node ID b32fa5b7492d5c4079903e014cc2cf787035fd49 # Parent fbc455eba14e8dd512dabfda1361a22e059e96e6 Include and (for getpid). Fix various comments referring to XEvents instead of input events. (x_queue_event): Fix format strings. (x_stop_queuing_selection_requests): Likewise. diff -r fbc455eba14e -r b32fa5b7492d src/xselect.c --- a/src/xselect.c Tue Nov 09 13:26:01 2004 +0000 +++ b/src/xselect.c Tue Nov 09 13:26:58 2004 +0000 @@ -24,6 +24,14 @@ #include #include /* termhooks.h needs this */ + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + #include "lisp.h" #include "xterm.h" /* for all of the X includes */ #include "dispextern.h" /* frame.h seems to want this */ @@ -174,7 +182,8 @@ -/* Define a queue to save up SelectionRequest events for later handling. */ +/* Define a queue to save up SELECTION_REQUEST_EVENT events for later + handling. */ struct selection_event_queue { @@ -184,11 +193,11 @@ static struct selection_event_queue *selection_queue; -/* Nonzero means queue up certain events--don't process them yet. */ +/* Nonzero means queue up SELECTION_REQUEST_EVENT events. */ static int x_queue_selection_requests; -/* Queue up an X event *EVENT, to be processed later. */ +/* Queue up an SELECTION_REQUEST_EVENT *EVENT, to be processed later. */ static void x_queue_event (event) @@ -196,12 +205,14 @@ { struct selection_event_queue *queue_tmp; - /* Don't queue repeated requests */ + /* Don't queue repeated requests. + This only happens for large requests which uses the incremental protocol. */ for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next) { if (!bcmp (&queue_tmp->event, event, sizeof (*event))) { - TRACE1 ("IGNORE DUP SELECTION EVENT %08x", (unsigned long)queue_tmp); + TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp); + x_decline_selection_request (event); return; } } @@ -211,14 +222,14 @@ if (queue_tmp != NULL) { - TRACE1 ("QUEUE SELECTION EVENT %08x", (unsigned long)queue_tmp); + TRACE1 ("QUEUE SELECTION EVENT %08lx", (unsigned long)queue_tmp); queue_tmp->event = *event; queue_tmp->next = selection_queue; selection_queue = queue_tmp; } } -/* Start queuing SelectionRequest events. */ +/* Start queuing SELECTION_REQUEST_EVENT events. */ static void x_start_queuing_selection_requests () @@ -230,7 +241,7 @@ TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests); } -/* Stop queuing SelectionRequest events. */ +/* Stop queuing SELECTION_REQUEST_EVENT events. */ static void x_stop_queuing_selection_requests () @@ -244,7 +255,7 @@ while (selection_queue != NULL) { struct selection_event_queue *queue_tmp = selection_queue; - TRACE1 ("RESTORE SELECTION EVENT %08x", (unsigned long)queue_tmp); + TRACE1 ("RESTORE SELECTION EVENT %08lx", (unsigned long)queue_tmp); kbd_buffer_unget_event (&queue_tmp->event); selection_queue = queue_tmp->next; xfree ((char *)queue_tmp); @@ -869,7 +880,9 @@ struct x_display_info *dpyinfo = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event)); - TRACE0 ("x_handle_selection_request"); + TRACE2 ("x_handle_selection_request, from=0x%08lx time=%lu", + (unsigned long) SELECTION_EVENT_REQUESTOR (event), + (unsigned long) SELECTION_EVENT_TIME (event)); local_selection_data = Qnil; target_symbol = Qnil;