home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!corpgate!bnrgate!bmers95!usenet
- From: ross@bnr.ca (Ross Brown)
- Subject: Re: What is the structure of WindowList?
- Message-ID: <1992Aug28.154812.10609@bmers95.bnr.ca>
- Sender: usenet@bmers95.bnr.ca
- Organization: Bell-Northern Research
- References: <1992Aug28.124209.4159@fwi.uva.nl>
- Date: Fri, 28 Aug 92 15:48:12 GMT
- Lines: 56
-
- In article <1992Aug28.124209.4159@fwi.uva.nl> bakker@fwi.uva.nl (Harry Bakker
- (I87)) writes:
- >To all net visitor,
- >
- >I'm working on a package that manages floating windows. For this purpose
- >I need the structure of the WindowList. In IM-1 it says, that the WindowList
- >contains ALL windows on the desktop, not just the windows that belong to the
- >currently active application. If that is so, how does the WindowManager keeps
- >track of which window belongs to which application? You can see that it does
- >know that after a context swich. All the windows that belong to the app that's
- >becoming active are brought to the front of all other windows.
- >Where can I find the root of the windowlist? If I have, say, three windows
- >open, and all background applications together have four windows open,
- >then how many windows do I count if I walked down the windowlist? Three or
- >seven?
- >
- >Could somebody help me on these questions?
-
- The system window list is a linked list of fake WindowRecords, one per
- application, with each application's own window list hanging off this list via
- the windowPic field (!). As far as I know, this is undocumented, and thus
- subject to change. For System 7.0, it works. Beyond that, who knows?
-
- #define SaveProc 0x0A90 /* low-memory global, anchor of window list */
- {
- WindowPeek wa, wp;
- /* Traverse all the window list headers. */
- for( wa = *(WindowPeek *) SaveProc; wa != nil; wa = wa->nextWindow )
- { /* Here is some info about the application owning each window list: */
- char *funnyPtr = (char *) GetWRefCon( (WindowPtr) wa );
- OSType type = *(OSType *) ( funnyPtr + 0x4 );
- OSType signature = *(OSType *) ( funnyPtr + 0x8 );
- ProcessSerialNumberPtr psnPtr = (ProcessSerialNumberPtr) ( funnyPtr + 0x24 );
- /* Traverse all the window records in each list. */
- for( wp = (WindowPeek) wa->windowPic; wp != nil; wp = wp->nextWindow )
- {
- /* wp points to a real WindowRecord.
- * You should watch for the following:
- * wp->visible => window is visible (not HideWindow'd)
- * EmptyRgn( wp->strucRgn ) => window's application is hidden
- * wp->windowKind == dialogKind => window is dialog
- * wp->windowKind >= userKind => window is normal application window
- * wp->windowKind < 0 => window is desk accessory window
- * wp->windowKind == -32767 => window is something unreal (avoid!)
- * Finder has a fake window named "Desktop" with a nil wp->dataHandle.
- */
- }
- }
- }
-
- W. Ross Brown | from Brown's Bestiary of the Macintosh:
- Advisor, Telemanagement Svcs. | PBCatMoof: A purring system trap shaped like
- Bell-Northern Research Ltd. | a dog with cow spots and a 3-hr. battery life.
- Ottawa, Ontario, Canada | ----------------------------------------------
- ross@bnr.ca | Any opinion expressed is mine, not BNR's.
-
-