MCPcopy Create free account
hub / github.com/NetHack/NetHack / SanePositions

Function SanePositions

outdated/sys/mac/macwin.c:565–693  ·  view source on GitHub ↗

* This function could be overloaded with any amount of intelligence... */

Source from the content-addressed store, hash-verified

563 * This function could be overloaded with any amount of intelligence...
564 */
565int
566SanePositions(void)
567{
568#if TARGET_API_MAC_CARBON
569 Rect rbase, rmsg;
570 SInt16 i, width, height;
571
572 ConstrainWindowToScreen(_mt_window, kWindowContentRgn,
573 kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
574 GetWindowBounds(_mt_window, kWindowContentRgn, &rbase);
575 if (RetrievePosition(kMapWindow, &rbase.top, &rbase.left))
576 MoveWindow(_mt_window, rbase.left, rbase.top, TRUE);
577
578 GetWindowBounds(theWindows[NHW_MESSAGE].its_window, kWindowContentRgn,
579 &rmsg);
580 height = rmsg.bottom - rmsg.top;
581 rmsg.top = rbase.bottom + 2;
582 rmsg.bottom = rmsg.top + height;
583 rmsg.left = rbase.left;
584 rmsgr.right = rbase.right;
585 RetrievePosition(kMessageWindow, &rmsg.top, &rmsg.left);
586 if (RetrieveSize(kMessageWindow, rmsg.top, rmsg.left, &height, &width)) {
587 rmsgr.right = rmsg.left + width;
588 rmsg.bottom = rmsg.top + height;
589 }
590 SetWindowBounds(theWindows[NHW_MESSAGE].its_window, kWindowContentRgn,
591 &rmsg);
592 ConstrainWindowToScreen(theWindows[NHW_MESSAGE].its_window,
593 kWindowContentRgn,
594 kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
595 DrawScrollbar(&theWindows[NHW_MESSAGE]);
596
597 for (i = 0; i < NUM_MACWINDOWS; i++)
598 if (i != WIN_STATUS && i != WIN_MESSAGE && i != WIN_MAP
599 && i != BASE_WINDOW && theWindows[i].its_window) {
600 /* FIXME */
601 ConstrainWindowToScreen(
602 theWindows[i].its_window, kWindowContentRgn,
603 kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
604 }
605#else
606 short left, top, width, height;
607 int ix, numText = 0, numMenu = 0;
608 int mbar_height = GetMBarHeight();
609 BitMap qbitmap;
610 Rect screenArea;
611 WindowPtr theWindow;
612 NhWindow *nhWin;
613
614 screenArea = GetQDGlobalsScreenBits(&qbitmap)->bounds;
615 OffsetRect(&screenArea, -screenArea.left, -screenArea.top);
616
617 /* Map Window */
618 height = _mt_window->portRect.bottom - _mt_window->portRect.top;
619 width = _mt_window->portRect.right - _mt_window->portRect.left;
620
621 if (!RetrievePosition(kMapWindow, &top, &left)) {
622 top = mbar_height + (small_screen ? 2 : 20);

Callers 2

DoMenuEvtFunction · 0.85

Calls 3

RetrievePositionFunction · 0.85
RetrieveSizeFunction · 0.85
DrawScrollbarFunction · 0.85

Tested by

no test coverage detected