Path: utzoo!attcan!uunet!husc6!bbn!bbn.com!levin From: levin@bbn.com (Joel B Levin) Newsgroups: comp.sys.mac.programmer Subject: Re: What do InitGraf (etc) do? Message-ID: <32617@bbn.COM> Date: 22 Nov 88 15:35:00 GMT References: <987@etive.ed.ac.uk> <988@etive.ed.ac.uk> Sender: news@bbn.COM Reply-To: levin@BBN.COM (Joel B Levin) Organization: BBN Communications Corporation Lines: 27 In article <988@etive.ed.ac.uk> nick@lfcs.ed.ac.uk (Nick Rothwell) writes: |A short and sweet question: Why do my programs have to call InitGraf(), |InitTE(), InitDialogs() and all the rest of this stuff? | A Macintosh sitting in the Finder is running QuickDraw, putting up dialogs, |and so on, so "initialisation" in that sense is surely unnecessary? Does it |make sense to initialise a manager more than once? (I'm sure you'll get lots of answers...) Some "global" managers are, in fact, initialized once, e.g. the resource manager, memory manager, etc ... Inside Mac spells this out for each appropriate manager ("The application should never need to do this" type of comment). Other managers deal with structures and processes "local" to the application and its heap. InitGraf initializes the QD globals for the application, clears the screen to the default desktop pattern(*), resets the cursor, etc. -- note how all this always happens when a new application is launched. So InitGraf and initialization procedures for all the managers dependent on QD need to be called every time the application heap is initialized. /JBL (*) While this does not all happen under MultiFinder, each application has its own heap and QD globals, so InitGraf is still needed. UUCP: {backbone}!bbn!levin POTS: (617) 873-3463 INTERNET: levin@bbn.com