Mac Carbon updates

This commit is contained in:
kmhugo
2004-08-10 05:37:41 +00:00
parent 3b2efac99c
commit f4322a56fb
11 changed files with 246 additions and 65 deletions

View File

@@ -53,9 +53,16 @@
* include the relevant files in the relevant .c files instead !
*/
#if TARGET_API_MAC_CARBON
/* Avoid including <CarbonCore/fp.h> -- it has a conflicting expl() */
# define __FP__
# include <Carbon/Carbon.h>
# ifdef GNUC
/* Avoid including <CarbonCore/fp.h> -- it has a conflicting expl() */
# define __FP__
# include <Carbon/Carbon.h>
# else
/* Avoid including <fenv.h> -- it uses GENERATINGPOWERPC */
# define __FENV__
# include <machine/types.h>
# include <Carbon.h>
# endif
#else
# include <MacTypes.h>
#endif
@@ -73,7 +80,7 @@
extern void error(const char *,...);
#if !defined(O_WRONLY)
# ifdef __MWERKS__
# if defined(__MWERKS__) && !TARGET_API_MAC_CARBON
# include <unix.h>
# endif
# include <fcntl.h>

View File

@@ -44,7 +44,7 @@
#undef red /* undef internal color const strings from decl */
#undef green
#undef blue
#if !TARGET_API_MAC_CARBON
#if 1 /*!TARGET_API_MAC_CARBON*/
# include <windows.h>
#endif

View File

@@ -137,6 +137,7 @@ static int lockptr;
#endif
#ifdef MAC
# undef unlink
# define unlink macunlink
#endif

View File

