home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14663 < prev    next >
Encoding:
Text File  |  1992-08-29  |  3.2 KB  |  68 lines

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