]> cvs.zerfleddert.de Git - micropolis/blob - src/tk/tkint.h
target "all" should be phony
[micropolis] / src / tk / tkint.h
1 /*
2 * tkInt.h --
3 *
4 * Declarations for things used internally by the Tk
5 * procedures but not exported outside the module.
6 *
7 * Copyright 1990-1992 Regents of the University of California.
8 * Permission to use, copy, modify, and distribute this
9 * software and its documentation for any purpose and without
10 * fee is hereby granted, provided that the above copyright
11 * notice appear in all copies. The University of California
12 * makes no representations about the suitability of this
13 * software for any purpose. It is provided "as is" without
14 * express or implied warranty.
15 *
16 * $Header: /user6/ouster/wish/RCS/tkInt.h,v 1.65 92/08/21 11:42:27 ouster Exp $ SPRITE (Berkeley)
17 */
18
19 #ifndef _TKINT
20 #define _TKINT
21
22 #ifndef _XLIB_H_
23 #include <X11/Xlib.h>
24 #ifdef IS_LINUX
25 #include <X11/Xlibint.h>
26 #endif
27 #endif
28 #ifndef _XUTIL_H
29 #include <X11/Xutil.h>
30 #endif
31 #ifndef _TK
32 #include "tk.h"
33 #endif
34 #ifndef _TCL
35 #include "tcl.h"
36 #endif
37 #ifndef _TCLHASH
38 #include "tclhash.h"
39 #endif
40
41 #define META_MASK (AnyModifier<<1)
42 #define ALT_MASK (AnyModifier<<2)
43
44 #define ALL_BUTTONS \
45 (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
46
47 /*
48 * One of the following structures is maintained for each display
49 * containing a window managed by Tk:
50 */
51
52 typedef struct TkDisplay {
53 Display *display; /* Xlib's info about display. */
54 struct TkDisplay *nextPtr; /* Next in list of all displays. */
55 char *name; /* Name of display (with any screen
56 * identifier removed). Malloc-ed. */
57 Time lastEventTime; /* Time of last event received for this
58 * display. */
59
60 /*
61 * Information used by tkEvent.c only:
62 */
63
64 struct TkWindow *mouseMainPtr;
65 /* Pointer to the main window of this
66 * display that currently contains the
67 * mouse pointer. NULL means the pointer
68 * isn't in a main window managed by
69 * this process. */
70
71 /*
72 * Information used by tkBind.c only:
73 */
74
75 int firstKeycode; /* First keycode supported by
76 * display. */
77 int lastKeycode; /* Last keycode supported by
78 * display. */
79 int symsPerCode; /* Number of KeySyms in "keySyms"
80 * for each keycode. 0 means the
81 * keysym information hasn't been
82 * retrieved from the server yet. */
83 KeySym *keySyms; /* Array of KeySyms, returned by
84 * XGetKeyboardMapping. */
85 unsigned int modeModMask;
86 unsigned int metaModMask;
87 unsigned int altModMask;
88
89 /*
90 * Information used by tkError.c only:
91 */
92
93 struct TkErrorHandler *errorPtr;
94 /* First in list of error handlers
95 * for this display. NULL means
96 * no handlers exist at present. */
97 int deleteCount; /* Counts # of handlers deleted since
98 * last time inactive handlers were
99 * garbage-collected. When this number
100 * gets big, handlers get cleaned up. */
101
102 /*
103 * Information used by tkSend.c only:
104 */
105
106 Tk_Window commWindow; /* Window used for communication
107 * between interpreters during "send"
108 * commands. NULL means send info hasn't
109 * been initialized yet. */
110 Atom commProperty; /* X's name for comm property. */
111 Atom registryProperty; /* X's name for property containing
112 * registry of interpreter names. */
113
114 /*
115 * Information used by tkSelect.c only:
116 */
117
118 Tk_Window selectionOwner; /* Current owner of selection, or
119 * NULL if selection isn't owned by
120 * a window in this process. */
121 int selectionSerial; /* Serial number of last XSelectionSetOwner
122 * request we made to server (used to
123 * filter out redundant SelectionClear
124 * events. */
125 Time selectionTime; /* Timestamp used to acquire selection. */
126 Atom multipleAtom; /* Atom for MULTIPLE. None means
127 * selection stuff isn't initialized. */
128 Atom incrAtom; /* Atom for INCR. */
129 Atom targetsAtom; /* Atom for TARGETS. */
130 Atom timestampAtom; /* Atom for TIMESTAMP. */
131 Atom textAtom; /* Atom for TEXT. */
132 Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
133
134 /*
135 * Information used by tkAtom.c only:
136 */
137
138 int atomInit; /* 0 means stuff below hasn't been
139 * initialized yet. */
140 Tcl_HashTable nameTable; /* Maps from names to Atom's. */
141 Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
142
143 /*
144 * Information used by tkCursor.c only:
145 */
146
147 Font cursorFont; /* Font to use for standard cursors.
148 * None means font not loaded yet. */
149
150 /*
151 * Information used by tkGrab.c only:
152 */
153
154 struct TkWindow *grabWinPtr;
155 /* Window in which the pointer is currently
156 * grabbed, or NULL if none. */
157 struct TkWindow *ungrabWinPtr;
158 /* Window to which pointer should be returned
159 * when the current grab ends (i.e. the
160 * window that the mouse is really on top
161 * of). */
162 struct TkWindow *buttonWinPtr;
163 /* Window in which first mouse button was
164 * pressed while grab was in effect, or NULL
165 * if no such press in effect. */
166 struct TkWindow *pointerWinPtr;
167 /* The window that officially contains the
168 * pointer, as far as this application is
169 * concerned. If a grab is in effect then
170 * this may not be the window that's underneath
171 * the pointer. NULL means the application
172 * doesn't consider the pointer to be in any
173 * window. */
174 struct TkWindow *serverWinPtr;
175 /* The window that contains the pointer, as
176 * far as the X server is concerned. This
177 * field gets set on every Enter or Leave
178 * event even if the grab code eventually
179 * discards the event. NULL means the server
180 * thinks the pointer is outside any window
181 * of any application on this screen. */
182 int grabFlags; /* Miscellaneous flag values. See definitions
183 * in tkGrab.c. */
184 /* XXX: FOCUS */
185 struct TkWindow *focusPtr; /* Identifies window that currently has the
186 * focus (or that will get the focus the next
187 * time the pointer enters any of the top-level
188 * windows associated with this display).
189 * NULL means nobody has the focus.
190 * Managed by tkEvent.c. */
191 } TkDisplay;
192
193 /*
194 * One of the following structures exists for each error handler
195 * created by a call to Tk_CreateErrorHandler. The structure
196 * is managed by tkError.c.
197 */
198
199 typedef struct TkErrorHandler {
200 TkDisplay *dispPtr; /* Display to which handler applies. */
201 unsigned long firstRequest; /* Only errors with serial numbers
202 * >= to this are considered. */
203 unsigned long lastRequest; /* Only errors with serial numbers
204 * <= to this are considered. This
205 * field is filled in when XUnhandle
206 * is called. -1 means XUnhandle
207 * hasn't been called yet. */
208 int error; /* Consider only errors with this
209 * error_code (-1 means consider
210 * all errors). */
211 int request; /* Consider only errors with this
212 * major request code (-1 means
213 * consider all major codes). */
214 int minorCode; /* Consider only errors with this
215 * minor request code (-1 means
216 * consider all minor codes). */
217 Tk_ErrorProc *errorProc; /* Procedure to invoke when a matching
218 * error occurs. NULL means just ignore
219 * errors. */
220 ClientData clientData; /* Arbitrary value to pass to
221 * errorProc. */
222 struct TkErrorHandler *nextPtr;
223 /* Pointer to next older handler for
224 * this display, or NULL for end of
225 * list. */
226 } TkErrorHandler;
227
228 /*
229 * One of the following structures exists for each event handler
230 * created by calling Tk_CreateEventHandler. This information
231 * is used by tkEvent.c only.
232 */
233
234 typedef struct TkEventHandler {
235 unsigned long mask; /* Events for which to invoke
236 * proc. */
237 Tk_EventProc *proc; /* Procedure to invoke when an event
238 * in mask occurs. */
239 ClientData clientData; /* Argument to pass to proc. */
240 struct TkEventHandler *nextPtr;
241 /* Next in list of handlers
242 * associated with window (NULL means
243 * end of list). */
244 } TkEventHandler;
245
246 /*
247 * One of the following structures exists for each selection
248 * handler created by calling Tk_CreateSelHandler. This
249 * information is used by tkSelect.c only.
250 */
251
252 typedef struct TkSelHandler {
253 Atom target; /* Target type for selection
254 * conversion, such as TARGETS or
255 * STRING. */
256 Atom format; /* Format in which selection
257 * info will be returned, such
258 * as STRING or ATOM. */
259 Tk_SelectionProc *proc; /* Procedure to generate selection
260 * in this format. */
261 ClientData clientData; /* Argument to pass to proc. */
262 int size; /* Size of units returned by proc
263 * (8 for STRING, 32 for almost
264 * anything else). */
265 struct TkSelHandler *nextPtr;
266 /* Next selection handler associated
267 * with same window (NULL for end of
268 * list). */
269 } TkSelHandler;
270
271 /*
272 * Tk keeps one of the following data structures for each main
273 * window (created by a call to Tk_CreateMainWindow). It stores
274 * information that is shared by all of the windows associated
275 * with a particular main window.
276 */
277
278 typedef struct TkMainInfo {
279 struct TkWindow *winPtr; /* Pointer to main window. */
280 Tcl_Interp *interp; /* Interpreter associated with application. */
281 Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow
282 * structs for all windows related to this
283 * main window. Managed by tkWindow.c. */
284 Tk_BindingTable bindingTable;
285 /* Used in conjunction with "bind" command
286 * to bind events to Tcl commands. */
287 /* XXX: FOCUS */
288 /* struct TkWindow *focusPtr; */ /* Identifies window that currently has the
289 * focus (or that will get the focus the next
290 * time the pointer enters any of the top-level
291 * windows associated with this display).
292 * NULL means nobody has the focus.
293 * Managed by tkEvent.c. */
294 struct ElArray *optionRootPtr;
295 /* Top level of option hierarchy for this
296 * main window. NULL means uninitialized.
297 * Managed by tkOption.c. */
298 } TkMainInfo;
299
300 /*
301 * Tk keeps one of the following structures for each window.
302 * Some of the information (like size and location) is a shadow
303 * of information managed by the X server, and some is special
304 * information used here, such as event and geometry management
305 * information. This information is (mostly) managed by tkWindow.c.
306 * WARNING: the declaration below must be kept consistent with the
307 * Tk_ClientWindow structure in tk.h. If you change one, be sure to
308 * change the other!!
309 */
310
311 typedef struct TkWindow {
312
313 /*
314 * Structural information:
315 */
316
317 Display *display; /* Display containing window. */
318 TkDisplay *dispPtr; /* Tk's information about display
319 * for window. */
320 int screenNum; /* Index of screen for window, among all
321 * those for dispPtr. */
322 Window window; /* X's id for window. NULL means window
323 * hasn't actually been created yet, or it's
324 * been deleted. */
325 struct TkWindow *childList; /* First in list of child windows,
326 * or NULL if no children. */
327 struct TkWindow *parentPtr; /* Pointer to parent window (logical
328 * parent, not necessarily X parent), or
329 * NULL if this is a main window. */
330 struct TkWindow *nextPtr; /* Next in list of children with
331 * same parent (NULL if end of
332 * list). */
333 TkMainInfo *mainPtr; /* Information shared by all windows
334 * associated with a particular main
335 * window. NULL means this window is
336 * a rogue that isn't associated with
337 * any application (at present, there
338 * should never be any rogues). */
339
340 /*
341 * Name and type information for the window:
342 */
343
344 char *pathName; /* Path name of window (concatenation
345 * of all names between this window and
346 * its top-level ancestor). This is a
347 * pointer into an entry in
348 * mainPtr->nameTable or NULL if mainPtr
349 * is NULL. */
350 Tk_Uid nameUid; /* Name of the window within its parent
351 * (unique within the parent). */
352 Tk_Uid classUid; /* Class of the window. NULL means window
353 * hasn't been given a class yet. */
354
355 /*
356 * Geometry and other attributes of window. This information
357 * may not be updated on the server immediately; stuff that
358 * hasn't been reflected in the server yet is called "dirty".
359 * At present, information can be dirty only if the window
360 * hasn't yet been created.
361 */
362
363 XWindowChanges changes; /* Geometry and other info about
364 * window. */
365 unsigned int dirtyChanges; /* Bits indicate fields of "changes"
366 * that are dirty. */
367 XSetWindowAttributes atts; /* Current attributes of window. */
368 unsigned long dirtyAtts; /* Bits indicate fields of "atts"
369 * that are dirty. */
370
371 unsigned int flags; /* Various flag values: these are all
372 * defined in tk.h (confusing, but they're
373 * needed there for some query macros). */
374
375 /*
376 * Information kept by the event manager (tkEvent.c):
377 */
378
379 TkEventHandler *handlerList;/* First in list of event handlers
380 * declared for this window, or
381 * NULL if none. */
382 /*
383 * Information related to input focussing (tkEvent.c):
384 */
385
386 Tk_FocusProc *focusProc; /* Procedure to invoke when this window
387 * gets or loses the input focus. NULL
388 * means this window is not prepared to
389 * receive the focus. */
390 ClientData focusData; /* Arbitrary value to pass to focusProc. */
391
392 /*
393 * Information used by tkOption.c to manage options for the
394 * window.
395 */
396
397 int optionLevel; /* -1 means no option information is
398 * currently cached for this window.
399 * Otherwise this gives the level in
400 * the option stack at which info is
401 * cached. */
402 /*
403 * Information used by tkSelect.c to manage the selection.
404 */
405
406 TkSelHandler *selHandlerList;
407 /* First in list of handlers for
408 * returning the selection in various
409 * forms. */
410 Tk_LostSelProc *selClearProc;
411 ClientData selClearData; /* Info to pass to selClearProc. */
412
413 /*
414 * Information used by tkGeometry.c for geometry management.
415 */
416
417 Tk_GeometryProc *geomProc; /* Procedure to handle geometry
418 * requests (NULL means no window is
419 * unmanaged). */
420 ClientData geomData; /* Argument for geomProc. */
421 int reqWidth, reqHeight; /* Arguments from last call to
422 * Tk_GeometryRequest, or 0's if
423 * Tk_GeometryRequest hasn't been
424 * called. */
425 int internalBorderWidth; /* Width of internal border of window
426 * (0 means no internal border). Geom.
427 * mgr. should not place children on top
428 * of the border. */
429
430 /*
431 * Information maintained by tkWm.c for window manager communication.
432 */
433
434 struct TkWmInfo *wmInfoPtr; /* For top-level windows, points to
435 * structure with wm-related info (see
436 * tkWm.c). For other windows, this
437 * is NULL. */
438 } TkWindow;
439
440 /*
441 * The context below is used to map from an X window id to
442 * the TkWindow structure associated with the window.
443 */
444
445 extern XContext tkWindowContext;
446
447 /*
448 * Pointer to first entry in list of all displays currently known.
449 */
450
451 extern TkDisplay *tkDisplayList;
452
453 /*
454 * Flags passed to TkMeasureChars:
455 */
456
457 #define TK_WHOLE_WORDS 1
458 #define TK_AT_LEAST_ONE 2
459 #define TK_PARTIAL_OK 4
460 #define TK_NEWLINES_NOT_SPECIAL 8
461
462 /*
463 * Location of library directory containing Tk scripts. This value
464 * is put in the $tkLibrary variable for each application.
465 */
466
467 #ifndef TK_LIBRARY
468 #ifdef MSDOS
469 #define TK_LIBRARY "res/tk"
470 #else
471 #define TK_LIBRARY "/usr/local/lib/tk"
472 #endif
473 #endif
474
475 /*
476 * See tkShare.c for explanation of following disgusting variable:
477 */
478
479 extern XEvent *tkShareEventPtr;
480
481 /*
482 * Secret way to inhibit event collapsing. -deh
483 */
484
485 extern int tkCollapseMotion;
486
487 /*
488 * Secret way to break out to Tk_MainLoop. -deh
489 */
490
491 extern int tkMustExit;
492
493 /*
494 * Miscellaneous variables shared among Tk modules but not exported
495 * to the outside world:
496 */
497
498 extern Tk_Uid tkActiveUid;
499 extern Tk_Uid tkDisabledUid;
500 extern Tk_Uid tkNormalUid;
501
502 /*
503 * Internal procedures shared among Tk modules but not exported
504 * to the outside world:
505 */
506
507 extern int TkAreaToPolygon _ANSI_ARGS_((double *polyPtr,
508 int numPoints, double *rectPtr));
509 extern void TkBezierPoints _ANSI_ARGS_((double control[],
510 int numSteps, double *coordPtr));
511 extern void TkBindError _ANSI_ARGS_((Tcl_Interp *interp));
512 extern void TkBindEventProc _ANSI_ARGS_((TkWindow *winPtr,
513 XEvent *eventPtr));
514 extern Time TkCurrentTime _ANSI_ARGS_((TkDisplay *dispPtr));
515 extern int TkDeadAppCmd _ANSI_ARGS_((ClientData clientData,
516 Tcl_Interp *interp, int argc, char **argv));
517 extern void TkDisplayChars _ANSI_ARGS_((Display *display,
518 Drawable drawable, GC gc,
519 XFontStruct *fontStructPtr, char *string,
520 int numChars, int x, int y, int flags));
521 extern void TkEventDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
522 extern void TkFocusEventProc _ANSI_ARGS_((TkWindow *winPtr,
523 XEvent *eventPtr));
524 extern void TkGetButtPoints _ANSI_ARGS_((double p1[], double p2[],
525 double width, int project, double m1[],
526 double m2[]));
527 extern int TkGetInterpNames _ANSI_ARGS_((Tcl_Interp *interp,
528 Tk_Window tkwin));
529 extern int TkGetMiterPoints _ANSI_ARGS_((double p1[], double p2[],
530 double p3[], double width, double m1[],
531 double m2[]));
532 extern void TkGrabDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
533 extern int TkLineToArea _ANSI_ARGS_((double end1Ptr[2],
534 double end2Ptr[2], double rectPtr[4]));
535 extern double TkLineToPoint _ANSI_ARGS_((double end1Ptr[2],
536 double end2Ptr[2], double pointPtr[2]));
537 extern int TkMeasureChars _ANSI_ARGS_((XFontStruct *fontStructPtr,
538 char *source, int maxChars, int startX, int maxX,
539 int flags, int *nextXPtr));
540 extern void TkOptionDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
541 extern int TkOvalToArea _ANSI_ARGS_((double *ovalPtr,
542 double *rectPtr));
543 extern double TkOvalToPoint _ANSI_ARGS_((double ovalPtr[4],
544 double width, int filled, double pointPtr[2]));
545 extern int TkPointerEvent _ANSI_ARGS_((XEvent *eventPtr,
546 TkWindow *winPtr));
547 extern int TkPolygonToArea _ANSI_ARGS_((double *polyPtr,
548 int numPoints, double *rectPtr));
549 extern double TkPolygonToPoint _ANSI_ARGS_((double *polyPtr,
550 int numPoints, double *pointPtr));
551 extern void TkSelDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
552 extern void TkSelEventProc _ANSI_ARGS_((Tk_Window tkwin,
553 XEvent *eventPtr));
554 extern void TkSelPropProc _ANSI_ARGS_((XEvent *eventPtr));
555 extern void TkUnderlineChars _ANSI_ARGS_((Display *display,
556 Drawable drawable, GC gc,
557 XFontStruct *fontStructPtr, char *string,
558 int x, int y, int flags, int firstChar,
559 int lastChar));
560 extern void TkWmDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
561 extern int TkWmMapWindow _ANSI_ARGS_((TkWindow *winPtr));
562 extern void TkWmSetClass _ANSI_ARGS_((TkWindow *winPtr));
563 extern void TkWmNewWindow _ANSI_ARGS_((TkWindow *winPtr));
564
565 #endif /* _TKINT */
Impressum, Datenschutz