@@ -2,9 +2,28 @@
#include "date.h"
#include "patchlevel.h"
resource 'plst' (0, purgeable) {
};
/* Carbon 'carb' resource
* has been made obsolete by the 'plst' resource below.
*/
/* Carbon 'plst' resource
* Single-file applications must have this resource for MacOS X to
* count it as a Carbon app rather than a Classic app. It contains
* an embedded Info.plist file, with the same format as would occur
* in an application based on a directory bundle. The attributes
* declared in this resource override the 'BNDL', 'FREF', and 'vers'
* resources in MacOS X.
*
* For further information, see
* http://developer.apple.com/technotes/tn/tn2013.html
*/
read 'plst' (0) "carbon.plist";
/* Classic resources
* These resources are used in MacOS 9.x and earlier.
*/
resource 'vers' (1, purgeable) {
VERSION_MAJOR, (VERSION_MINOR<<4) | PATCHLEVEL, final, EDITLEVEL, verUS,
VERSION_STRING,
@@ -17,6 +36,140 @@ resource 'vers' (2, purgeable) {
"devteam@nethack.org"
};
/* Dungeon librarian files
* File data and quest.dat have gotten too big to be put into resources!
*/
#ifdef TARGET_API_MAC_CARBON
read 'File' (1000,"cmdhelp") "cmdhelp";
read 'File' (1001,"help") "help";
read 'File' (1002,"hh") "hh";
read 'File' (1003,"history") "history";
read 'File' (1004,"license") "license";
read 'File' (1005,"MacHelp") "MacHelp";
read 'File' (1006,"News") "News";
read 'File' (1007,"opthelp") "opthelp";
read 'File' (1008,"wizhelp") "wizhelp";
read 'File' (1009,"air.lev") "air.lev";
read 'File' (1010,"asmodeus.lev") "asmodeus.lev";
read 'File' (1011,"astral.lev") "astral.lev";
read 'File' (1012,"baalz.lev") "baalz.lev";
read 'File' (1013,"bigrm-1.lev") "bigrm-1.lev";
read 'File' (1014,"bigrm-2.lev") "bigrm-2.lev";
read 'File' (1015,"bigrm-3.lev") "bigrm-3.lev";
read 'File' (1016,"bigrm-4.lev") "bigrm-4.lev";
read 'File' (1017,"bigrm-5.lev") "bigrm-5.lev";
read 'File' (1018,"castle.lev") "castle.lev";
//read 'File' (1019,"data") "data";
read 'File' (1020,"dungeon") "dungeon";
read 'File' (1021,"earth.lev") "earth.lev";
read 'File' (1022,"fakewiz1.lev") "fakewiz1.lev";
read 'File' (1023,"fakewiz2.lev") "fakewiz2.lev";
read 'File' (1024,"fire.lev") "fire.lev";
read 'File' (1025,"juiblex.lev") "juiblex.lev";
read 'File' (1026,"knox.lev") "knox.lev";
read 'File' (1027,"medusa-1.lev") "medusa-1.lev";
read 'File' (1028,"medusa-2.lev") "medusa-2.lev";
read 'File' (1029,"minefill.lev") "minefill.lev";
read 'File' (1030,"minend-1.lev") "minend-1.lev";
read 'File' (1031,"minend-2.lev") "minend-2.lev";
read 'File' (1032,"minend-3.lev") "minend-3.lev";
read 'File' (1034,"minetn-1.lev") "minetn-1.lev";
read 'File' (1035,"minetn-2.lev") "minetn-2.lev";
read 'File' (1036,"minetn-3.lev") "minetn-3.lev";
read 'File' (1037,"minetn-4.lev") "minetn-4.lev";
read 'File' (1038,"minetn-5.lev") "minetn-5.lev";
read 'File' (1039,"minetn-6.lev") "minetn-6.lev";
read 'File' (1040,"minetn-7.lev") "minetn-7.lev";
read 'File' (1041,"options") "options";
read 'File' (1042,"oracle.lev") "oracle.lev";
read 'File' (1043,"oracles") "oracles";
read 'File' (1044,"orcus.lev") "orcus.lev";
//read 'File' (1045,"quest.dat") "quest.dat";
read 'File' (1046,"rumors") "rumors";
read 'File' (1047,"sanctum.lev") "sanctum.lev";
read 'File' (1048,"soko1-1.lev") "soko1-1.lev";
read 'File' (1049,"soko1-2.lev") "soko1-2.lev";
read 'File' (1050,"soko2-1.lev") "soko2-1.lev";
read 'File' (1051,"soko2-2.lev") "soko2-2.lev";
read 'File' (1052,"soko3-1.lev") "soko3-1.lev";
read 'File' (1053,"soko3-2.lev") "soko3-2.lev";
read 'File' (1054,"soko4-1.lev") "soko4-1.lev";
read 'File' (1055,"soko4-2.lev") "soko4-2.lev";
read 'File' (1056,"tower1.lev") "tower1.lev";
read 'File' (1057,"tower2.lev") "tower2.lev";
read 'File' (1058,"tower3.lev") "tower3.lev";
read 'File' (1059,"valley.lev") "valley.lev";
read 'File' (1060,"water.lev") "water.lev";
read 'File' (1061,"wizard1.lev") "wizard1.lev";
read 'File' (1062,"wizard2.lev") "wizard2.lev";
read 'File' (1063,"wizard3.lev") "wizard3.lev";
read 'File' (1100,"Arc-fila.lev") "Arc-fila.lev";
read 'File' (1101,"Arc-filb.lev") "Arc-filb.lev";
read 'File' (1102,"Arc-goal.lev") "Arc-goal.lev";
read 'File' (1103,"Arc-loca.lev") "Arc-loca.lev";
read 'File' (1104,"Arc-strt.lev") "Arc-strt.lev";
read 'File' (1105,"Bar-fila.lev") "Bar-fila.lev";
read 'File' (1106,"Bar-filb.lev") "Bar-filb.lev";
read 'File' (1107,"Bar-goal.lev") "Bar-goal.lev";
read 'File' (1108,"Bar-loca.lev") "Bar-loca.lev";
read 'File' (1109,"Bar-strt.lev") "Bar-strt.lev";
read 'File' (1110,"Cav-fila.lev") "Cav-fila.lev";
read 'File' (1111,"Cav-filb.lev") "Cav-filb.lev";
read 'File' (1112,"Cav-goal.lev") "Cav-goal.lev";
read 'File' (1113,"Cav-loca.lev") "Cav-loca.lev";
read 'File' (1114,"Cav-strt.lev") "Cav-strt.lev";
read 'File' (1115,"Hea-fila.lev") "Hea-fila.lev";
read 'File' (1116,"Hea-filb.lev") "Hea-filb.lev";
read 'File' (1117,"Hea-goal.lev") "Hea-goal.lev";
read 'File' (1118,"Hea-loca.lev") "Hea-loca.lev";
read 'File' (1119,"Hea-strt.lev") "Hea-strt.lev";
read 'File' (1120,"Kni-fila.lev") "Kni-fila.lev";
read 'File' (1121,"Kni-filb.lev") "Kni-filb.lev";
read 'File' (1122,"Kni-goal.lev") "Kni-goal.lev";
read 'File' (1123,"Kni-loca.lev") "Kni-loca.lev";
read 'File' (1124,"Kni-strt.lev") "Kni-strt.lev";
read 'File' (1125,"Mon-fila.lev") "Mon-fila.lev";
read 'File' (1126,"Mon-filb.lev") "Mon-filb.lev";
read 'File' (1127,"Mon-goal.lev") "Mon-goal.lev";
read 'File' (1128,"Mon-loca.lev") "Mon-loca.lev";
read 'File' (1129,"Mon-strt.lev") "Mon-strt.lev";
read 'File' (1130,"Pri-fila.lev") "Pri-fila.lev";
read 'File' (1131,"Pri-filb.lev") "Pri-filb.lev";
read 'File' (1132,"Pri-goal.lev") "Pri-goal.lev";
read 'File' (1133,"Pri-loca.lev") "Pri-loca.lev";
read 'File' (1134,"Pri-strt.lev") "Pri-strt.lev";
read 'File' (1135,"Ran-fila.lev") "Ran-fila.lev";
read 'File' (1136,"Ran-filb.lev") "Ran-filb.lev";
read 'File' (1137,"Ran-goal.lev") "Ran-goal.lev";
read 'File' (1138,"Ran-loca.lev") "Ran-loca.lev";
read 'File' (1139,"Ran-strt.lev") "Ran-strt.lev";
read 'File' (1140,"Rog-fila.lev") "Rog-fila.lev";
read 'File' (1141,"Rog-filb.lev") "Rog-filb.lev";
read 'File' (1142,"Rog-goal.lev") "Rog-goal.lev";
read 'File' (1143,"Rog-loca.lev") "Rog-loca.lev";
read 'File' (1144,"Rog-strt.lev") "Rog-strt.lev";
read 'File' (1145,"Sam-fila.lev") "Sam-fila.lev";
read 'File' (1146,"Sam-filb.lev") "Sam-filb.lev";
read 'File' (1147,"Sam-goal.lev") "Sam-goal.lev";
read 'File' (1148,"Sam-loca.lev") "Sam-loca.lev";
read 'File' (1149,"Sam-strt.lev") "Sam-strt.lev";
read 'File' (1150,"Tou-fila.lev") "Tou-fila.lev";
read 'File' (1151,"Tou-filb.lev") "Tou-filb.lev";
read 'File' (1152,"Tou-goal.lev") "Tou-goal.lev";
read 'File' (1153,"Tou-loca.lev") "Tou-loca.lev";
read 'File' (1154,"Tou-strt.lev") "Tou-strt.lev";
read 'File' (1155,"Val-fila.lev") "Val-fila.lev";
read 'File' (1156,"Val-filb.lev") "Val-filb.lev";
read 'File' (1157,"Val-goal.lev") "Val-goal.lev";
read 'File' (1158,"Val-loca.lev") "Val-loca.lev";
read 'File' (1159,"Val-strt.lev") "Val-strt.lev";
read 'File' (1160,"Wiz-fila.lev") "Wiz-fila.lev";
read 'File' (1161,"Wiz-filb.lev") "Wiz-filb.lev";
read 'File' (1162,"Wiz-goal.lev") "Wiz-goal.lev";
read 'File' (1163,"Wiz-loca.lev") "Wiz-loca.lev";
read 'File' (1164,"Wiz-strt.lev") "Wiz-strt.lev";
#else
read 'File' (1000,"cmdhelp") ":dat:cmdhelp";
read 'File' (1001,"help") ":dat:help";
read 'File' (1002,"hh") ":dat:hh";
@@ -50,7 +203,6 @@ read 'File' (1029,"minefill.lev") ":lib:minefill.lev";
read 'File' (1030,"minend-1.lev") ":lib:minend-1.lev";
read 'File' (1031,"minend-2.lev") ":lib:minend-2.lev";
read 'File' (1032,"minend-3.lev") ":lib:minend-3.lev";
read 'File' (1033,"minend-4.lev") ":lib:minend-4.lev";
read 'File' (1034,"minetn-1.lev") ":lib:minetn-1.lev";
read 'File' (1035,"minetn-2.lev") ":lib:minetn-2.lev";
read 'File' (1036,"minetn-3.lev") ":lib:minetn-3.lev";
@@ -146,3 +298,4 @@ read 'File' (1161,"Wiz-filb.lev") ":lib:Wiz-filb.lev";
read 'File' (1162,"Wiz-goal.lev") ":lib:Wiz-goal.lev";
read 'File' (1163,"Wiz-loca.lev") ":lib:Wiz-loca.lev";
read 'File' (1164,"Wiz-strt.lev") ":lib:Wiz-strt.lev";
#endif

View File

@@ -6,7 +6,7 @@
#include "mactty.h"
#include "macwin.h"
#if !TARGET_API_MAC_CARBON
#if 1 /*!TARGET_API_MAC_CARBON*/
#include <Folders.h>
#include <TextUtils.h>
#include <Resources.h>

View File

@@ -9,7 +9,7 @@
#include "macwin.h"
#include "mactty.h"
#if !TARGET_API_MAC_CARBON
#if 1 /*!TARGET_API_MAC_CARBON*/
#include <OSUtils.h>
#include <files.h>
#include <Types.h>
@@ -135,7 +135,7 @@ main (void)
if (discover)
You("are in non-scoring discovery mode.");
context.move = 0;
flags.move = 0;
UndimMenuBar (); /* Yes, this is the place for it (!) */

View File

@@ -767,8 +767,8 @@ void mac_askname ()
}
SetPort(oldport);
DisposeDialog(askdialog);
DisposeRoutineDescriptor(filter);
DisposeRoutineDescriptor(redraw);
DisposeModalFilterUPP(filter);
DisposeUserItemUPP(redraw);
/* Process the mode */
#ifdef WIZARD

