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