diff --git a/mozilla/build/mac/build_scripts/MozillaBuildFlags.txt b/mozilla/build/mac/build_scripts/MozillaBuildFlags.txt index 5b8e6d71ba2..2bf3e59c84e 100644 --- a/mozilla/build/mac/build_scripts/MozillaBuildFlags.txt +++ b/mozilla/build/mac/build_scripts/MozillaBuildFlags.txt @@ -46,6 +46,7 @@ mailextras 1 xptlink 0 psm 0 embedding_test 1 +carbon 0 filepath_flags idepath ":CodeWarrior IDE Path.txt" diff --git a/mozilla/build/mac/build_scripts/MozillaBuildList.pm b/mozilla/build/mac/build_scripts/MozillaBuildList.pm index c6a169fe4b2..fea0cb78052 100644 --- a/mozilla/build/mac/build_scripts/MozillaBuildList.pm +++ b/mozilla/build/mac/build_scripts/MozillaBuildList.pm @@ -1314,7 +1314,8 @@ sub BuildLayoutProjects() BuildOneProject(":mozilla:expat:macbuild:expat.mcp", "expat$D.o", 0, 0, 0); BuildOneProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); - BuildOneProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); +# BuildOneProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProjectWithOutput(":mozilla:gfx:macbuild:gfx.mcp", "gfx$C$D.shlb", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); BuildOneProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); BuildOneProject(":mozilla:modules:plugin:macbuild:plugin.mcp", "plugin$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); BuildOneProject(":mozilla:layout:macbuild:layoutxsl.mcp", "layoutxsl$D.o", 0, 0, 0); diff --git a/mozilla/config/mac/DefinesMac.h b/mozilla/config/mac/DefinesMac.h index a9f4e1aa31f..31c9c98cb8b 100644 --- a/mozilla/config/mac/DefinesMac.h +++ b/mozilla/config/mac/DefinesMac.h @@ -29,7 +29,6 @@ */ /* enable to start building for Carbon */ -#define TARGET_CARBON 0 #if TARGET_CARBON #define PP_Target_Carbon 1 #define OLDP2C 1 diff --git a/mozilla/config/mac/DefinesMozilla.h b/mozilla/config/mac/DefinesMozilla.h index f5981d49d9e..570c6850d8e 100644 --- a/mozilla/config/mac/DefinesMozilla.h +++ b/mozilla/config/mac/DefinesMozilla.h @@ -23,8 +23,6 @@ #ifndef DefinesMozilla_h_ #define DefinesMozilla_h_ -#include "DefinesOptions.h" // written at build time - // *** Security //#define NADA_VERSION //#define EXPORT_VERSION diff --git a/mozilla/config/mac/NGLayoutConfigInclude.h b/mozilla/config/mac/NGLayoutConfigInclude.h index 25acbd0d677..84fa8b5b6b9 100644 --- a/mozilla/config/mac/NGLayoutConfigInclude.h +++ b/mozilla/config/mac/NGLayoutConfigInclude.h @@ -34,6 +34,9 @@ /* Read compiler options */ #include "IDE_Options.h" +/* Read generated build options. */ +#include "DefinesOptions.h" // written at build time + /* Read file of defines global to the Mac build */ #include "DefinesMac.h" diff --git a/mozilla/dbm/include/cdefs.h b/mozilla/dbm/include/cdefs.h index 7b5c46f63ec..a933c588206 100644 --- a/mozilla/dbm/include/cdefs.h +++ b/mozilla/dbm/include/cdefs.h @@ -101,7 +101,7 @@ #if defined(__cplusplus) #define __inline inline /* convert to C++ keyword */ #else -#ifndef __GNUC__ +#if !defined(__GNUC__) && !defined(__MWERKS__) #define __inline /* delete GCC keyword */ #endif /* !__GNUC__ */ #endif /* !__cplusplus */ diff --git a/mozilla/dbm/src/db.c b/mozilla/dbm/src/db.c index 2c6edec2ab2..e4b1fff8fb4 100644 --- a/mozilla/dbm/src/db.c +++ b/mozilla/dbm/src/db.c @@ -47,9 +47,7 @@ static char sccsid[] = "@(#)db.c 8.4 (Berkeley) 2/21/94"; #endif #include -#ifndef macintosh #include -#endif #include #include diff --git a/mozilla/dbm/src/h_page.c b/mozilla/dbm/src/h_page.c index aa82b4ad43a..f81298e673b 100644 --- a/mozilla/dbm/src/h_page.c +++ b/mozilla/dbm/src/h_page.c @@ -66,10 +66,12 @@ static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94"; #include #endif -#include -#ifndef macintosh -#include +#if defined(macintosh) +#include #endif + +#include +#include #include #include #include diff --git a/mozilla/dbm/src/hash.c b/mozilla/dbm/src/hash.c index cef9e08da7b..5aa91424b35 100644 --- a/mozilla/dbm/src/hash.c +++ b/mozilla/dbm/src/hash.c @@ -51,12 +51,13 @@ static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94"; #include #endif -#include -#ifdef macintosh +#if defined(macintosh) #include -#else -#include +#include #endif + +#include +#include #include #include #include diff --git a/mozilla/dbm/src/hsearch.c b/mozilla/dbm/src/hsearch.c index 4ae4cabe443..fb8a58bad27 100644 --- a/mozilla/dbm/src/hsearch.c +++ b/mozilla/dbm/src/hsearch.c @@ -42,9 +42,9 @@ static char sccsid[] = "@(#)hsearch.c 8.4 (Berkeley) 7/21/94"; #ifndef macintosh #include +#endif #include -#endif #include #include "mcom_db.h" diff --git a/mozilla/gfx/macbuild/gfx.mcp b/mozilla/gfx/macbuild/gfx.mcp index 64262f988be..18f1ec3021e 100644 Binary files a/mozilla/gfx/macbuild/gfx.mcp and b/mozilla/gfx/macbuild/gfx.mcp differ diff --git a/mozilla/gfx/src/mac/nsDeviceContextMac.cpp b/mozilla/gfx/src/mac/nsDeviceContextMac.cpp index 0c9060c72af..0465a864b9d 100644 --- a/mozilla/gfx/src/mac/nsDeviceContextMac.cpp +++ b/mozilla/gfx/src/mac/nsDeviceContextMac.cpp @@ -24,6 +24,7 @@ #include "nsDeviceContextMac.h" #include "nsRenderingContextMac.h" #include "nsDeviceContextSpecMac.h" +#include "nsIPrintingContext.h" #include "nsString.h" #include "nsHashtable.h" #include "nsFont.h" @@ -671,10 +672,9 @@ NS_IMETHODIMP nsDeviceContextMac::GetClientRect(nsRect &aRect) NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDevice,nsIDeviceContext *&aContext) { -GrafPtr curPort; -THPrint thePrintRecord; // handle to print record -double pix_Inch; -nsDeviceContextMac *macDC; + GrafPtr curPort; + double pix_Inch; + nsDeviceContextMac *macDC; aContext = new nsDeviceContextMac(); macDC = (nsDeviceContextMac*)aContext; @@ -682,22 +682,35 @@ nsDeviceContextMac *macDC; NS_ADDREF(aDevice); ::GetPort(&curPort); - - thePrintRecord = ((nsDeviceContextSpecMac*)aDevice)->mPrtRec; + +#if !TARGET_CARBON + THPrint thePrintRecord = ((nsDeviceContextSpecMac*)aDevice)->mPrtRec; pix_Inch = (**thePrintRecord).prInfo.iHRes; - + macDC->mPageRect = (**thePrintRecord).prInfo.rPage; +#else + nsCOMPtr printingContext = do_QueryInterface(aDevice); + if (printingContext) { + if (NS_FAILED(printingContext->GetPrinterResolution(&pix_Inch))) + pix_Inch = 72.0; + double top, left, bottom, right; + printingContext->GetPageRect(&top, &left, &bottom, &right); + Rect& pageRect = macDC->mPageRect; + pageRect.top = top, pageRect.left = left; + pageRect.bottom = bottom, pageRect.right = right; + } +#endif + ((nsDeviceContextMac*)aContext)->Init(curPort); - macDC->mPageRect = (**thePrintRecord).prInfo.rPage; macDC->mTwipsToPixels = pix_Inch/(float)NSIntPointsToTwips(72); macDC->mPixelsToTwips = 1.0f/macDC->mTwipsToPixels; - macDC->mAppUnitsToDevUnits = macDC->mTwipsToPixels; - macDC->mDevUnitsToAppUnits = 1.0f / macDC->mAppUnitsToDevUnits; + macDC->mAppUnitsToDevUnits = macDC->mTwipsToPixels; + macDC->mDevUnitsToAppUnits = 1.0f / macDC->mAppUnitsToDevUnits; - macDC->mCPixelScale = macDC->mTwipsToPixels / mTwipsToPixels; + macDC->mCPixelScale = macDC->mTwipsToPixels / mTwipsToPixels; //((nsDeviceContextMac*)aContext)->Init(this); - return NS_OK; + return NS_OK; } @@ -717,8 +730,14 @@ GrafPtr thePort; SetDrawingSurface(((nsDeviceContextSpecMac*)(this->mSpec))->mPrtRec); SetPort(thePort); } -#endif return NS_OK; +#else + nsresult rv = NS_ERROR_FAILURE; + nsCOMPtr printingContext = do_QueryInterface(mSpec); + if (printingContext) + rv = printingContext->BeginDocument(); + return rv; +#endif } @@ -728,13 +747,19 @@ GrafPtr thePort; */ NS_IMETHODIMP nsDeviceContextMac::EndDocument(void) { +#if !TARGET_CARBON if(((nsDeviceContextSpecMac*)(this->mSpec))->mPrintManagerOpen){ ::SetPort(mOldPort); -#if !TARGET_CARBON ::PrCloseDoc(((nsDeviceContextSpecMac*)(this->mSpec))->mPrinterPort); -#endif } - return NS_OK; + return NS_OK; +#else + nsresult rv = NS_ERROR_FAILURE; + nsCOMPtr printingContext = do_QueryInterface(mSpec); + if (printingContext) + rv = printingContext->EndDocument(); + return rv; +#endif } @@ -747,8 +772,14 @@ NS_IMETHODIMP nsDeviceContextMac::BeginPage(void) #if !TARGET_CARBON if(((nsDeviceContextSpecMac*)(this->mSpec))->mPrintManagerOpen) ::PrOpenPage(((nsDeviceContextSpecMac*)(this->mSpec))->mPrinterPort,nsnull); -#endif return NS_OK; +#else + nsresult rv = NS_ERROR_FAILURE; + nsCOMPtr printingContext = do_QueryInterface(mSpec); + if (printingContext) + rv = printingContext->BeginPage(); + return rv; +#endif } @@ -763,8 +794,14 @@ NS_IMETHODIMP nsDeviceContextMac::EndPage(void) ::SetPort((GrafPtr)(((nsDeviceContextSpecMac*)(this->mSpec))->mPrinterPort)); ::PrClosePage(((nsDeviceContextSpecMac*)(this->mSpec))->mPrinterPort); } + return NS_OK; +#else + nsresult rv = NS_ERROR_FAILURE; + nsCOMPtr printingContext = do_QueryInterface(mSpec); + if (printingContext) + rv = printingContext->EndPage(); + return rv; #endif - return NS_OK; } diff --git a/mozilla/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp b/mozilla/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp index 6f402a10d05..2e3e50fd362 100644 --- a/mozilla/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp +++ b/mozilla/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp @@ -21,7 +21,8 @@ */ #include "nsDeviceContextSpecFactoryM.h" -#include "nsDeviceContextSpecMac.h" +#include "nsIDeviceContextSpec.h" +#include "nsIPrintingContext.h" #include "nsGfxCIID.h" #include "plstr.h" @@ -42,13 +43,7 @@ nsDeviceContextSpecFactoryMac :: ~nsDeviceContextSpecFactoryMac() { } -static NS_DEFINE_IID(kDeviceContextSpecFactoryIID, NS_IDEVICE_CONTEXT_SPEC_FACTORY_IID); -static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); -static NS_DEFINE_IID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); - -NS_IMPL_QUERY_INTERFACE(nsDeviceContextSpecFactoryMac, kDeviceContextSpecFactoryIID) -NS_IMPL_ADDREF(nsDeviceContextSpecFactoryMac) -NS_IMPL_RELEASE(nsDeviceContextSpecFactoryMac) +NS_IMPL_ISUPPORTS1(nsDeviceContextSpecFactoryMac, nsIDeviceContextSpecFactory) /** ------------------------------------------------------- * Initialize the device context spec factory @@ -56,7 +51,7 @@ NS_IMPL_RELEASE(nsDeviceContextSpecFactoryMac) */ NS_IMETHODIMP nsDeviceContextSpecFactoryMac :: Init(void) { - return NS_OK; + return NS_OK; } /** ------------------------------------------------------- @@ -67,16 +62,18 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryMac :: CreateDeviceContextSpec(nsIWidget nsIDeviceContextSpec *&aNewSpec, PRBool aQuiet) { -nsresult rv = NS_ERROR_FAILURE; -nsIDeviceContextSpec *devSpec = nsnull; - - nsComponentManager::CreateInstance(kDeviceContextSpecCID, nsnull, kIDeviceContextSpecIID, (void **)&devSpec); - - if (nsnull != devSpec){ - if (NS_OK == ((nsDeviceContextSpecMac *)devSpec)->Init(aQuiet)){ - aNewSpec = devSpec; - rv = NS_OK; - } + nsresult rv; + static NS_DEFINE_CID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); + nsCOMPtr devSpec = do_CreateInstance(kDeviceContextSpecCID, &rv); + if (NS_SUCCEEDED(rv)) { + nsCOMPtr printingContext = do_QueryInterface(devSpec, &rv); + if (NS_SUCCEEDED(rv)) { + rv = printingContext->Init(aQuiet); + if (NS_SUCCEEDED(rv)) { + aNewSpec = devSpec; + NS_ADDREF(aNewSpec); + } + } } return rv; } diff --git a/mozilla/gfx/src/mac/nsDeviceContextSpecMac.cpp b/mozilla/gfx/src/mac/nsDeviceContextSpecMac.cpp index 3622ed1b166..5a3f95f2f07 100644 --- a/mozilla/gfx/src/mac/nsDeviceContextSpecMac.cpp +++ b/mozilla/gfx/src/mac/nsDeviceContextSpecMac.cpp @@ -55,9 +55,7 @@ nsDeviceContextSpecMac :: ~nsDeviceContextSpecMac() static NS_DEFINE_IID(kDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); -NS_IMPL_QUERY_INTERFACE(nsDeviceContextSpecMac, kDeviceContextSpecIID) -NS_IMPL_ADDREF(nsDeviceContextSpecMac) -NS_IMPL_RELEASE(nsDeviceContextSpecMac) +NS_IMPL_ISUPPORTS2(nsDeviceContextSpecMac, nsIDeviceContextSpec, nsIPrintingContext) /** ------------------------------------------------------- * Initialize the nsDeviceContextSpecMac @@ -115,3 +113,39 @@ PRBool isPMOpen; return NS_OK; } + +NS_IMETHODIMP nsDeviceContextSpecMac::BeginDocument() +{ + nsresult rv = NS_OK; + return rv; +} + +NS_IMETHODIMP nsDeviceContextSpecMac::EndDocument() +{ + nsresult rv = NS_OK; + return rv; +} + +NS_IMETHODIMP nsDeviceContextSpecMac::BeginPage() +{ + nsresult rv = NS_OK; + return rv; +} + +NS_IMETHODIMP nsDeviceContextSpecMac::EndPage() +{ + nsresult rv = NS_OK; + return rv; +} + +NS_IMETHODIMP nsDeviceContextSpecMac::GetPrinterResolution(double* aResolution) +{ + nsresult rv = NS_OK; + return rv; +} + +NS_IMETHODIMP nsDeviceContextSpecMac::GetPageRect(double* aTop, double* aLeft, double* aBottom, double* aRight) +{ + nsresult rv = NS_OK; + return rv; +} diff --git a/mozilla/gfx/src/mac/nsDeviceContextSpecMac.h b/mozilla/gfx/src/mac/nsDeviceContextSpecMac.h index c564b1cffdf..9f4f3afa450 100644 --- a/mozilla/gfx/src/mac/nsDeviceContextSpecMac.h +++ b/mozilla/gfx/src/mac/nsDeviceContextSpecMac.h @@ -24,11 +24,11 @@ #define nsDeviceContextSpecMac_h___ #include "nsIDeviceContextSpec.h" +#include "nsIPrintingContext.h" #include "nsDeviceContextMac.h" #include -class nsDeviceContextSpecMac : public nsIDeviceContextSpec -{ +class nsDeviceContextSpecMac : public nsIDeviceContextSpec, public nsIPrintingContext { public: /** * Construct a nsDeviceContextSpecMac, which is an object which contains and manages a mac printrecord @@ -65,6 +65,17 @@ public: */ NS_IMETHOD ClosePrintManager(); + NS_IMETHOD BeginDocument(); + + NS_IMETHOD EndDocument(); + + NS_IMETHOD BeginPage(); + + NS_IMETHOD EndPage(); + + NS_IMETHOD GetPrinterResolution(double* aResolution); + + NS_IMETHOD GetPageRect(double* aTop, double* aLeft, double* aBottom, double* aRight); protected: /** * Destuct a nsDeviceContextSpecMac, this will release the printrecord diff --git a/mozilla/gfx/src/mac/nsGfxFactoryMac.cpp b/mozilla/gfx/src/mac/nsGfxFactoryMac.cpp index 16830266eb8..3774b43e156 100644 --- a/mozilla/gfx/src/mac/nsGfxFactoryMac.cpp +++ b/mozilla/gfx/src/mac/nsGfxFactoryMac.cpp @@ -32,6 +32,9 @@ #include "nsScriptableRegion.h" #include "nsIImageManager.h" #include "nsDeviceContextSpecMac.h" +#if TARGET_CARBON +#include "nsDeviceContextSpecX.h" +#endif #include "nsDeviceContextSpecFactoryM.h" #include "nsScreenManagerMac.h" #include "nsBlender.h" @@ -124,7 +127,13 @@ nsresult nsGfxFactoryMac::CreateInstance(nsISupports *aOuter, } } else if (mClassID.Equals(kCDeviceContextSpec)) { - NS_NEWXPCOM(inst, nsDeviceContextSpecMac); + nsCOMPtr dcSpec; +#if TARGET_CARBON + NS_NEWXPCOM(dcSpec, nsDeviceContextSpecX); +#else + NS_NEWXPCOM(dcSpec, nsDeviceContextSpecMac); +#endif + inst = dcSpec; } else if (mClassID.Equals(kCPrintOptions)) { NS_NEWXPCOM(inst, nsPrintOptionsMac); diff --git a/mozilla/include/npupp.h b/mozilla/include/npupp.h index 00dd1d5c229..c5796bcbb1c 100644 --- a/mozilla/include/npupp.h +++ b/mozilla/include/npupp.h @@ -22,7 +22,7 @@ /* - * npupp.h $Revision: 3.3 $ + * npupp.h $Revision: 3.4 $ * function call mecahnics needed by platform specific glue code. */ @@ -56,7 +56,9 @@ /* NPP_Initialize */ -#if TARGET_RT_MAC_CFM +#define _NPUPP_USE_UPP_ (TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON) + +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_InitializeUPP; enum { @@ -83,7 +85,7 @@ typedef void (* NP_LOADDS NPP_InitializeUPP)(void); /* NPP_Shutdown */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_ShutdownUPP; enum { @@ -110,7 +112,7 @@ typedef void (* NP_LOADDS NPP_ShutdownUPP)(void); /* NPP_New */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_NewUPP; enum { @@ -143,7 +145,7 @@ typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, ui /* NPP_Destroy */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_DestroyUPP; enum { @@ -169,7 +171,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save); /* NPP_SetWindow */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_SetWindowUPP; enum { @@ -196,7 +198,7 @@ typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window); /* NPP_NewStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_NewStreamUPP; enum { @@ -224,7 +226,7 @@ typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NP /* NPP_DestroyStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_DestroyStreamUPP; enum { @@ -252,7 +254,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* strea /* NPP_WriteReady */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_WriteReadyUPP; enum { @@ -279,7 +281,7 @@ typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream); /* NPP_Write */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_WriteUPP; enum { @@ -309,7 +311,7 @@ typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 o /* NPP_StreamAsFile */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_StreamAsFileUPP; enum { @@ -336,7 +338,7 @@ typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, c /* NPP_Print */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_PrintUPP; enum { @@ -363,7 +365,7 @@ typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint); /* NPP_HandleEvent */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_HandleEventUPP; enum { @@ -390,7 +392,7 @@ typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event); /* NPP_URLNotify */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_URLNotifyUPP; enum { @@ -419,7 +421,7 @@ typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPRea /* NPP_GetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_GetValueUPP; enum { @@ -445,7 +447,7 @@ typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable /* NPP_SetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_SetValueUPP; enum { @@ -478,7 +480,7 @@ typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable /* NPN_GetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetValueUPP; enum { @@ -504,7 +506,7 @@ typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable /* NPN_SetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_SetValueUPP; enum { @@ -530,7 +532,7 @@ typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable /* NPN_GetUrlNotify */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetURLNotifyUPP; enum { @@ -557,7 +559,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, /* NPN_PostUrlNotify */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_PostURLNotifyUPP; enum { @@ -587,7 +589,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url /* NPN_GetUrl */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetURLUPP; enum { @@ -613,7 +615,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const /* NPN_PostUrl */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_PostURLUPP; enum { @@ -642,7 +644,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, cons /* NPN_RequestRead */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_RequestReadUPP; enum { @@ -669,7 +671,7 @@ typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* /* NPN_NewStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_NewStreamUPP; enum { @@ -698,7 +700,7 @@ typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, co /* NPN_Write */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_WriteUPP; enum { @@ -727,7 +729,7 @@ typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 l /* NPN_DestroyStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_DestroyStreamUPP; enum { @@ -755,7 +757,7 @@ typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* strea /* NPN_Status */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_StatusUPP; enum { @@ -781,7 +783,7 @@ typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message); /* NPN_UserAgent */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_UserAgentUPP; enum { @@ -807,7 +809,7 @@ typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance); /* NPN_MemAlloc */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_MemAllocUPP; enum { @@ -834,7 +836,7 @@ typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size); /* NPN__MemFree */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_MemFreeUPP; enum { @@ -860,7 +862,7 @@ typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr); /* NPN_MemFlush */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_MemFlushUPP; enum { @@ -888,7 +890,7 @@ typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size); /* NPN_ReloadPlugins */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_ReloadPluginsUPP; enum { @@ -915,7 +917,7 @@ typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages); /* NPN_GetJavaEnv */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetJavaEnvUPP; enum { @@ -940,7 +942,7 @@ typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void); /* NPN_GetJavaPeer */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetJavaPeerUPP; enum { @@ -967,7 +969,7 @@ typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance); /* NPN_InvalidateRect */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_InvalidateRectUPP; enum { @@ -995,7 +997,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect); /* NPN_InvalidateRegion */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_InvalidateRegionUPP; enum { @@ -1022,7 +1024,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region /* NPN_ForceRedraw */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_ForceRedrawUPP; enum { @@ -1121,7 +1123,7 @@ typedef struct _NPNetscapeFuncs { * and NPPShutdownUPP for Netscape's use. */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_MainEntryUPP; enum { diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index ea002b169fb..855d112b267 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -5387,7 +5387,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, ((nsMenuFrame*) newFrame)->SetFrameConstructor(this); } else if (aTag == nsXULAtoms::menubar) { -#if (defined(XP_MAC) && !TARGET_CARBON) || defined(RHAPSODY) // The Mac uses its native menu bar. +#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar. aHaltProcessing = PR_TRUE; return NS_OK; #else diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index 5ae8f9f70ae..f357b2e5119 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -426,8 +426,7 @@ nsScrollFrame::CreateScrollingView(nsIPresContext* aPresContext) } // Initialize the scrolling view - view->Init(viewManager, mRect, parentView, display->IsVisible()? - nsViewVisibility_kShow : nsViewVisibility_kHide); + view->Init(viewManager, mRect, parentView, nsViewVisibility_kHide); // Insert the view into the view hierarchy viewManager->InsertChild(parentView, view, zIndex); diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index ea002b169fb..855d112b267 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -5387,7 +5387,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, ((nsMenuFrame*) newFrame)->SetFrameConstructor(this); } else if (aTag == nsXULAtoms::menubar) { -#if (defined(XP_MAC) && !TARGET_CARBON) || defined(RHAPSODY) // The Mac uses its native menu bar. +#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar. aHaltProcessing = PR_TRUE; return NS_OK; #else diff --git a/mozilla/lib/mac/NSStdLib/NSStdLib.mcp b/mozilla/lib/mac/NSStdLib/NSStdLib.mcp index 22a93ced34c..6f52b3a3c52 100644 Binary files a/mozilla/lib/mac/NSStdLib/NSStdLib.mcp and b/mozilla/lib/mac/NSStdLib/NSStdLib.mcp differ diff --git a/mozilla/mailnews/base/src/nsDecodeAppleFile.h b/mozilla/mailnews/base/src/nsDecodeAppleFile.h new file mode 100644 index 00000000000..c4deb3d714f --- /dev/null +++ b/mozilla/mailnews/base/src/nsDecodeAppleFile.h @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#ifndef nsDecodeAppleFile_h__ +#define nsDecodeAppleFile_h__ + +#include "nsCom.h" +#include "nscore.h" +#include "nsCOMPtr.h" +#include "nsFileSpec.h" + +class ProcessAppleDoubleResourceFork +{ +public: + ProcessAppleDoubleResourceFork(); + virtual ~ProcessAppleDoubleResourceFork(); + + OSErr Initialize(nsFileSpec& file); + OSErr Write(unsigned char *buffer, PRUint32 bufferSize, PRUint32* writeCount); + +private: + OSErr Decodeheaders(unsigned char *buffer, PRUint32 bufferSize, PRUint32* processCount); + + FSSpec m_fsFileSpec; + SInt16 m_rfRefNum; + PRBool m_bNeedToDecodeHeaders; +}; + +/* +** applefile definitions used +*/ +#if PRAGMA_STRUCT_ALIGN + #pragma options align=mac68k +#endif + +#define APPLESINGLE_MAGIC 0x00051600L +#define APPLEDOUBLE_MAGIC 0x00051607L +#define VERSION 0x00020000 + +#define NUM_ENTRIES 6 + +#define ENT_DFORK 1L +#define ENT_RFORK 2L +#define ENT_NAME 3L +#define ENT_COMMENT 4L +#define ENT_DATES 8L +#define ENT_FINFO 9L + +#define CONVERT_TIME 1265437696L + +/* +** data type used in the header decoder. +*/ +typedef struct ap_header +{ + PRInt32 magic; + PRInt32 version; + char fill[16]; + PRInt16 entries; + +} ap_header; + +typedef struct ap_entry +{ + PRInt32 id; + PRInt32 offset; + PRInt32 length; + +} ap_entry; + +typedef struct ap_dates +{ + PRInt32 create, modify, backup, access; + +} ap_dates; + +#if PRAGMA_STRUCT_ALIGN + #pragma options align=reset +#endif + +/* +**Error codes +*/ +enum { + errADNotEnoughData = -12099, + errADNotSupported, + errADBadVersion +}; +#endif diff --git a/mozilla/mailnews/compose/src/nsMsgAppleCodes.h b/mozilla/mailnews/compose/src/nsMsgAppleCodes.h index 4de1f4b5e27..9869f7fb1ff 100644 --- a/mozilla/mailnews/compose/src/nsMsgAppleCodes.h +++ b/mozilla/mailnews/compose/src/nsMsgAppleCodes.h @@ -33,7 +33,7 @@ ** applefile definitions used */ #ifdef XP_MAC -#if PRAGMA_ALIGN_SUPPORTED +#if PRAGMA_STRUCT_ALIGN #pragma options align=mac68k #endif #endif /* XP_MAC */ @@ -114,7 +114,7 @@ int ap_decode_process_data( appledouble_decode_object* p_ap_decode_obj, PRBool XP_END_PROTOS #ifdef XP_MAC -#if PRAGMA_ALIGN_SUPPORTED +#if PRAGMA_STRUCT_ALIGN #pragma options align=reset #endif #endif /* XP_MAC */ diff --git a/mozilla/mailnews/compose/src/nsMsgAppleEncode.cpp b/mozilla/mailnews/compose/src/nsMsgAppleEncode.cpp index 82df3a645de..b873cf33bc6 100755 --- a/mozilla/mailnews/compose/src/nsMsgAppleEncode.cpp +++ b/mozilla/mailnews/compose/src/nsMsgAppleEncode.cpp @@ -159,6 +159,10 @@ int ap_encode_file_infor( } /* get a file comment, if possible */ +#if TARGET_CARBON + // not sure why working directories are needed here... + comlen = 0; +#else procID = 0; GetWDInfo(p_ap_encode_obj->vRefNum, &fpb->ioVRefNum, &fpb->ioDirID, &procID); memset((void *) &vinfo, '\0', sizeof (vinfo)); @@ -182,6 +186,7 @@ int ap_encode_file_infor( comlen = dtp.ioDTActCount; } } +#endif /* write header */ // head.magic = dfork ? APPLESINGLE_MAGIC : APPLEDOUBLE_MAGIC; diff --git a/mozilla/modules/libimg/src/xpcompat.cpp b/mozilla/modules/libimg/src/xpcompat.cpp index de7e30eb9e7..07444320fc1 100644 --- a/mozilla/modules/libimg/src/xpcompat.cpp +++ b/mozilla/modules/libimg/src/xpcompat.cpp @@ -33,6 +33,7 @@ # include #endif #include +#include #include "prlog.h" #include "prmem.h" #include "plstr.h" diff --git a/mozilla/modules/plugin/base/public/npupp.h b/mozilla/modules/plugin/base/public/npupp.h index 00dd1d5c229..c5796bcbb1c 100644 --- a/mozilla/modules/plugin/base/public/npupp.h +++ b/mozilla/modules/plugin/base/public/npupp.h @@ -22,7 +22,7 @@ /* - * npupp.h $Revision: 3.3 $ + * npupp.h $Revision: 3.4 $ * function call mecahnics needed by platform specific glue code. */ @@ -56,7 +56,9 @@ /* NPP_Initialize */ -#if TARGET_RT_MAC_CFM +#define _NPUPP_USE_UPP_ (TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON) + +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_InitializeUPP; enum { @@ -83,7 +85,7 @@ typedef void (* NP_LOADDS NPP_InitializeUPP)(void); /* NPP_Shutdown */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_ShutdownUPP; enum { @@ -110,7 +112,7 @@ typedef void (* NP_LOADDS NPP_ShutdownUPP)(void); /* NPP_New */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_NewUPP; enum { @@ -143,7 +145,7 @@ typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, ui /* NPP_Destroy */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_DestroyUPP; enum { @@ -169,7 +171,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save); /* NPP_SetWindow */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_SetWindowUPP; enum { @@ -196,7 +198,7 @@ typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window); /* NPP_NewStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_NewStreamUPP; enum { @@ -224,7 +226,7 @@ typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NP /* NPP_DestroyStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_DestroyStreamUPP; enum { @@ -252,7 +254,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* strea /* NPP_WriteReady */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_WriteReadyUPP; enum { @@ -279,7 +281,7 @@ typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream); /* NPP_Write */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_WriteUPP; enum { @@ -309,7 +311,7 @@ typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 o /* NPP_StreamAsFile */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_StreamAsFileUPP; enum { @@ -336,7 +338,7 @@ typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, c /* NPP_Print */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_PrintUPP; enum { @@ -363,7 +365,7 @@ typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint); /* NPP_HandleEvent */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_HandleEventUPP; enum { @@ -390,7 +392,7 @@ typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event); /* NPP_URLNotify */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_URLNotifyUPP; enum { @@ -419,7 +421,7 @@ typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPRea /* NPP_GetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_GetValueUPP; enum { @@ -445,7 +447,7 @@ typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable /* NPP_SetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_SetValueUPP; enum { @@ -478,7 +480,7 @@ typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable /* NPN_GetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetValueUPP; enum { @@ -504,7 +506,7 @@ typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable /* NPN_SetValue */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_SetValueUPP; enum { @@ -530,7 +532,7 @@ typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable /* NPN_GetUrlNotify */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetURLNotifyUPP; enum { @@ -557,7 +559,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, /* NPN_PostUrlNotify */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_PostURLNotifyUPP; enum { @@ -587,7 +589,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url /* NPN_GetUrl */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetURLUPP; enum { @@ -613,7 +615,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const /* NPN_PostUrl */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_PostURLUPP; enum { @@ -642,7 +644,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, cons /* NPN_RequestRead */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_RequestReadUPP; enum { @@ -669,7 +671,7 @@ typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* /* NPN_NewStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_NewStreamUPP; enum { @@ -698,7 +700,7 @@ typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, co /* NPN_Write */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_WriteUPP; enum { @@ -727,7 +729,7 @@ typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 l /* NPN_DestroyStream */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_DestroyStreamUPP; enum { @@ -755,7 +757,7 @@ typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* strea /* NPN_Status */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_StatusUPP; enum { @@ -781,7 +783,7 @@ typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message); /* NPN_UserAgent */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_UserAgentUPP; enum { @@ -807,7 +809,7 @@ typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance); /* NPN_MemAlloc */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_MemAllocUPP; enum { @@ -834,7 +836,7 @@ typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size); /* NPN__MemFree */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_MemFreeUPP; enum { @@ -860,7 +862,7 @@ typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr); /* NPN_MemFlush */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_MemFlushUPP; enum { @@ -888,7 +890,7 @@ typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size); /* NPN_ReloadPlugins */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_ReloadPluginsUPP; enum { @@ -915,7 +917,7 @@ typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages); /* NPN_GetJavaEnv */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetJavaEnvUPP; enum { @@ -940,7 +942,7 @@ typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void); /* NPN_GetJavaPeer */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_GetJavaPeerUPP; enum { @@ -967,7 +969,7 @@ typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance); /* NPN_InvalidateRect */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_InvalidateRectUPP; enum { @@ -995,7 +997,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect); /* NPN_InvalidateRegion */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_InvalidateRegionUPP; enum { @@ -1022,7 +1024,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region /* NPN_ForceRedraw */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPN_ForceRedrawUPP; enum { @@ -1121,7 +1123,7 @@ typedef struct _NPNetscapeFuncs { * and NPPShutdownUPP for Netscape's use. */ -#if TARGET_RT_MAC_CFM +#if _NPUPP_USE_UPP_ typedef UniversalProcPtr NPP_MainEntryUPP; enum { diff --git a/mozilla/modules/plugin/base/src/ns4xPlugin.cpp b/mozilla/modules/plugin/base/src/ns4xPlugin.cpp index 2f7d33aa37b..d8daf66a38e 100644 --- a/mozilla/modules/plugin/base/src/ns4xPlugin.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPlugin.cpp @@ -60,10 +60,6 @@ ns4xPlugin::CheckClassInitialized(void) CALLBACKS.size = sizeof(CALLBACKS); CALLBACKS.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; -#if !TARGET_CARBON -// pinkerton - these macros rely on BuildRoutineDescriptor(), which is no longer in -// Carbon. Our easy solution to this is to drop support for 68K plugins. Now we just -// need to do the work... CALLBACKS.geturl = NewNPN_GetURLProc(_geturl); CALLBACKS.posturl = NewNPN_PostURLProc(_posturl); CALLBACKS.requestread = NewNPN_RequestReadProc(_requestread); @@ -85,10 +81,9 @@ ns4xPlugin::CheckClassInitialized(void) CALLBACKS.invalidaterect = NewNPN_InvalidateRectProc(_invalidaterect); CALLBACKS.invalidateregion = NewNPN_InvalidateRegionProc(_invalidateregion); CALLBACKS.forceredraw = NewNPN_ForceRedrawProc(_forceredraw); -#endif initialized = TRUE; -}; +} //////////////////////////////////////////////////////////////////////// // nsISupports stuff @@ -313,9 +308,14 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, return NS_ERROR_UNEXPECTED; #endif -#if defined(XP_MAC) && !TARGET_CARBON +#if defined(XP_MAC) +#if TARGET_CARBON + // get the main entry point + NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "main"); +#else // get the mainRD entry point NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "mainRD"); +#endif if(pfnMain == NULL) return NS_ERROR_FAILURE; @@ -335,14 +335,13 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, const nsFileSpec& file = iter; if (pluginsDir.IsPluginFile(file)) { - FSSpec spec = file; - char* fileName = p2cstrdup(spec.name); - if(!PL_strcmp(fileName, aFileName)) - { - Boolean targetIsFolder, wasAliased; - OSErr err = ::ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased); - pluginRefNum = ::FSpOpenResFile(&spec, fsRdPerm); - } + FSSpec spec = file; + if (!nsCRT::memcmp(spec.name + 1, aFileName, spec.name[0])) + { + Boolean targetIsFolder, wasAliased; + OSErr err = ::ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased); + pluginRefNum = ::FSpOpenResFile(&spec, fsRdPerm); + } } } @@ -438,10 +437,8 @@ ns4xPlugin::Shutdown(void) printf("shutting down plugin %08x\n",(int)this); #endif #ifdef XP_MAC -#if !TARGET_CARBON CallNPP_ShutdownProc(fShutdownEntry); ::CloseResFile(fPluginRefNum); -#endif #else NS_TRY_SAFE_CALL_VOID(fShutdownEntry(), fLibrary); #endif diff --git a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp index c58141924fe..8d6653eadb4 100644 --- a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp @@ -127,27 +127,23 @@ ns4xPluginStreamListener::OnStartBinding(nsIPluginStreamInfo* pluginInfo) mInst->GetCallbacks(&callbacks); mInst->GetNPP(&npp); -#if !TARGET_CARBON -// pinkerton -// relies on routine descriptors, not present in carbon. We need to fix this. - - PRLibrary* lib = nsnull; - if(mInst) + PRLibrary* lib = nsnull; + if(mInst) lib = mInst->fLibrary; - // if we don't know the end of the stream, use 0 instead of -1. bug 59571 - if (mNPStream.end == -1) + // if we don't know the end of the stream, use 0 instead of -1. bug 59571 + if (mNPStream.end == -1) mNPStream.end = 0; - NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewStreamProc(callbacks->newstream, - npp, - (char *)contentType, - &mNPStream, - seekable, - &streamType), lib); - if(error != NPERR_NO_ERROR) - return NS_ERROR_FAILURE; -#endif + NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewStreamProc(callbacks->newstream, + npp, + (char *)contentType, + &mNPStream, + seekable, + &streamType), lib); + if(error != NPERR_NO_ERROR) + return NS_ERROR_FAILURE; + // translate the old 4x style stream type to the new one switch(streamType) { @@ -172,7 +168,7 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, nsIInputStream* input, PRUint32 length) { - const NPPluginFuncs *callbacks; + const NPPluginFuncs *callbacks; NPP npp; PRUint32 numtowrite = 0; PRUint32 amountRead = 0; @@ -200,11 +196,6 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, { if (callbacks->writeready != NULL) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; PRBool started = PR_FALSE; if(mInst) { @@ -218,7 +209,6 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, npp, &mNPStream), lib); } -#endif // if WriteReady returned 0, the plugin is not ready to handle // the data, return FAILURE for now @@ -235,14 +225,9 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, if(numtowrite > 0) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; if(mInst) - lib = mInst->fLibrary; + lib = mInst->fLibrary; NS_TRY_SAFE_CALL_RETURN(writeCount, CallNPP_WriteProc(callbacks->write, npp, @@ -251,8 +236,7 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, numtowrite, (void *)buffer), lib); if(writeCount < 0) - return NS_ERROR_FAILURE; -#endif + return NS_ERROR_FAILURE; amountRead -= numtowrite; mPosition += numtowrite; } @@ -276,11 +260,6 @@ ns4xPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo, if (callbacks->asfile == NULL) return NS_OK; -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; PRBool started = PR_FALSE; if(mInst) { @@ -295,7 +274,6 @@ ns4xPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo, &mNPStream, fileName), lib); } -#endif return NS_OK; } @@ -317,10 +295,6 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, if (callbacks->destroystream != NULL) { // XXX need to convert status to NPReason -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. PRLibrary* lib = nsnull; PRBool started = PR_FALSE; if(mInst) { @@ -337,17 +311,11 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, } if(error != NPERR_NO_ERROR) return NS_ERROR_FAILURE; -#endif } // check to see if we have a call back if (callbacks->urlnotify != NULL && mNotifyData != nsnull) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; if(mInst) lib = mInst->fLibrary; @@ -357,7 +325,6 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, mNPStream.url, nsPluginReason_Done, mNotifyData), lib); -#endif } @@ -471,14 +438,8 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void) NPSavedData *sdata; -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. NS_TRY_SAFE_CALL_RETURN(error, CallNPP_DestroyProc(fCallbacks->destroy, &fNPP, &sdata), fLibrary); -#endif - mStarted = PR_FALSE; if(error != NPERR_NO_ERROR) return NS_ERROR_FAILURE; @@ -518,10 +479,6 @@ nsresult ns4xPluginInstance::InitializePlugin(nsIPluginInstancePeer* peer) mPeer->GetMode(&mode); mPeer->GetMIMEType(&mimetype); -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. We need to fix this. - NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewProc(fCallbacks->newp, (char *)mimetype, &fNPP, @@ -530,7 +487,6 @@ nsresult ns4xPluginInstance::InitializePlugin(nsIPluginInstancePeer* peer) (char**)names, (char**)values, NULL), fLibrary); -#endif //!TARGET_CARBON if(error != NPERR_NO_ERROR) rv = NS_ERROR_FAILURE; @@ -639,10 +595,6 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // XXX Turns out that NPPluginWindow and NPWindow are structurally // identical (on purpose!), so there's no need to make a copy. -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. We - // need to fix this. #ifdef NS_DEBUG printf("About to call CallNPP_SetWindowProc()...\n"); fflush(NULL); @@ -652,7 +604,6 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) &fNPP, (NPWindow*) window), fLibrary); -#endif // XXX In the old code, we'd just ignore any errors coming // back from the plugin's SetWindow(). Is this the correct @@ -706,10 +657,6 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand if (fCallbacks->event) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. #ifdef XP_MAC res = CallNPP_HandleEventProc(fCallbacks->event, &fNPP, @@ -725,8 +672,6 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand NS_TRY_SAFE_CALL_RETURN(res, CallNPP_HandleEventProc(fCallbacks->event, &fNPP, (void*)&npEvent), fLibrary); -#endif - #endif *handled = res; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index c300838f203..2b431933c37 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -99,6 +99,14 @@ #endif #endif +#if defined(XP_MAC) && TARGET_CARBON +#include "nsIClassicPluginFactory.h" +#endif + +#if defined(XP_MAC) && TARGET_CARBON +#include "nsIClassicPluginFactory.h" +#endif + // We need this hackery so that we can dynamically register doc // loaders for the 4.x plugins that we discover. #if defined(XP_PC) @@ -3109,10 +3117,10 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi nsIPlugin* plugin = pluginTag->mEntryPoint; if(plugin == NULL) { - // No, this is not a leak. GetGlobalServiceManager() doesn't - // addref the pointer on the way out. It probably should. - nsIServiceManager* serviceManager; - nsServiceManager::GetGlobalServiceManager(&serviceManager); + // No, this is not a leak. GetGlobalServiceManager() doesn't + // addref the pointer on the way out. It probably should. + nsIServiceManager* serviceManager; + nsServiceManager::GetGlobalServiceManager(&serviceManager); // need to get the plugin factory from this plugin. nsFactoryProc nsGetFactory = nsnull; @@ -3127,11 +3135,19 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi } else { +#if defined(XP_MAC) && TARGET_CARBON + // should we also look for a 'carb' resource? + if (PR_FindSymbol(pluginTag->mLibrary, "mainRD") != NULL) { + NS_WITH_SERVICE(nsIClassicPluginFactory, factory, NS_CLASSIC_PLUGIN_FACTORY_CONTRACTID, &rv); + if (NS_SUCCEEDED(rv)) rv = factory->CreatePlugin(serviceManager, pluginTag->mFileName, + pluginTag->mLibrary, &pluginTag->mEntryPoint); + } else +#endif rv = ns4xPlugin::CreatePlugin(serviceManager, pluginTag->mFileName, pluginTag->mLibrary, &pluginTag->mEntryPoint); - + plugin = pluginTag->mEntryPoint; pluginTag->mFlags |= NS_PLUGIN_FLAG_OLDSCHOOL; @@ -3139,7 +3155,7 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi } } - if(plugin != nsnull) + if (plugin != nsnull) { *aPlugin = plugin; plugin->AddRef(); diff --git a/mozilla/modules/plugin/default/mac/NullPlugin.cpp b/mozilla/modules/plugin/default/mac/NullPlugin.cpp index e93c95c2b58..450fff8cb2d 100644 --- a/mozilla/modules/plugin/default/mac/NullPlugin.cpp +++ b/mozilla/modules/plugin/default/mac/NullPlugin.cpp @@ -113,8 +113,10 @@ char* CPlugin::sJavaScriptPage = NULL; FSSpec CPlugin::sDataFileSpec; extern short gResFile; -extern QDGlobals* gQDPtr; +#if !TARGET_API_MAC_CARBON +extern QDGlobals* gQDPtr; +#endif // 'cicn' const short rBrokenPluginIcon = 326; @@ -696,7 +698,12 @@ void CPlugin::Draw(HiliteState hilite) RGBForeColor(&black); RGBBackColor(&white); +#if !TARGET_API_MAC_CARBON FillRect(&drawRect, &(gQDPtr->white)); +#else + Pattern qdWhite; + FillRect(&drawRect, GetQDGlobalsWhite(&qdWhite)); +#endif if (hilite == kHilited) { hiliteColor.red = 0xFFFF; @@ -784,8 +791,14 @@ Boolean CPlugin::FocusDraw() { GetPort(&fSavePort); SetPort((GrafPtr) ourPort); - fSavePortTop = ourPort->portRect.top; - fSavePortLeft = ourPort->portRect.left; + Rect portRect; +#if !TARGET_API_MAC_CARBON + portRect = ourPort->portRect; +#else + GetPortBounds(ourPort, &portRect); +#endif + fSavePortTop = portRect.top; + fSavePortLeft = portRect.left; GetClip(fSaveClip); fRevealedRect.top = fWindow->clipRect.top + npport->porty; @@ -1051,8 +1064,13 @@ void CPlugin::AskAndLoadURL() // NOTE: We need to set the cursor because almost always we will have set it to the // hand cursor before we get here. +#if !TARGET_API_MAC_CARBON SetCursor(&(gQDPtr->arrow)); - +#else + Cursor qdArrow; + SetCursor(GetQDGlobalsArrow(&qdArrow)); +#endif + // Now that weÕve queried the user about this mime type, // add it to our list so we wonÕt bug them again. AddMimeTypeToList(ourType); diff --git a/mozilla/modules/plugin/default/mac/npmac.cpp b/mozilla/modules/plugin/default/mac/npmac.cpp index 5b75f47c914..874b5fdcfe3 100644 --- a/mozilla/modules/plugin/default/mac/npmac.cpp +++ b/mozilla/modules/plugin/default/mac/npmac.cpp @@ -90,7 +90,9 @@ // //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +#if !TARGET_API_MAC_CARBON QDGlobals* gQDPtr; // Pointer to NetscapeÕs QuickDraw globals +#endif short gResFile; // Refnum of the pluginÕs resource file NPNetscapeFuncs gNetscapeFuncs; // Function table for procs in Netscape called by plugin @@ -461,6 +463,7 @@ void SetUpQD(void) // gResFile = CurResFile(); +#if !TARGET_API_MAC_CARBON // // Ask the system if CFM is available. // @@ -526,21 +529,22 @@ void SetUpQD(void) // gQDPtr = (QDGlobals*)(*((long*)SetCurrentA5()) - (sizeof(QDGlobals) - sizeof(GrafPtr))); } - +#endif } NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp); +#if !TARGET_API_MAC_CARBON #pragma export on #if GENERATINGCFM RoutineDescriptor mainRD = BUILD_ROUTINE_DESCRIPTOR(uppNPP_MainEntryProcInfo, main); #endif #pragma export off +#endif /* !TARGET_API_MAC_CARBON */ - -NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp) +DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp) { EnterCodeResource(); PLUGINDEBUGSTR("\pmain"); diff --git a/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp b/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp index 2f7d33aa37b..d8daf66a38e 100644 --- a/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp +++ b/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp @@ -60,10 +60,6 @@ ns4xPlugin::CheckClassInitialized(void) CALLBACKS.size = sizeof(CALLBACKS); CALLBACKS.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; -#if !TARGET_CARBON -// pinkerton - these macros rely on BuildRoutineDescriptor(), which is no longer in -// Carbon. Our easy solution to this is to drop support for 68K plugins. Now we just -// need to do the work... CALLBACKS.geturl = NewNPN_GetURLProc(_geturl); CALLBACKS.posturl = NewNPN_PostURLProc(_posturl); CALLBACKS.requestread = NewNPN_RequestReadProc(_requestread); @@ -85,10 +81,9 @@ ns4xPlugin::CheckClassInitialized(void) CALLBACKS.invalidaterect = NewNPN_InvalidateRectProc(_invalidaterect); CALLBACKS.invalidateregion = NewNPN_InvalidateRegionProc(_invalidateregion); CALLBACKS.forceredraw = NewNPN_ForceRedrawProc(_forceredraw); -#endif initialized = TRUE; -}; +} //////////////////////////////////////////////////////////////////////// // nsISupports stuff @@ -313,9 +308,14 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, return NS_ERROR_UNEXPECTED; #endif -#if defined(XP_MAC) && !TARGET_CARBON +#if defined(XP_MAC) +#if TARGET_CARBON + // get the main entry point + NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "main"); +#else // get the mainRD entry point NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "mainRD"); +#endif if(pfnMain == NULL) return NS_ERROR_FAILURE; @@ -335,14 +335,13 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, const nsFileSpec& file = iter; if (pluginsDir.IsPluginFile(file)) { - FSSpec spec = file; - char* fileName = p2cstrdup(spec.name); - if(!PL_strcmp(fileName, aFileName)) - { - Boolean targetIsFolder, wasAliased; - OSErr err = ::ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased); - pluginRefNum = ::FSpOpenResFile(&spec, fsRdPerm); - } + FSSpec spec = file; + if (!nsCRT::memcmp(spec.name + 1, aFileName, spec.name[0])) + { + Boolean targetIsFolder, wasAliased; + OSErr err = ::ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased); + pluginRefNum = ::FSpOpenResFile(&spec, fsRdPerm); + } } } @@ -438,10 +437,8 @@ ns4xPlugin::Shutdown(void) printf("shutting down plugin %08x\n",(int)this); #endif #ifdef XP_MAC -#if !TARGET_CARBON CallNPP_ShutdownProc(fShutdownEntry); ::CloseResFile(fPluginRefNum); -#endif #else NS_TRY_SAFE_CALL_VOID(fShutdownEntry(), fLibrary); #endif diff --git a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp index c58141924fe..8d6653eadb4 100644 --- a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp @@ -127,27 +127,23 @@ ns4xPluginStreamListener::OnStartBinding(nsIPluginStreamInfo* pluginInfo) mInst->GetCallbacks(&callbacks); mInst->GetNPP(&npp); -#if !TARGET_CARBON -// pinkerton -// relies on routine descriptors, not present in carbon. We need to fix this. - - PRLibrary* lib = nsnull; - if(mInst) + PRLibrary* lib = nsnull; + if(mInst) lib = mInst->fLibrary; - // if we don't know the end of the stream, use 0 instead of -1. bug 59571 - if (mNPStream.end == -1) + // if we don't know the end of the stream, use 0 instead of -1. bug 59571 + if (mNPStream.end == -1) mNPStream.end = 0; - NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewStreamProc(callbacks->newstream, - npp, - (char *)contentType, - &mNPStream, - seekable, - &streamType), lib); - if(error != NPERR_NO_ERROR) - return NS_ERROR_FAILURE; -#endif + NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewStreamProc(callbacks->newstream, + npp, + (char *)contentType, + &mNPStream, + seekable, + &streamType), lib); + if(error != NPERR_NO_ERROR) + return NS_ERROR_FAILURE; + // translate the old 4x style stream type to the new one switch(streamType) { @@ -172,7 +168,7 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, nsIInputStream* input, PRUint32 length) { - const NPPluginFuncs *callbacks; + const NPPluginFuncs *callbacks; NPP npp; PRUint32 numtowrite = 0; PRUint32 amountRead = 0; @@ -200,11 +196,6 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, { if (callbacks->writeready != NULL) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; PRBool started = PR_FALSE; if(mInst) { @@ -218,7 +209,6 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, npp, &mNPStream), lib); } -#endif // if WriteReady returned 0, the plugin is not ready to handle // the data, return FAILURE for now @@ -235,14 +225,9 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, if(numtowrite > 0) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; if(mInst) - lib = mInst->fLibrary; + lib = mInst->fLibrary; NS_TRY_SAFE_CALL_RETURN(writeCount, CallNPP_WriteProc(callbacks->write, npp, @@ -251,8 +236,7 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, numtowrite, (void *)buffer), lib); if(writeCount < 0) - return NS_ERROR_FAILURE; -#endif + return NS_ERROR_FAILURE; amountRead -= numtowrite; mPosition += numtowrite; } @@ -276,11 +260,6 @@ ns4xPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo, if (callbacks->asfile == NULL) return NS_OK; -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; PRBool started = PR_FALSE; if(mInst) { @@ -295,7 +274,6 @@ ns4xPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo, &mNPStream, fileName), lib); } -#endif return NS_OK; } @@ -317,10 +295,6 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, if (callbacks->destroystream != NULL) { // XXX need to convert status to NPReason -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. PRLibrary* lib = nsnull; PRBool started = PR_FALSE; if(mInst) { @@ -337,17 +311,11 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, } if(error != NPERR_NO_ERROR) return NS_ERROR_FAILURE; -#endif } // check to see if we have a call back if (callbacks->urlnotify != NULL && mNotifyData != nsnull) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. - PRLibrary* lib = nsnull; if(mInst) lib = mInst->fLibrary; @@ -357,7 +325,6 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, mNPStream.url, nsPluginReason_Done, mNotifyData), lib); -#endif } @@ -471,14 +438,8 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void) NPSavedData *sdata; -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. NS_TRY_SAFE_CALL_RETURN(error, CallNPP_DestroyProc(fCallbacks->destroy, &fNPP, &sdata), fLibrary); -#endif - mStarted = PR_FALSE; if(error != NPERR_NO_ERROR) return NS_ERROR_FAILURE; @@ -518,10 +479,6 @@ nsresult ns4xPluginInstance::InitializePlugin(nsIPluginInstancePeer* peer) mPeer->GetMode(&mode); mPeer->GetMIMEType(&mimetype); -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. We need to fix this. - NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewProc(fCallbacks->newp, (char *)mimetype, &fNPP, @@ -530,7 +487,6 @@ nsresult ns4xPluginInstance::InitializePlugin(nsIPluginInstancePeer* peer) (char**)names, (char**)values, NULL), fLibrary); -#endif //!TARGET_CARBON if(error != NPERR_NO_ERROR) rv = NS_ERROR_FAILURE; @@ -639,10 +595,6 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // XXX Turns out that NPPluginWindow and NPWindow are structurally // identical (on purpose!), so there's no need to make a copy. -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. We - // need to fix this. #ifdef NS_DEBUG printf("About to call CallNPP_SetWindowProc()...\n"); fflush(NULL); @@ -652,7 +604,6 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) &fNPP, (NPWindow*) window), fLibrary); -#endif // XXX In the old code, we'd just ignore any errors coming // back from the plugin's SetWindow(). Is this the correct @@ -706,10 +657,6 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand if (fCallbacks->event) { -#if !TARGET_CARBON - // pinkerton - // relies on routine descriptors, not present in carbon. - // We need to fix this. #ifdef XP_MAC res = CallNPP_HandleEventProc(fCallbacks->event, &fNPP, @@ -725,8 +672,6 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand NS_TRY_SAFE_CALL_RETURN(res, CallNPP_HandleEventProc(fCallbacks->event, &fNPP, (void*)&npEvent), fLibrary); -#endif - #endif *handled = res; diff --git a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp index c300838f203..2b431933c37 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -99,6 +99,14 @@ #endif #endif +#if defined(XP_MAC) && TARGET_CARBON +#include "nsIClassicPluginFactory.h" +#endif + +#if defined(XP_MAC) && TARGET_CARBON +#include "nsIClassicPluginFactory.h" +#endif + // We need this hackery so that we can dynamically register doc // loaders for the 4.x plugins that we discover. #if defined(XP_PC) @@ -3109,10 +3117,10 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi nsIPlugin* plugin = pluginTag->mEntryPoint; if(plugin == NULL) { - // No, this is not a leak. GetGlobalServiceManager() doesn't - // addref the pointer on the way out. It probably should. - nsIServiceManager* serviceManager; - nsServiceManager::GetGlobalServiceManager(&serviceManager); + // No, this is not a leak. GetGlobalServiceManager() doesn't + // addref the pointer on the way out. It probably should. + nsIServiceManager* serviceManager; + nsServiceManager::GetGlobalServiceManager(&serviceManager); // need to get the plugin factory from this plugin. nsFactoryProc nsGetFactory = nsnull; @@ -3127,11 +3135,19 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi } else { +#if defined(XP_MAC) && TARGET_CARBON + // should we also look for a 'carb' resource? + if (PR_FindSymbol(pluginTag->mLibrary, "mainRD") != NULL) { + NS_WITH_SERVICE(nsIClassicPluginFactory, factory, NS_CLASSIC_PLUGIN_FACTORY_CONTRACTID, &rv); + if (NS_SUCCEEDED(rv)) rv = factory->CreatePlugin(serviceManager, pluginTag->mFileName, + pluginTag->mLibrary, &pluginTag->mEntryPoint); + } else +#endif rv = ns4xPlugin::CreatePlugin(serviceManager, pluginTag->mFileName, pluginTag->mLibrary, &pluginTag->mEntryPoint); - + plugin = pluginTag->mEntryPoint; pluginTag->mFlags |= NS_PLUGIN_FLAG_OLDSCHOOL; @@ -3139,7 +3155,7 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi } } - if(plugin != nsnull) + if (plugin != nsnull) { *aPlugin = plugin; plugin->AddRef(); diff --git a/mozilla/modules/plugin/samples/default/mac/NullPlugin.cpp b/mozilla/modules/plugin/samples/default/mac/NullPlugin.cpp index e93c95c2b58..450fff8cb2d 100644 --- a/mozilla/modules/plugin/samples/default/mac/NullPlugin.cpp +++ b/mozilla/modules/plugin/samples/default/mac/NullPlugin.cpp @@ -113,8 +113,10 @@ char* CPlugin::sJavaScriptPage = NULL; FSSpec CPlugin::sDataFileSpec; extern short gResFile; -extern QDGlobals* gQDPtr; +#if !TARGET_API_MAC_CARBON +extern QDGlobals* gQDPtr; +#endif // 'cicn' const short rBrokenPluginIcon = 326; @@ -696,7 +698,12 @@ void CPlugin::Draw(HiliteState hilite) RGBForeColor(&black); RGBBackColor(&white); +#if !TARGET_API_MAC_CARBON FillRect(&drawRect, &(gQDPtr->white)); +#else + Pattern qdWhite; + FillRect(&drawRect, GetQDGlobalsWhite(&qdWhite)); +#endif if (hilite == kHilited) { hiliteColor.red = 0xFFFF; @@ -784,8 +791,14 @@ Boolean CPlugin::FocusDraw() { GetPort(&fSavePort); SetPort((GrafPtr) ourPort); - fSavePortTop = ourPort->portRect.top; - fSavePortLeft = ourPort->portRect.left; + Rect portRect; +#if !TARGET_API_MAC_CARBON + portRect = ourPort->portRect; +#else + GetPortBounds(ourPort, &portRect); +#endif + fSavePortTop = portRect.top; + fSavePortLeft = portRect.left; GetClip(fSaveClip); fRevealedRect.top = fWindow->clipRect.top + npport->porty; @@ -1051,8 +1064,13 @@ void CPlugin::AskAndLoadURL() // NOTE: We need to set the cursor because almost always we will have set it to the // hand cursor before we get here. +#if !TARGET_API_MAC_CARBON SetCursor(&(gQDPtr->arrow)); - +#else + Cursor qdArrow; + SetCursor(GetQDGlobalsArrow(&qdArrow)); +#endif + // Now that weÕve queried the user about this mime type, // add it to our list so we wonÕt bug them again. AddMimeTypeToList(ourType); diff --git a/mozilla/modules/plugin/samples/default/mac/npmac.cpp b/mozilla/modules/plugin/samples/default/mac/npmac.cpp index 5b75f47c914..874b5fdcfe3 100644 --- a/mozilla/modules/plugin/samples/default/mac/npmac.cpp +++ b/mozilla/modules/plugin/samples/default/mac/npmac.cpp @@ -90,7 +90,9 @@ // //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +#if !TARGET_API_MAC_CARBON QDGlobals* gQDPtr; // Pointer to NetscapeÕs QuickDraw globals +#endif short gResFile; // Refnum of the pluginÕs resource file NPNetscapeFuncs gNetscapeFuncs; // Function table for procs in Netscape called by plugin @@ -461,6 +463,7 @@ void SetUpQD(void) // gResFile = CurResFile(); +#if !TARGET_API_MAC_CARBON // // Ask the system if CFM is available. // @@ -526,21 +529,22 @@ void SetUpQD(void) // gQDPtr = (QDGlobals*)(*((long*)SetCurrentA5()) - (sizeof(QDGlobals) - sizeof(GrafPtr))); } - +#endif } NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp); +#if !TARGET_API_MAC_CARBON #pragma export on #if GENERATINGCFM RoutineDescriptor mainRD = BUILD_ROUTINE_DESCRIPTOR(uppNPP_MainEntryProcInfo, main); #endif #pragma export off +#endif /* !TARGET_API_MAC_CARBON */ - -NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp) +DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp) { EnterCodeResource(); PLUGINDEBUGSTR("\pmain"); diff --git a/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp b/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp index a7103bd69de..4f5d771ba04 100644 --- a/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp +++ b/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp @@ -35,6 +35,8 @@ * recordID->metadata */ +#include + #include "nsDBAccessor.h" #include "nscore.h" diff --git a/mozilla/netwerk/macbuild/netwerk.mcp b/mozilla/netwerk/macbuild/netwerk.mcp index 86bceba1637..013249ee8e1 100644 Binary files a/mozilla/netwerk/macbuild/netwerk.mcp and b/mozilla/netwerk/macbuild/netwerk.mcp differ diff --git a/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp b/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp index c6a4c00006a..64b65273b18 100644 --- a/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp +++ b/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp @@ -51,6 +51,8 @@ #include +using namespace std; + extern nsIPluginManager* thePluginManager; extern nsIPluginManager2* thePluginManager2; diff --git a/mozilla/uriloader/exthandler/mac/nsDecodeAppleFile.h b/mozilla/uriloader/exthandler/mac/nsDecodeAppleFile.h index f61e867d96b..f6855fcfb42 100644 --- a/mozilla/uriloader/exthandler/mac/nsDecodeAppleFile.h +++ b/mozilla/uriloader/exthandler/mac/nsDecodeAppleFile.h @@ -33,7 +33,7 @@ /* ** applefile definitions used */ -#if PRAGMA_ALIGN_SUPPORTED +#if PRAGMA_STRUCT_ALIGN #pragma options align=mac68k #endif @@ -78,7 +78,7 @@ typedef struct ap_dates } ap_dates; -#if PRAGMA_ALIGN_SUPPORTED +#if PRAGMA_STRUCT_ALIGN #pragma options align=reset #endif diff --git a/mozilla/widget/macbuild/widget.mcp b/mozilla/widget/macbuild/widget.mcp index 7df4c3e7f98..cff0cf22a2a 100644 Binary files a/mozilla/widget/macbuild/widget.mcp and b/mozilla/widget/macbuild/widget.mcp differ diff --git a/mozilla/widget/src/mac/nsFilePicker.cpp b/mozilla/widget/src/mac/nsFilePicker.cpp index 9b1287bbcdf..e2d89fd2460 100644 --- a/mozilla/widget/src/mac/nsFilePicker.cpp +++ b/mozilla/widget/src/mac/nsFilePicker.cpp @@ -283,8 +283,8 @@ nsFilePicker::GetLocalFile(Str255 & inTitle, /* filter list here later */ FSSpec PRInt16 retVal = returnCancel; NavReplyRecord reply; NavDialogOptions dialogOptions; - NavEventUPP eventProc = NewNavEventProc(FileDialogEventHandlerProc); // doesn't really matter if this fails - NavObjectFilterUPP filterProc = NewNavObjectFilterProc(FileDialogFilterProc); // doesn't really matter if this fails + NavEventUPP eventProc = NewNavEventUPP(FileDialogEventHandlerProc); // doesn't really matter if this fails + NavObjectFilterUPP filterProc = NewNavObjectFilterUPP(FileDialogFilterProc); // doesn't really matter if this fails OSErr anErr = NavGetDefaultDialogOptions(&dialogOptions); if (anErr == noErr) { @@ -357,7 +357,7 @@ nsFilePicker::GetLocalFolder(Str255 & inTitle, FSSpec* outSpec) PRInt16 retVal = returnCancel; NavReplyRecord reply; NavDialogOptions dialogOptions; - NavEventUPP eventProc = NewNavEventProc(FileDialogEventHandlerProc); // doesn't really matter if this fails + NavEventUPP eventProc = NewNavEventUPP(FileDialogEventHandlerProc); // doesn't really matter if this fails OSErr anErr = NavGetDefaultDialogOptions(&dialogOptions); if (anErr == noErr) { @@ -413,7 +413,7 @@ nsFilePicker::PutLocalFile(Str255 & inTitle, Str255 & inDefaultName, FSSpec* out PRInt16 retVal = returnCancel; NavReplyRecord reply; NavDialogOptions dialogOptions; - NavEventUPP eventProc = NewNavEventProc(FileDialogEventHandlerProc); // doesn't really matter if this fails + NavEventUPP eventProc = NewNavEventUPP(FileDialogEventHandlerProc); // doesn't really matter if this fails OSType typeToSave = 'TEXT'; OSType creatorToSave = 'MOZZ'; diff --git a/mozilla/widget/src/mac/nsFileWidget.cpp b/mozilla/widget/src/mac/nsFileWidget.cpp index d43728f4ca0..215cd9a05c3 100644 --- a/mozilla/widget/src/mac/nsFileWidget.cpp +++ b/mozilla/widget/src/mac/nsFileWidget.cpp @@ -235,7 +235,7 @@ nsFileWidget :: PutFile ( Str255 & inTitle, Str255 & inDefaultName, FSSpec* outS PRBool retVal = PR_FALSE; NavReplyRecord reply; NavDialogOptions dialogOptions; - NavEventUPP eventProc = NewNavEventProc(myProc); // doesn't really matter if this fails + NavEventUPP eventProc = NewNavEventUPP(myProc); // doesn't really matter if this fails OSType typeToSave = 'TEXT'; OSType creatorToSave = 'MOZZ'; @@ -313,7 +313,7 @@ nsFileWidget :: GetFile ( Str255 & inTitle, /* filter list here later */ FSSpec* PRBool retVal = PR_FALSE; NavReplyRecord reply; NavDialogOptions dialogOptions; - NavEventUPP eventProc = NewNavEventProc(myProc); // doesn't really matter if this fails + NavEventUPP eventProc = NewNavEventUPP(myProc); // doesn't really matter if this fails OSErr anErr = NavGetDefaultDialogOptions(&dialogOptions); if (anErr == noErr) { @@ -383,7 +383,7 @@ nsFileWidget :: GetFolder ( Str255 & inTitle, FSSpec* outSpec ) PRBool retVal = PR_FALSE; NavReplyRecord reply; NavDialogOptions dialogOptions; - NavEventUPP eventProc = NewNavEventProc(myProc); // doesn't really matter if this fails + NavEventUPP eventProc = NewNavEventUPP(myProc); // doesn't really matter if this fails OSErr anErr = NavGetDefaultDialogOptions(&dialogOptions); if (anErr == noErr) { diff --git a/mozilla/widget/src/mac/nsMacEventHandler.cpp b/mozilla/widget/src/mac/nsMacEventHandler.cpp index 30f4730b304..8d04881d6d6 100644 --- a/mozilla/widget/src/mac/nsMacEventHandler.cpp +++ b/mozilla/widget/src/mac/nsMacEventHandler.cpp @@ -365,7 +365,7 @@ nsMacEventHandler::nsMacEventHandler(nsMacWindow* aTopLevelWidget) mIMEIsComposing = PR_FALSE; mIMECompositionStr=nsnull; - mControlActionProc = NewControlActionProc(ScrollActionProc); + mControlActionProc = NewControlActionUPP(ScrollActionProc); } diff --git a/mozilla/widget/src/mac/nsMacMessagePump.cpp b/mozilla/widget/src/mac/nsMacMessagePump.cpp index f71cd3c21f9..eeb43e11f5b 100644 --- a/mozilla/widget/src/mac/nsMacMessagePump.cpp +++ b/mozilla/widget/src/mac/nsMacMessagePump.cpp @@ -828,6 +828,7 @@ void nsMacMessagePump::DoMenu(EventRecord &anEvent, long menuResult) // The app can handle its menu commands here or // in the nsNativeBrowserWindow and nsNativeViewerApp +#if !TARGET_CARBON extern const PRInt16 kAppleMenuID; // Danger Will Robinson!!! - this currently requires // APPLE_MENU_HACK to be defined in nsMenu.h // One of these days it'll become a non-hack @@ -844,14 +845,14 @@ extern const PRInt16 kAppleMenuID; // Danger Will Robinson!!! - this currently r ::GetMenuItemText(::GetMenuHandle(kAppleMenuID), theItem, daName); ::GetPort(&savePort); -#if !TARGET_CARBON ::OpenDeskAcc(daName); -#endif ::SetPort(savePort); HiliteMenu(0); return; } } +#endif + // Note that we still give Raptor a shot at the event as it will eventually // handle the About... selection diff --git a/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp b/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp index 71f24bef5e7..2a66f410031 100644 --- a/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp +++ b/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp @@ -49,14 +49,14 @@ nsMacTSMMessagePump::nsMacTSMMessagePump() { OSErr err; - mPos2OffsetUPP = NewAEEventHandlerProc(nsMacTSMMessagePump::PositionToOffsetHandler); - NS_ASSERTION(mPos2OffsetUPP!=NULL,"nsMacTSMMessagePump::InstallTSMAEHandlers: NewAEEventHandlerProc[Pos2Pffset] failed"); + mPos2OffsetUPP = NewAEEventHandlerUPP(nsMacTSMMessagePump::PositionToOffsetHandler); + NS_ASSERTION(mPos2OffsetUPP!=NULL,"nsMacTSMMessagePump::InstallTSMAEHandlers: NewAEEventHandlerUPP[Pos2Pffset] failed"); - mOffset2PosUPP = NewAEEventHandlerProc(nsMacTSMMessagePump::OffsetToPositionHandler); - NS_ASSERTION(mPos2OffsetUPP!=NULL,"nsMacTSMMessagePump::InstallTSMAEHandlers: NewAEEventHandlerProc[Pos2Pffset] failed"); + mOffset2PosUPP = NewAEEventHandlerUPP(nsMacTSMMessagePump::OffsetToPositionHandler); + NS_ASSERTION(mPos2OffsetUPP!=NULL,"nsMacTSMMessagePump::InstallTSMAEHandlers: NewAEEventHandlerUPP[Pos2Pffset] failed"); - mUpdateUPP = NewAEEventHandlerProc(nsMacTSMMessagePump::UpdateHandler); - NS_ASSERTION(mPos2OffsetUPP!=NULL,"nsMacTSMMessagePump::InstallTSMAEHandlers: NewAEEventHandlerProc[Pos2Pffset] failed"); + mUpdateUPP = NewAEEventHandlerUPP(nsMacTSMMessagePump::UpdateHandler); + NS_ASSERTION(mPos2OffsetUPP!=NULL,"nsMacTSMMessagePump::InstallTSMAEHandlers: NewAEEventHandlerUPP[Pos2Pffset] failed"); err = AEInstallEventHandler(kTextServiceClass,kPos2Offset,mPos2OffsetUPP,(long)this,false); NS_ASSERTION(err==noErr,"nsMacTSMMessagePump::InstallTSMAEHandlers: AEInstallEventHandlers[Pos2Offset] failed"); @@ -114,7 +114,7 @@ void nsMacTSMMessagePump::Shutdown() // //------------------------------------------------------------------------- -pascal OSErr nsMacTSMMessagePump::PositionToOffsetHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon) +pascal OSErr nsMacTSMMessagePump::PositionToOffsetHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { OSErr err; DescType returnedType; @@ -163,7 +163,7 @@ pascal OSErr nsMacTSMMessagePump::PositionToOffsetHandler(const AppleEvent *theA return noErr; } -pascal OSErr nsMacTSMMessagePump::OffsetToPositionHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon) +pascal OSErr nsMacTSMMessagePump::OffsetToPositionHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { OSErr err; DescType returnedType; @@ -209,7 +209,7 @@ pascal OSErr nsMacTSMMessagePump::OffsetToPositionHandler(const AppleEvent *theA return noErr; } -pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon) +pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { OSErr err; DescType returnedType; diff --git a/mozilla/widget/src/mac/nsMacTSMMessagePump.h b/mozilla/widget/src/mac/nsMacTSMMessagePump.h index 2308dbbc7fb..31223f45592 100644 --- a/mozilla/widget/src/mac/nsMacTSMMessagePump.h +++ b/mozilla/widget/src/mac/nsMacTSMMessagePump.h @@ -45,9 +45,9 @@ public: void Shutdown(); private: - static pascal OSErr PositionToOffsetHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon); - static pascal OSErr OffsetToPositionHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon); - static pascal OSErr UpdateHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon); + static pascal OSErr PositionToOffsetHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); + static pascal OSErr OffsetToPositionHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); + static pascal OSErr UpdateHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); static AEEventHandlerUPP mPos2OffsetUPP; static AEEventHandlerUPP mOffset2PosUPP; static AEEventHandlerUPP mUpdateUPP; diff --git a/mozilla/widget/src/mac/nsMacWindow.cpp b/mozilla/widget/src/mac/nsMacWindow.cpp index 9a6a3206813..a09c0a07cec 100644 --- a/mozilla/widget/src/mac/nsMacWindow.cpp +++ b/mozilla/widget/src/mac/nsMacWindow.cpp @@ -380,7 +380,6 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent, break; case eWindowType_dialog: -#if !TARGET_CARBON if (aInitData) { switch (aInitData->mBorderStyle) @@ -426,7 +425,6 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent, hOffset = kDialogMarginWidth; vOffset = kDialogTitleBarHeight; break; -#endif case eWindowType_toplevel: if (aInitData && @@ -581,7 +579,7 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState) // we need to make sure we call ::Show/HideWindow() to generate the // necessary activate/deactivate events. Calling ::ShowHide() is // not adequate, unless we don't want activation (popups). (pinkerton). - if ( bState ) { + if ( bState && !mBounds.IsEmpty() ) { if ( mAcceptsActivation ) ::ShowWindow(mWindowPtr); else { diff --git a/mozilla/widget/src/mac/nsMenuBarX.h b/mozilla/widget/src/mac/nsMenuBarX.h index fcef645fe93..da87bbf26eb 100644 --- a/mozilla/widget/src/mac/nsMenuBarX.h +++ b/mozilla/widget/src/mac/nsMenuBarX.h @@ -27,6 +27,7 @@ #include "nsIMenuListener.h" #include "nsIDocumentObserver.h" #include "nsIChangeManager.h" +#include "nsIPresContext.h" #include "nsSupportsArray.h" #include "nsVoidArray.h" #include "nsHashtable.h" diff --git a/mozilla/widget/src/mac/nsScrollbar.cpp b/mozilla/widget/src/mac/nsScrollbar.cpp index 59489cb7547..cf04ffa9de8 100644 --- a/mozilla/widget/src/mac/nsScrollbar.cpp +++ b/mozilla/widget/src/mac/nsScrollbar.cpp @@ -51,7 +51,7 @@ nsScrollbar::nsScrollbar(PRBool /*aIsVertical*/) WIDGET_SET_CLASSNAME("nsScrollbar"); SetControlType(kControlScrollBarLiveProc); if (!sControlActionProc) - sControlActionProc = NewControlActionProc(nsScrollbar::ScrollActionProc); + sControlActionProc = NewControlActionUPP(nsScrollbar::ScrollActionProc); // Unfortunately, not disposed when the app quits, but that's still a non-issue. } diff --git a/mozilla/widget/src/mac/nsToolkit.cpp b/mozilla/widget/src/mac/nsToolkit.cpp index 583b1cd2bd1..ac77015a8d3 100644 --- a/mozilla/widget/src/mac/nsToolkit.cpp +++ b/mozilla/widget/src/mac/nsToolkit.cpp @@ -320,7 +320,10 @@ OSErr nsMacMemoryCushion::Init(Size bufferSize, Size reserveSize) // make this purgable ::HPurge(mBufferHandle); +#if !TARGET_CARBON ::SetGrowZone(NewGrowZoneProc(GrowZoneProc)); +#endif + return noErr; } diff --git a/mozilla/widget/src/mac/nsWidgetFactory.cpp b/mozilla/widget/src/mac/nsWidgetFactory.cpp index bd8b1d934c5..3eee7b0c38c 100644 --- a/mozilla/widget/src/mac/nsWidgetFactory.cpp +++ b/mozilla/widget/src/mac/nsWidgetFactory.cpp @@ -36,9 +36,22 @@ #include "nsFilePicker.h" #include "nsFileSpecWithUIImpl.h" #include "nsScrollbar.h" + +#if TARGET_CARBON +#include "nsMenuBarX.h" +#include "nsMenuX.h" +#include "nsMenuItemX.h" + +#define nsMenuBar nsMenuBarX +#define nsMenu nsMenuX +#define nsMenuItem nsMenuItemX + +#else #include "nsMenuBar.h" #include "nsMenu.h" #include "nsMenuItem.h" +#endif + #include "nsFileWidget.h" #include "nsClipboard.h" diff --git a/mozilla/xpcom/components/nsNativeComponentLoader.cpp b/mozilla/xpcom/components/nsNativeComponentLoader.cpp index b160fe13953..07978a281c6 100644 --- a/mozilla/xpcom/components/nsNativeComponentLoader.cpp +++ b/mozilla/xpcom/components/nsNativeComponentLoader.cpp @@ -751,7 +751,8 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when, // so that 3rd party shared libraries will be noticed! validExtension = ((type == 'shlb') || (type == 'NSPL')); } - + +#if !TARGET_CARBON if (validExtension) { // This call to SystemTask is here to give the OS time to grow it's @@ -760,6 +761,7 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when, // story. ::SystemTask(); } +#endif } #else diff --git a/mozilla/xpcom/typelib/xpidl/macplugin/mac_memory.cpp b/mozilla/xpcom/typelib/xpidl/macplugin/mac_memory.cpp index 975328296e5..d7ae0cb8db2 100644 --- a/mozilla/xpcom/typelib/xpidl/macplugin/mac_memory.cpp +++ b/mozilla/xpcom/typelib/xpidl/macplugin/mac_memory.cpp @@ -42,7 +42,7 @@ extern CWPluginContext gPluginContext; * global data. Just be careful out there! */ -const bool kTemporaryAllocation = false; +const Boolean kTemporaryAllocation = false; void* operator new(size_t size) { diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 2835a977e9e..079bfe2ac2a 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -120,7 +120,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIDOMXULDocument.h" // End hack -#if (defined(XP_MAC) && !TARGET_CARBON) || defined(RHAPSODY) +#if defined(XP_MAC) || defined(RHAPSODY) #define USE_NATIVE_MENUS #endif