View File

@@ -17,10 +17,12 @@
#include "hack.h"
#include "mactty.h"
#include "macwin.h"
#if !TARGET_API_MAC_CARBON
#if 1 /*!TARGET_API_MAC_CARBON*/
# include <Sound.h>
# include <Resources.h>
#else
#endif
#ifndef freqDurationCmd
# define freqDurationCmd 40
#endif

View File

@@ -13,7 +13,7 @@
#include "mactty.h"
#include "wintty.h"
#if !TARGET_API_MAC_CARBON
#if 1 /*!TARGET_API_MAC_CARBON*/
#include <LowMem.h>
#include <AppleEvents.h>
#include <Gestalt.h>
@@ -28,7 +28,7 @@
* Local variables and functions
*/
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
static EventTypeSpec baseevents[] = {
{ kEventClassKeyboard, kEventRawKeyDown },
{ kEventClassKeyboard, kEventRawKeyRepeat },
@@ -225,10 +225,12 @@ Boolean small_screen = 0;
static int FDECL(filter_scroll_key,(const int, NhWindow *));
#if 1//!TARGET_API_MAC_CARBON
static void FDECL(DoScrollBar,(Point, short, ControlHandle, NhWindow *));
#endif
static pascal void FDECL(MoveScrollBar, (ControlHandle, short));
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
typedef void (*CbFunc) (EventRecord *, WindowPtr);
typedef short (*CbUpFunc) (EventRecord *, WindowPtr);
typedef void (*CbCursFunc) (EventRecord *, WindowPtr, RgnHandle);
@@ -462,7 +464,7 @@ InitMac(void) {
/* Create the "record" file, if necessary */
check_recordfile("");
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
/* Create event handler universal procedure pointers */
dispatcher = GetEventDispatcherTarget();
baseupp = NewEventHandlerUPP(BaseEvent);
@@ -566,21 +568,38 @@ SanePositions (void)
{
#if TARGET_API_MAC_CARBON
Rect rbase, rmsg;
UInt16 height;
SInt16 i, width, height;
ConstrainWindowToScreen(_mt_window, kWindowStructureRgn,
ConstrainWindowToScreen(_mt_window, kWindowContentRgn,
kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
GetWindowBounds(_mt_window, kWindowStructureRgn, &rbase);
GetWindowBounds(theWindows[NHW_MESSAGE].its_window, kWindowStructureRgn, &rmsg);
GetWindowBounds(_mt_window, kWindowContentRgn, &rbase);
if (RetrievePosition(kMapWindow, &rbase.top, &rbase.left))
MoveWindow(_mt_window, rbase.left, rbase.top, TRUE);
GetWindowBounds(theWindows[NHW_MESSAGE].its_window, kWindowContentRgn, &rmsg);
height = rmsg.bottom - rmsg.top;
rmsg.top = rbase.bottom+2;
rmsg.bottom = rmsg.top + height;
rmsg.left = rbase.left;
rmsg.right = rbase.right;
SetWindowBounds(theWindows[NHW_MESSAGE].its_window, kWindowStructureRgn, &rmsg);
ConstrainWindowToScreen(theWindows[NHW_MESSAGE].its_window, kWindowStructureRgn,
RetrievePosition(kMessageWindow, &rmsg.top, &rmsg.left);
if (RetrieveSize(kMessageWindow, rmsg.top, rmsg.left, &height, &width)) {
rmsg.right = rmsg.left + width;
rmsg.bottom = rmsg.top + height;
}
SetWindowBounds(theWindows[NHW_MESSAGE].its_window, kWindowContentRgn, &rmsg);
ConstrainWindowToScreen(theWindows[NHW_MESSAGE].its_window, kWindowContentRgn,
kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
DrawScrollbar(&theWindows[NHW_MESSAGE]);
for (i = 0; i < NUM_MACWINDOWS; i++)
if (i != WIN_STATUS && i != WIN_MESSAGE && i != WIN_MAP &&
i != BASE_WINDOW && theWindows[i].its_window) {
/* FIXME */
ConstrainWindowToScreen(theWindows[i].its_window, kWindowContentRgn,
kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
}
#else
short left, top, width, height;
int ix, numText = 0, numMenu = 0;
@@ -672,8 +691,9 @@ SanePositions (void)
void
mac_init_nhwindows (int *argcp, char **argv)
{
Rect r;
#if !TARGET_API_MAC_CARBON
Rect r, scr = (*GetGrayRgn())->rgnBBox;
Rect scr = (*GetGrayRgn())->rgnBBox;
small_screen = scr.bottom - scr.top <= (iflags.large_font ? 12*40 : 9*40);
#endif
@@ -699,7 +719,7 @@ mac_init_nhwindows (int *argcp, char **argv)
mac_create_nhwindow(NHW_BASE);
tty_create_nhwindow(NHW_MESSAGE);
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
/* Resize and reposition the message window */
RetrievePosition(kMessageWindow, &r.top, &r.left);
RetrieveSize(kMessageWindow, r.top, r.left, &r.bottom, &r.right);
@@ -765,7 +785,7 @@ got1 :
get_tty_metrics(aWin->its_window, &x_sz, &y_sz, &x_sz_p, &y_sz_p,
&aWin->font_number, &aWin->font_size,
&aWin->char_width, &aWin->row_height);
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
InstallWindowEventHandler(aWin->its_window, baseupp,
sizeof(baseevents)/sizeof(EventTypeSpec), baseevents,
(void *)aWin, NULL);
@@ -786,7 +806,7 @@ got1 :
aWin->x_curs = aWin->y_curs = 0;
aWin->drawn = TRUE;
mac_clear_nhwindow (i);
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
switch (kind) {
case NHW_MESSAGE:
InstallWindowEventHandler(aWin->its_window, msgupp,
@@ -927,8 +947,7 @@ mac_clear_nhwindow (winid win) {
static Boolean
ClosingWindowChar(const int c) {
return c == CHAR_ESC || c == CHAR_BLANK || c == CHAR_LF || c == CHAR_CR ||
c == 'q';
return (c == CHAR_ESC || c == CHAR_BLANK || c == CHAR_LF || c == CHAR_CR);
}
@@ -986,7 +1005,7 @@ enter_topl_mode(char *query) {
void
leave_topl_mode(char *answer) {
unsigned char *ap, *bp;
/*unsigned*/ char *ap, *bp;
int ans_len = (*top_line)->teLength - topl_query_len;
NhWindow *aWin = theWindows + WIN_MESSAGE;
@@ -1205,7 +1224,7 @@ adjust_window_pos(NhWindow *aWin, short width, short height)
MoveWindow(theWindow, r.left, r.top, false);
SizeWindow(theWindow, width, height, true);
ConstrainWindowToScreen(theWindow, kWindowStructureRgn,
kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
kWindowConstrainMayResize|kWindowConstrainMoveRegardlessOfFit, NULL, NULL);
#else
Rect scr_r = (*GetGrayRgn())->rgnBBox;
const Rect win_ind = {2, 2, 3, 3};
@@ -1323,7 +1342,7 @@ mac_destroy_nhwindow (winid win) {
}
if (win == WIN_INVEN || win == WIN_MESSAGE) {
if (iflags.window_inited) {
if (flags.tombstone && killer.name[0]) {
if (flags.tombstone && killer[0]) {
/* Prepare for the coming of the tombstone window. */
win_fonts [NHW_TEXT] = kFontIDMonaco;
}
@@ -1460,7 +1479,7 @@ ListCoordinateToItem (NhWindow *aWin, short Row) {
static pascal void
MoveScrollBar (ControlHandle theBar, short part) {
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
EventRecord fake;
#endif
Rect r;
@@ -1508,7 +1527,7 @@ MoveScrollBar (ControlHandle theBar, short part) {
InvalWindowRgn(theWin, rgn);
BeginUpdate(theWin);
}
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
switch (GetWindowKind(theWin) - WIN_BASE_KIND) {
case NHW_MESSAGE:
MsgUpdate(GetNhWin(theWin));
@@ -1530,7 +1549,7 @@ MoveScrollBar (ControlHandle theBar, short part) {
}
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
static void
DoScrollBar (Point p, short code, ControlHandle theBar, NhWindow *aWin)
{
@@ -1634,7 +1653,10 @@ mac_get_nh_event(void) {
if (!iflags.window_inited)
return;
(void) WaitNextEvent (everyEvent, &anEvent, -1, gMouseRgn);
#if TARGET_API_MAC_CARBON
QDFlushPortBuffer(GetWindowPort(_mt_window), NULL);
#endif
(void) WaitNextEvent (everyEvent, &anEvent, 1, gMouseRgn);
HandleEvent(&anEvent);
return;
}
@@ -1647,7 +1669,7 @@ mac_nhgetch(void) {
EventRecord anEvent;
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
/* We want to take care of keys in the buffer as fast as
* possible
*/
@@ -1672,6 +1694,9 @@ mac_nhgetch(void) {
#endif
do {
#if TARGET_API_MAC_CARBON
QDFlushPortBuffer(GetWindowPort(_mt_window), NULL);
#endif
#if 0//TARGET_API_MAC_CARBON
EventRef event;
@@ -2098,10 +2123,10 @@ BaseClick(NhWindow *wind, Point pt, UInt32 modifiers)
if (strchr(topl_resp, *click_to_cmd(pt.h, pt.v, clicked_mod)))
nhbell();
else {
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
if (cursor_locked)
while (WaitMouseUp())
SystemTask();
/*SystemTask()*/;
#endif
gClickedToMove = TRUE;
@@ -2137,7 +2162,7 @@ BaseCursor(NhWindow *wind, Point pt)
}
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
static pascal OSStatus
BaseEvent(EventHandlerCallRef nexthandler, EventRef event, void *userdata)
{
@@ -2420,7 +2445,7 @@ MsgUpdate(NhWindow *wind)
}
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
static pascal OSStatus
MsgEvent(EventHandlerCallRef nexthandler, EventRef event, void *userdata)
{
@@ -2645,7 +2670,7 @@ MenwUpdate(NhWindow *wind)
}
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
static pascal OSStatus
MenwEvent(EventHandlerCallRef nexthandler, EventRef event, void *userdata)
{
@@ -2823,7 +2848,7 @@ TextUpdate(NhWindow *wind)
}
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
static pascal OSStatus
TextEvent(EventHandlerCallRef nexthandler, EventRef event, void *userdata)
{
@@ -2911,7 +2936,7 @@ macClickText (EventRecord *theEvent, WindowPtr theWindow) {
* Global events
*/
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
static pascal OSStatus
GlobalEvent(EventHandlerCallRef nexthandler, EventRef event, void *userdata)
{
@@ -2995,7 +3020,7 @@ HandleClick (EventRecord *theEvent) {
switch (code) {
case inContent :
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
if (not_inSelect) {
int kind = GetWindowKind(theWindow) - WIN_BASE_KIND;
winCursorFuncs [kind] (theEvent, theWindow, gMouseRgn);
@@ -3057,7 +3082,7 @@ HandleClick (EventRecord *theEvent) {
}
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
static short
GeneralUpdate (EventRecord *theEvent, WindowPtr theWindow) {
@@ -3075,6 +3100,9 @@ HandleUpdate (EventRecord *theEvent) {
WindowPtr theWindow = (WindowPtr) theEvent->message;
NhWindow *aWin = GetNhWin (theWindow);
Rect r;
#if 1//!TARGET_API_MAC_CARBON
EventRecord fake;
#endif
char existing_update_region = FALSE;
@@ -3088,7 +3116,7 @@ HandleUpdate (EventRecord *theEvent) {
GetWindowBounds(theWindow, kWindowContentRgn, &r);
OffsetRect(&r, -r.left, -r.top);
EraseRect(&r);
#if TARGET_API_MAC_CARBON
#if 0//TARGET_API_MAC_CARBON
switch (GetWindowKind(theWindow) - WIN_BASE_KIND) {
case NHW_BASE:
case NHW_MAP:
@@ -3106,7 +3134,7 @@ HandleUpdate (EventRecord *theEvent) {
break;
}
#else
winUpdateFuncs [GetWindowKind(theWin) - WIN_BASE_KIND] (&fake, theWin);
winUpdateFuncs[GetWindowKind(theWindow) - WIN_BASE_KIND](&fake, theWindow);
#endif
if (theWindow == _mt_window && existing_update_region) {
@@ -3117,7 +3145,7 @@ HandleUpdate (EventRecord *theEvent) {
}
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
static void
GeneralCursor (EventRecord *theEvent, WindowPtr theWindow, RgnHandle mouseRgn) {
@@ -3148,7 +3176,7 @@ DoOsEvt (EventRecord *theEvent) {
OffsetRect (&r, theEvent->where.h, theEvent->where.v);
RectRgn (gMouseRgn, &r);
} else {
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
int kind = GetWindowKind(win) - WIN_BASE_KIND;
if (kind >= 0 && kind <= NHW_TEXT) {
winCursorFuncs [kind] (theEvent, win, gMouseRgn);
@@ -3165,7 +3193,7 @@ DoOsEvt (EventRecord *theEvent) {
void
HandleEvent (EventRecord *theEvent) {
switch (theEvent->what) {
#if !TARGET_API_MAC_CARBON
#if 1//!TARGET_API_MAC_CARBON
case autoKey:
case keyDown:
HandleKey(theEvent);
@@ -3260,17 +3288,6 @@ struct window_procs mac_procs = {
0, // mac_end_screen,
genl_outrip,
genl_preference_update,
genl_getmsghistory,
genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init,
genl_status_finish,
genl_status_enablefield,
genl_status_update,
# ifdef STATUS_HILITES
genl_status_threshold,
# endif
#endif
};
/*macwin.c*/

View File

@@ -2,7 +2,7 @@
/* Copyright (c) Jon W{tte, Hao-Yang Wang, Jonathan Handler 1992. */
/* NetHack may be freely redistributed. See license for details. */
#if !TARGET_API_MAC_CARBON
#if 1 /*!TARGET_API_MAC_CARBON*/
# include <Dialogs.h>
# include <ControlDefinitions.h>
#else

View File

@@ -11,6 +11,7 @@
#if !TARGET_API_MAC_CARBON
#include <Palettes.h>
#endif
#include <Gestalt.h>
#define MT_WINDOW 135
#define MT_WIDTH 80