Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tkSelect.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /* | |
2 * tkSelect.h -- | |
3 * | |
4 * Declarations of types shared among the files that implement selection | |
5 * support. | |
6 * | |
7 * Copyright (c) 1995 Sun Microsystems, Inc. | |
8 * | |
9 * See the file "license.terms" for information on usage and redistribution of | |
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
11 */ | |
12 | |
13 #ifndef _TKSELECT | |
14 #define _TKSELECT | |
15 | |
16 /* | |
17 * When a selection is owned by a window on a given display, one of the | |
18 * following structures is present on a list of current selections in the | |
19 * display structure. The structure is used to record the current owner of a | |
20 * selection for use in later retrieval requests. There is a list of such | |
21 * structures because a display can have multiple different selections active | |
22 * at the same time. | |
23 */ | |
24 | |
25 typedef struct TkSelectionInfo { | |
26 Atom selection; /* Selection name, e.g. XA_PRIMARY. */ | |
27 Tk_Window owner; /* Current owner of this selection. */ | |
28 int serial; /* Serial number of last XSelectionSetOwner | |
29 * request made to server for this selection | |
30 * (used to filter out redundant | |
31 * SelectionClear events). */ | |
32 Time time; /* Timestamp used to acquire selection. */ | |
33 Tk_LostSelProc *clearProc; /* Procedure to call when owner loses | |
34 * selection. */ | |
35 ClientData clearData; /* Info to pass to clearProc. */ | |
36 struct TkSelectionInfo *nextPtr; | |
37 /* Next in list of current selections on this | |
38 * display. NULL means end of list. */ | |
39 } TkSelectionInfo; | |
40 | |
41 /* | |
42 * One of the following structures exists for each selection handler created | |
43 * for a window by calling Tk_CreateSelHandler. The handlers are linked in a | |
44 * list rooted in the TkWindow structure. | |
45 */ | |
46 | |
47 typedef struct TkSelHandler { | |
48 Atom selection; /* Selection name, e.g. XA_PRIMARY. */ | |
49 Atom target; /* Target type for selection conversion, such | |
50 * as TARGETS or STRING. */ | |
51 Atom format; /* Format in which selection info will be | |
52 * returned, such as STRING or ATOM. */ | |
53 Tk_SelectionProc *proc; /* Procedure to generate selection in this | |
54 * format. */ | |
55 ClientData clientData; /* Argument to pass to proc. */ | |
56 int size; /* Size of units returned by proc (8 for | |
57 * STRING, 32 for almost anything else). */ | |
58 struct TkSelHandler *nextPtr; | |
59 /* Next selection handler associated with same | |
60 * window (NULL for end of list). */ | |
61 } TkSelHandler; | |
62 | |
63 /* | |
64 * When the selection is being retrieved, one of the following structures is | |
65 * present on a list of pending selection retrievals. The structure is used to | |
66 * communicate between the background procedure that requests the selection | |
67 * and the foreground event handler that processes the events in which the | |
68 * selection is returned. There is a list of such structures so that there can | |
69 * be multiple simultaneous selection retrievals (e.g. on different displays). | |
70 */ | |
71 | |
72 typedef struct TkSelRetrievalInfo { | |
73 Tcl_Interp *interp; /* Interpreter for error reporting. */ | |
74 TkWindow *winPtr; /* Window used as requestor for selection. */ | |
75 Atom selection; /* Selection being requested. */ | |
76 Atom property; /* Property where selection will appear. */ | |
77 Atom target; /* Desired form for selection. */ | |
78 Tk_GetSelProc *proc; /* Procedure to call to handle pieces of | |
79 * selection. */ | |
80 ClientData clientData; /* Argument for proc. */ | |
81 int result; /* Initially -1. Set to a Tcl return value | |
82 * once the selection has been retrieved. */ | |
83 Tcl_TimerToken timeout; /* Token for current timeout procedure. */ | |
84 int idleTime; /* Number of seconds that have gone by without | |
85 * hearing anything from the selection | |
86 * owner. */ | |
87 Tcl_EncodingState encState; /* Holds intermediate state during translations | |
88 * of data that cross buffer boundaries. */ | |
89 int encFlags; /* Encoding translation state flags. */ | |
90 Tcl_DString buf; /* Buffer to hold translation data. */ | |
91 struct TkSelRetrievalInfo *nextPtr; | |
92 /* Next in list of all pending selection | |
93 * retrievals. NULL means end of list. */ | |
94 } TkSelRetrievalInfo; | |
95 | |
96 /* | |
97 * The clipboard contains a list of buffers of various types and formats. All | |
98 * of the buffers of a given type will be returned in sequence when the | |
99 * CLIPBOARD selection is retrieved. All buffers of a given type on the same | |
100 * clipboard must have the same format. The TkClipboardTarget structure is | |
101 * used to record the information about a chain of buffers of the same type. | |
102 */ | |
103 | |
104 typedef struct TkClipboardBuffer { | |
105 char *buffer; /* Null terminated data buffer. */ | |
106 long length; /* Length of string in buffer. */ | |
107 struct TkClipboardBuffer *nextPtr; | |
108 /* Next in list of buffers. NULL means end of | |
109 * list . */ | |
110 } TkClipboardBuffer; | |
111 | |
112 typedef struct TkClipboardTarget { | |
113 Atom type; /* Type conversion supported. */ | |
114 Atom format; /* Representation used for data. */ | |
115 TkClipboardBuffer *firstBufferPtr; | |
116 /* First in list of data buffers. */ | |
117 TkClipboardBuffer *lastBufferPtr; | |
118 /* Last in list of clipboard buffers. Used to | |
119 * speed up appends. */ | |
120 struct TkClipboardTarget *nextPtr; | |
121 /* Next in list of targets on clipboard. NULL | |
122 * means end of list. */ | |
123 } TkClipboardTarget; | |
124 | |
125 /* | |
126 * It is possible for a Tk_SelectionProc to delete the handler that it | |
127 * represents. If this happens, the code that is retrieving the selection | |
128 * needs to know about it so it doesn't use the now-defunct handler structure. | |
129 * One structure of the following form is created for each retrieval in | |
130 * progress, so that the retriever can find out if its handler is deleted. All | |
131 * of the pending retrievals (if there are more than one) are linked into a | |
132 * list. | |
133 */ | |
134 | |
135 typedef struct TkSelInProgress { | |
136 TkSelHandler *selPtr; /* Handler being executed. If this handler is | |
137 * deleted, the field is set to NULL. */ | |
138 struct TkSelInProgress *nextPtr; | |
139 /* Next higher nested search. */ | |
140 } TkSelInProgress; | |
141 | |
142 /* | |
143 * Chunk size for retrieving selection. It's defined both in words and in | |
144 * bytes; the word size is used to allocate buffer space that's guaranteed to | |
145 * be word-aligned and that has an extra character for the terminating NULL. | |
146 */ | |
147 | |
148 #define TK_SEL_BYTES_AT_ONCE 4000 | |
149 #define TK_SEL_WORDS_AT_ONCE 1001 | |
150 | |
151 /* | |
152 * Declarations for procedures that are used by the selection-related files | |
153 * but shouldn't be used anywhere else in Tk (or by Tk clients): | |
154 */ | |
155 | |
156 MODULE_SCOPE TkSelInProgress *TkSelGetInProgress(void); | |
157 MODULE_SCOPE void TkSelSetInProgress(TkSelInProgress *pendingPtr); | |
158 MODULE_SCOPE void TkSelClearSelection(Tk_Window tkwin, XEvent *eventPtr); | |
159 MODULE_SCOPE int TkSelDefaultSelection(TkSelectionInfo *infoPtr, | |
160 Atom target, char *buffer, int maxBytes, | |
161 Atom *typePtr); | |
162 #ifndef TkSelUpdateClipboard | |
163 MODULE_SCOPE void TkSelUpdateClipboard(TkWindow *winPtr, | |
164 TkClipboardTarget *targetPtr); | |
165 #endif | |
166 | |
167 #endif /* _TKSELECT */ |