
Example 18-4. Sample reply procedure
–
SelectionReplyProc (continued)
if (target == ATOM(server, "STRING")) {
static int incr = False;
if (type == ATOM(server, "INCR")) {
textsw_insert(textsw, "Contents of the selection:\n", 27);
incr = True;
}
else
if (length) {
if (!incr)
textsw_insert(textsw, "Contents of the selection:\n", 27);
textsw_insert(textsw, (char *)value, length);
textsw_insert(textsw, "\n", 1);
}
else
incr = False;
}
else
if (target == ATOM(server, "DELETE")) {
textsw_insert(textsw, "The Selection has been deleted\n", 31);
}
textsw_insert(textsw, LINE, strlen(LINE));
}
18.2.5.1 Handling selection reply procedure errors
If the selection conversion fails, and you are using a non-blocking request, the reply proce-
dure is called with replyValue set to an error code and length set to SEL_ERROR. The reply
procedure error codes are defined in sel_pkg.h and shown in Table 18-2.
If the selection conversion fails, and you are using a blocking request without a reply proce-
dure defined, the xv_get() returns with the length argument set to SEL_ERROR, format set
to 0, and a NULL value is returned. If a reply procedure is defined, its replyValue argument is
set to one of the error codes shown in Table 18-2.
Table 18-2. Error Codes
Code Description
SEL_BAD_CONVERSION If the conversion is refused by the selection holder or there
is no holder of the selection, this value is returned. This
may mean that there is no