source: trunk/kitgen/8.x/blt/generic/bltWindow.c@ 176

Last change on this file since 176 was 175, checked in by demin, 12 years ago

initial commit

File size: 63.4 KB
Line 
1/*
2 * bltWindow.c --
3 *
4 * This module implements additional window functionality for
5 * the BLT toolkit, such as transparent Tk windows,
6 * and reparenting Tk windows.
7 *
8 * Copyright 1991-1998 Lucent Technologies, Inc.
9 *
10 * Permission to use, copy, modify, and distribute this software and
11 * its documentation for any purpose and without fee is hereby
12 * granted, provided that the above copyright notice appear in all
13 * copies and that both that the copyright notice and warranty
14 * disclaimer appear in supporting documentation, and that the names
15 * of Lucent Technologies any of their entities not be used in
16 * advertising or publicity pertaining to distribution of the software
17 * without specific, written prior permission.
18 *
19 * Lucent Technologies disclaims all warranties with regard to this
20 * software, including all implied warranties of merchantability and
21 * fitness. In no event shall Lucent Technologies be liable for any
22 * special, indirect or consequential damages or any damages
23 * whatsoever resulting from loss of use, data or profits, whether in
24 * an action of contract, negligence or other tortuous action, arising
25 * out of or in connection with the use or performance of this
26 * software.
27 */
28
29#include "bltInt.h"
30
31#include <X11/Xlib.h>
32#ifndef WIN32
33#include <X11/Xproto.h>
34#endif
35
36typedef struct TkIdStackStruct TkIdStack;
37typedef struct TkErrorHandlerStruct TkErrorHandler;
38typedef struct TkSelectionInfoStruct TkSelectionInfo;
39typedef struct TkClipboardTargetStruct TkClipboardTarget;
40
41#ifndef WIN32
42typedef struct TkWindowStruct TkWindow;
43#endif
44typedef struct TkWindowEventStruct TkWindowEvent;
45typedef struct TkMainInfoStruct TkMainInfo;
46typedef struct TkEventHandlerStruct TkEventHandler;
47typedef struct TkSelHandlerStruct TkSelHandler;
48typedef struct TkWinInfoStruct TkWinInfo;
49typedef struct TkClassProcsStruct TkClassProcs;
50typedef struct TkWindowPrivateStruct TkWindowPrivate;
51typedef struct TkGrabEventStruct TkGrabEvent;
52typedef struct TkColormapStruct TkColormap;
53typedef struct TkStressedCmapStruct TkStressedCmap;
54typedef struct TkWmInfoStruct TkWmInfo;
55
56#ifdef XNQueryInputStyle
57#define TK_USE_INPUT_METHODS
58#endif
59
60/*
61 * This defines whether we should try to use XIM over-the-spot style
62 * input. Allow users to override it. It is a much more elegant use
63 * of XIM, but uses a bit more memory.
64 */
65#ifndef TK_XIM_SPOT
66# define TK_XIM_SPOT 1
67#endif
68
69#ifndef TK_REPARENTED
70#define TK_REPARENTED 0
71#endif
72
73#if (TK_VERSION_NUMBER >= _VERSION(8,5,0))
74
75typedef struct TkCaret {
76 struct TkWindow *winPtr; /* The window on which we requested caret
77 * placement. */
78 int x; /* Relative x coord of the caret. */
79 int y; /* Relative y coord of the caret. */
80 int height; /* Specified height of the window. */
81} TkCaret;
82
83/*
84 * One of the following structures is maintained for each display containing a
85 * window managed by Tk. In part, the structure is used to store thread-
86 * specific data, since each thread will have its own TkDisplay structure.
87 */
88
89typedef struct TkDisplayStruct {
90 Display *display; /* Xlib's info about display. */
91 struct TkDisplay *nextPtr; /* Next in list of all displays. */
92 char *name; /* Name of display (with any screen identifier
93 * removed). Malloc-ed. */
94 Time lastEventTime; /* Time of last event received for this
95 * display. */
96
97 /*
98 * Information used primarily by tk3d.c:
99 */
100
101 int borderInit; /* 0 means borderTable needs initializing. */
102 Tcl_HashTable borderTable; /* Maps from color name to TkBorder
103 * structure. */
104
105 /*
106 * Information used by tkAtom.c only:
107 */
108
109 int atomInit; /* 0 means stuff below hasn't been initialized
110 * yet. */
111 Tcl_HashTable nameTable; /* Maps from names to Atom's. */
112 Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
113
114 /*
115 * Information used primarily by tkBind.c:
116 */
117
118 int bindInfoStale; /* Non-zero means the variables in this part
119 * of the structure are potentially incorrect
120 * and should be recomputed. */
121 unsigned int modeModMask; /* Has one bit set to indicate the modifier
122 * corresponding to "mode shift". If no such
123 * modifier, than this is zero. */
124 unsigned int metaModMask; /* Has one bit set to indicate the modifier
125 * corresponding to the "Meta" key. If no such
126 * modifier, then this is zero. */
127 unsigned int altModMask; /* Has one bit set to indicate the modifier
128 * corresponding to the "Meta" key. If no such
129 * modifier, then this is zero. */
130 enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
131 /* Indicates how to interpret lock
132 * modifier. */
133 int numModKeyCodes; /* Number of entries in modKeyCodes array
134 * below. */
135 KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for all
136 * of the keys that have modifiers associated
137 * with them. Malloc'ed, but may be NULL. */
138
139 /*
140 * Information used by tkBitmap.c only:
141 */
142
143 int bitmapInit; /* 0 means tables above need initializing. */
144 int bitmapAutoNumber; /* Used to number bitmaps. */
145 Tcl_HashTable bitmapNameTable;
146 /* Maps from name of bitmap to the first
147 * TkBitmap record for that name. */
148 Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
149 * structure for the bitmap. */
150 Tcl_HashTable bitmapDataTable;
151 /* Used by Tk_GetBitmapFromData to map from a
152 * collection of in-core data about a bitmap
153 * to a reference giving an automatically-
154 * generated name for the bitmap. */
155
156 /*
157 * Information used by tkCanvas.c only:
158 */
159
160 int numIdSearches;
161 int numSlowSearches;
162
163 /*
164 * Used by tkColor.c only:
165 */
166
167 int colorInit; /* 0 means color module needs initializing. */
168 TkStressedCmap *stressPtr; /* First in list of colormaps that have filled
169 * up, so we have to pick an approximate
170 * color. */
171 Tcl_HashTable colorNameTable;
172 /* Maps from color name to TkColor structure
173 * for that color. */
174 Tcl_HashTable colorValueTable;
175 /* Maps from integer RGB values to TkColor
176 * structures. */
177
178 /*
179 * Used by tkCursor.c only:
180 */
181
182 int cursorInit; /* 0 means cursor module need initializing. */
183 Tcl_HashTable cursorNameTable;
184 /* Maps from a string name to a cursor to the
185 * TkCursor record for the cursor. */
186 Tcl_HashTable cursorDataTable;
187 /* Maps from a collection of in-core data
188 * about a cursor to a TkCursor structure. */
189 Tcl_HashTable cursorIdTable;
190 /* Maps from a cursor id to the TkCursor
191 * structure for the cursor. */
192 char cursorString[20]; /* Used to store a cursor id string. */
193 Font cursorFont; /* Font to use for standard cursors. None
194 * means font not loaded yet. */
195
196 /*
197 * Information used by tkError.c only:
198 */
199
200 struct TkErrorHandler *errorPtr;
201 /* First in list of error handlers for this
202 * display. NULL means no handlers exist at
203 * present. */
204 int deleteCount; /* Counts # of handlers deleted since last
205 * time inactive handlers were garbage-
206 * collected. When this number gets big,
207 * handlers get cleaned up. */
208
209 /*
210 * Used by tkEvent.c only:
211 */
212
213 struct TkWindowEvent *delayedMotionPtr;
214 /* Points to a malloc-ed motion event whose
215 * processing has been delayed in the hopes
216 * that another motion event will come along
217 * right away and we can merge the two of them
218 * together. NULL means that there is no
219 * delayed motion event. */
220
221 /*
222 * Information used by tkFocus.c only:
223 */
224
225 int focusDebug; /* 1 means collect focus debugging
226 * statistics. */
227 struct TkWindow *implicitWinPtr;
228 /* If the focus arrived at a toplevel window
229 * implicitly via an Enter event (rather than
230 * via a FocusIn event), this points to the
231 * toplevel window. Otherwise it is NULL. */
232 struct TkWindow *focusPtr; /* Points to the window on this display that
233 * should be receiving keyboard events. When
234 * multiple applications on the display have
235 * the focus, this will refer to the innermost
236 * window in the innermost application. This
237 * information isn't used on Windows, but it's
238 * needed on the Mac, and also on X11 when XIM
239 * processing is being done. */
240
241 /*
242 * Information used by tkGC.c only:
243 */
244
245 Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
246 * describing a GC with those values. */
247 Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */
248 int gcInit; /* 0 means the tables below need
249 * initializing. */
250
251 /*
252 * Information used by tkGeometry.c only:
253 */
254
255 Tcl_HashTable maintainHashTable;
256 /* Hash table that maps from a master's
257 * Tk_Window token to a list of slaves managed
258 * by that master. */
259 int geomInit;
260
261 /*
262 * Information used by tkGet.c only:
263 */
264
265 Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */
266 int uidInit; /* 0 means uidTable needs initializing. */
267
268 /*
269 * Information used by tkGrab.c only:
270 */
271
272 struct TkWindow *grabWinPtr;/* Window in which the pointer is currently
273 * grabbed, or NULL if none. */
274 struct TkWindow *eventualGrabWinPtr;
275 /* Value that grabWinPtr will have once the
276 * grab event queue (below) has been
277 * completely emptied. */
278 struct TkWindow *buttonWinPtr;
279 /* Window in which first mouse button was
280 * pressed while grab was in effect, or NULL
281 * if no such press in effect. */
282 struct TkWindow *serverWinPtr;
283 /* If no application contains the pointer then
284 * this is NULL. Otherwise it contains the
285 * last window for which we've gotten an Enter
286 * or Leave event from the server (i.e. the
287 * last window known to have contained the
288 * pointer). Doesn't reflect events that were
289 * synthesized in tkGrab.c. */
290 TkGrabEvent *firstGrabEventPtr;
291 /* First in list of enter/leave events
292 * synthesized by grab code. These events must
293 * be processed in order before any other
294 * events are processed. NULL means no such
295 * events. */
296 TkGrabEvent *lastGrabEventPtr;
297 /* Last in list of synthesized events, or NULL
298 * if list is empty. */
299 int grabFlags; /* Miscellaneous flag values. See definitions
300 * in tkGrab.c. */
301
302 /*
303 * Information used by tkGrid.c only:
304 */
305
306 int gridInit; /* 0 means table below needs initializing. */
307 Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to corresponding
308 * Grid structures. */
309
310 /*
311 * Information used by tkImage.c only:
312 */
313
314 int imageId; /* Value used to number image ids. */
315
316 /*
317 * Information used by tkMacWinMenu.c only:
318 */
319
320 int postCommandGeneration;
321
322 /*
323 * Information used by tkOption.c only.
324 */
325
326 /*
327 * Information used by tkPack.c only.
328 */
329
330 int packInit; /* 0 means table below needs initializing. */
331 Tcl_HashTable packerHashTable;
332 /* Maps from Tk_Window tokens to corresponding
333 * Packer structures. */
334
335 /*
336 * Information used by tkPlace.c only.
337 */
338
339 int placeInit; /* 0 means tables below need initializing. */
340 Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
341 * structure for the window, if it exists. */
342 Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
343 * structure for the window, if it exists. */
344
345 /*
346 * Information used by tkSelect.c and tkClipboard.c only:
347 */
348
349 struct TkSelectionInfo *selectionInfoPtr;
350 /* First in list of selection information
351 * records. Each entry contains information
352 * about the current owner of a particular
353 * selection on this display. */
354 Atom multipleAtom; /* Atom for MULTIPLE. None means selection
355 * stuff isn't initialized. */
356 Atom incrAtom; /* Atom for INCR. */
357 Atom targetsAtom; /* Atom for TARGETS. */
358 Atom timestampAtom; /* Atom for TIMESTAMP. */
359 Atom textAtom; /* Atom for TEXT. */
360 Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
361 Atom applicationAtom; /* Atom for TK_APPLICATION. */
362 Atom windowAtom; /* Atom for TK_WINDOW. */
363 Atom clipboardAtom; /* Atom for CLIPBOARD. */
364 Atom utf8Atom; /* Atom for UTF8_STRING. */
365
366 Tk_Window clipWindow; /* Window used for clipboard ownership and to
367 * retrieve selections between processes. NULL
368 * means clipboard info hasn't been
369 * initialized. */
370 int clipboardActive; /* 1 means we currently own the clipboard
371 * selection, 0 means we don't. */
372 struct TkMainInfo *clipboardAppPtr;
373 /* Last application that owned clipboard. */
374 struct TkClipboardTarget *clipTargetPtr;
375 /* First in list of clipboard type information
376 * records. Each entry contains information
377 * about the buffers for a given selection
378 * target. */
379
380 /*
381 * Information used by tkSend.c only:
382 */
383
384 Tk_Window commTkwin; /* Window used for communication between
385 * interpreters during "send" commands. NULL
386 * means send info hasn't been initialized
387 * yet. */
388 Atom commProperty; /* X's name for comm property. */
389 Atom registryProperty; /* X's name for property containing registry
390 * of interpreter names. */
391 Atom appNameProperty; /* X's name for property used to hold the
392 * application name on each comm window. */
393
394 /*
395 * Information used by tkXId.c only:
396 */
397
398 struct TkIdStack *idStackPtr;
399 /* First in list of chunks of free resource
400 * identifiers, or NULL if there are no free
401 * resources. */
402 XID (*defaultAllocProc) (Display *display);
403 /* Default resource allocator for display. */
404 struct TkIdStack *windowStackPtr;
405 /* First in list of chunks of window ids that
406 * can't be reused right now. */
407 Tcl_TimerToken idCleanupScheduled;
408 /* If set, it means a call to WindowIdCleanup
409 * has already been scheduled, 0 means it
410 * hasn't. */
411
412 /*
413 * Information used by tkUnixWm.c and tkWinWm.c only:
414 */
415
416 struct TkWmInfo *firstWmPtr;/* Points to first top-level window. */
417 struct TkWmInfo *foregroundWmPtr;
418 /* Points to the foreground window. */
419
420 /*
421 * Information maintained by tkWindow.c for use later on by tkXId.c:
422 */
423
424 int destroyCount; /* Number of Tk_DestroyWindow operations in
425 * progress. */
426 unsigned long lastDestroyRequest;
427 /* Id of most recent XDestroyWindow request;
428 * can re-use ids in windowStackPtr when
429 * server has seen this request and event
430 * queue is empty. */
431
432 /*
433 * Information used by tkVisual.c only:
434 */
435
436 TkColormap *cmapPtr; /* First in list of all non-default colormaps
437 * allocated for this display. */
438
439 /*
440 * Miscellaneous information:
441 */
442
443#ifdef TK_USE_INPUT_METHODS
444 XIM inputMethod; /* Input method for this display. */
445 XIMStyle inputStyle; /* Input style selected for this display. */
446 XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */
447#endif /* TK_USE_INPUT_METHODS */
448 Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
449
450 int refCount; /* Reference count of how many Tk applications
451 * are using this display. Used to clean up
452 * the display when we no longer have any Tk
453 * applications using it. */
454
455 /*
456 * The following field were all added for Tk8.3
457 */
458
459 int mouseButtonState; /* Current mouse button state for this
460 * display. */
461 Window mouseButtonWindow; /* Window the button state was set in, added
462 * in Tk 8.4. */
463 Window warpWindow;
464 int warpX;
465 int warpY;
466
467 /*
468 * The following field(s) were all added for Tk8.4
469 */
470
471 unsigned int flags; /* Various flag values: these are all defined
472 * in below. */
473 TkCaret caret; /* Information about the caret for this
474 * display. This is not a pointer. */
475
476 int iconDataSize; /* Size of default iconphoto image data. */
477 unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
478} TkDisplay;
479
480#elif (TK_VERSION_NUMBER >= _VERSION(8,1,0))
481
482typedef struct TkCaret {
483 struct TkWindow *winPtr; /* the window on which we requested caret
484 * placement */
485 int x; /* relative x coord of the caret */
486 int y; /* relative y coord of the caret */
487 int height; /* specified height of the window */
488} TkCaret;
489
490/*
491 * One of the following structures is maintained for each display
492 * containing a window managed by Tk. In part, the structure is
493 * used to store thread-specific data, since each thread will have
494 * its own TkDisplay structure.
495 */
496
497typedef struct TkDisplayStruct {
498 Display *display; /* Xlib's info about display. */
499 struct TkDisplayStruct *nextPtr; /* Next in list of all displays. */
500 char *name; /* Name of display (with any screen
501 * identifier removed). Malloc-ed. */
502 Time lastEventTime; /* Time of last event received for this
503 * display. */
504
505 /*
506 * Information used primarily by tk3d.c:
507 */
508
509 int borderInit; /* 0 means borderTable needs initializing. */
510 Tcl_HashTable borderTable; /* Maps from color name to TkBorder
511 * structure. */
512
513 /*
514 * Information used by tkAtom.c only:
515 */
516
517 int atomInit; /* 0 means stuff below hasn't been
518 * initialized yet. */
519 Tcl_HashTable nameTable; /* Maps from names to Atom's. */
520 Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
521
522 /*
523 * Information used primarily by tkBind.c:
524 */
525
526 int bindInfoStale; /* Non-zero means the variables in this
527 * part of the structure are potentially
528 * incorrect and should be recomputed. */
529 unsigned int modeModMask; /* Has one bit set to indicate the modifier
530 * corresponding to "mode shift". If no
531 * such modifier, than this is zero. */
532 unsigned int metaModMask; /* Has one bit set to indicate the modifier
533 * corresponding to the "Meta" key. If no
534 * such modifier, then this is zero. */
535 unsigned int altModMask; /* Has one bit set to indicate the modifier
536 * corresponding to the "Meta" key. If no
537 * such modifier, then this is zero. */
538 enum {
539 LU_IGNORE, LU_CAPS, LU_SHIFT
540 } lockUsage; /* Indicates how to interpret lock modifier. */
541 int numModKeyCodes; /* Number of entries in modKeyCodes array
542 * below. */
543 KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for
544 * all of the keys that have modifiers
545 * associated with them. Malloc'ed, but
546 * may be NULL. */
547
548 /*
549 * Information used by tkBitmap.c only:
550 */
551
552 int bitmapInit; /* 0 means tables above need initializing. */
553 int bitmapAutoNumber; /* Used to number bitmaps. */
554 Tcl_HashTable bitmapNameTable;
555 /* Maps from name of bitmap to the first
556 * TkBitmap record for that name. */
557 Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
558 * structure for the bitmap. */
559 Tcl_HashTable bitmapDataTable;
560 /* Used by Tk_GetBitmapFromData to map from
561 * a collection of in-core data about a
562 * bitmap to a reference giving an auto-
563 * matically-generated name for the bitmap. */
564
565 /*
566 * Information used by tkCanvas.c only:
567 */
568
569 int numIdSearches;
570 int numSlowSearches;
571
572 /*
573 * Used by tkColor.c only:
574 */
575
576 int colorInit; /* 0 means color module needs initializing. */
577 TkStressedCmap *stressPtr; /* First in list of colormaps that have
578 * filled up, so we have to pick an
579 * approximate color. */
580 Tcl_HashTable colorNameTable;
581 /* Maps from color name to TkColor structure
582 * for that color. */
583 Tcl_HashTable colorValueTable;
584 /* Maps from integer RGB values to TkColor
585 * structures. */
586
587 /*
588 * Used by tkCursor.c only:
589 */
590
591 int cursorInit; /* 0 means cursor module need initializing. */
592 Tcl_HashTable cursorNameTable;
593 /* Maps from a string name to a cursor to the
594 * TkCursor record for the cursor. */
595 Tcl_HashTable cursorDataTable;
596 /* Maps from a collection of in-core data
597 * about a cursor to a TkCursor structure. */
598 Tcl_HashTable cursorIdTable;
599 /* Maps from a cursor id to the TkCursor
600 * structure for the cursor. */
601 char cursorString[20]; /* Used to store a cursor id string. */
602 Font cursorFont; /* Font to use for standard cursors.
603 * None means font not loaded yet. */
604
605 /*
606 * Information used by tkError.c only:
607 */
608
609 struct TkErrorHandler *errorPtr;
610 /* First in list of error handlers
611 * for this display. NULL means
612 * no handlers exist at present. */
613 int deleteCount; /* Counts # of handlers deleted since
614 * last time inactive handlers were
615 * garbage-collected. When this number
616 * gets big, handlers get cleaned up. */
617
618 /*
619 * Used by tkEvent.c only:
620 */
621
622 struct TkWindowEvent *delayedMotionPtr;
623 /* Points to a malloc-ed motion event
624 * whose processing has been delayed in
625 * the hopes that another motion event
626 * will come along right away and we can
627 * merge the two of them together. NULL
628 * means that there is no delayed motion
629 * event. */
630
631 /*
632 * Information used by tkFocus.c only:
633 */
634
635 int focusDebug; /* 1 means collect focus debugging
636 * statistics. */
637 struct TkWindow *implicitWinPtr;
638 /* If the focus arrived at a toplevel window
639 * implicitly via an Enter event (rather
640 * than via a FocusIn event), this points
641 * to the toplevel window. Otherwise it is
642 * NULL. */
643 struct TkWindow *focusPtr; /* Points to the window on this display that
644 * should be receiving keyboard events. When
645 * multiple applications on the display have
646 * the focus, this will refer to the
647 * innermost window in the innermost
648 * application. This information isn't used
649 * under Unix or Windows, but it's needed on
650 * the Macintosh. */
651
652 /*
653 * Information used by tkGC.c only:
654 */
655
656 Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
657 * describing a GC with those values. */
658 Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */
659 int gcInit; /* 0 means the tables below need
660 * initializing. */
661
662 /*
663 * Information used by tkGeometry.c only:
664 */
665
666 Tcl_HashTable maintainHashTable;
667 /* Hash table that maps from a master's
668 * Tk_Window token to a list of slaves
669 * managed by that master. */
670 int geomInit;
671
672 /*
673 * Information used by tkGet.c only:
674 */
675
676 Tcl_HashTable uidTable; /* Stores all Tk_Uids used in a thread. */
677 int uidInit; /* 0 means uidTable needs initializing. */
678
679 /*
680 * Information used by tkGrab.c only:
681 */
682
683 struct TkWindow *grabWinPtr;
684 /* Window in which the pointer is currently
685 * grabbed, or NULL if none. */
686 struct TkWindow *eventualGrabWinPtr;
687 /* Value that grabWinPtr will have once the
688 * grab event queue (below) has been
689 * completely emptied. */
690 struct TkWindow *buttonWinPtr;
691 /* Window in which first mouse button was
692 * pressed while grab was in effect, or NULL
693 * if no such press in effect. */
694 struct TkWindow *serverWinPtr;
695 /* If no application contains the pointer then
696 * this is NULL. Otherwise it contains the
697 * last window for which we've gotten an
698 * Enter or Leave event from the server (i.e.
699 * the last window known to have contained
700 * the pointer). Doesn't reflect events
701 * that were synthesized in tkGrab.c. */
702 TkGrabEvent *firstGrabEventPtr;
703 /* First in list of enter/leave events
704 * synthesized by grab code. These events
705 * must be processed in order before any other
706 * events are processed. NULL means no such
707 * events. */
708 TkGrabEvent *lastGrabEventPtr;
709 /* Last in list of synthesized events, or NULL
710 * if list is empty. */
711 int grabFlags; /* Miscellaneous flag values. See definitions
712 * in tkGrab.c. */
713
714 /*
715 * Information used by tkGrid.c only:
716 */
717
718 int gridInit; /* 0 means table below needs initializing. */
719 Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to
720 * corresponding Grid structures. */
721
722 /*
723 * Information used by tkImage.c only:
724 */
725
726 int imageId; /* Value used to number image ids. */
727
728 /*
729 * Information used by tkMacWinMenu.c only:
730 */
731
732 int postCommandGeneration;
733
734 /*
735 * Information used by tkOption.c only.
736 */
737
738
739
740 /*
741 * Information used by tkPack.c only.
742 */
743
744 int packInit; /* 0 means table below needs initializing. */
745 Tcl_HashTable packerHashTable;
746 /* Maps from Tk_Window tokens to
747 * corresponding Packer structures. */
748
749
750 /*
751 * Information used by tkPlace.c only.
752 */
753
754 int placeInit; /* 0 means tables below need initializing. */
755 Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
756 * structure for the window, if it exists. */
757 Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
758 * structure for the window, if it exists. */
759
760 /*
761 * Information used by tkSelect.c and tkClipboard.c only:
762 */
763
764
765 struct TkSelectionInfo *selectionInfoPtr;
766 /* First in list of selection information
767 * records. Each entry contains information
768 * about the current owner of a particular
769 * selection on this display. */
770 Atom multipleAtom; /* Atom for MULTIPLE. None means
771 * selection stuff isn't initialized. */
772 Atom incrAtom; /* Atom for INCR. */
773 Atom targetsAtom; /* Atom for TARGETS. */
774 Atom timestampAtom; /* Atom for TIMESTAMP. */
775 Atom textAtom; /* Atom for TEXT. */
776 Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
777 Atom applicationAtom; /* Atom for TK_APPLICATION. */
778 Atom windowAtom; /* Atom for TK_WINDOW. */
779 Atom clipboardAtom; /* Atom for CLIPBOARD. */
780#if (TK_VERSION_NUMBER >= _VERSION(8,4,0))
781 Atom utf8Atom;
782#endif
783 Tk_Window clipWindow; /* Window used for clipboard ownership and to
784 * retrieve selections between processes. NULL
785 * means clipboard info hasn't been
786 * initialized. */
787 int clipboardActive; /* 1 means we currently own the clipboard
788 * selection, 0 means we don't. */
789 struct TkMainInfo *clipboardAppPtr;
790 /* Last application that owned clipboard. */
791 struct TkClipboardTarget *clipTargetPtr;
792 /* First in list of clipboard type information
793 * records. Each entry contains information
794 * about the buffers for a given selection
795 * target. */
796
797 /*
798 * Information used by tkSend.c only:
799 */
800
801 Tk_Window commTkwin; /* Window used for communication
802 * between interpreters during "send"
803 * commands. NULL means send info hasn't
804 * been initialized yet. */
805 Atom commProperty; /* X's name for comm property. */
806 Atom registryProperty; /* X's name for property containing
807 * registry of interpreter names. */
808 Atom appNameProperty; /* X's name for property used to hold the
809 * application name on each comm window. */
810
811 /*
812 * Information used by tkXId.c only:
813 */
814
815 struct TkIdStack *idStackPtr;
816 /* First in list of chunks of free resource
817 * identifiers, or NULL if there are no free
818 * resources. */
819 XID(*defaultAllocProc) _ANSI_ARGS_((Display *display));
820 /* Default resource allocator for display. */
821 struct TkIdStack *windowStackPtr;
822 /* First in list of chunks of window
823 * identifers that can't be reused right
824 * now. */
825#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
826 int idCleanupScheduled; /* 1 means a call to WindowIdCleanup has
827 * already been scheduled, 0 means it
828 * hasn't. */
829#else
830 Tcl_TimerToken idCleanupScheduled;
831 /* If set, it means a call to WindowIdCleanup
832 * has already been scheduled, 0 means it
833 * hasn't. */
834#endif
835 /*
836 * Information used by tkUnixWm.c and tkWinWm.c only:
837 */
838
839#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
840 int wmTracing; /* Used to enable or disable tracing in
841 * this module. If tracing is enabled,
842 * then information is printed on
843 * standard output about interesting
844 * interactions with the window manager. */
845#endif
846 struct TkWmInfo *firstWmPtr; /* Points to first top-level window. */
847 struct TkWmInfo *foregroundWmPtr;
848 /* Points to the foreground window. */
849
850 /*
851 * Information maintained by tkWindow.c for use later on by tkXId.c:
852 */
853
854
855 int destroyCount; /* Number of Tk_DestroyWindow operations
856 * in progress. */
857 unsigned long lastDestroyRequest;
858 /* Id of most recent XDestroyWindow request;
859 * can re-use ids in windowStackPtr when
860 * server has seen this request and event
861 * queue is empty. */
862
863 /*
864 * Information used by tkVisual.c only:
865 */
866
867 TkColormap *cmapPtr; /* First in list of all non-default colormaps
868 * allocated for this display. */
869
870 /*
871 * Miscellaneous information:
872 */
873
874#ifdef TK_USE_INPUT_METHODS
875 XIM inputMethod; /* Input method for this display */
876#if (TK_VERSION_NUMBER >= _VERSION(8,4,0))
877#if TK_XIM_SPOT
878 XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */
879#endif /* TK_XIM_SPOT */
880#endif /* TK_VERSION_NUMBER >= 8.4 */
881#endif /* TK_USE_INPUT_METHODS */
882 Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
883 int refCount; /* Reference count of how many Tk applications
884 * are using this display. Used to clean up
885 * the display when we no longer have any
886 * Tk applications using it.
887 */
888 /*
889 * The following field were all added for Tk8.3
890 */
891 int mouseButtonState; /* current mouse button state for this
892 * display */
893#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
894 int warpInProgress;
895#endif
896 Window warpWindow;
897 int warpX;
898 int warpY;
899#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
900 int useInputMethods; /* Whether to use input methods */
901#else
902 /*
903 * The following field(s) were all added for Tk8.4
904 */
905 long deletionEpoch; /* Incremented by window deletions */
906 unsigned int flags; /* Various flag values: these are all
907 * defined in below. */
908 TkCaret caret; /* information about the caret for this
909 * display. This is not a pointer. */
910#endif
911} TkDisplay;
912
913#else
914
915/*
916 * One of the following structures is maintained for each display
917 * containing a window managed by Tk:
918 */
919typedef struct TkDisplayStruct {
920 Display *display; /* Xlib's info about display. */
921 struct TkDisplayStruct *nextPtr; /* Next in list of all displays. */
922 char *name; /* Name of display (with any screen
923 * identifier removed). Malloc-ed. */
924 Time lastEventTime; /* Time of last event received for this
925 * display. */
926
927 /*
928 * Information used primarily by tkBind.c:
929 */
930
931 int bindInfoStale; /* Non-zero means the variables in this
932 * part of the structure are potentially
933 * incorrect and should be recomputed. */
934 unsigned int modeModMask; /* Has one bit set to indicate the modifier
935 * corresponding to "mode shift". If no
936 * such modifier, than this is zero. */
937 unsigned int metaModMask; /* Has one bit set to indicate the modifier
938 * corresponding to the "Meta" key. If no
939 * such modifier, then this is zero. */
940 unsigned int altModMask; /* Has one bit set to indicate the modifier
941 * corresponding to the "Meta" key. If no
942 * such modifier, then this is zero. */
943 enum {
944 LU_IGNORE, LU_CAPS, LU_SHIFT
945 } lockUsage;
946 /* Indicates how to interpret lock modifier. */
947 int numModKeyCodes; /* Number of entries in modKeyCodes array
948 * below. */
949 KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for
950 * all of the keys that have modifiers
951 * associated with them. Malloc'ed, but
952 * may be NULL. */
953
954 /*
955 * Information used by tkError.c only:
956 */
957
958 TkErrorHandler *errorPtr;
959 /* First in list of error handlers
960 * for this display. NULL means
961 * no handlers exist at present. */
962 int deleteCount; /* Counts # of handlers deleted since
963 * last time inactive handlers were
964 * garbage-collected. When this number
965 * gets big, handlers get cleaned up. */
966
967 /*
968 * Information used by tkSend.c only:
969 */
970
971 Tk_Window commTkwin; /* Window used for communication
972 * between interpreters during "send"
973 * commands. NULL means send info hasn't
974 * been initialized yet. */
975 Atom commProperty; /* X's name for comm property. */
976 Atom registryProperty; /* X's name for property containing
977 * registry of interpreter names. */
978 Atom appNameProperty; /* X's name for property used to hold the
979 * application name on each comm window. */
980
981 /*
982 * Information used by tkSelect.c and tkClipboard.c only:
983 */
984
985 TkSelectionInfo *selectionInfoPtr;
986 /* First in list of selection information
987 * records. Each entry contains information
988 * about the current owner of a particular
989 * selection on this display. */
990 Atom multipleAtom; /* Atom for MULTIPLE. None means
991 * selection stuff isn't initialized. */
992 Atom incrAtom; /* Atom for INCR. */
993 Atom targetsAtom; /* Atom for TARGETS. */
994 Atom timestampAtom; /* Atom for TIMESTAMP. */
995 Atom textAtom; /* Atom for TEXT. */
996 Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
997 Atom applicationAtom; /* Atom for TK_APPLICATION. */
998 Atom windowAtom; /* Atom for TK_WINDOW. */
999 Atom clipboardAtom; /* Atom for CLIPBOARD. */
1000
1001 Tk_Window clipWindow; /* Window used for clipboard ownership and to
1002 * retrieve selections between processes. NULL
1003 * means clipboard info hasn't been
1004 * initialized. */
1005 int clipboardActive; /* 1 means we currently own the clipboard
1006 * selection, 0 means we don't. */
1007 TkMainInfo *clipboardAppPtr;
1008 /* Last application that owned clipboard. */
1009 TkClipboardTarget *clipTargetPtr;
1010 /* First in list of clipboard type information
1011 * records. Each entry contains information
1012 * about the buffers for a given selection
1013 * target. */
1014
1015 /*
1016 * Information used by tkAtom.c only:
1017 */
1018
1019 int atomInit; /* 0 means stuff below hasn't been
1020 * initialized yet. */
1021 Tcl_HashTable nameTable; /* Maps from names to Atom's. */
1022 Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
1023
1024 /*
1025 * Information used by tkCursor.c only:
1026 */
1027
1028 Font cursorFont; /* Font to use for standard cursors.
1029 * None means font not loaded yet. */
1030
1031 /*
1032 * Information used by tkGrab.c only:
1033 */
1034
1035 TkWindow *grabWinPtr;
1036 /* Window in which the pointer is currently
1037 * grabbed, or NULL if none. */
1038 TkWindow *eventualGrabWinPtr;
1039 /* Value that grabWinPtr will have once the
1040 * grab event queue (below) has been
1041 * completely emptied. */
1042 TkWindow *buttonWinPtr;
1043 /* Window in which first mouse button was
1044 * pressed while grab was in effect, or NULL
1045 * if no such press in effect. */
1046 TkWindow *serverWinPtr;
1047 /* If no application contains the pointer then
1048 * this is NULL. Otherwise it contains the
1049 * last window for which we've gotten an
1050 * Enter or Leave event from the server (i.e.
1051 * the last window known to have contained
1052 * the pointer). Doesn't reflect events
1053 * that were synthesized in tkGrab.c. */
1054 TkGrabEvent *firstGrabEventPtr;
1055 /* First in list of enter/leave events
1056 * synthesized by grab code. These events
1057 * must be processed in order before any other
1058 * events are processed. NULL means no such
1059 * events. */
1060 TkGrabEvent *lastGrabEventPtr;
1061 /* Last in list of synthesized events, or NULL
1062 * if list is empty. */
1063 int grabFlags; /* Miscellaneous flag values. See definitions
1064 * in tkGrab.c. */
1065
1066 /*
1067 * Information used by tkXId.c only:
1068 */
1069
1070 TkIdStack *idStackPtr;
1071 /* First in list of chunks of free resource
1072 * identifiers, or NULL if there are no free
1073 * resources. */
1074 XID(*defaultAllocProc) _ANSI_ARGS_((Display *display));
1075 /* Default resource allocator for display. */
1076 TkIdStack *windowStackPtr;
1077 /* First in list of chunks of window
1078 * identifers that can't be reused right
1079 * now. */
1080 int idCleanupScheduled; /* 1 means a call to WindowIdCleanup has
1081 * already been scheduled, 0 means it
1082 * hasn't. */
1083
1084 /*
1085 * Information maintained by tkWindow.c for use later on by tkXId.c:
1086 */
1087
1088
1089 int destroyCount; /* Number of Tk_DestroyWindow operations
1090 * in progress. */
1091 unsigned long lastDestroyRequest;
1092 /* Id of most recent XDestroyWindow request;
1093 * can re-use ids in windowStackPtr when
1094 * server has seen this request and event
1095 * queue is empty. */
1096
1097 /*
1098 * Information used by tkVisual.c only:
1099 */
1100
1101 TkColormap *cmapPtr; /* First in list of all non-default colormaps
1102 * allocated for this display. */
1103
1104 /*
1105 * Information used by tkFocus.c only:
1106 */
1107#if (TK_MAJOR_VERSION == 4)
1108
1109 TkWindow *focusWinPtr;
1110 /* Window that currently has the focus for
1111 * this display, or NULL if none. */
1112 TkWindow *implicitWinPtr;
1113 /* If the focus arrived at a toplevel window
1114 * implicitly via an Enter event (rather
1115 * than via a FocusIn event), this points
1116 * to the toplevel window. Otherwise it is
1117 * NULL. */
1118 TkWindow *focusOnMapPtr;
1119 /* This points to a toplevel window that is
1120 * supposed to receive the X input focus as
1121 * soon as it is mapped (needed to handle the
1122 * fact that X won't allow the focus on an
1123 * unmapped window). NULL means no delayed
1124 * focus op in progress. */
1125 int forceFocus; /* Associated with focusOnMapPtr: non-zero
1126 * means claim the focus even if some other
1127 * application currently has it. */
1128#else
1129 TkWindow *implicitWinPtr;
1130 /* If the focus arrived at a toplevel window
1131 * implicitly via an Enter event (rather
1132 * than via a FocusIn event), this points
1133 * to the toplevel window. Otherwise it is
1134 * NULL. */
1135 TkWindow *focusPtr; /* Points to the window on this display that
1136 * should be receiving keyboard events. When
1137 * multiple applications on the display have
1138 * the focus, this will refer to the
1139 * innermost window in the innermost
1140 * application. This information isn't used
1141 * under Unix or Windows, but it's needed on
1142 * the Macintosh. */
1143#endif /* TK_MAJOR_VERSION == 4 */
1144
1145 /*
1146 * Used by tkColor.c only:
1147 */
1148
1149 TkStressedCmap *stressPtr; /* First in list of colormaps that have
1150 * filled up, so we have to pick an
1151 * approximate color. */
1152
1153 /*
1154 * Used by tkEvent.c only:
1155 */
1156
1157 TkWindowEvent *delayedMotionPtr;
1158 /* Points to a malloc-ed motion event
1159 * whose processing has been delayed in
1160 * the hopes that another motion event
1161 * will come along right away and we can
1162 * merge the two of them together. NULL
1163 * means that there is no delayed motion
1164 * event. */
1165 /*
1166 * Miscellaneous information:
1167 */
1168
1169#ifdef TK_USE_INPUT_METHODS
1170 XIM inputMethod; /* Input method for this display */
1171#endif /* TK_USE_INPUT_METHODS */
1172 Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
1173#if (TK_MAJOR_VERSION > 4)
1174 int refCount; /* Reference count of how many Tk applications
1175 * are using this display. Used to clean up
1176 * the display when we no longer have any
1177 * Tk applications using it.
1178 */
1179#endif /* TK_MAJOR_VERSION > 4 */
1180
1181} TkDisplay;
1182
1183#endif /* TK_VERSION_NUMBER >= _VERSION(8,1,0) */
1184
1185
1186struct TkWindowStruct {
1187 Display *display;
1188 TkDisplay *dispPtr;
1189 int screenNum;
1190 Visual *visual;
1191 int depth;
1192 Window window;
1193 TkWindow *childList;
1194 TkWindow *lastChildPtr;
1195 TkWindow *parentPtr;
1196 TkWindow *nextPtr;
1197 TkMainInfo *infoPtr;
1198 char *pathName;
1199 Tk_Uid nameUid;
1200 Tk_Uid classUid;
1201 XWindowChanges changes;
1202 unsigned int dirtyChanges;
1203 XSetWindowAttributes atts;
1204 unsigned long dirtyAtts;
1205 unsigned int flags;
1206 TkEventHandler *handlerList;
1207#ifdef TK_USE_INPUT_METHODS
1208 XIC inputContext;
1209#endif /* TK_USE_INPUT_METHODS */
1210 ClientData *tagPtr;
1211 int nTags;
1212 int optionLevel;
1213 TkSelHandler *selHandlerList;
1214 Tk_GeomMgr *geomMgrPtr;
1215 ClientData geomData;
1216 int reqWidth, reqHeight;
1217 int internalBorderWidth;
1218 TkWinInfo *wmInfoPtr;
1219#if (TK_MAJOR_VERSION > 4)
1220 TkClassProcs *classProcsPtr;
1221 ClientData instanceData;
1222#endif
1223 TkWindowPrivate *privatePtr;
1224};
1225
1226#ifdef WIN32
1227/*
1228 *----------------------------------------------------------------------
1229 *
1230 * GetWindowHandle --
1231 *
1232 * Returns the XID for the Tk_Window given. Starting in Tk 8.0,
1233 * the toplevel widgets are wrapped by another window.
1234 * Currently there's no way to get at that window, other than
1235 * what is done here: query the X window hierarchy and grab the
1236 * parent.
1237 *
1238 * Results:
1239 * Returns the X Window ID of the widget. If it's a toplevel, then
1240 * the XID of the wrapper is returned.
1241 *
1242 *----------------------------------------------------------------------
1243 */
1244static HWND
1245GetWindowHandle(Tk_Window tkwin)
1246{
1247 HWND hWnd;
1248 Window window;
1249
1250 window = Tk_WindowId(tkwin);
1251 if (window == None) {
1252 Tk_MakeWindowExist(tkwin);
1253 }
1254 hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
1255#if (TK_MAJOR_VERSION > 4)
1256 if (Tk_IsTopLevel(tkwin)) {
1257 hWnd = GetParent(hWnd);
1258 }
1259#endif /* TK_MAJOR_VERSION > 4 */
1260 return hWnd;
1261}
1262
1263#else
1264
1265Window
1266Blt_GetParent(display, window)
1267 Display *display;
1268 Window window;
1269{
1270 Window root, parent;
1271 Window *dummy;
1272 unsigned int count;
1273
1274 if (XQueryTree(display, window, &root, &parent, &dummy, &count) > 0) {
1275 XFree(dummy);
1276 return parent;
1277 }
1278 return None;
1279}
1280
1281static Window
1282GetWindowId(tkwin)
1283 Tk_Window tkwin;
1284{
1285 Window window;
1286
1287 Tk_MakeWindowExist(tkwin);
1288 window = Tk_WindowId(tkwin);
1289#if (TK_MAJOR_VERSION > 4)
1290 if (Tk_IsTopLevel(tkwin)) {
1291 Window parent;
1292
1293 parent = Blt_GetParent(Tk_Display(tkwin), window);
1294 if (parent != None) {
1295 window = parent;
1296 }
1297 window = parent;
1298 }
1299#endif /* TK_MAJOR_VERSION > 4 */
1300 return window;
1301}
1302
1303#endif /* WIN32 */
1304
1305/*
1306 *----------------------------------------------------------------------
1307 *
1308 * DoConfigureNotify --
1309 *
1310 * Generate a ConfigureNotify event describing the current
1311 * configuration of a window.
1312 *
1313 * Results:
1314 * None.
1315 *
1316 * Side effects:
1317 * An event is generated and processed by Tk_HandleEvent.
1318 *
1319 *----------------------------------------------------------------------
1320 */
1321static void
1322DoConfigureNotify(winPtr)
1323 Tk_FakeWin *winPtr; /* Window whose configuration was just
1324 * changed. */
1325{
1326 XEvent event;
1327
1328 event.type = ConfigureNotify;
1329 event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display);
1330 event.xconfigure.send_event = False;
1331 event.xconfigure.display = winPtr->display;
1332 event.xconfigure.event = winPtr->window;
1333 event.xconfigure.window = winPtr->window;
1334 event.xconfigure.x = winPtr->changes.x;
1335 event.xconfigure.y = winPtr->changes.y;
1336 event.xconfigure.width = winPtr->changes.width;
1337 event.xconfigure.height = winPtr->changes.height;
1338 event.xconfigure.border_width = winPtr->changes.border_width;
1339 if (winPtr->changes.stack_mode == Above) {
1340 event.xconfigure.above = winPtr->changes.sibling;
1341 } else {
1342 event.xconfigure.above = None;
1343 }
1344 event.xconfigure.override_redirect = winPtr->atts.override_redirect;
1345 Tk_HandleEvent(&event);
1346}
1347
1348/*
1349 *--------------------------------------------------------------
1350 *
1351 * Blt_MakeTransparentWindowExist --
1352 *
1353 * Similar to Tk_MakeWindowExist but instead creates a
1354 * transparent window to block for user events from sibling
1355 * windows.
1356 *
1357 * Differences from Tk_MakeWindowExist.
1358 *
1359 * 1. This is always a "busy" window. There's never a
1360 * platform-specific class procedure to execute instead.
1361 * 2. The window is transparent and never will contain children,
1362 * so colormap information is irrelevant.
1363 *
1364 * Results:
1365 * None.
1366 *
1367 * Side effects:
1368 * When the procedure returns, the internal window associated
1369 * with tkwin is guaranteed to exist. This may require the
1370 * window's ancestors to be created too.
1371 *
1372 *--------------------------------------------------------------
1373 */
1374void
1375Blt_MakeTransparentWindowExist(tkwin, parent, isBusy)
1376 Tk_Window tkwin; /* Token for window. */
1377 Window parent; /* Parent window. */
1378 int isBusy; /* */
1379{
1380 TkWindow *winPtr = (TkWindow *) tkwin;
1381 TkWindow *winPtr2;
1382 Tcl_HashEntry *hPtr;
1383 int notUsed;
1384 TkDisplay *dispPtr;
1385#ifdef WIN32
1386 HWND hParent;
1387 int style;
1388 DWORD exStyle;
1389 HWND hWnd;
1390#else
1391 long int mask;
1392#endif /* WIN32 */
1393
1394 if (winPtr->window != None) {
1395 return; /* Window already exists. */
1396 }
1397#ifdef notdef
1398 if ((winPtr->parentPtr == NULL) || (winPtr->flags & TK_TOP_LEVEL)) {
1399 parent = XRootWindow(winPtr->display, winPtr->screenNum);
1400 /* TODO: Make the entire screen busy */
1401 } else {
1402 if (Tk_WindowId(winPtr->parentPtr) == None) {
1403 Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr);
1404 }
1405 }
1406#endif
1407
1408 /* Create a transparent window and put it on top. */
1409
1410#ifdef WIN32
1411 hParent = (HWND) parent;
1412 style = (WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
1413 exStyle = (WS_EX_TRANSPARENT | WS_EX_TOPMOST);
1414#define TK_WIN_CHILD_CLASS_NAME "TkChild"
1415 hWnd = CreateWindowEx(exStyle, TK_WIN_CHILD_CLASS_NAME, NULL, style,
1416 Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin),
1417 hParent, NULL, (HINSTANCE) Tk_GetHINSTANCE(), NULL);
1418 winPtr->window = Tk_AttachHWND(tkwin, hWnd);
1419#else
1420 mask = (!isBusy) ? 0 : (CWDontPropagate | CWEventMask);
1421 /* Ignore the important events while the window is mapped. */
1422#define USER_EVENTS (EnterWindowMask | LeaveWindowMask | KeyPressMask | \
1423 KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
1424#define PROP_EVENTS (KeyPressMask | KeyReleaseMask | ButtonPressMask | \
1425 ButtonReleaseMask | PointerMotionMask)
1426
1427 winPtr->atts.do_not_propagate_mask = PROP_EVENTS;
1428 winPtr->atts.event_mask = USER_EVENTS;
1429 winPtr->changes.border_width = 0;
1430 winPtr->depth = 0;
1431
1432 winPtr->window = XCreateWindow(winPtr->display, parent,
1433 winPtr->changes.x, winPtr->changes.y,
1434 (unsigned)winPtr->changes.width, /* width */
1435 (unsigned)winPtr->changes.height, /* height */
1436 (unsigned)winPtr->changes.border_width, /* border_width */
1437 winPtr->depth, /* depth */
1438 InputOnly, /* class */
1439 winPtr->visual, /* visual */
1440 mask, /* valuemask */
1441 &(winPtr->atts) /* attributes */ );
1442#endif /* WIN32 */
1443
1444 dispPtr = winPtr->dispPtr;
1445 hPtr = Tcl_CreateHashEntry(&(dispPtr->winTable), (char *)winPtr->window,
1446 &notUsed);
1447 Tcl_SetHashValue(hPtr, winPtr);
1448 winPtr->dirtyAtts = 0;
1449 winPtr->dirtyChanges = 0;
1450#ifdef TK_USE_INPUT_METHODS
1451 winPtr->inputContext = NULL;
1452#endif /* TK_USE_INPUT_METHODS */
1453 if (!(winPtr->flags & TK_TOP_LEVEL)) {
1454 /*
1455 * If any siblings higher up in the stacking order have already
1456 * been created then move this window to its rightful position
1457 * in the stacking order.
1458 *
1459 * NOTE: this code ignores any changes anyone might have made
1460 * to the sibling and stack_mode field of the window's attributes,
1461 * so it really isn't safe for these to be manipulated except
1462 * by calling Tk_RestackWindow.
1463 */
1464 for (winPtr2 = winPtr->nextPtr; winPtr2 != NULL;
1465 winPtr2 = winPtr2->nextPtr) {
1466 if ((winPtr2->window != None) && !(winPtr2->flags & TK_TOP_LEVEL)) {
1467 XWindowChanges changes;
1468 changes.sibling = winPtr2->window;
1469 changes.stack_mode = Below;
1470 XConfigureWindow(winPtr->display, winPtr->window,
1471 CWSibling | CWStackMode, &changes);
1472 break;
1473 }
1474 }
1475 }
1476
1477 /*
1478 * Issue a ConfigureNotify event if there were deferred configuration
1479 * changes (but skip it if the window is being deleted; the
1480 * ConfigureNotify event could cause problems if we're being called
1481 * from Tk_DestroyWindow under some conditions).
1482 */
1483 if ((winPtr->flags & TK_NEED_CONFIG_NOTIFY)
1484 && !(winPtr->flags & TK_ALREADY_DEAD)) {
1485 winPtr->flags &= ~TK_NEED_CONFIG_NOTIFY;
1486 DoConfigureNotify((Tk_FakeWin *) tkwin);
1487 }
1488}
1489
1490/*
1491 *----------------------------------------------------------------------
1492 *
1493 * Blt_FindChild --
1494 *
1495 * Performs a linear search for the named child window in a given
1496 * parent window.
1497 *
1498 * This can be done via Tcl, but not through Tk's C API. It's
1499 * simple enough, if you peek into the Tk_Window structure.
1500 *
1501 * Results:
1502 * The child Tk_Window. If the named child can't be found, NULL
1503 * is returned.
1504 *
1505 *----------------------------------------------------------------------
1506 */
1507
1508/*LINTLIBRARY*/
1509Tk_Window
1510Blt_FindChild(parent, name)
1511 Tk_Window parent;
1512 char *name;
1513{
1514 register TkWindow *winPtr;
1515 TkWindow *parentPtr = (TkWindow *)parent;
1516
1517 for (winPtr = parentPtr->childList; winPtr != NULL;
1518 winPtr = winPtr->nextPtr) {
1519 if (strcmp(name, winPtr->nameUid) == 0) {
1520 return (Tk_Window)winPtr;
1521 }
1522 }
1523 return NULL;
1524}
1525
1526/*
1527 *----------------------------------------------------------------------
1528 *
1529 * Blt_FirstChildWindow --
1530 *
1531 * Performs a linear search for the named child window in a given
1532 * parent window.
1533 *
1534 * This can be done via Tcl, but not through Tk's C API. It's
1535 * simple enough, if you peek into the Tk_Window structure.
1536 *
1537 * Results:
1538 * The child Tk_Window. If the named child can't be found, NULL
1539 * is returned.
1540 *
1541 *----------------------------------------------------------------------
1542 */
1543/*LINTLIBRARY*/
1544Tk_Window
1545Blt_FirstChild(parent)
1546 Tk_Window parent;
1547{
1548 TkWindow *parentPtr = (TkWindow *)parent;
1549 return (Tk_Window)parentPtr->childList;
1550}
1551
1552/*
1553 *----------------------------------------------------------------------
1554 *
1555 * Blt_FindChild --
1556 *
1557 * Performs a linear search for the named child window in a given
1558 * parent window.
1559 *
1560 * This can be done via Tcl, but not through Tk's C API. It's
1561 * simple enough, if you peek into the Tk_Window structure.
1562 *
1563 * Results:
1564 * The child Tk_Window. If the named child can't be found, NULL
1565 * is returned.
1566 *
1567 *----------------------------------------------------------------------
1568 */
1569
1570/*LINTLIBRARY*/
1571Tk_Window
1572Blt_NextChild(tkwin)
1573 Tk_Window tkwin;
1574{
1575 TkWindow *winPtr = (TkWindow *)tkwin;
1576
1577 if (winPtr == NULL) {
1578 return NULL;
1579 }
1580 return (Tk_Window)winPtr->nextPtr;
1581}
1582
1583/*
1584 *----------------------------------------------------------------------
1585 *
1586 * UnlinkWindow --
1587 *
1588 * This procedure removes a window from the childList of its
1589 * parent.
1590 *
1591 * Results:
1592 * None.
1593 *
1594 * Side effects:
1595 * The window is unlinked from its childList.
1596 *
1597 *----------------------------------------------------------------------
1598 */
1599static void
1600UnlinkWindow(winPtr)
1601 TkWindow *winPtr; /* Child window to be unlinked. */
1602{
1603 TkWindow *prevPtr;
1604
1605 prevPtr = winPtr->parentPtr->childList;
1606 if (prevPtr == winPtr) {
1607 winPtr->parentPtr->childList = winPtr->nextPtr;
1608 if (winPtr->nextPtr == NULL) {
1609 winPtr->parentPtr->lastChildPtr = NULL;
1610 }
1611 } else {
1612 while (prevPtr->nextPtr != winPtr) {
1613 prevPtr = prevPtr->nextPtr;
1614 if (prevPtr == NULL) {
1615 panic("UnlinkWindow couldn't find child in parent");
1616 }
1617 }
1618 prevPtr->nextPtr = winPtr->nextPtr;
1619 if (winPtr->nextPtr == NULL) {
1620 winPtr->parentPtr->lastChildPtr = prevPtr;
1621 }
1622 }
1623}
1624
1625/*
1626 *----------------------------------------------------------------------
1627 *
1628 * Blt_RelinkWindow --
1629 *
1630 * Relinks a window into a new parent. The window is unlinked
1631 * from its original parent's child list and added onto the end
1632 * of the new parent's list.
1633 *
1634 * FIXME: If the window has focus, the focus should be moved
1635 * to an ancestor. Otherwise, Tk becomes confused
1636 * about which Toplevel turns on focus for the window.
1637 * Right now this is done at the Tcl layer. For example,
1638 * see blt::CreateTearoff in tabset.tcl.
1639 *
1640 * Results:
1641 * None.
1642 *
1643 * Side effects:
1644 * The window is unlinked from its childList.
1645 *
1646 *----------------------------------------------------------------------
1647 */
1648void
1649Blt_RelinkWindow(tkwin, newParent, x, y)
1650 Tk_Window tkwin; /* Child window to be linked. */
1651 Tk_Window newParent;
1652 int x, y;
1653{
1654 TkWindow *winPtr, *parentWinPtr;
1655
1656 if (Blt_ReparentWindow(Tk_Display(tkwin), Tk_WindowId(tkwin),
1657 Tk_WindowId(newParent), x, y) != TCL_OK) {
1658 return;
1659 }
1660 winPtr = (TkWindow *)tkwin;
1661 parentWinPtr = (TkWindow *)newParent;
1662
1663 winPtr->flags &= ~TK_REPARENTED;
1664 UnlinkWindow(winPtr); /* Remove the window from its parent's list */
1665
1666 /* Append the window onto the end of the parent's list of children */
1667 winPtr->parentPtr = parentWinPtr;
1668 winPtr->nextPtr = NULL;
1669 if (parentWinPtr->childList == NULL) {
1670 parentWinPtr->childList = winPtr;
1671 } else {
1672 parentWinPtr->lastChildPtr->nextPtr = winPtr;
1673 }
1674 parentWinPtr->lastChildPtr = winPtr;
1675}
1676
1677/*
1678 *----------------------------------------------------------------------
1679 *
1680 * Blt_RelinkWindow --
1681 *
1682 * Relinks a window into a new parent. The window is unlinked
1683 * from its original parent's child list and added onto the end
1684 * of the new parent's list.
1685 *
1686 * FIXME: If the window has focus, the focus should be moved
1687 * to an ancestor. Otherwise, Tk becomes confused
1688 * about which Toplevel turns on focus for the window.
1689 * Right now this is done at the Tcl layer. For example,
1690 * see blt::CreateTearoff in tabset.tcl.
1691 *
1692 * Results:
1693 * None.
1694 *
1695 * Side effects:
1696 * The window is unlinked from its childList.
1697 *
1698 *----------------------------------------------------------------------
1699 */
1700void
1701Blt_RelinkWindow2(tkwin, window, newParent, x, y)
1702 Tk_Window tkwin; /* Child window to be linked. */
1703 Window window;
1704 Tk_Window newParent;
1705 int x, y;
1706{
1707#ifdef notdef
1708 TkWindow *winPtr, *parentWinPtr;
1709#endif
1710 if (Blt_ReparentWindow(Tk_Display(tkwin), window,
1711 Tk_WindowId(newParent), x, y) != TCL_OK) {
1712 return;
1713 }
1714#ifdef notdef
1715 winPtr = (TkWindow *)tkwin;
1716 parentWinPtr = (TkWindow *)newParent;
1717
1718 winPtr->flags &= ~TK_REPARENTED;
1719 UnlinkWindow(winPtr); /* Remove the window from its parent's list */
1720
1721 /* Append the window onto the end of the parent's list of children */
1722 winPtr->parentPtr = parentWinPtr;
1723 winPtr->nextPtr = NULL;
1724 if (parentWinPtr->childList == NULL) {
1725 parentWinPtr->childList = winPtr;
1726 } else {
1727 parentWinPtr->lastChildPtr->nextPtr = winPtr;
1728 }
1729 parentWinPtr->lastChildPtr = winPtr;
1730#endif
1731}
1732
1733void
1734Blt_UnlinkWindow(tkwin)
1735 Tk_Window tkwin; /* Child window to be linked. */
1736{
1737 TkWindow *winPtr;
1738 Window root;
1739
1740 root = XRootWindow(Tk_Display(tkwin), Tk_ScreenNumber(tkwin));
1741 if (Blt_ReparentWindow(Tk_Display(tkwin), Tk_WindowId(tkwin),
1742 root, 0, 0) != TCL_OK) {
1743 return;
1744 }
1745 winPtr = (TkWindow *)tkwin;
1746 winPtr->flags &= ~TK_REPARENTED;
1747#ifdef notdef
1748 UnlinkWindow(winPtr); /* Remove the window from its parent's list */
1749#endif
1750}
1751
1752/*
1753 *----------------------------------------------------------------------
1754 *
1755 * Blt_Toplevel --
1756 *
1757 * Climbs up the widget hierarchy to find the top level window of
1758 * the window given.
1759 *
1760 * Results:
1761 * Returns the Tk_Window of the toplevel widget.
1762 *
1763 *----------------------------------------------------------------------
1764 */
1765Tk_Window
1766Blt_Toplevel(tkwin)
1767 register Tk_Window tkwin;
1768{
1769 while (!Tk_IsTopLevel(tkwin)) {
1770 tkwin = Tk_Parent(tkwin);
1771 }
1772 return tkwin;
1773}
1774
1775void
1776Blt_RootCoordinates(tkwin, x, y, rootXPtr, rootYPtr)
1777 Tk_Window tkwin;
1778 int x, y;
1779 int *rootXPtr, *rootYPtr;
1780{
1781 int vx, vy, vw, vh;
1782 int rootX, rootY;
1783
1784 Tk_GetRootCoords(tkwin, &rootX, &rootY);
1785 x += rootX;
1786 y += rootY;
1787 Tk_GetVRootGeometry(tkwin, &vx, &vy, &vw, &vh);
1788 x += vx;
1789 y += vy;
1790 *rootXPtr = x;
1791 *rootYPtr = y;
1792}
1793
1794
1795/* Find the toplevel then */
1796int
1797Blt_RootX(tkwin)
1798 Tk_Window tkwin;
1799{
1800 int x;
1801
1802 for (x = 0; tkwin != NULL; tkwin = Tk_Parent(tkwin)) {
1803 x += Tk_X(tkwin) + Tk_Changes(tkwin)->border_width;
1804 if (Tk_IsTopLevel(tkwin)) {
1805 break;
1806 }
1807 }
1808 return x;
1809}
1810
1811int
1812Blt_RootY(tkwin)
1813 Tk_Window tkwin;
1814{
1815 int y;
1816
1817 for (y = 0; tkwin != NULL; tkwin = Tk_Parent(tkwin)) {
1818 y += Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width;
1819 if (Tk_IsTopLevel(tkwin)) {
1820 break;
1821 }
1822 }
1823 return y;
1824}
1825
1826#ifdef WIN32
1827/*
1828 *----------------------------------------------------------------------
1829 *
1830 * Blt_GetRealWindowId --
1831 *
1832 * Returns the XID for the Tk_Window given. Starting in Tk 8.0,
1833 * the toplevel widgets are wrapped by another window.
1834 * Currently there's no way to get at that window, other than
1835 * what is done here: query the X window hierarchy and grab the
1836 * parent.
1837 *
1838 * Results:
1839 * Returns the X Window ID of the widget. If it's a toplevel, then
1840 * the XID of the wrapper is returned.
1841 *
1842 *----------------------------------------------------------------------
1843 */
1844Window
1845Blt_GetRealWindowId(Tk_Window tkwin)
1846{
1847 return (Window) GetWindowHandle(tkwin);
1848}
1849
1850/*
1851 *----------------------------------------------------------------------
1852 *
1853 * Blt_GetToplevel --
1854 *
1855 * Retrieves the toplevel window which is the nearest ancestor of
1856 * of the specified window.
1857 *
1858 * Results:
1859 * Returns the toplevel window or NULL if the window has no
1860 * ancestor which is a toplevel.
1861 *
1862 * Side effects:
1863 * None.
1864 *
1865 *----------------------------------------------------------------------
1866 */
1867Tk_Window
1868Blt_GetToplevel(Tk_Window tkwin) /* Window for which the toplevel
1869 * should be deterined. */
1870{
1871 while (!Tk_IsTopLevel(tkwin)) {
1872 tkwin = Tk_Parent(tkwin);
1873 if (tkwin == NULL) {
1874 return NULL;
1875 }
1876 }
1877 return tkwin;
1878}
1879
1880/*
1881 *----------------------------------------------------------------------
1882 *
1883 * Blt_RaiseToLevelWindow --
1884 *
1885 * Results:
1886 * None.
1887 *
1888 *----------------------------------------------------------------------
1889 */
1890void
1891Blt_RaiseToplevel(Tk_Window tkwin)
1892{
1893 SetWindowPos(GetWindowHandle(tkwin), HWND_TOP, 0, 0, 0, 0,
1894 SWP_NOMOVE | SWP_NOSIZE);
1895}
1896
1897/*
1898 *----------------------------------------------------------------------
1899 *
1900 * Blt_MapToplevel --
1901 *
1902 * Results:
1903 * None.
1904 *
1905 *----------------------------------------------------------------------
1906 */
1907void
1908Blt_MapToplevel(Tk_Window tkwin)
1909{
1910 ShowWindow(GetWindowHandle(tkwin), SW_SHOWNORMAL);
1911}
1912
1913/*
1914 *----------------------------------------------------------------------
1915 *
1916 * Blt_UnmapToplevel --
1917 *
1918 * Results:
1919 * None.
1920 *
1921 *----------------------------------------------------------------------
1922 */
1923void
1924Blt_UnmapToplevel(Tk_Window tkwin)
1925{
1926 ShowWindow(GetWindowHandle(tkwin), SW_HIDE);
1927}
1928
1929/*
1930 *----------------------------------------------------------------------
1931 *
1932 * Blt_MoveResizeToplevel --
1933 *
1934 * Results:
1935 * None.
1936 *
1937 *----------------------------------------------------------------------
1938 */
1939void
1940Blt_MoveResizeToplevel(tkwin, x, y, width, height)
1941 Tk_Window tkwin;
1942 int x, y, width, height;
1943{
1944 SetWindowPos(GetWindowHandle(tkwin), HWND_TOP, x, y, width, height, 0);
1945}
1946
1947int
1948Blt_ReparentWindow(
1949 Display *display,
1950 Window window,
1951 Window newParent,
1952 int x, int y)
1953{
1954 XReparentWindow(display, window, newParent, x, y);
1955 return TCL_OK;
1956}
1957
1958#else /* WIN32 */
1959
1960/*
1961 *----------------------------------------------------------------------
1962 *
1963 * Blt_GetRealWindowId --
1964 *
1965 * Returns the XID for the Tk_Window given. Starting in Tk 8.0,
1966 * the toplevel widgets are wrapped by another window.
1967 * Currently there's no way to get at that window, other than
1968 * what is done here: query the X window hierarchy and grab the
1969 * parent.
1970 *
1971 * Results:
1972 * Returns the X Window ID of the widget. If it's a toplevel, then
1973 * the XID of the wrapper is returned.
1974 *
1975 *----------------------------------------------------------------------
1976 */
1977Window
1978Blt_GetRealWindowId(tkwin)
1979 Tk_Window tkwin;
1980{
1981 return GetWindowId(tkwin);
1982}
1983
1984/*
1985 *----------------------------------------------------------------------
1986 *
1987 * Blt_RaiseToplevel --
1988 *
1989 * Results:
1990 * None.
1991 *
1992 *----------------------------------------------------------------------
1993 */
1994void
1995Blt_RaiseToplevel(tkwin)
1996 Tk_Window tkwin;
1997{
1998 XRaiseWindow(Tk_Display(tkwin), GetWindowId(tkwin));
1999}
2000
2001/*
2002 *----------------------------------------------------------------------
2003 *
2004 * Blt_LowerToplevel --
2005 *
2006 * Results:
2007 * None.
2008 *
2009 *----------------------------------------------------------------------
2010 */
2011void
2012Blt_LowerToplevel(tkwin)
2013 Tk_Window tkwin;
2014{
2015 XLowerWindow(Tk_Display(tkwin), GetWindowId(tkwin));
2016}
2017
2018/*
2019 *----------------------------------------------------------------------
2020 *
2021 * Blt_ResizeToplevel --
2022 *
2023 * Results:
2024 * None.
2025 *
2026 *----------------------------------------------------------------------
2027 */
2028void
2029Blt_ResizeToplevel(tkwin, width, height)
2030 Tk_Window tkwin;
2031 int width, height;
2032{
2033 XResizeWindow(Tk_Display(tkwin), GetWindowId(tkwin), width, height);
2034}
2035
2036/*
2037 *----------------------------------------------------------------------
2038 *
2039 * Blt_MoveResizeToplevel --
2040 *
2041 * Results:
2042 * None.
2043 *
2044 *----------------------------------------------------------------------
2045 */
2046void
2047Blt_MoveResizeToplevel(tkwin, x, y, width, height)
2048 Tk_Window tkwin;
2049 int x, y, width, height;
2050{
2051 XMoveResizeWindow(Tk_Display(tkwin), GetWindowId(tkwin), x, y,
2052 width, height);
2053}
2054
2055/*
2056 *----------------------------------------------------------------------
2057 *
2058 * Blt_ResizeToplevel --
2059 *
2060 * Results:
2061 * None.
2062 *
2063 *----------------------------------------------------------------------
2064 */
2065void
2066Blt_MoveToplevel(tkwin, x, y)
2067 Tk_Window tkwin;
2068 int x, y;
2069{
2070 XMoveWindow(Tk_Display(tkwin), GetWindowId(tkwin), x, y);
2071}
2072
2073/*
2074 *----------------------------------------------------------------------
2075 *
2076 * Blt_MapToplevel --
2077 *
2078 * Results:
2079 * None.
2080 *
2081 *----------------------------------------------------------------------
2082 */
2083void
2084Blt_MapToplevel(tkwin)
2085 Tk_Window tkwin;
2086{
2087 XMapWindow(Tk_Display(tkwin), GetWindowId(tkwin));
2088}
2089
2090/*
2091 *----------------------------------------------------------------------
2092 *
2093 * Blt_UnmapToplevel --
2094 *
2095 * Results:
2096 * None.
2097 *
2098 *----------------------------------------------------------------------
2099 */
2100void
2101Blt_UnmapToplevel(tkwin)
2102 Tk_Window tkwin;
2103{
2104 XUnmapWindow(Tk_Display(tkwin), GetWindowId(tkwin));
2105}
2106
2107/* ARGSUSED */
2108static int
2109XReparentWindowErrorProc(clientData, errEventPtr)
2110 ClientData clientData;
2111 XErrorEvent *errEventPtr;
2112{
2113 int *errorPtr = clientData;
2114
2115 *errorPtr = TCL_ERROR;
2116 return 0;
2117}
2118
2119int
2120Blt_ReparentWindow(display, window, newParent, x, y)
2121 Display *display;
2122 Window window, newParent;
2123 int x, y;
2124{
2125 Tk_ErrorHandler handler;
2126 int result;
2127 int any = -1;
2128
2129 result = TCL_OK;
2130 handler = Tk_CreateErrorHandler(display, any, X_ReparentWindow, any,
2131 XReparentWindowErrorProc, &result);
2132 XReparentWindow(display, window, newParent, x, y);
2133 Tk_DeleteErrorHandler(handler);
2134 XSync(display, False);
2135 return result;
2136}
2137
2138#endif /* WIN32 */
2139
2140#if (TK_MAJOR_VERSION == 4)
2141#include <bltHash.h>
2142static int initialized = FALSE;
2143static Blt_HashTable windowTable;
2144
2145void
2146Blt_SetWindowInstanceData(tkwin, instanceData)
2147 Tk_Window tkwin;
2148 ClientData instanceData;
2149{
2150 Blt_HashEntry *hPtr;
2151 int isNew;
2152
2153 if (!initialized) {
2154 Blt_InitHashTable(&windowTable, BLT_ONE_WORD_KEYS);
2155 initialized = TRUE;
2156 }
2157 hPtr = Blt_CreateHashEntry(&windowTable, (char *)tkwin, &isNew);
2158 assert(isNew);
2159 Blt_SetHashValue(hPtr, instanceData);
2160}
2161
2162ClientData
2163Blt_GetWindowInstanceData(tkwin)
2164 Tk_Window tkwin;
2165{
2166 Blt_HashEntry *hPtr;
2167
2168 hPtr = Blt_FindHashEntry(&windowTable, (char *)tkwin);
2169 if (hPtr == NULL) {
2170 return NULL;
2171 }
2172 return Blt_GetHashValue(hPtr);
2173}
2174
2175void
2176Blt_DeleteWindowInstanceData(tkwin)
2177 Tk_Window tkwin;
2178{
2179 Blt_HashEntry *hPtr;
2180
2181 hPtr = Blt_FindHashEntry(&windowTable, (char *)tkwin);
2182 assert(hPtr);
2183 Blt_DeleteHashEntry(&windowTable, hPtr);
2184}
2185
2186#else
2187
2188void
2189Blt_SetWindowInstanceData(tkwin, instanceData)
2190 Tk_Window tkwin;
2191 ClientData instanceData;
2192{
2193 TkWindow *winPtr = (TkWindow *)tkwin;
2194
2195 winPtr->instanceData = instanceData;
2196}
2197
2198ClientData
2199Blt_GetWindowInstanceData(tkwin)
2200 Tk_Window tkwin;
2201{
2202 TkWindow *winPtr = (TkWindow *)tkwin;
2203
2204 return winPtr->instanceData;
2205}
2206
2207void
2208Blt_DeleteWindowInstanceData(tkwin)
2209 Tk_Window tkwin;
2210{
2211}
2212
2213#endif
2214
Note: See TracBrowser for help on using the repository browser.