home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!apple!applelink.apple.com
- From: SIGMUND@NORA.HD.UIB.NO
- Newsgroups: comp.sys.mac.oop.macapp3
- Subject: TWindow, a problem and a bug
- Message-ID: <199301011930.AA00471@nora.hd.uib.no>
- Date: 1 Jan 93 20:30:00 GMT
- Sender: daemon@Apple.COM
- Organization: AppleLink Gateway
- Lines: 84
-
- From: sigmund@nora.hd.uib.no
- To: MACAPP3TECH$@applelink.apple.com
- Cc: achiqui@roman.uib.no
-
- Dear MacAppers,
-
- Working with multiple monitors connected has revealed a problem with MacApp
- 3.0.1 and also what I believe are a couple of bugs.
-
- The problem:
-
- Members of TWindow: Center and Zoom, are two large functions that call
- this->GetMaxIntersectedDevice. That means they are hardcoded to be
- directed to the device that has the largest area in common with the window.
- One of my windows needs to be directed towards the device with a video
- board connected, and we can imagine occasions where a window should be
- directed to the deepest device, or the main device.
-
- It would be better if there was a "GetPreferredDevice" function that Center
- and Zoom would call instead. TWindow::GetPreferredDevice could simply call
- GetMaxIntersectedDevice, and subclasses could call something else.
-
- The first bug:
-
- TWindow::Center doesn't work if GetMaxIntersectedDevice returns any other
- device than the main screen. As theFrame is calculated, Center only pays
- attention to the device's size, not its position. As a result the window
- is placed on the main device, in a position where it would have been
- centered on the correct device.
-
- The second bug:
-
- TWindow::Center doesn't really trust GetMaxIntersectedDevice to account for
- menubar and adds GetMBarHeight to theFrame.top. This compensates for bug
- #1 when dealing with the main device, but when bug #1 is corrected, the
- window will be placed 20 pixels (at least here in Norway) too low on any
- device.
-
- I would suggest the following fix to both bugs in TWindow::Center, where
- theFrame.top and theFrame.left are calculated.
-
- Take this:
-
- if (horizontally)
- theFrame.left = (screenSize.h - contentSize.h + fContentRegionInset.h)
- / 2;
- if (forDialog)
- // Put it in the top third of the screen
- theFrame.top = ((screenSize.v - contentSize.v + fContentRegionInset.v)
- / 3)
- +
- GetMBarHeight();
- else if (vertically)
- theFrame.top = ((screenSize.v - contentSize.v + fContentRegionInset.v)
- / 2)
- +
- GetMBarHeight();
-
- And change to this:
-
- if (horizontally)
- theFrame.left = (screenSize.h - contentSize.h + fContentRegionInset.h)
- / 2
- +
- screenRect.left;
- if (forDialog)
- // Put it in the top third of the screen
- theFrame.top = (screenSize.v - contentSize.v + fContentRegionInset.v) /
- 3
- + screenRect.top;
- else if (vertically)
- theFrame.top = (screenSize.v - contentSize.v + fContentRegionInset.v) /
- 2
- + screenRect.top;
-
-
- This works for me, but please correct me if I am wrong or if anybody has a
- better solution.
-
- Regards,
- Sigmund Tveit
- Humanistisk Datasenter
- Norway
-
-