Landing the rest of the mach-o OSX changes.

Bug #75653 r=cls sr=waterson
This commit is contained in:
seawood%netscape.com 2001-10-27 07:38:18 +00:00
Родитель cad0dc7095
Коммит 9b5ae05e33
77 изменённых файлов: 1080 добавлений и 594 удалений

Просмотреть файл

@ -51,6 +51,11 @@ endif
DIRS += $(NSPRPUB_DIR)
# MacOSX needs to build lib for MoreFiles before xpcom
ifeq ($(OS_ARCH),Darwin)
DIRS += lib/mac/MoreFiles
endif
# intl should not be in here - it's just temporary until
# xpconnect's dependency on intl is repaired - see bug 106130
DIRS += dbm modules/libreg js string xpcom intl js/src/xpconnect

Просмотреть файл

@ -786,6 +786,12 @@ extensions/transformiix/source/Makefile
extensions/transformiix/Makefile
"
if [ "$MACOSX" ]; then
MAKEFILES_macmorefiles="
lib/mac/MoreFiles/Makefile
"
fi
if [ "$MOZ_MAIL_NEWS" ]; then
if [ -f ${srcdir}/mailnews/makefiles ]; then
MAKEFILES_mailnews=`cat ${srcdir}/mailnews/makefiles`

Просмотреть файл

@ -747,7 +747,7 @@ ifneq ($(OS_ARCH),OS2)
# that are built using other static libraries. Confused...?
#
ifdef SHARED_LIBRARY_LIBS
ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Rhapsody,$(OS_ARCH)))
ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
else

Просмотреть файл

@ -921,23 +921,35 @@ alpha*-*-osf*)
fi
;;
*-rhapsody*)
DLL_SUFFIX=".dylib"
DSO_LDOPTS='-compatibility_version 1 -current_version 1'
AC_DEFINE(NO_X11)
*-darwin*)
AC_DEFINE(DARWIN)
AC_DEFINE(RHAPSODY)
AC_DEFINE(TARGET_CARBON)
AC_DEFINE(TARGET_API_MAC_CARBON)
ENABLE_TESTS=
MOZ_WIDGET_TOOLKIT='mac'
TK_LIBS='/System/Library/Frameworks/Carbon.framework/Carbon'
CFLAGS="$CFLAGS -traditional-cpp -fno-common -I/System/Library/Frameworks/Carbon.framework/Headers"
CXXFLAGS="$CXXFLAGS -traditional-cpp -fno-common -I/System/Library/Frameworks/Carbon.framework/Headers"
MKSHLIB='$(CXX) $(CXXFLAGS) -arch ppc $(DSO_LDOPTS) -o $@'
_PEDANTIC=
CFLAGS="$CFLAGS -fpascal-strings -traditional-cpp -fno-common"
CXXFLAGS="$CXXFLAGS -fpascal-strings -traditional-cpp -fno-common"
DLL_SUFFIX=".dylib"
DSO_LDOPTS='-compatibility_version 1 -current_version 1'
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
MKSHLIB_FORCE_ALL=''
MKSHLIB_UNFORCE_ALL=''
case "${target_cpu}" in
powerpc*)
AC_DEFINE(NO_X11)
AC_DEFINE(XP_MACOSX)
AC_DEFINE(TARGET_CARBON)
AC_DEFINE(TARGET_API_MAC_CARBON)
no_x=yes
MACOSX=1
MOZ_WIDGET_TOOLKIT='mac'
LDFLAGS="$LDFLAGS -framework Carbon"
DSO_LDOPTS="$DSO_LDOPTS -arch ppc -install_name @executable_path/\$@"
TK_LIBS='/System/Library/Frameworks/Carbon.framework/Carbon'
TK_CFLAGS="-I/Developer/Headers/FlatCarbon -F/System/Library/Frameworks"
CFLAGS="$CFLAGS $TK_CFLAGS"
CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
;;
esac
;;
*-sco*)
@ -4018,7 +4030,7 @@ elif test "$OS_TARGET" = "BeOS"; then
AC_DEFINE(XP_BEOS)
MOZ_MOVEMAIL=1
AC_SUBST(MOZ_MOVEMAIL)
elif test "$OS_TARGET" = "Mac OS"; then
elif test "$OS_TARGET" = "Darwin"; then
AC_DEFINE(XP_UNIX)
AC_DEFINE(UNIX_EMBED)
AC_DEFINE(UNIX_LDAP)

Просмотреть файл

@ -62,11 +62,13 @@ CPPSRCS = \
nsUnicodeRenderingToolkit.cpp \
nsScreenMac.cpp \
nsScreenManagerMac.cpp \
nsPrintOptionsX.cpp \
$(NULL)
# $(DIST)/lib/libimg_s.a \
EXTRA_DSO_LDOPTS = \
$(MKSHLIB_FORCE_ALL) \
$(DIST)/lib/libimg_s.a \
$(DIST)/lib/libmozutil_s.a \
-lgkgfx \
$(MKSHLIB_UNFORCE_ALL) \

Просмотреть файл

@ -954,10 +954,10 @@ PRUint32 nsDeviceContextMac::GetScreenResolution()
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
PRInt32 intVal;
if (NS_SUCCEEDED(prefs->GetIntPref("browser.display.screen_resolution", &intVal))) {
if (NS_SUCCEEDED(prefs->GetIntPref("browser.display.screen_resolution", &intVal)) && intVal > 0) {
mPixelsPerInch = intVal;
}
#if 0
#ifdef XP_MACOSX
else {
short hppi, vppi;
::ScreenRes(&hppi, &vppi);

Просмотреть файл

@ -38,6 +38,7 @@
*
* ***** END LICENSE BLOCK ***** */
#define PM_USE_SESSION_APIS 0
#include "nsDeviceContextSpecX.h"
#include "prmem.h"

Просмотреть файл

@ -20,7 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Patrick C. Beard <beard@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -59,6 +59,104 @@
#include "nsScreenManagerMac.h"
#include "nsBlender.h"
#include "nsCOMPtr.h"
#include "nsPrintOptionsMac.h"
#ifdef XP_MACOSX
#include "nsIGenericFactory.h"
// XXX Implement the GFX module using NS_GENERIC_FACTORY_CONSTRUCTOR / NS_IMPL_NSGETMODULE
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontMetricsMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRenderingContextMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDrawingSurfaceMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsX)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecFactoryMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerMac)
static NS_IMETHODIMP
nsScriptableRegionConstructor(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
NS_ENSURE_NO_AGGREGATION(aOuter);
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsCOMPtr<nsIRegion> region = new nsRegionMac();
NS_ENSURE_TRUE(region, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIScriptableRegion> result(new nsScriptableRegion(region));
NS_ENSURE_TRUE(result, NS_ERROR_OUT_OF_MEMORY);
return result->QueryInterface(aIID, aResult);
}
static nsModuleComponentInfo components[] =
{
{ "nsFontMetrics",
NS_FONT_METRICS_CID,
"@mozilla.org/gfx/fontmetrics;1",
nsFontMetricsMacConstructor },
{ "nsDeviceContext",
NS_DEVICE_CONTEXT_CID,
"@mozilla.org/gfx/devicecontext;1",
nsDeviceContextMacConstructor },
{ "nsRenderingContext",
NS_RENDERING_CONTEXT_CID,
"@mozilla.org/gfx/renderingcontext;1",
nsRenderingContextMacConstructor },
{ "nsImage",
NS_IMAGE_CID,
"@mozilla.org/gfx/image;1",
nsImageMacConstructor },
{ "nsRegion",
NS_REGION_CID,
"@mozilla.org/gfx/unscriptable-region;1",
nsRegionMacConstructor },
{ "nsBlender",
NS_BLENDER_CID,
"@mozilla.org/gfx/blender;1",
nsBlenderConstructor },
{ "nsDrawingSurface",
NS_DRAWING_SURFACE_CID,
"@mozilla.org/gfx/drawing-surface;1",
nsDrawingSurfaceMacConstructor },
{ "nsDeviceContextSpec",
NS_DEVICE_CONTEXT_SPEC_CID,
"@mozilla.org/gfx/devicecontextspec;1",
nsDeviceContextSpecXConstructor },
{ "nsDeviceContextSpecFactory",
NS_DEVICE_CONTEXT_SPEC_FACTORY_CID,
"@mozilla.org/gfx/devicecontextspecfactory;1",
nsDeviceContextSpecFactoryMacConstructor },
{ "nsScriptableRegion",
NS_SCRIPTABLE_REGION_CID,
"@mozilla.org/gfx/region;1",
nsScriptableRegionConstructor },
{ "nsPrintOptions",
NS_PRINTOPTIONS_CID,
"@mozilla.org/gfx/printoptions;1",
nsPrintOptionsXConstructor },
{ "nsFontEnumerator",
NS_FONT_ENUMERATOR_CID,
"@mozilla.org/gfx/fontenumerator;1",
nsFontEnumeratorMacConstructor },
{ "nsFontList",
NS_FONTLIST_CID,
"@mozilla.org/gfx/fontlist;1",
nsFontListConstructor },
{ "nsScreenManager",
NS_SCREENMANAGER_CID,
"@mozilla.org/gfx/screenmanager;1",
nsScreenManagerMacConstructor }
};
NS_IMPL_NSGETMODULE(nsGfxModule, components)
#else
static NS_DEFINE_IID(kCFontMetrics, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kCFontEnumerator, NS_FONT_ENUMERATOR_CID);
@ -211,3 +309,5 @@ extern "C" NS_GFX nsresult NSGetFactory(nsISupports* servMgr,
return factory->QueryInterface(kIFactoryIID, (void**)aFactory);
}
#endif

Просмотреть файл

@ -36,6 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#define PM_USE_SESSION_APIS 0
#include <PMApplication.h>
#include "nsCOMPtr.h"
@ -145,18 +146,20 @@ nsPrintOptionsX::GetNativeData(PRInt16 aDataType, void * *_retval)
switch (aDataType)
{
case kNativeDataPrintRecord:
// we need to clone and pass out
PMPageFormat pageFormat = kPMNoPageFormat;
OSStatus status = ::PMNewPageFormat(&pageFormat);
if (status != noErr) return NS_ERROR_FAILURE;
{
// we need to clone and pass out
PMPageFormat pageFormat = kPMNoPageFormat;
OSStatus status = ::PMNewPageFormat(&pageFormat);
if (status != noErr) return NS_ERROR_FAILURE;
status = ::PMCopyPageFormat(mPageFormat, pageFormat);
if (status != noErr) {
::PMDisposePageFormat(pageFormat);
return NS_ERROR_FAILURE;
status = ::PMCopyPageFormat(mPageFormat, pageFormat);
if (status != noErr) {
::PMDisposePageFormat(pageFormat);
return NS_ERROR_FAILURE;
}
*_retval = pageFormat;
}
*_retval = pageFormat;
break;
default:

Просмотреть файл

@ -122,11 +122,11 @@ nsWatchTask :: DoWatchTask ( nsWatchTask* inSelf )
{
if ( inSelf->mChecksum == 'mozz' ) {
if ( !inSelf->mSuspended ) {
#if TARGET_CARBON
#if TARGET_CARBON
PRBool busy = inSelf->mBusy;
#else
#else
PRBool busy = inSelf->mBusy && LMGetCrsrBusy();
#endif
#endif
if ( !busy ) {
if ( ::TickCount() - inSelf->mTicks > kTicksToShowWatch ) {
::SetCursor ( &(inSelf->mWatchCursor) );
@ -140,9 +140,10 @@ nsWatchTask :: DoWatchTask ( nsWatchTask* inSelf )
++inSelf->mAnimation;
}
#if !TARGET_CARBON
// reset the task to fire again
inSelf->mTask.vblCount = kRepeatInterval;
#endif
} // if valid checksum
} // DoWatchTask

Просмотреть файл

@ -41,7 +41,9 @@
#define WatchTask_h__
#ifndef XP_MACOSX
#include <Retrace.h>
#endif
#include <Quickdraw.h>
#include "PRTypes.h"
#include "nscore.h"
@ -87,7 +89,9 @@ private:
// the VBL task
static pascal void DoWatchTask(nsWatchTask* theTaskPtr) ;
#if !TARGET_CARBON
VBLTask mTask; // this must be first!!
#endif
long mChecksum; // 'mozz' to validate we have real data at interrupt time (not needed?)
void* mSelf; // so we can get back to |this| from the static routine
long mTicks; // last time the event loop was hit

Просмотреть файл

@ -48,7 +48,7 @@
#include "fdlibm.h"
/* XXX ugly hack to get msvc to link without error. */
#if _LIB_VERSION == _IEEE_ && !defined(RHAPSODY)
#if _LIB_VERSION == _IEEE_ && !defined(DARWIN)
int errno;
# define EDOM 0
# define ERANGE 0

Просмотреть файл

@ -357,7 +357,7 @@ PRMJ_DSTOffset(JSInt64 local_time)
JSInt64 maxtimet;
struct tm tm;
PRMJTime prtm;
#if ( defined( USE_AUTOCONF ) && !defined( HAVE_LOCALTIME_R) ) || ( !defined ( USE_AUTOCONF ) && ( defined( XP_PC ) || defined( __FreeBSD__ ) || defined ( HPUX9 ) || defined ( SNI ) || defined ( NETBSD ) || defined ( OPENBSD ) || defined( RHAPSODY ) ) )
#if ( defined( USE_AUTOCONF ) && !defined( HAVE_LOCALTIME_R) ) || ( !defined ( USE_AUTOCONF ) && ( defined( XP_PC ) || defined( __FreeBSD__ ) || defined ( HPUX9 ) || defined ( SNI ) || defined ( NETBSD ) || defined ( OPENBSD ) || defined( DARWIN ) ) )
struct tm *ptm;
#endif
@ -376,7 +376,7 @@ PRMJ_DSTOffset(JSInt64 local_time)
}
JSLL_L2UI(local,local_time);
PRMJ_basetime(local_time,&prtm);
#if ( defined( USE_AUTOCONF ) && !defined( HAVE_LOCALTIME_R) ) || ( !defined ( USE_AUTOCONF ) && ( defined( XP_PC ) || defined( __FreeBSD__ ) || defined ( HPUX9 ) || defined ( SNI ) || defined ( NETBSD ) || defined ( OPENBSD ) || defined( RHAPSODY ) ) )
#if ( defined( USE_AUTOCONF ) && !defined( HAVE_LOCALTIME_R) ) || ( !defined ( USE_AUTOCONF ) && ( defined( XP_PC ) || defined( __FreeBSD__ ) || defined ( HPUX9 ) || defined ( SNI ) || defined ( NETBSD ) || defined ( OPENBSD ) || defined( DARWIN ) ) )
ptm = localtime(&local);
if(!ptm){
return JSLL_ZERO;

Просмотреть файл

@ -5215,7 +5215,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
((nsMenuFrame*) newFrame)->SetFrameConstructor(this);
}
else if (aTag == nsXULAtoms::menubar) {
#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar.
#if defined(XP_MAC) || defined(XP_MACOSX) // The Mac uses its native menu bar.
aHaltProcessing = PR_TRUE;
return NS_OK;
#else

Просмотреть файл

@ -5215,7 +5215,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
((nsMenuFrame*) newFrame)->SetFrameConstructor(this);
}
else if (aTag == nsXULAtoms::menubar) {
#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar.
#if defined(XP_MAC) || defined(XP_MACOSX) // The Mac uses its native menu bar.
aHaltProcessing = PR_TRUE;
return NS_OK;
#else

Просмотреть файл

@ -144,7 +144,7 @@ static void CheckForMatches(CInfoPBPtr cPB,
#undef pascal
#endif
#if TARGET_RT_MAC_CFM || defined(MACOSX)
#if TARGET_RT_MAC_CFM || defined(XP_MACOSX)
static pascal void TimeOutTask(TMTaskPtr tmTaskPtr);
@ -687,7 +687,7 @@ Failed:
#undef pascal
#endif
#if TARGET_RT_MAC_CFM || defined(MACOSX)
#if TARGET_RT_MAC_CFM || defined(XP_MACOSX)
static pascal void TimeOutTask(TMTaskPtr tmTaskPtr)
{

Просмотреть файл

@ -1066,7 +1066,7 @@ il_gif_write(il_container *ic, const PRUint8 *buf, int32 len)
gs->global_colormap = map;
#ifndef M12N /* Fix me. */
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
im->hasUniqueColormap = 1;
#endif
#endif /* M12N */
@ -1475,7 +1475,7 @@ il_gif_write(il_container *ic, const PRUint8 *buf, int32 len)
}
#ifndef M12N /* Fix me */
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
im->hasUniqueColormap = 1;
#endif
#endif /* M12N */

Просмотреть файл

@ -1035,7 +1035,7 @@ int gif_write(gif_struct *gs, const PRUint8 *buf, PRUint32 len)
gs->global_colormap = map;
#ifndef M12N /* Fix me. */
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
//im->hasUniqueColormap = 1; // What the hell is this?
#endif
#endif /* M12N */
@ -1440,7 +1440,7 @@ int gif_write(gif_struct *gs, const PRUint8 *buf, PRUint32 len)
}
#ifndef M12N /* Fix me */
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
//im->hasUniqueColormap = 1; // WTF?
#endif
#endif /* M12N */

Просмотреть файл

@ -427,7 +427,7 @@ int HaveDecodedRow(
case gfxIFormats::RGB:
{
while(rowBufIndex != decoder->mGIFStruct->rowend) {
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
*rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad
#endif
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red;
@ -477,7 +477,7 @@ int HaveDecodedRow(
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].green;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red;
#else
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
*rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad
#endif
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red;
@ -486,7 +486,7 @@ int HaveDecodedRow(
#endif
decoder->mAlphaLine[x>>3] |= 1<<(7-x&0x7);
} else {
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
rgbRowIndex+=4;
#else
rgbRowIndex+=3;

Просмотреть файл

@ -329,7 +329,7 @@ NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR
JPOOL_IMAGE,
row_stride, 1);
#if defined(XP_PC) || defined(XP_BEOS) || defined(XP_MAC) || defined(MOZ_WIDGET_PHOTON)
#if defined(XP_PC) || defined(XP_BEOS) || defined(XP_MAC) || defined(XP_MACOSX) || defined(MOZ_WIDGET_PHOTON)
// allocate buffer to do byte flipping if needed
if (mInfo.output_components == 3) {
mRGBPadRow = (PRUint8*) PR_MALLOC(row_stride);
@ -496,7 +496,7 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines)
/* Convert from grayscale to RGB. */
while (j1 < j1end) {
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
j = *j1++;
j3[0] = 0;
j3[1] = j;
@ -527,7 +527,7 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines)
}
samples = mRGBPadRow;
#elif defined(XP_MAC)
#elif defined(XP_MAC) || defined(XP_MACOSX)
memset(mRGBPadRow, 0, mInfo.output_width * 4);
PRUint8 *ptrOutputBuf = mRGBPadRow;

Просмотреть файл

@ -191,7 +191,7 @@ info_callback(png_structp png_ptr, png_infop info_ptr)
* using educated guesses for display-system exponents; do preferences
* later */
#if defined(XP_MAC)
#if defined(XP_MAC) || defined(XP_MACOSX)
LUT_exponent = 1.8 / 2.61;
#elif defined(XP_UNIX)
# if defined(__sgi)
@ -378,7 +378,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
switch (format) {
case gfxIFormats::RGB:
case gfxIFormats::BGR:
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
cptr = decoder->colorLine;
for (PRUint32 x=0; x<iwidth; x++) {
*cptr++ = 0;
@ -398,7 +398,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
aptr = decoder->alphaLine;
memset(aptr, 0, abpr);
for (PRUint32 x=0; x<iwidth; x++) {
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
*cptr++ = 0;
#endif
if (line[3]) {
@ -428,7 +428,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
cptr = decoder->colorLine;
aptr = decoder->alphaLine;
for (PRUint32 x=0; x<iwidth; x++) {
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
*cptr++ = 0;
#endif
*cptr++ = *line++;
@ -442,7 +442,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
break;
case gfxIFormats::RGBA:
case gfxIFormats::BGRA:
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
{
cptr = decoder->colorLine;
aptr = decoder->alphaLine;

Просмотреть файл

@ -30,6 +30,10 @@ include $(srcdir)/objs.mk
MODULE = libreg
LIBRARY_NAME = mozreg_s
# MacOSX requires the MoreFiles module
ifeq ($(OS_ARCH),Darwin)
REQUIRES = macmorefiles
endif
CSRCS = reg.c VerReg.c vr_stubs.c nr_bufio.c

Просмотреть файл

@ -60,7 +60,7 @@
#include "NSReg.h"
#include "VerReg.h"
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Folders.h>
#endif
@ -101,7 +101,7 @@ static char *app_dir = NULL;
char *verRegName = NULL;
#if defined(XP_UNIX)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
/* Extra Unix variables to deal with two registries
* "vreg" is always the writable registry.
* If "vreg" is the local registry then "unixreg" will
@ -142,7 +142,7 @@ static REGERR vr_GetUninstallItemPath(char *regPackageName, char *regbuf, uint32
static REGERR vr_convertPackageName(char *regPackageName, char *convertedPackageName, uint32 convertedDataLength);
static REGERR vr_unmanglePackageName(char *mangledPackageName, char *regPackageName, uint32 regPackageLength);
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
static void vr_MacAliasFromPath(const char * fileName, void ** alias, int32 * length);
static char * vr_PathFromMacAlias(const void * alias, uint32 aliasLength);
#endif
@ -154,11 +154,11 @@ static REGERR vr_Init(void)
REGERR err = REGERR_OK;
char *regname = vr_findVerRegName();
#if defined(XP_UNIX) || defined(STANDALONE_REGISTRY)
#if defined(XP_UNIX) && !defined(XP_MACOSX) || defined(STANDALONE_REGISTRY)
char curstr[MAXREGNAMELEN];
RKEY navKey;
#endif
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
char *regbuf = NULL;
#endif
@ -170,7 +170,7 @@ static REGERR vr_Init(void)
if (!isInited)
{
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
/* need browser directory to find the correct registry */
if (app_dir != NULL) {
regbuf = (char*)XP_ALLOC( 10 + XP_STRLEN(app_dir) );
@ -204,7 +204,7 @@ static REGERR vr_Init(void)
}
}
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
/* try to open shared Unix registry, but not an error if you can't */
unixreg = NULL;
if (!bGlobalRegistry && err == REGERR_OK ) {
@ -262,7 +262,7 @@ static REGERR vr_Init(void)
done:
PR_Unlock(vr_lock);
#if defined(XP_UNIX) && !defined(STANDALONE_REGISTRY)
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(STANDALONE_REGISTRY)
XP_FREEIF(regbuf);
#endif
return err;
@ -274,7 +274,7 @@ done:
#ifdef XP_PC
#define VR_FILE_SEP '\\'
#endif
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
#define VR_FILE_SEP ':'
#endif
#ifdef XP_BEOS
@ -302,7 +302,7 @@ static XP_Bool vr_CompareDirs( char *dir1, char *dir2 )
if ( len1 != len2 )
return FALSE;
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
return ( XP_STRNCMP(dir1, dir2, len1) == 0 );
#else
return ( XP_STRNCASECMP(dir1, dir2, len1) == 0 );
@ -436,7 +436,7 @@ static REGERR vr_GetPathname(HREG reg, RKEY key, char *entry, char *buf, uint32
info.size = sizeof(REGINFO);
#ifndef XP_MAC
#if !defined(XP_MAC) && !defined(XP_MACOSX)
err = NR_RegGetEntry( reg, key, entry, (void*)buf, &sizebuf );
return err;
#else
@ -640,7 +640,7 @@ static REGERR vr_FindKey(char *component_path, HREG *hreg, RKEY *key)
REGERR err;
RKEY rootkey;
#if !defined(STANDALONE_REGISTRY) && defined(XP_UNIX)
#if !defined(STANDALONE_REGISTRY) && defined(XP_UNIX) && !defined(XP_MACOSX)
if (unixreg != NULL) {
*hreg = unixreg;
rootkey = UNIX_ROOT(component_path);
@ -696,14 +696,14 @@ VR_INTERFACE(REGERR) VR_CreateRegistry( char *installation, char *programPath, c
{
REGERR err;
char * regname = vr_findVerRegName();
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
char * regbuf = NULL;
#endif
if ( installation == NULL || *installation == '\0' )
return REGERR_PARAM;
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
#ifndef STANDALONE_REGISTRY
if (bGlobalRegistry)
#endif
@ -737,7 +737,7 @@ VR_INTERFACE(REGERR) VR_CreateRegistry( char *installation, char *programPath, c
PR_Unlock(vr_lock);
#if defined(XP_UNIX)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
XP_FREEIF( regbuf );
#endif
return err;
@ -757,7 +757,7 @@ VR_INTERFACE(REGERR) VR_Close(void)
PR_Lock(vr_lock);
if (isInited) {
#if !defined(STANDALONE_REGISTRY) && defined(XP_UNIX)
#if !defined(STANDALONE_REGISTRY) && defined(XP_UNIX) && !defined(XP_MACOSX)
if ( unixreg != NULL )
NR_RegClose( unixreg );
#endif

Просмотреть файл

@ -36,7 +36,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#if defined(XP_MAC)
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Errors.h>
#endif
@ -144,7 +144,7 @@ BufioFile* bufio_Open(const char* name, const char* mode)
switch (errno)
{
/* file not found */
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
case fnfErr:
#else
case ENOENT:
@ -153,7 +153,7 @@ BufioFile* bufio_Open(const char* name, const char* mode)
break;
/* file in use */
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
case opWrErr:
#else
case EACCES:

Просмотреть файл

@ -54,7 +54,7 @@
#include <assert.h>
#include <errno.h>
#if defined(XP_MAC)
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Errors.h>
#endif
@ -74,7 +74,9 @@
#include "reg.h"
#include "NSReg.h"
#if defined(XP_UNIX)
#if defined(XP_MAC) || defined(XP_MACOSX)
#define MAX_PATH 512
#elif defined(XP_UNIX)
#ifndef MAX_PATH
#define MAX_PATH 1024
#endif
@ -84,8 +86,6 @@
#endif
#elif defined(WIN32)
#define MAX_PATH _MAX_PATH
#elif defined(XP_MAC)
#define MAX_PATH 512
#elif defined(XP_BEOS)
#include <limits.h>
#define MAX_PATH PATH_MAX
@ -141,7 +141,7 @@ static char *user_name = NULL;
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
void nr_MacAliasFromPath(const char * fileName, void ** alias, int32 * length);
char * nr_PathFromMacAlias(const void * alias, uint32 aliasLength);
@ -305,7 +305,7 @@ static REGFILE* vr_findRegFile(char *filename)
pReg = RegList;
while( pReg != NULL ) {
#if defined XP_UNIX || defined XP_BEOS
#if defined(XP_UNIX) && !defined(XP_MACOSX) || defined XP_BEOS
if ( 0 == XP_STRCMP( filename, pReg->filename ) ) {
#else
if ( 0 == XP_STRCASECMP( filename, pReg->filename ) ) {
@ -345,14 +345,14 @@ static REGERR nr_OpenFile(char *path, FILEHANDLE *fh)
{
switch (errno)
{
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
case fnfErr:
#else
case ENOENT: /* file not found */
#endif
return REGERR_NOFILE;
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
case opWrErr:
#else
#ifndef XP_OS2_VACPP
@ -454,7 +454,7 @@ static REGERR nr_ReadFile(FILEHANDLE fh, REGOFF offset, int32 len, void *buffer)
readlen = XP_FileRead(buffer, len, fh );
/* PR_READ() returns an unreliable length, check EOF separately */
if (readlen < 0) {
#if !defined(STANDALONE_REGISTRY) || !defined(XP_MAC)
#if !defined(STANDALONE_REGISTRY) || !defined(XP_MAC) || !defined(XP_MACOSX)
#if defined(STANDALONE_REGISTRY)
if (errno == EBADF) /* bad file handle, not open for read, etc. */
#else
@ -3037,7 +3037,7 @@ VR_INTERFACE(REGERR) NR_RegGetEntry( HREG hReg, RKEY key, char *name,
case REGTYPE_ENTRY_FILE:
err = nr_ReadData( reg, &desc, *size, (char*)buffer );
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
if (err == 0)
{
tmpbuf = nr_PathFromMacAlias(buffer, *size);
@ -3199,7 +3199,7 @@ VR_INTERFACE(REGERR) NR_RegSetEntry( HREG hReg, RKEY key, char *name, uint16 typ
case REGTYPE_ENTRY_FILE:
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
nr_MacAliasFromPath(buffer, &data, &datalen);
if (data)
needFree = TRUE;
@ -3955,7 +3955,7 @@ extern PRLock *vr_lock;
#if defined(XP_UNIX) && !defined(STANDALONE_REGISTRY)
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(STANDALONE_REGISTRY)
extern XP_Bool bGlobalRegistry;
#endif
@ -3993,7 +3993,7 @@ VR_INTERFACE(REGERR) NR_StartupRegistry(void)
/* initialization for version registry */
vr_lock = PR_NewLock();
XP_ASSERT( vr_lock != NULL );
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
bGlobalRegistry = ( getenv(UNIX_GLOBAL_FLAG) != NULL );
#endif
#endif

Просмотреть файл

@ -53,7 +53,7 @@
#include "vr_stubs.h"
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Folders.h>
#include <Script.h>
#include <stdlib.h>
@ -217,7 +217,7 @@ int FAR PASCAL _export WEP(int nParam)
* ------------------------------------------------------------------
*/
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Files.h>
#include "FullPath.h"
@ -443,6 +443,7 @@ char *strdup(const char *source)
return newAllocation;
}
#ifndef XP_MACOSX
int strcasecmp(const char *str1, const char *str2)
{
char currentChar1, currentChar2;
@ -501,6 +502,7 @@ int strncasecmp(const char *str1, const char *str2, int length)
return currentChar1 - currentChar2;
}
#endif /* XP_MACOSX */
#endif /* STANDALONE_REGISTRY */
#endif /* XP_MAC */
@ -531,14 +533,14 @@ char *TheRegistry = "registry";
char *Flist;
/* WARNING: build hackery */
#if defined(STANDALONE_REGISTRY) && !defined(XP_MAC)
#if defined(STANDALONE_REGISTRY) && !defined(XP_MAC) && !defined(XP_MACOSX)
long BUILDNUM = NS_BUILD_ID;
#endif
REGERR vr_ParseVersion(char *verstr, VERSION *result);
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
#ifdef STANDALONE_REGISTRY
extern XP_File vr_fileOpen (const char *name, const char * mode)

Просмотреть файл

@ -272,7 +272,7 @@ typedef int XP_Bool;
typedef struct stat XP_StatStruct;
#define XP_Stat(file,data) stat((file),(data))
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
extern int nr_RenameFile(char *from, char *to);
#else
XP_BEGIN_PROTOS

Просмотреть файл

@ -31,6 +31,11 @@ include $(srcdir)/../src/objs.mk
MODULE = libreg
LIBRARY_NAME = mozregsa_s
# MacOSX requires the MoreFiles module
ifeq ($(OS_ARCH),Darwin)
REQUIRES = macmorefiles
endif
CSRCS = $(MODULES_LIBREG_SRC_LCSRCS)
FORCE_STATIC_LIB = 1

Просмотреть файл

@ -446,7 +446,7 @@ NS_IMETHODIMP nsRegistry::Open( const char *regFile ) {
static void
EnsureDefaultRegistryDirectory() {
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
// Create ~/.mozilla as that is the default place for the registry file
/* The default registry on the unix system is $HOME/.mozilla/registry per

Просмотреть файл

@ -65,7 +65,7 @@
# include "prtypes.h"
#endif
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
# include <Quickdraw.h>
# include <Events.h>
# include <MacWindows.h>
@ -211,7 +211,7 @@ enum nsPluginWindowType {
nsPluginWindowType_Drawable
};
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
struct nsPluginPort {
CGrafPtr port; /* Grafport */
@ -281,7 +281,7 @@ struct nsPluginPrint {
struct nsPluginEvent {
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
EventRecord* event;
nsPluginPlatformWindowRef window;
@ -306,13 +306,13 @@ struct nsPluginEvent {
* Non-standard event types that can be passed to HandleEvent
*/
enum nsPluginEventType {
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
nsPluginEventType_GetFocusEvent = (osEvt + 16),
nsPluginEventType_LoseFocusEvent,
nsPluginEventType_AdjustCursorEvent,
nsPluginEventType_MenuCommandEvent,
nsPluginEventType_ClippingChangedEvent,
#endif /* XP_MAC */
#endif /* XP_MAC || XP_MACOSX */
nsPluginEventType_Idle = 0
};

Просмотреть файл

@ -64,7 +64,7 @@
#include "prtypes.h"
#endif
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
# include <Quickdraw.h>
# include <Events.h>
# include <MacWindows.h>
@ -245,7 +245,7 @@ enum nsPluginWindowType {
nsPluginWindowType_Drawable
};
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
struct nsPluginPort {
CGrafPtr port; /* Grafport */
@ -315,7 +315,7 @@ struct nsPluginPrint {
struct nsPluginEvent {
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
EventRecord* event;
nsPluginPlatformWindowRef window;
@ -340,13 +340,13 @@ struct nsPluginEvent {
* Non-standard event types that can be passed to HandleEvent
*/
enum nsPluginEventType {
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
nsPluginEventType_GetFocusEvent = (osEvt + 16),
nsPluginEventType_LoseFocusEvent,
nsPluginEventType_AdjustCursorEvent,
nsPluginEventType_MenuCommandEvent,
nsPluginEventType_ClippingChangedEvent,
#endif /* XP_MAC */
#endif /* XP_MAC || XP_MACOSX */
nsPluginEventType_Idle = 0
};

Просмотреть файл

@ -2472,7 +2472,7 @@ NS_IMETHODIMP nsPluginHostImpl::GetValue(nsPluginManagerVariable aVariable, void
NS_ENSURE_ARG_POINTER(aValue);
#if defined(XP_UNIX) && !defined(MACOSX) && !defined(NO_X11)
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(NO_X11)
if (nsPluginManagerVariable_XDisplay == aVariable) {
Display** value = NS_REINTERPRET_CAST(Display**, aValue);
#if defined(MOZ_WIDGET_GTK)

Просмотреть файл

@ -943,14 +943,12 @@ nsHttpHandler::InitUserAgentComponents()
"OS/2"
#elif defined(XP_PC)
"Windows"
#elif defined(RHAPSODY)
#elif defined(XP_MAC) || defined(XP_MACOSX)
"Macintosh"
#elif defined (XP_UNIX)
"X11"
#elif defined(XP_BEOS)
"BeOS"
#elif defined(XP_MAC)
"Macintosh"
#endif
));

Просмотреть файл

@ -32,7 +32,7 @@ EXPORT_LIBRARY = 1
SHORT_LIBNAME = gkweb
EXTRA_DSO_LIBS = jsdom docshell
ifeq ($(OS_ARCH),Rhapsody)
ifeq ($(OS_ARCH),Darwin)
IS_COMPONENT = 1
endif

Просмотреть файл

@ -160,8 +160,8 @@ install::
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),Rhapsody)
INCLUDES += -I$(topsrcdir)/widget/src/mac
ifeq ($(OS_ARCH),Darwin)
LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/mac
endif
CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS)

Просмотреть файл

@ -43,40 +43,44 @@
#include "nsIServiceManager.h"
#include "resources.h"
#include <ToolUtils.h> // MacOS includes
#include <ToolUtils.h> // MacOS includes
#include <Menus.h>
#include <Windows.h>
#include <Devices.h>
#include <Resources.h>
#include <Dialogs.h>
#include "nsMacMessagePump.h" // for the windowless menu event handler
#include "nsMacMessagePump.h" // for the windowless menu event handler
#ifdef GC_LEAK_DETECTOR
#include "nsILeakDetector.h"
#endif
#ifndef XP_MACOSX
#include "macstdlibextras.h"
#endif
typedef SInt32 MessageT;
typedef SInt32 MessageT;
typedef PRUint32 Uint32;
const MessageT cmd_Undo = 11; // nil
const MessageT cmd_Cut = 12; // nil
const MessageT cmd_Copy = 13; // nil
const MessageT cmd_Paste = 14; // nil
const MessageT cmd_Clear = 15; // nil
const MessageT cmd_SelectAll = 16; // nil
const MessageT cmd_Undo = 11; // nil
const MessageT cmd_Cut = 12; // nil
const MessageT cmd_Copy = 13; // nil
const MessageT cmd_Paste = 14; // nil
const MessageT cmd_Clear = 15; // nil
const MessageT cmd_SelectAll = 16; // nil
const MessageT cmd_About = 1; // nil
const MessageT cmd_About = 1; // nil
// File Menu
const MessageT cmd_New = 2; // nil
const MessageT cmd_Open = 3; // nil
const MessageT cmd_Close = 4; // nil
const MessageT cmd_Save = 5; // nil
const MessageT cmd_SaveAs = 6; // nil
const MessageT cmd_Revert = 7; // nil
const MessageT cmd_PageSetup = 8; // nil
const MessageT cmd_Print = 9; // nil
const MessageT cmd_PrintOne = 17; // nil
const MessageT cmd_Quit = 10; // nil
const MessageT cmd_Preferences = 27; // nil
// File Menu
const MessageT cmd_New = 2; // nil
const MessageT cmd_Open = 3; // nil
const MessageT cmd_Close = 4; // nil
const MessageT cmd_Save = 5; // nil
const MessageT cmd_SaveAs = 6; // nil
const MessageT cmd_Revert = 7; // nil
const MessageT cmd_PageSetup = 8; // nil
const MessageT cmd_Print = 9; // nil
const MessageT cmd_PrintOne = 17; // nil
const MessageT cmd_Quit = 10; // nil
const MessageT cmd_Preferences = 27; // nil
enum
@ -86,66 +90,66 @@ enum
enum
{
menu_First = 128,
menu_Apple = menu_First,
menu_File,
menu_Edit,
menu_Sample,
menu_Debug,
menu_Tools,
menu_URLS,
menu_Last = menu_URLS,
menu_First = 128,
menu_Apple = menu_First,
menu_File,
menu_Edit,
menu_Sample,
menu_Debug,
menu_Tools,
menu_URLS,
menu_Last = menu_URLS,
submenu_Print = 16,
submenu_CompatibilityMode = 32,
submenu_Print = 16,
submenu_CompatibilityMode = 32,
cmd_Sample0 = 1000,
cmd_FirstXPToolkitSample = 1100,
cmd_PrintOneColumn = 2000,
cmd_Find = 3000,
cmd_Sample0 = 1000,
cmd_FirstXPToolkitSample = 1100,
cmd_PrintOneColumn = 2000,
cmd_Find = 3000,
cmd_ViewSource = 2200,
cmd_PrintSetup,
cmd_ViewSource = 2200,
cmd_PrintSetup,
cmd_DebugMode = 4000,
cmd_ReflowTest,
cmd_DumpContents,
cmd_DumpFrames,
cmd_DumpViews,
cmd_DumpStyleSheets,
cmd_DumpStyleContexts,
cmd_ShowContentSize,
cmd_ShowFrameSize,
cmd_ShowStyleSize,
cmd_DebugSave,
cmd_DebugOutputText,
cmd_DebugOutputHTML,
cmd_DebugToggleSelection,
cmd_DebugRobot,
cmd_ShowContentQuality,
cmd_GFXWidgetMode,
cmd_NativeWidgetMode,
cmd_GFXScrollBars,
cmd_NativeScrollBars,
cmd_DumpLeaks,
cmd_DebugMode = 4000,
cmd_ReflowTest,
cmd_DumpContents,
cmd_DumpFrames,
cmd_DumpViews,
cmd_DumpStyleSheets,
cmd_DumpStyleContexts,
cmd_ShowContentSize,
cmd_ShowFrameSize,
cmd_ShowStyleSize,
cmd_DebugSave,
cmd_DebugOutputText,
cmd_DebugOutputHTML,
cmd_DebugToggleSelection,
cmd_DebugRobot,
cmd_ShowContentQuality,
cmd_GFXWidgetMode,
cmd_NativeWidgetMode,
cmd_GFXScrollBars,
cmd_NativeScrollBars,
cmd_DumpLeaks,
item_GFXWidgetMode = 24,
item_NativeWidgetMode,
item_GFXWidgetMode = 24,
item_NativeWidgetMode,
cmd_Compatibility_UseDTD = 4200,
cmd_Compatibility_NavQuirks,
cmd_Compatibility_Standard,
cmd_Compatibility_UseDTD = 4200,
cmd_Compatibility_NavQuirks,
cmd_Compatibility_Standard,
cmd_JSConsole = 5000,
cmd_EditorMode,
cmd_Top100,
cmd_TableInspector,
cmd_ImageInspector,
cmd_JSConsole = 5000,
cmd_EditorMode,
cmd_Top100,
cmd_TableInspector,
cmd_ImageInspector,
cmd_SaveURL1 = 6000,
cmd_SaveURL2,
cmd_LoadURL1,
cmd_LoadURL2
cmd_SaveURL1 = 6000,
cmd_SaveURL2,
cmd_LoadURL1,
cmd_LoadURL2
};
@ -156,7 +160,7 @@ static nsNativeViewerApp* gTheApp;
nsNativeViewerApp::nsNativeViewerApp()
{
//nsMacMessagePump::SetWindowlessMenuEventHandler(DispatchMenuItemWithoutWindow);
//nsMacMessagePump::SetWindowlessMenuEventHandler(DispatchMenuItemWithoutWindow);
}
nsNativeViewerApp::~nsNativeViewerApp()
@ -173,44 +177,44 @@ nsNativeViewerApp::Run()
void nsNativeViewerApp::DispatchMenuItemWithoutWindow(PRInt32 menuResult)
{
long menuID = HiWord(menuResult);
long menuItem = LoWord(menuResult);
switch (menuID)
{
case menu_Apple:
switch (menuItem)
{
case cmd_About:
::Alert(128, nil);
break;
default:
Str255 daName;
GetMenuItemText(GetMenuHandle(menu_Apple), menuItem, daName);
#if !TARGET_CARBON
OpenDeskAcc(daName);
#endif
break;
}
break;
long menuID = HiWord(menuResult);
long menuItem = LoWord(menuResult);
switch (menuID)
{
case menu_Apple:
switch (menuItem)
{
case cmd_About:
::Alert(128, nil);
break;
default:
Str255 daName;
GetMenuItemText(GetMenuHandle(menu_Apple), menuItem, daName);
#if !TARGET_CARBON
OpenDeskAcc(daName);
#endif
break;
}
break;
case menu_File:
case menu_File:
switch (menuItem)
{
case cmd_New:
gTheApp->OpenWindow();
break;
case cmd_Open:
nsBrowserWindow * newWindow;
gTheApp->OpenWindow((PRUint32)0, newWindow);
newWindow->DoFileOpen();
break;
case cmd_Quit:
gTheApp->Exit();
break;
}
break;
}
switch (menuItem)
{
case cmd_New:
gTheApp->OpenWindow();
break;
case cmd_Open:
nsBrowserWindow * newWindow;
gTheApp->OpenWindow((PRUint32)0, newWindow);
newWindow->DoFileOpen();
break;
case cmd_Quit:
gTheApp->Exit();
break;
}
break;
}
}
#pragma mark -
@ -228,40 +232,42 @@ nsNativeBrowserWindow::~nsNativeBrowserWindow()
nsresult
nsNativeBrowserWindow::InitNativeWindow()
{
// this is where we get a chance to set up the window refCon
NS_PRECONDITION(nsnull != mWindow, "Null window in InitNativeWindow");
// this is where we get a chance to set up the window refCon
NS_PRECONDITION(nsnull != mWindow, "Null window in InitNativeWindow");
WindowPtr wind = (WindowPtr)mWindow->GetNativeData(NS_NATIVE_DISPLAY);
if (!wind) return NS_ERROR_NULL_POINTER;
WindowPtr wind = (WindowPtr)mWindow->GetNativeData(NS_NATIVE_DISPLAY);
if (!wind) return NS_ERROR_NULL_POINTER;
::SetWRefCon(wind, (long)this);
return NS_OK;
::SetWRefCon(wind, (long)this);
return NS_OK;
}
static void CloseFrontWindow()
{
WindowPtr wind = ::FrontWindow();
if (!wind) return;
WindowPtr wind = ::FrontWindow();
if (!wind) return;
nsBrowserWindow *browserWindow = (nsBrowserWindow *)GetWRefCon(wind);
if (!browserWindow) return;
nsBrowserWindow *browserWindow = (nsBrowserWindow *)GetWRefCon(wind);
if (!browserWindow) return;
browserWindow->Destroy();
browserWindow->Destroy();
}
nsresult
nsNativeBrowserWindow::CreateMenuBar(PRInt32 aWidth)
{
for (int i = menu_First; i <= menu_Last; i++)
{
InsertMenu(GetMenu(i), 0);
}
InsertMenu(GetMenu(submenu_Print), -1);
InsertMenu(GetMenu(submenu_CompatibilityMode), -1);
AppendResMenu(GetMenuHandle(menu_Apple), 'DRVR');
DrawMenuBar();
return NS_OK;
for (int i = menu_First; i <= menu_Last; i++)
{
MenuHandle menu = GetMenu(i);
NS_ASSERTION(menu, "menu failed to load");
if (menu) InsertMenu(menu, 0);
}
InsertMenu(GetMenu(submenu_Print), -1);
InsertMenu(GetMenu(submenu_CompatibilityMode), -1);
AppendResMenu(GetMenuHandle(menu_Apple), 'DRVR');
DrawMenuBar();
return NS_OK;
}
nsresult
@ -277,193 +283,212 @@ nsNativeBrowserWindow::GetMenuBarHeight(PRInt32 * aHeightOut)
nsEventStatus
nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
{
nsEventStatus status = nsEventStatus_eIgnore;
PRInt32 xpID = 0;
long menuID = HiWord(aID);
long menuItem = LoWord(aID);
nsEventStatus status = nsEventStatus_eIgnore;
PRInt32 xpID = 0;
long menuID = HiWord(aID);
long menuItem = LoWord(aID);
switch (menuID)
{
case menu_Apple:
switch (menuItem)
{
case cmd_About:
::Alert(128, nil);
break;
default:
Str255 daName;
GetMenuItemText(GetMenuHandle(menu_Apple), menuItem, daName);
#if !TARGET_CARBON
OpenDeskAcc(daName);
#endif
break;
}
break;
switch (menuID)
{
case menu_Apple:
switch (menuItem)
{
case cmd_About:
::Alert(128, nil);
break;
default:
Str255 daName;
GetMenuItemText(GetMenuHandle(menu_Apple), menuItem, daName);
#if !TARGET_CARBON
OpenDeskAcc(daName);
#endif
break;
}
break;
case menu_File:
switch (menuItem)
{
case cmd_New: xpID = VIEWER_WINDOW_OPEN; break;
case cmd_Open: xpID = VIEWER_FILE_OPEN; break;
case cmd_Close:
CloseFrontWindow();
status = nsEventStatus_eConsumeNoDefault;
break;
case menu_File:
switch (menuItem)
{
case cmd_New: xpID = VIEWER_WINDOW_OPEN; break;
case cmd_Open: xpID = VIEWER_FILE_OPEN; break;
case cmd_Close:
CloseFrontWindow();
status = nsEventStatus_eConsumeNoDefault;
break;
case cmd_ViewSource: xpID = VIEW_SOURCE; break;
case cmd_Save: /*n.a.*/ break;
case cmd_SaveAs: /*n.a.*/ break;
case cmd_Revert: /*n.a.*/ break;
case cmd_PageSetup: /*n.a.*/ break;
case cmd_Print: xpID = VIEWER_PRINT; break;
case cmd_PrintSetup: xpID = VIEWER_PRINT_SETUP; break;
case cmd_Quit: xpID = VIEWER_EXIT; break;
}
break;
case cmd_ViewSource: xpID = VIEW_SOURCE; break;
case cmd_Save: /*n.a.*/ break;
case cmd_SaveAs: /*n.a.*/ break;
case cmd_Revert: /*n.a.*/ break;
case cmd_PageSetup: /*n.a.*/ break;
case cmd_Print: xpID = VIEWER_PRINT; break;
case cmd_PrintSetup: xpID = VIEWER_PRINT_SETUP; break;
case cmd_Quit: xpID = VIEWER_EXIT; break;
}
break;
case menu_Edit:
switch (menuItem)
{
case cmd_Undo: /*n.a.*/ break;
case cmd_Cut: xpID = VIEWER_EDIT_CUT; break;
case cmd_Copy: xpID = VIEWER_EDIT_COPY; break;
case cmd_Paste: xpID = VIEWER_EDIT_PASTE; break;
case cmd_Clear: /*n.a.*/ break;
case cmd_SelectAll: xpID = VIEWER_EDIT_SELECTALL; break;
case cmd_Find: xpID = VIEWER_EDIT_FINDINPAGE; break;
case cmd_Preferences: xpID = VIEWER_PREFS; break;
}
break;
case menu_Edit:
switch (menuItem)
{
case cmd_Undo: /*n.a.*/ break;
case cmd_Cut: xpID = VIEWER_EDIT_CUT; break;
case cmd_Copy: xpID = VIEWER_EDIT_COPY; break;
case cmd_Paste: xpID = VIEWER_EDIT_PASTE; break;
case cmd_Clear: /*n.a.*/ break;
case cmd_SelectAll: xpID = VIEWER_EDIT_SELECTALL; break;
case cmd_Find: xpID = VIEWER_EDIT_FINDINPAGE; break;
case cmd_Preferences: xpID = VIEWER_PREFS; break;
}
break;
case menu_Sample:
if ( menuItem < cmd_FirstXPToolkitSample )
xpID = VIEWER_DEMO0 + menuItem - cmd_Sample0;
else
xpID = VIEWER_XPTOOLKITDEMOBASE + (menuItem - cmd_FirstXPToolkitSample);
break;
case menu_Sample:
if ( menuItem < cmd_FirstXPToolkitSample )
xpID = VIEWER_DEMO0 + menuItem - cmd_Sample0;
else
xpID = VIEWER_XPTOOLKITDEMOBASE + (menuItem - cmd_FirstXPToolkitSample);
break;
case menu_Debug:
switch (menuItem)
{
case cmd_DebugMode: xpID = VIEWER_VISUAL_DEBUGGING; break;
case cmd_ReflowTest: xpID = VIEWER_REFLOW_TEST; break;
case menu_Debug:
switch (menuItem)
{
case cmd_DebugMode: xpID = VIEWER_VISUAL_DEBUGGING; break;
case cmd_ReflowTest: xpID = VIEWER_REFLOW_TEST; break;
case cmd_DumpContents: xpID = VIEWER_DUMP_CONTENT; break;
case cmd_DumpFrames: xpID = VIEWER_DUMP_FRAMES; break;
case cmd_DumpViews: xpID = VIEWER_DUMP_VIEWS; break;
case cmd_DumpContents: xpID = VIEWER_DUMP_CONTENT; break;
case cmd_DumpFrames: xpID = VIEWER_DUMP_FRAMES; break;
case cmd_DumpViews: xpID = VIEWER_DUMP_VIEWS; break;
case cmd_DumpStyleSheets: xpID = VIEWER_DUMP_STYLE_SHEETS; break;
case cmd_DumpStyleContexts: xpID = VIEWER_DUMP_STYLE_CONTEXTS; break;
case cmd_DumpStyleSheets: xpID = VIEWER_DUMP_STYLE_SHEETS; break;
case cmd_DumpStyleContexts: xpID = VIEWER_DUMP_STYLE_CONTEXTS; break;
case cmd_ShowContentSize: xpID = VIEWER_SHOW_CONTENT_SIZE; break;
case cmd_ShowFrameSize: xpID = VIEWER_SHOW_FRAME_SIZE; break;
case cmd_ShowStyleSize: xpID = VIEWER_SHOW_STYLE_SIZE; break;
case cmd_ShowContentSize: xpID = VIEWER_SHOW_CONTENT_SIZE; break;
case cmd_ShowFrameSize: xpID = VIEWER_SHOW_FRAME_SIZE; break;
case cmd_ShowStyleSize: xpID = VIEWER_SHOW_STYLE_SIZE; break;
case cmd_DebugSave: xpID = VIEWER_DEBUGSAVE; break;
case cmd_DebugOutputText: xpID = VIEWER_DISPLAYTEXT; break;
case cmd_DebugOutputHTML: xpID = VIEWER_DISPLAYHTML; break;
case cmd_DebugToggleSelection: xpID = VIEWER_TOGGLE_SELECTION; break;
case cmd_DebugRobot: xpID = VIEWER_DEBUGROBOT; break;
case cmd_ShowContentQuality: xpID =VIEWER_SHOW_CONTENT_QUALITY; break;
case cmd_DumpLeaks:
{
nsresult rv;
nsCOMPtr<nsILeakDetector> leakDetector =
do_GetService("@mozilla.org/xpcom/leakdetector;1", &rv);
if (NS_SUCCEEDED(rv))
leakDetector->DumpLeaks();
}
break;
case cmd_GFXScrollBars: xpID =VIEWER_GFX_SCROLLBARS_ON; break;
case cmd_NativeScrollBars: xpID =VIEWER_GFX_SCROLLBARS_OFF; break;
}
break;
case cmd_DebugSave: xpID = VIEWER_DEBUGSAVE; break;
case cmd_DebugOutputText: xpID = VIEWER_DISPLAYTEXT; break;
case cmd_DebugOutputHTML: xpID = VIEWER_DISPLAYHTML; break;
case cmd_DebugToggleSelection: xpID = VIEWER_TOGGLE_SELECTION; break;
case cmd_DebugRobot: xpID = VIEWER_DEBUGROBOT; break;
case cmd_ShowContentQuality: xpID =VIEWER_SHOW_CONTENT_QUALITY; break;
#ifdef GC_LEAK_DETECTOR
case cmd_DumpLeaks:
{
nsresult rv;
nsCOMPtr<nsILeakDetector> leakDetector =
do_GetService("@mozilla.org/xpcom/leakdetector;1", &rv);
if (NS_SUCCEEDED(rv))
leakDetector->DumpLeaks();
}
break;
#endif
case cmd_GFXScrollBars: xpID =VIEWER_GFX_SCROLLBARS_ON; break;
case cmd_NativeScrollBars: xpID =VIEWER_GFX_SCROLLBARS_OFF; break;
}
break;
case menu_Tools:
switch (menuItem)
{
case cmd_JSConsole: xpID = JS_CONSOLE; break;
case cmd_EditorMode: xpID = EDITOR_MODE; break;
case cmd_Top100: xpID = VIEWER_TOP100; break;
case cmd_TableInspector: xpID = VIEWER_TABLE_INSPECTOR; break;
case cmd_ImageInspector: xpID = VIEWER_IMAGE_INSPECTOR; break;
}
break;
case menu_Tools:
switch (menuItem)
{
case cmd_JSConsole: xpID = JS_CONSOLE; break;
case cmd_EditorMode: xpID = EDITOR_MODE; break;
case cmd_Top100: xpID = VIEWER_TOP100; break;
case cmd_TableInspector: xpID = VIEWER_TABLE_INSPECTOR; break;
case cmd_ImageInspector: xpID = VIEWER_IMAGE_INSPECTOR; break;
}
break;
case menu_URLS:
switch (menuItem)
{
case cmd_SaveURL1: xpID = VIEWER_SAVE_TEST_URL1; break;
case cmd_SaveURL2: xpID = VIEWER_SAVE_TEST_URL2; break;
case cmd_LoadURL1: xpID = VIEWER_GOTO_TEST_URL1; break;
case cmd_LoadURL2: xpID = VIEWER_GOTO_TEST_URL2; break;
}
switch (menuItem)
{
case cmd_SaveURL1: xpID = VIEWER_SAVE_TEST_URL1; break;
case cmd_SaveURL2: xpID = VIEWER_SAVE_TEST_URL2; break;
case cmd_LoadURL1: xpID = VIEWER_GOTO_TEST_URL1; break;
case cmd_LoadURL2: xpID = VIEWER_GOTO_TEST_URL2; break;
}
break;
case submenu_Print:
xpID = VIEWER_ONE_COLUMN + menuItem - cmd_PrintOneColumn;
break;
case submenu_Print:
xpID = VIEWER_ONE_COLUMN + menuItem - cmd_PrintOneColumn;
break;
case submenu_CompatibilityMode:
switch (menuItem)
{
case cmd_Compatibility_UseDTD: xpID = VIEWER_USE_DTD_MODE; break;
case cmd_Compatibility_NavQuirks: xpID = VIEWER_NAV_QUIRKS_MODE; break;
case cmd_Compatibility_Standard: xpID = VIEWER_STANDARD_MODE; break;
}
break;
}
case submenu_CompatibilityMode:
switch (menuItem)
{
case cmd_Compatibility_UseDTD: xpID = VIEWER_USE_DTD_MODE; break;
case cmd_Compatibility_NavQuirks: xpID = VIEWER_NAV_QUIRKS_MODE; break;
case cmd_Compatibility_Standard: xpID = VIEWER_STANDARD_MODE; break;
}
break;
}
// Dispatch xp menu items
if (xpID != 0) {
// beard: nsBrowserWindow::DispatchMenuItem almost always returns nsEventStatus_eIgnore.
// this causes double menu item dispatching for most items except for VIEWER_EXIT!
nsBrowserWindow::DispatchMenuItem(xpID);
status = nsEventStatus_eConsumeNoDefault;
}
return status;
// Dispatch xp menu items
if (xpID != 0) {
// beard: nsBrowserWindow::DispatchMenuItem almost always returns nsEventStatus_eIgnore.
// this causes double menu item dispatching for most items except for VIEWER_EXIT!
nsBrowserWindow::DispatchMenuItem(xpID);
status = nsEventStatus_eConsumeNoDefault;
}
return status;
}
/**
* Quit AppleEvent handler.
*/
static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, UInt32)
static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, long)
{
if (gTheApp != nsnull) {
gTheApp->Exit();
} else {
ExitToShell();
}
return noErr;
if (gTheApp != nsnull) {
gTheApp->Exit();
} else {
ExitToShell();
}
return noErr;
}
#pragma mark -
//----------------------------------------------------------------------
int main(int argc, char **argv)
{
// Set up the toolbox and (if DEBUG) the console
InitializeMacToolbox();
#if !TARGET_CARBON
// Set up the toolbox and (if DEBUG) the console
InitializeMacToolbox();
#endif
// Install an a Quit AppleEvent handler.
OSErr err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
NewAEEventHandlerProc(handleQuitApplication), 0, false);
NS_ASSERTION((err==noErr), "AEInstallEventHandler failed");
// Install an a Quit AppleEvent handler.
OSErr err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
NewAEEventHandlerUPP(handleQuitApplication), 0, false);
NS_ASSERTION((err==noErr), "AEInstallEventHandler failed");
// Start up XPCOM?
nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
#ifdef XP_MACOSX
// use the location of the executable to learn where everything is, this
// is because the current working directory is ill-defined when the
// application is double-clicked from the Finder.
{
char* path = strdup(argv[0]);
char* lastSlash = strrchr(path, '/');
if (lastSlash) {
*lastSlash = '\0';
setenv("MOZILLA_FIVE_HOME", path, 1);
}
free(path);
}
#endif
gTheApp = new nsNativeViewerApp();
if (gTheApp != nsnull) {
NS_ADDREF(gTheApp);
if (gTheApp->Initialize(argc, argv) == NS_OK)
gTheApp->Run();
NS_RELEASE(gTheApp);
}
// Start up XPCOM?
nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
// Shutdown XPCOM?
rv = NS_ShutdownXPCOM(nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
gTheApp = new nsNativeViewerApp();
if (gTheApp != nsnull) {
NS_ADDREF(gTheApp);
if (gTheApp->Initialize(argc, argv) == NS_OK)
gTheApp->Run();
NS_RELEASE(gTheApp);
}
return 0;
// Shutdown XPCOM?
rv = NS_ShutdownXPCOM(nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
return 0;
}

Просмотреть файл

@ -458,6 +458,11 @@ nsViewerApp::ProcessArguments(int argc, char** argv)
old |= _CRTDBG_CHECK_ALWAYS_DF;
_CrtSetDbgFlag(old);
}
#endif
#if defined(XP_MACOSX)
else if (PL_strncmp(argv[i], "-psn_", 5) == 0) {
continue;
}
#endif
else if (PL_strncmp(argv[i], "-p", 2) == 0) {
char *optionalSampleStopIndex = &(argv[i][2]);

Просмотреть файл

@ -108,7 +108,7 @@ public:
~nsNativeViewerApp();
virtual int Run();
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
static void DispatchMenuItemWithoutWindow(PRInt32 menuResult);
#endif
};

Просмотреть файл

@ -57,13 +57,15 @@
#include <Fonts.h>
#include <TextEdit.h>
#include <Dialogs.h>
#ifndef XP_MACOSX
#include <Traps.h>
#endif
#include <Events.h>
#include <Menus.h>
#include <stdlib.h>
#ifndef RHAPSODY
#ifndef XP_MACOSX
#include "macstdlibextras.h"
#endif
PRBool nsAppShell::mInitializedToolbox = PR_FALSE;

Просмотреть файл

@ -56,7 +56,9 @@
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsPrimitiveHelpers.h"
#ifndef XP_MACOSX
#include "nsILocalFileMac.h"
#endif
#include "nsWatchTask.h"
// rjc
@ -516,9 +518,11 @@ printf("looking for data in type %s, mac flavor %ld\n", NS_STATIC_CAST(const cha
// we have a HFSFlavor struct in |dataBuff|. Create an nsLocalFileMac object.
HFSFlavor* fileData = NS_REINTERPRET_CAST(HFSFlavor*, dataBuff);
NS_ASSERTION ( sizeof(HFSFlavor) == dataSize, "Ooops, we realy don't have a HFSFlavor" );
#ifndef XP_MACOSX
nsCOMPtr<nsILocalFileMac> file;
if ( NS_SUCCEEDED(NS_NewLocalFileWithFSSpec(&fileData->fileSpec, PR_TRUE, getter_AddRefs(file))) )
genericDataWrapper = do_QueryInterface(file);
#endif
}
else {
// we probably have some form of text. The DOM only wants LF, so convert k

Просмотреть файл

@ -26,7 +26,9 @@
#include "nsNetUtil.h"
#include "nsIComponentManager.h"
#include "nsILocalFile.h"
#ifndef XP_MACOSX
#include "nsILocalFileMac.h"
#endif
#include "nsIURL.h"
#include "nsVoidArray.h"
#include "nsIFileChannel.h"
@ -149,6 +151,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
// Clean up filter buffers
delete[] filterBuffer;
#ifndef XP_MACOSX
if (userClicksOK == returnOK || userClicksOK == returnReplace)
{
nsCOMPtr<nsILocalFile> localFile(do_CreateInstance("@mozilla.org/file/local;1"));
@ -159,6 +162,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
mFile = do_QueryInterface(macFile);
}
#endif
*retval = userClicksOK;
return NS_OK;

Просмотреть файл

@ -52,7 +52,7 @@
#include "nsIMenuRollup.h"
#include "nsTSMStrategy.h"
#ifndef RHAPSODY
#ifndef XP_MACOSX
#include <locale>
#endif

Просмотреть файл

@ -70,7 +70,9 @@
#include <MacWindows.h>
#include <ToolUtils.h>
#ifndef XP_MACOSX
#include <DiskInit.h>
#endif
#include <LowMem.h>
#include <Devices.h>
#include <Quickdraw.h>
@ -90,7 +92,7 @@
#define botRight(r) (((Point *) &(r))[1])
#endif
#if DEBUG && !defined(MACOSX)
#if DEBUG && !defined(XP_MACOSX)
#include <SIOUX.h>
#include "macstdlibextras.h"
#endif
@ -237,7 +239,7 @@ WindowPtr nsMacMessagePump::GetFrontApplicationWindow()
{
WindowPtr firstAppWindow = ::FrontWindow();
#if DEBUG
#if DEBUG && !defined(XP_MACOSX)
if (IsSIOUXWindow(firstAppWindow))
firstAppWindow = ::GetNextWindow(firstAppWindow);
#endif
@ -411,7 +413,7 @@ void nsMacMessagePump::DispatchEvent(PRBool aRealEvent, EventRecord *anEvent)
if (aRealEvent == PR_TRUE)
{
#if DEBUG && !defined(MACOSX)
#if DEBUG && !defined(XP_MACOSX)
if ((anEvent->what != kHighLevelEvent) && SIOUXHandleOneEvent(anEvent))
return;
#endif

Просмотреть файл

@ -42,6 +42,7 @@
short nsMacResources::mRefNum = kResFileNotOpened;
short nsMacResources::mSaveResFile = 0;
#if !TARGET_CARBON
pascal OSErr __NSInitialize(const CFragInitBlock *theInitBlock);
pascal OSErr __initializeResources(const CFragInitBlock *theInitBlock);
@ -76,6 +77,7 @@ pascal void __terminateResources(void)
::CloseResFile(nsMacResources::GetLocalResourceFile());
__NSTerminate();
}
#endif /*!TARGET_CARBON*/
//----------------------------------------------------------------------------------------
//
@ -83,6 +85,14 @@ pascal void __terminateResources(void)
nsresult nsMacResources::OpenLocalResourceFile()
{
#ifdef XP_MACOSX
// XXX quick and dirty hack to make resources available so we don't crash.
if (mRefNum == kResFileNotOpened) {
FSSpec spec = { 0, 0, "\plibwidget.rsrc" };
if (FindFolder(kUserDomain, kDomainLibraryFolderType, false, &spec.vRefNum, &spec.parID) == noErr)
mRefNum = FSpOpenResFile(&spec, fsRdPerm);
}
#endif
if (mRefNum == kResFileNotOpened)
return NS_ERROR_NOT_INITIALIZED;

Просмотреть файл

@ -1225,13 +1225,22 @@ NS_IMETHODIMP nsMacWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepai
Rect macRect;
::GetWindowPortBounds ( mWindowPtr, &macRect );
if (((macRect.right - macRect.left) != aWidth)
|| ((macRect.bottom - macRect.top) != aHeight))
short w = macRect.right - macRect.left;
short h = macRect.bottom - macRect.top;
Boolean needReposition = (w == 1 && h == 1);
if ((w != aWidth) || (h != aHeight))
{
// make sure that we don't infinitely recurse if live-resize is on
mResizeIsFromUs = PR_TRUE;
::SizeWindow(mWindowPtr, aWidth, aHeight, aRepaint);
mResizeIsFromUs = PR_FALSE;
#if defined(XP_MACOSX)
// workaround for bug in MacOSX if windows start life as 1x1.
if (needReposition)
RepositionWindow(mWindowPtr, NULL, kWindowCascadeOnMainScreen);
#endif
}
}
Inherited::Resize(aWidth, aHeight, aRepaint);

Просмотреть файл

@ -62,7 +62,9 @@
#include <Menus.h>
#include <TextUtils.h>
#include <Balloons.h>
#ifndef XP_MACOSX
#include <Traps.h>
#endif
#include <Resources.h>
#include <Appearance.h>
#include "nsMacResources.h"

Просмотреть файл

@ -926,8 +926,10 @@ nsMovieSoundRequest::ImportMovie(Handle inDataHandle, long inDataSize, const nsA
// ensure that the track never draws on screen, otherwise we might be
// suspecptible to spoofing attacks
Rect movieRect = {0};
::SetMovieBox(mMovie, &movieRect);
{
Rect movieRect = {0};
::SetMovieBox(mMovie, &movieRect);
}
::GoToEndOfMovie(mMovie); // simplifies the logic in PlaySound()

Просмотреть файл

@ -42,9 +42,7 @@
#include "nsRepeater.h"
#include "nsCOMPtr.h"
class nsIEventQueue;
class nsIEventQueueService;
#include "nsIEventQueueService.h"
/**
* The toolkit abstraction is necessary because the message pump must

Просмотреть файл

@ -88,6 +88,160 @@
#include "nsBidiKeyboard.h"
#endif
#ifdef XP_MACOSX
#include "nsIGenericFactory.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerImpl)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsButton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
//NS_GENERIC_FACTORY_CONSTRUCTOR(nsFileWidget)
#if USE_NATIVE_VERSION
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCheckButton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsComboBox)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRadioButton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsListBox)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextAreaWidget)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextWidget)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLabel)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMenuBar)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMenu)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMenuItem)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
//NS_GENERIC_FACTORY_CONSTRUCTOR(nsFileSpecWithUIImpl)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
#ifdef IBMBIDI
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
#endif
#define NS_GENERIC_SCROLLBAR_CONSTRUCTOR(type, isVertical) \
static NS_IMETHODIMP \
type ## ScrollbarConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) \
{ \
if (aOuter) return NS_ERROR_NO_AGGREGATION; \
if (!aResult) return NS_ERROR_NULL_POINTER; \
*aResult = NULL; \
nsCOMPtr<nsIScrollbar> scrollbar = new nsScrollbar(isVertical); \
if (!scrollbar) return NS_ERROR_OUT_OF_MEMORY; \
return scrollbar->QueryInterface(aIID, aResult); \
}
NS_GENERIC_SCROLLBAR_CONSTRUCTOR(Vertical, PR_TRUE)
NS_GENERIC_SCROLLBAR_CONSTRUCTOR(Horizontal, PR_FALSE)
static nsModuleComponentInfo components[] =
{
{ "Timer",
NS_TIMER_CID,
"@mozilla.org/timer;1",
nsTimerImplConstructor },
{ "nsWindow",
NS_WINDOW_CID,
"@mozilla.org/widgets/window/mac;1",
nsMacWindowConstructor },
{ "Popup nsWindow",
NS_POPUP_CID,
"@mozilla.org/widgets/popup/mac;1",
nsMacWindowConstructor },
{ "Child nsWindow",
NS_CHILD_CID,
"@mozilla.org/widgets/childwindow/mac;1",
ChildWindowConstructor },
{ "Button",
NS_BUTTON_CID,
"@mozilla.org/widgets/button/mac;1",
nsButtonConstructor },
{ "File Picker",
NS_FILEPICKER_CID,
"@mozilla.org/filepicker;1",
nsFilePickerConstructor },
{ "Horiz Scrollbar",
NS_HORZSCROLLBAR_CID,
"@mozilla.org/widgets/horizscroll/mac;1",
HorizontalScrollbarConstructor },
{ "Vert Scrollbar",
NS_VERTSCROLLBAR_CID,
"@mozilla.org/widgets/vertscroll/mac;1",
VerticalScrollbarConstructor },
{ "Text Field",
NS_TEXTFIELD_CID,
"@mozilla.org/widgets/textfield/mac;1",
nsTextWidgetConstructor },
{ "AppShell",
NS_APPSHELL_CID,
"@mozilla.org/widget/appshell/mac;1",
nsAppShellConstructor },
{ "Toolkit",
NS_TOOLKIT_CID,
"@mozilla.org/widget/toolkit/mac;1",
nsToolkitConstructor },
{ "Look And Feel",
NS_LOOKANDFEEL_CID,
"@mozilla.org/widget/lookandfeel/mac;1",
nsLookAndFeelConstructor },
{ "Label",
NS_LABEL_CID,
"@mozilla.org/widget/label/mac;1",
nsLabelConstructor },
{ "Menubar",
NS_MENUBAR_CID,
"@mozilla.org/widget/menubar/mac;1",
nsMenuBarConstructor },
{ "Menu",
NS_MENU_CID,
"@mozilla.org/widget/menu/mac;1",
nsMenuConstructor },
{ "MenuItem",
NS_MENUITEM_CID,
"@mozilla.org/widget/menuitem/mac;1",
nsMenuItemConstructor },
{ "Sound",
NS_SOUND_CID,
"@mozilla.org/sound;1",
nsSoundConstructor },
{ "Transferable",
NS_TRANSFERABLE_CID,
"@mozilla.org/widget/transferable;1",
nsTransferableConstructor },
{ "HTML Format Converter",
NS_HTMLFORMATCONVERTER_CID,
"@mozilla.org/widget/htmlformatconverter/mac;1",
nsHTMLFormatConverterConstructor },
{ "Clipboard",
NS_CLIPBOARD_CID,
"@mozilla.org/widget/clipboard;1",
nsClipboardConstructor },
{ "Clipboard Helper",
NS_CLIPBOARDHELPER_CID,
"@mozilla.org/widget/clipboardhelper;1",
nsClipboardHelperConstructor },
{ "Drag Service",
NS_DRAGSERVICE_CID,
"@mozilla.org/widget/dragservice;1",
nsDragServiceConstructor },
#ifdef IBMBIDI
{ "Gtk Bidi Keyboard",
NS_BIDIKEYBOARD_CID,
"@mozilla.org/widget/bidikeyboard;1",
nsBidiKeyboardConstructor },
#endif // IBMBIDI
};
NS_IMPL_NSGETMODULE(nsWidgetModule, components)
#else
// NOTE the following does not match MAC_STATIC actually used below in this file!
#define MACSTATIC
@ -318,3 +472,5 @@ NSGetFactory(nsISupports* serviceMgr,
return (*aFactory)->QueryInterface(NS_GET_IID(nsIFactory), (void**)aFactory);
}
#endif

Просмотреть файл

@ -251,7 +251,7 @@ NS_SPECIALIZE_TEMPLATE
struct nsCOMTypeInfo<nsISupports>
{
static const nsIID& GetIID() {
static const nsIID iid = NS_ISUPPORTS_IID; return iid;
static const nsIID iid_NS_ISUPPORTS_IID = NS_ISUPPORTS_IID; return iid_NS_ISUPPORTS_IID;
}
};

Просмотреть файл

@ -38,6 +38,11 @@ EXPORTS = \
nsXPCOM.h \
$(NULL)
# pull in MoreFiles for MacOSX
ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
REQUIRES += macmorefiles
endif
CPPSRCS = nsXPComInit.cpp
ifdef XPCOM_USE_LEA
@ -80,6 +85,11 @@ ifdef GC_LEAK_DETECTOR
EXTRA_DSO_LDOPTS += -lboehm
endif
# pull in MoreFiles for MacOSX
ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
EXTRA_DSO_LDOPTS += $(DEPTH)/dist/lib/libmacmorefiles_s.a
endif
# Turn off grep filter for .def files
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
XPCOM_SWITCH = 1

Просмотреть файл

@ -229,7 +229,7 @@ protected:
#define NS_ERROR_IS_DIR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 24)
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
/* The default registry on the unix system is $HOME/.mozilla/registry per
* vr_findGlobalRegName(). vr_findRegFile() will create the registry file
* if it doesn't exist. But it wont create directories.

Просмотреть файл

@ -46,7 +46,7 @@
#include "nsITimelineService.h"
#ifdef XP_MAC // sdagley dougt fix
#if defined(XP_MAC) // sdagley dougt fix
#include <Files.h>
#include <Errors.h>
#include "nsILocalFileMac.h"
@ -726,7 +726,7 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when,
".so", /* Unix */
".shlb", /* Mac ? */
".dso", /* Unix ? */
".dylib", /* Unix: Rhapsody */
".dylib", /* Unix: Mach */
".so.1.0", /* Unix: BSD */
".sl", /* Unix: HP-UX */
#if defined(VMS)
@ -754,7 +754,7 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when,
// deal only with files that have a valid extension
PRBool validExtension = PR_FALSE;
#ifdef XP_MAC // sdagley dougt fix
#if defined(XP_MAC) // sdagley dougt fix
// rjc - on Mac, check the file's type code (skip checking the creator code)
nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface(component);

Просмотреть файл

@ -446,7 +446,7 @@ NS_IMETHODIMP nsRegistry::Open( const char *regFile ) {
static void
EnsureDefaultRegistryDirectory() {
#ifdef XP_UNIX
#if defined(XP_UNIX) && !defined(XP_MACOSX)
// Create ~/.mozilla as that is the default place for the registry file
/* The default registry on the unix system is $HOME/.mozilla/registry per

Просмотреть файл

@ -251,7 +251,7 @@ NS_SPECIALIZE_TEMPLATE
struct nsCOMTypeInfo<nsISupports>
{
static const nsIID& GetIID() {
static const nsIID iid = NS_ISUPPORTS_IID; return iid;
static const nsIID iid_NS_ISUPPORTS_IID = NS_ISUPPORTS_IID; return iid_NS_ISUPPORTS_IID;
}
};

Просмотреть файл

@ -61,9 +61,14 @@ CPPSRCS = \
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
CPPSRCS += nsLocalFileOS2.cpp
#else
#ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
#CPPSRCS += nsLocalFileMac.cpp
#CSRCS += macDirectoryCopy.c
else
CPPSRCS += nsLocalFileUnix.cpp
endif
#endif
EXPORTS = \
nsAppDirectoryServiceDefs.h \
@ -89,8 +94,12 @@ EXPORTS = \
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
EXPORTS += nsLocalFileOS2.h
else
#ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
#EXPORTS += nsLocalFileMac.h nsILocalFileMac.h
#else
EXPORTS += nsLocalFileUnix.h
endif
#endif
XPIDLSRCS = \
nsIBinaryInputStream.idl \

Просмотреть файл

@ -30,14 +30,13 @@
#include "nsString.h"
#include "nsXPIDLString.h"
#if defined(XP_MAC)
#if defined(XP_MAC) /* || defined(XP_MACOSX) REMIND HACKING FOR MACOS X!!! */
#include <Folders.h>
#include <Script.h>
#include <Processes.h>
#include <Gestalt.h>
#include "nsILocalFileMac.h"
#endif
#if defined(XP_OS2)
#elif defined(XP_OS2)
#define INCL_DOSPROCESS
#define INCL_DOSMODULEMGR
#include <os2.h>
@ -59,7 +58,7 @@
// WARNING: These hard coded names need to go away. They need to
// come from localizable resources
#ifdef XP_MAC
#if defined(XP_MAC) /* || defined(XP_MACOSX) REMIND HACKING FOR MACOS X!!! */
#define APP_REGISTRY_NAME "Application Registry"
#elif defined(XP_WIN) || defined(XP_OS2)
#define APP_REGISTRY_NAME "registry.dat"
@ -250,7 +249,7 @@ NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsILocalFile **aLocalFi
PRBool exists;
nsCOMPtr<nsILocalFile> localDir;
#if defined(XP_MAC)
#if defined(XP_MAC) /* || defined(XP_MACOSX) REMIND HACKING FOR MACOS X!!! */
nsCOMPtr<nsIProperties> directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
@ -329,7 +328,7 @@ NS_METHOD nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsILocalFile **aL
rv = GetProductDirectory(getter_AddRefs(localDir));
if (NS_FAILED(rv)) return rv;
#if defined(XP_MAC) || defined(XP_OS2) || defined(XP_PC)
#if defined(XP_MAC) || defined(XP_MACOSX) || defined(XP_OS2) || defined(XP_PC)
// These 3 platforms share this part of the path - do them as one
rv = localDir->AppendRelativePath("Profiles");
if (NS_FAILED(rv)) return rv;

Просмотреть файл

@ -43,17 +43,20 @@
#include "nsLocalFile.h"
#include "nsDebug.h"
#ifdef XP_MAC
#if defined(XP_MAC)
#include <Folders.h>
#include <Files.h>
#include <Memory.h>
#include <Processes.h>
#ifdef XP_MACOSX
#include "prenv.h"
#endif
#elif defined(XP_WIN)
#include <windows.h>
#include <shlobj.h>
#include <stdlib.h>
#include <stdio.h>
#elif defined(XP_UNIX)
#elif defined(XP_UNIX) || defined(XP_MACOSX)
#include <unistd.h>
#include <stdlib.h>
#include <sys/param.h>
@ -73,7 +76,7 @@
#include "nsSpecialSystemDirectory.h"
#ifdef XP_MAC
#if defined(XP_MAC)
#define COMPONENT_REGISTRY_NAME "Component Registry"
#define COMPONENT_DIRECTORY "Components"
#else
@ -81,7 +84,7 @@
#define COMPONENT_DIRECTORY "components"
#endif
#ifdef XP_MAC
#if defined(XP_MAC)
#define APP_REGISTRY_NAME "Application Registry"
#elif defined(XP_WIN) || defined(XP_OS2)
#define APP_REGISTRY_NAME "registry.dat"
@ -95,7 +98,7 @@
#define HOME_DIR NS_WIN_APPDATA_DIR
#elif defined (XP_MAC)
#define HOME_DIR NS_MAC_HOME_DIR
#elif defined (XP_UNIX)
#elif defined (XP_UNIX) || defined(XP_MACOSX)
#define HOME_DIR NS_UNIX_HOME_DIR
#elif defined (XP_OS2)
#define HOME_DIR NS_OS2_HOME_DIR
@ -106,7 +109,7 @@
// define default product directory
#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_OS2) || defined(XP_BEOS)
#define DEFAULT_PRODUCT_DIR "Mozilla"
#elif defined (XP_UNIX)
#elif defined (XP_UNIX) || defined(XP_MACOSX)
#define DEFAULT_PRODUCT_DIR ".mozilla"
#endif
@ -163,36 +166,72 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile)
// get info for the the current process to determine the directory
// its located in
OSErr err;
ProcessSerialNumber psn;
if (!(err = GetCurrentProcess(&psn)))
ProcessSerialNumber psn = {kNoProcess, kCurrentProcess};
ProcessInfoRec pInfo;
FSSpec tempSpec;
// initialize ProcessInfoRec before calling
// GetProcessInformation() or die horribly.
pInfo.processName = nil;
pInfo.processAppSpec = &tempSpec;
pInfo.processInfoLength = sizeof(ProcessInfoRec);
err = GetProcessInformation(&psn, &pInfo);
if (!err)
{
ProcessInfoRec pInfo;
FSSpec tempSpec;
FSSpec appFSSpec = *(pInfo.processAppSpec);
// initialize ProcessInfoRec before calling
// GetProcessInformation() or die horribly.
pInfo.processName = nil;
pInfo.processAppSpec = &tempSpec;
pInfo.processInfoLength = sizeof(ProcessInfoRec);
// Truncate the nsame so the spec is just to the app directory
appFSSpec.name[0] = 0;
if (!(err = GetProcessInformation(&psn, &pInfo)))
nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface((nsIFile*)localFile);
if (localFileMac)
{
FSSpec appFSSpec = *(pInfo.processAppSpec);
// Truncate the nsame so the spec is just to the app directory
appFSSpec.name[0] = 0;
nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface((nsIFile*)localFile);
if (localFileMac)
{
localFileMac->InitWithFSSpec(&appFSSpec);
localFileMac->InitWithFSSpec(&appFSSpec);
*aFile = localFile;
return NS_OK;
}
}
}
#if defined(DEBUG) && defined(XP_MACOSX)
else
{
// In the absence of a good way to get the executable directory let
// us try this for unix:
// - if MOZILLA_FIVE_HOME is defined, that is it
char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");
if (moz5)
{
printf( "nsDirectoryService::MOZILLA_FIVE_HOME is set to %s\n", moz5 );
Str255 pascalpath;
FSSpec ioSpec;
#elif defined(XP_UNIX)
int srcLength = strlen(moz5);
pascalpath[0] = srcLength;
memcpy(&pascalpath[1], moz5, srcLength);
err = ::FSMakeFSSpec(0, 0, pascalpath, &ioSpec);
nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface((nsIFile*)localFile);
if (localFileMac)
{
localFileMac->InitWithFSSpec(&ioSpec);
*aFile = localFile;
return NS_OK;
}
}
else
{
static PRBool firstWarning = PR_TRUE;
if(firstWarning) {
// Warn that MOZILLA_FIVE_HOME not set, once.
printf("***Warning: MOZILLA_FIVE_HOME not set.\n");
firstWarning = PR_FALSE;
}
}
}
#endif /* DEBUG && XP_MACOSX */
#elif defined(XP_UNIX) || defined(XP_MACOSX)
// In the absence of a good way to get the executable directory let
// us try this for unix:
@ -302,7 +341,7 @@ nsIAtom* nsDirectoryService::sOS_DriveDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_TemporaryDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_CurrentProcessDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_CurrentWorkingDirectory = nsnull;
#ifdef XP_MAC
#if defined(XP_MAC)
nsIAtom* nsDirectoryService::sDirectory = nsnull;
nsIAtom* nsDirectoryService::sDesktopDirectory = nsnull;
nsIAtom* nsDirectoryService::sTrashDirectory = nsnull;
@ -345,7 +384,7 @@ nsIAtom* nsDirectoryService::sCommon_Startup = nsnull;
nsIAtom* nsDirectoryService::sCommon_Desktopdirectory = nsnull;
nsIAtom* nsDirectoryService::sAppdata = nsnull;
nsIAtom* nsDirectoryService::sPrinthood = nsnull;
#elif defined (XP_UNIX)
#elif defined (XP_UNIX) || defined(XP_MACOSX)
nsIAtom* nsDirectoryService::sLocalDirectory = nsnull;
nsIAtom* nsDirectoryService::sLibDirectory = nsnull;
nsIAtom* nsDirectoryService::sHomeDirectory = nsnull;
@ -401,7 +440,7 @@ nsDirectoryService::Init()
nsDirectoryService::sOS_TemporaryDirectory = NS_NewAtom(NS_OS_TEMP_DIR);
nsDirectoryService::sOS_CurrentProcessDirectory = NS_NewAtom(NS_OS_CURRENT_PROCESS_DIR);
nsDirectoryService::sOS_CurrentWorkingDirectory = NS_NewAtom(NS_OS_CURRENT_WORKING_DIR);
#ifdef XP_MAC
#if defined(XP_MAC)
nsDirectoryService::sDirectory = NS_NewAtom(NS_OS_SYSTEM_DIR);
nsDirectoryService::sDesktopDirectory = NS_NewAtom(NS_MAC_DESKTOP_DIR);
nsDirectoryService::sTrashDirectory = NS_NewAtom(NS_MAC_TRASH_DIR);
@ -444,7 +483,7 @@ nsDirectoryService::Init()
nsDirectoryService::sCommon_Desktopdirectory = NS_NewAtom(NS_WIN_COMMON_DESKTOP_DIRECTORY);
nsDirectoryService::sAppdata = NS_NewAtom(NS_WIN_APPDATA_DIR);
nsDirectoryService::sPrinthood = NS_NewAtom(NS_WIN_PRINTHOOD);
#elif defined (XP_UNIX)
#elif defined (XP_UNIX) || defined(XP_MACOSX)
nsDirectoryService::sLocalDirectory = NS_NewAtom(NS_UNIX_LOCAL_DIR);
nsDirectoryService::sLibDirectory = NS_NewAtom(NS_UNIX_LIB_DIR);
nsDirectoryService::sHomeDirectory = NS_NewAtom(NS_UNIX_HOME_DIR);
@ -482,7 +521,7 @@ nsDirectoryService::~nsDirectoryService()
NS_IF_RELEASE(nsDirectoryService::sOS_TemporaryDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_CurrentProcessDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_CurrentWorkingDirectory);
#ifdef XP_MAC
#if defined(XP_MAC)
NS_IF_RELEASE(nsDirectoryService::sDirectory);
NS_IF_RELEASE(nsDirectoryService::sDesktopDirectory);
NS_IF_RELEASE(nsDirectoryService::sTrashDirectory);
@ -524,7 +563,7 @@ nsDirectoryService::~nsDirectoryService()
NS_IF_RELEASE(nsDirectoryService::sCommon_Desktopdirectory);
NS_IF_RELEASE(nsDirectoryService::sAppdata);
NS_IF_RELEASE(nsDirectoryService::sPrinthood);
#elif defined (XP_UNIX)
#elif defined (XP_UNIX) || defined(XP_MACOSX)
NS_IF_RELEASE(nsDirectoryService::sLocalDirectory);
NS_IF_RELEASE(nsDirectoryService::sLibDirectory);
NS_IF_RELEASE(nsDirectoryService::sHomeDirectory);
@ -763,7 +802,7 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret
rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile));
}
#ifdef XP_MAC
#if defined(XP_MAC)
else if (inAtom == nsDirectoryService::sDirectory)
{
nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_SystemDirectory);
@ -970,7 +1009,7 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret
nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Printhood);
rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile));
}
#elif defined (XP_UNIX)
#elif defined (XP_UNIX) || defined(XP_MACOSX)
else if (inAtom == nsDirectoryService::sLocalDirectory)
{

Просмотреть файл

@ -82,7 +82,7 @@ private:
static nsIAtom *sOS_TemporaryDirectory;
static nsIAtom *sOS_CurrentProcessDirectory;
static nsIAtom *sOS_CurrentWorkingDirectory;
#ifdef XP_MAC
#if defined(XP_MAC)
static nsIAtom *sDirectory;
static nsIAtom *sDesktopDirectory;
static nsIAtom *sTrashDirectory;
@ -125,7 +125,7 @@ private:
static nsIAtom *sCommon_Desktopdirectory;
static nsIAtom *sAppdata;
static nsIAtom *sPrinthood;
#elif defined (XP_UNIX)
#elif defined (XP_UNIX) || defined(XP_MACOSX)
static nsIAtom *sLocalDirectory;
static nsIAtom *sLibDirectory;
static nsIAtom *sHomeDirectory;

Просмотреть файл

@ -62,11 +62,18 @@
#define NS_OS_CURRENT_PROCESS_DIR "CurProcD"
#define NS_OS_CURRENT_WORKING_DIR "CurWorkD"
#if !defined (XP_UNIX)
#if !defined (XP_UNIX) || defined(XP_MACOSX)
#define NS_OS_SYSTEM_DIR "SysD"
#endif
#ifdef XP_MAC
// for MacOSX we need the UNIX entries, plus the MAC entries
#if defined (XP_UNIX) || defined(XP_MACOSX)
#define NS_UNIX_LOCAL_DIR "Locl"
#define NS_UNIX_LIB_DIR "LibD"
#define NS_UNIX_HOME_DIR "Home"
#endif
#if defined(XP_MAC) || defined(XP_MACOSX)
#define NS_MAC_DESKTOP_DIR "Desk"
#define NS_MAC_TRASH_DIR "Trsh"
#define NS_MAC_STARTUP_DIR "Strt"
@ -107,10 +114,6 @@
#define NS_WIN_COMMON_DESKTOP_DIRECTORY "CmDeskP"
#define NS_WIN_APPDATA_DIR "AppData"
#define NS_WIN_PRINTHOOD "PrntHd"
#elif defined (XP_UNIX)
#define NS_UNIX_LOCAL_DIR "Locl"
#define NS_UNIX_LIB_DIR "LibD"
#define NS_UNIX_HOME_DIR "Home"
#elif defined (XP_OS2)
#define NS_OS2_DIR "OS2Dir"
#define NS_OS2_HOME_DIR "Home"

Просмотреть файл

@ -66,7 +66,7 @@
extern unsigned char* _mbsrchr( const unsigned char*, int);
#endif
#ifdef XP_MAC
#if defined(XP_MAC)
#include <Aliases.h>
#include <TextUtils.h>
#endif
@ -305,7 +305,7 @@ NS_NAMESPACE nsFileSpecHelpers
, kMaxAltDigitLength = 5
, kMaxCoreLeafNameLength = (kMaxFilenameLength - (kMaxAltDigitLength + 1))
};
#ifndef XP_MAC
#if !defined(XP_MAC)
NS_NAMESPACE_PROTOTYPE void Canonify(nsSimpleCharString& ioPath, PRBool inMakeDirs);
NS_NAMESPACE_PROTOTYPE void MakeAllDirectories(const char* inPath, int mode);
#endif
@ -426,7 +426,7 @@ char* nsSimpleCharString::GetLeaf(char inSeparator) const
#pragma mark -
#endif
#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS)
#if (defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS))
//----------------------------------------------------------------------------------------
void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
@ -509,12 +509,9 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
#elif defined(XP_MAC)
//#include "nsFileSpecMac.cpp" // Macintosh-specific implementations
// we include the .cpp file in the project now.
#elif defined(RHAPSODY)
#include "nsFileSpecMac.cpp" // Macintosh-specific implementations
#include "nsFileSpecUnix.cpp" // Unix-specific implementations
#elif defined(XP_BEOS)
#include "nsFileSpecBeOS.cpp" // BeOS-specific implementations
#elif defined(XP_UNIX)
#elif defined(XP_UNIX) || defined(XP_MACOSX)
#include "nsFileSpecUnix.cpp" // Unix-specific implementations
#elif defined(XP_OS2)
#include "nsFileSpecOS2.cpp" // OS/2-specific implementations
@ -524,7 +521,7 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
// nsFileURL implementation
//========================================================================================
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFileURL::nsFileURL(const char* inString, PRBool inCreateDirs)
//----------------------------------------------------------------------------------------
@ -542,7 +539,7 @@ nsFileURL::nsFileURL(const char* inString, PRBool inCreateDirs)
} // nsFileURL::nsFileURL
#endif
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFileURL::nsFileURL(const nsString& inString, PRBool inCreateDirs)
//----------------------------------------------------------------------------------------
@ -566,13 +563,13 @@ nsFileURL::nsFileURL(const nsString& inString, PRBool inCreateDirs)
nsFileURL::nsFileURL(const nsFileURL& inOther)
//----------------------------------------------------------------------------------------
: mURL(inOther.mURL)
#ifdef XP_MAC
#if defined(XP_MAC)
, mFileSpec(inOther.GetFileSpec())
#endif
{
} // nsFileURL::nsFileURL
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFileURL::nsFileURL(const nsFilePath& inOther)
//----------------------------------------------------------------------------------------
@ -581,7 +578,7 @@ nsFileURL::nsFileURL(const nsFilePath& inOther)
} // nsFileURL::nsFileURL
#endif
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFileURL::nsFileURL(const nsFileSpec& inOther)
//----------------------------------------------------------------------------------------
@ -596,7 +593,7 @@ nsFileURL::~nsFileURL()
{
}
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
void nsFileURL::operator = (const char* inString)
//----------------------------------------------------------------------------------------
@ -616,7 +613,7 @@ void nsFileURL::operator +=(const char* inRelativeUnixPath)
char* escapedPath = nsEscape(inRelativeUnixPath, url_Path);
mURL += escapedPath;
nsCRT::free(escapedPath);
#ifdef XP_MAC
#if defined(XP_MAC)
mFileSpec += inRelativeUnixPath;
#endif
} // nsFileURL::operator +=
@ -635,12 +632,12 @@ void nsFileURL::operator = (const nsFileURL& inOther)
//----------------------------------------------------------------------------------------
{
mURL = inOther.mURL;
#ifdef XP_MAC
#if defined(XP_MAC)
mFileSpec = inOther.GetFileSpec();
#endif
} // nsFileURL::operator =
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
void nsFileURL::operator = (const nsFilePath& inOther)
//----------------------------------------------------------------------------------------
@ -664,7 +661,7 @@ void nsFileURL::operator = (const nsFilePath& inOther)
} // nsFileURL::operator =
#endif
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
void nsFileURL::operator = (const nsFileSpec& inOther)
//----------------------------------------------------------------------------------------
@ -687,13 +684,13 @@ void nsFileURL::operator = (const nsFileSpec& inOther)
nsFilePath::nsFilePath(const nsFilePath& inPath)
//----------------------------------------------------------------------------------------
: mPath(inPath.mPath)
#ifdef XP_MAC
#if defined(XP_MAC)
, mFileSpec(inPath.mFileSpec)
#endif
{
}
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFilePath::nsFilePath(const char* inString, PRBool inCreateDirs)
//----------------------------------------------------------------------------------------
@ -716,7 +713,7 @@ nsFilePath::nsFilePath(const char* inString, PRBool inCreateDirs)
}
#endif
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFilePath::nsFilePath(const nsString& inString, PRBool inCreateDirs)
//----------------------------------------------------------------------------------------
@ -738,7 +735,7 @@ nsFilePath::nsFilePath(const nsString& inString, PRBool inCreateDirs)
}
#endif
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFilePath::nsFilePath(const nsFileURL& inOther)
//----------------------------------------------------------------------------------------
@ -748,7 +745,7 @@ nsFilePath::nsFilePath(const nsFileURL& inOther)
}
#endif
#if defined XP_UNIX || defined XP_BEOS
#if (defined XP_UNIX || defined XP_BEOS)
//----------------------------------------------------------------------------------------
nsFilePath::nsFilePath(const nsFileSpec& inOther)
//----------------------------------------------------------------------------------------
@ -763,7 +760,7 @@ nsFilePath::~nsFilePath()
{
}
#if defined XP_UNIX || defined XP_BEOS
#if (defined XP_UNIX || defined XP_BEOS)
//----------------------------------------------------------------------------------------
void nsFilePath::operator = (const nsFileSpec& inOther)
//----------------------------------------------------------------------------------------
@ -774,7 +771,7 @@ void nsFilePath::operator = (const nsFileSpec& inOther)
}
#endif // XP_UNIX
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
void nsFilePath::operator = (const char* inString)
//----------------------------------------------------------------------------------------
@ -795,7 +792,7 @@ void nsFilePath::operator = (const char* inString)
}
#endif // XP_MAC
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
void nsFilePath::operator = (const nsFileURL& inOther)
//----------------------------------------------------------------------------------------
@ -809,7 +806,7 @@ void nsFilePath::operator = (const nsFilePath& inOther)
//----------------------------------------------------------------------------------------
{
mPath = inOther.mPath;
#ifdef XP_MAC
#if defined(XP_MAC)
mFileSpec = inOther.GetFileSpec();
#endif
}
@ -823,7 +820,7 @@ void nsFilePath::operator +=(const char* inRelativeUnixPath)
char* escapedPath = nsEscape(inRelativeUnixPath, url_Path);
mPath += escapedPath;
nsCRT::free(escapedPath);
#ifdef XP_MAC
#if defined(XP_MAC)
mFileSpec += inRelativeUnixPath;
#endif
} // nsFilePath::operator +=
@ -852,7 +849,7 @@ nsFilePath nsFilePath::operator +(const char* inRelativeUnixPath) const
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
#endif /* XPCOM_STANDALONE */
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec()
//----------------------------------------------------------------------------------------
@ -952,7 +949,7 @@ void nsFileSpec::operator = (const nsPersistentFileDescriptor& inDescriptor)
PRInt32 dataSize;
inDescriptor.GetData(data, dataSize);
#ifdef XP_MAC
#if defined(XP_MAC)
char* decodedData = PL_Base64Decode((const char*)data, (int)dataSize, nsnull);
// Cast to an alias record and resolve.
AliasHandle aliasH = nsnull;
@ -975,7 +972,7 @@ void nsFileSpec::operator = (const nsPersistentFileDescriptor& inDescriptor)
// UNIX & WIN nsFileSpec implementation
//========================================================================================
#if defined XP_UNIX || defined XP_BEOS
#if (defined XP_UNIX || defined XP_BEOS)
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec(const nsFilePath& inPath)
//----------------------------------------------------------------------------------------
@ -994,7 +991,7 @@ void nsFileSpec::operator = (const nsFilePath& inPath)
}
#endif //XP_UNIX
#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS)
#if (defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS))
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec(const nsFileSpec& inSpec)
//----------------------------------------------------------------------------------------
@ -1061,7 +1058,7 @@ PRBool nsFileSpec::operator == (const nsFileSpec& inOther) const
//----------------------------------------------------------------------------------------
{
#ifdef XP_MAC
#if defined(XP_MAC)
if ( inOther.mSpec.vRefNum == mSpec.vRefNum &&
inOther.mSpec.parID == mSpec.parID &&
EqualString(inOther.mSpec.name, mSpec.name, false, true))
@ -1117,7 +1114,7 @@ PRBool nsFileSpec::operator != (const nsFileSpec& inOther) const
return (! (*this == inOther) );
}
#ifndef XP_MAC
#if !defined(XP_MAC)
//----------------------------------------------------------------------------------------
// This is the only automatic conversion to const char*
// that is provided, and it allows the
@ -1312,7 +1309,7 @@ nsPersistentFileDescriptor::nsPersistentFileDescriptor(const nsFileSpec& inSpec)
void nsPersistentFileDescriptor::operator = (const nsFileSpec& inSpec)
//----------------------------------------------------------------------------------------
{
#ifdef XP_MAC
#if defined(XP_MAC)
if (inSpec.Error())
return;
AliasHandle aliasH;
@ -1431,7 +1428,7 @@ NS_FileSpecToIFile(nsFileSpec* fileSpec, nsILocalFile* *result)
if (!file) return NS_ERROR_FAILURE;
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC)
{
FSSpec spec = fileSpec->GetFSSpec();
nsCOMPtr<nsILocalFileMac> psmAppMacFile = do_QueryInterface(file, &rv);

Просмотреть файл

@ -176,12 +176,10 @@
#include "nsILocalFile.h"
#include "nsCOMPtr.h"
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC)
#include <Files.h>
#include "nsILocalFileMac.h"
#endif
// this can't be elif because rhapsody needs both headers
#if defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS) || defined(RHAPSODY)
#elif defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS)
#if defined(XP_OS2)
#define INCL_DOS
#define INCL_DOSERRORS
@ -373,7 +371,7 @@ class NS_COM nsFileSpec
PRBool IsChildOf(nsFileSpec &possibleParent);
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC)
// For Macintosh people, this is meant to be useful in its own right as a C++ version
// of the FSSpec struct.
nsFileSpec(
@ -409,10 +407,10 @@ class NS_COM nsFileSpec
PRBool Valid() const { return NS_SUCCEEDED(Error()); }
nsresult Error() const
{
#ifndef XP_MAC
#if !defined(XP_MAC)
if (mPath.IsEmpty() && NS_SUCCEEDED(mError))
((nsFileSpec*)this)->mError = NS_ERROR_NOT_INITIALIZED;
#endif
#endif
return mError;
}
PRBool Failed() const { return (PRBool)NS_FAILED(Error()); }
@ -544,7 +542,7 @@ class NS_COM nsFileSpec
friend class nsFilePath;
friend class nsFileURL;
friend class nsDirectoryIterator;
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC)
FSSpec mSpec;
#endif
nsSimpleCharString mPath;
@ -592,7 +590,7 @@ class NS_COM nsFileURL
const char* GetAsString() const { return (const char*)mURL; }
// Not allocated, so don't free it.
#ifdef XP_MAC
#if defined(XP_MAC)
// Accessor to allow quick assignment to a mFileSpec
const nsFileSpec& GetFileSpec() const { return mFileSpec; }
#endif
@ -605,7 +603,7 @@ class NS_COM nsFileURL
friend class nsFilePath; // to allow construction of nsFilePath
nsSimpleCharString mURL;
#ifdef XP_MAC
#if defined(XP_MAC)
// Since the path on the macintosh does not uniquely specify a file (volumes
// can have the same name), stash the secret nsFileSpec, too.
nsFileSpec mFileSpec;
@ -645,7 +643,7 @@ class NS_COM nsFilePath
void operator +=(const char* inRelativeUnixPath);
nsFilePath operator +(const char* inRelativeUnixPath) const;
#ifdef XP_MAC
#if defined(XP_MAC)
public:
// Accessor to allow quick assignment to a mFileSpec
const nsFileSpec& GetFileSpec() const { return mFileSpec; }
@ -658,7 +656,7 @@ class NS_COM nsFilePath
private:
nsSimpleCharString mPath;
#ifdef XP_MAC
#if defined(XP_MAC)
// Since the path on the macintosh does not uniquely specify a file (volumes
// can have the same name), stash the secret nsFileSpec, too.
nsFileSpec mFileSpec;
@ -734,7 +732,7 @@ class NS_COM nsDirectoryIterator
public:
nsDirectoryIterator( const nsFileSpec& parent,
PRBool resoveSymLinks);
#ifndef XP_MAC
#if !defined(XP_MAC)
// Macintosh currently doesn't allocate, so needn't clean up.
virtual ~nsDirectoryIterator();
#endif
@ -763,19 +761,19 @@ class NS_COM nsDirectoryIterator
PRBool mExists;
PRBool mResoveSymLinks;
#if defined(XP_UNIX) || defined(XP_BEOS) || defined (XP_WIN) || defined(XP_OS2)
#if (defined(XP_UNIX) || defined(XP_BEOS) || defined (XP_WIN) || defined(XP_OS2))
nsFileSpec mStarting;
#endif
#if defined(XP_UNIX) || defined(XP_BEOS)
#if defined(XP_MAC)
short mVRefNum;
long mParID;
short mIndex;
short mMaxIndex;
#elif defined(XP_UNIX) || defined(XP_BEOS)
DIR* mDir;
#elif defined(XP_WIN) || defined(XP_OS2)
PRDir* mDir; // XXX why not use PRDir for Unix too?
#elif defined(XP_MAC)
short mVRefNum;
long mParID;
short mIndex;
short mMaxIndex;
#endif
}; // class nsDirectoryIterator

Просмотреть файл

@ -44,15 +44,12 @@
#include "prtypes.h"
#include "nscore.h"
#ifndef RHAPSODY
#include "FullPath.h"
#include "FileCopy.h"
#include "MoreFilesExtras.h"
#endif
#include <Aliases.h>
#include <Folders.h>
#include <Errors.h>
#include <Math64.h>
#include <TextUtils.h>
#include <Processes.h>
@ -63,7 +60,6 @@
#include "nsXPIDLString.h"
#ifndef RHAPSODY
const unsigned char* kAliasHavenFolderName = "\pnsAliasHaven";
//========================================================================================
@ -558,7 +554,6 @@ char* MacFileHelpers::PathNameFromFSSpec( const FSSpec& inSpec )
return result;
} // MacFileHelpers::PathNameFromFSSpec
#endif
#pragma mark -
@ -566,7 +561,6 @@ char* MacFileHelpers::PathNameFromFSSpec( const FSSpec& inSpec )
// Macintosh nsFileSpec implementation
//========================================================================================
#ifndef RHAPSODY
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec()
//----------------------------------------------------------------------------------------
@ -574,7 +568,6 @@ nsFileSpec::nsFileSpec()
// NS_ASSERTION(0, "nsFileSpec is unsupported - use nsIFile!");
Clear();
}
#endif
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec(const FSSpec& inSpec, PRBool resolveAlias)
@ -598,7 +591,6 @@ void nsFileSpec::operator = (const FSSpec& inSpec)
mError = NS_OK;
}
#ifndef RHAPSODY
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec(const nsFileSpec& inSpec)
//----------------------------------------------------------------------------------------
@ -1394,8 +1386,8 @@ nsDirectoryIterator::nsDirectoryIterator(
//----------------------------------------------------------------------------------------
: mCurrent(inDirectory)
, mExists(false)
, mIndex(-1)
, mResoveSymLinks(resolveSymLinks)
, mIndex(-1)
{
CInfoPBRec pb;
OSErr err = inDirectory.GetCatInfo(pb);
@ -1472,4 +1464,3 @@ nsDirectoryIterator& nsDirectoryIterator::operator ++ ()
return *this;
} // nsDirectoryIterator::operator ++
#endif

Просмотреть файл

@ -115,4 +115,7 @@ public:
extern "C" NS_EXPORT nsresult
NS_NewLocalFileWithFSSpec(FSSpec* inSpec, PRBool followSymlinks, nsILocalFileMac* *result);
extern "C" NS_EXPORT nsresult
NS_NewLocalFile(const char* path, PRBool followLinks, nsILocalFile* *result);
#endif

Просмотреть файл

@ -40,9 +40,9 @@
#ifdef XP_WIN
#include "nsLocalFileWin.h"
#elif defined(XP_MAC) || defined(MACOSX)
#elif defined(XP_MAC) && !defined(XP_MACOSX)
#include "nsLocalFileMac.h"
#elif defined(XP_UNIX) || defined(XP_BEOS)
#elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_MACOSX)
#include "nsLocalFileUnix.h"
#elif defined(XP_OS2)
#include "nsLocalFileOS2.h"

Просмотреть файл

@ -40,7 +40,7 @@
#include "nsReadableUtils.h"
#ifdef MACOSX
#ifdef XP_MACOSX
#include "nsXPIDLString.h"
#include "private/pprio.h"
@ -75,7 +75,7 @@
// Stupid @#$% header looks like its got extern mojo but it doesn't really
extern "C"
{
#ifndef MACOSX
#ifndef XP_MACOSX
// BADPINK - this MSL header doesn't exist under macosx :-(
#include <FSp_fopen.h>
#endif
@ -1323,7 +1323,7 @@ nsLocalFile::OpenANSIFileDesc(const char *mode, FILE * *_retval)
spec = mTargetSpec;
}
#ifdef MACOSX
#ifdef XP_MACOSX
// BADPINK - FSp_fopen() doesn't exist under macosx :-(
*_retval = nsnull;
#else
@ -1677,6 +1677,22 @@ nsLocalFile::GetPath(char **_retval)
if ((*_retval)[lastChar] == ':')
(*_retval)[lastChar] = '\0';
#ifdef XP_MACOSX
// Watch out for a really big hack, coming soon to this space!
char* slashified = (char*) nsMemory::Alloc(sizeof("/Volumes/") + strlen(*_retval));
if (slashified) {
strcpy(slashified, "/Volumes/");
strcat(slashified, *_retval);
nsMemory::Free(*_retval);
*_retval = slashified;
char *colon = strchr(slashified, ':');
while (colon != NULL) {
*colon = '/';
colon = strchr(colon + 1, ':');
}
}
#endif
return NS_OK;
}

Просмотреть файл

@ -253,41 +253,63 @@ static void GetCurrentProcessDirectory(nsFileSpec& aFileSpec)
// get info for the the current process to determine the directory
// its located in
OSErr err;
ProcessSerialNumber psn;
if (!(err = GetCurrentProcess(&psn)))
ProcessSerialNumber psn = {kNoProcess, kCurrentProcess};
ProcessInfoRec pInfo;
FSSpec tempSpec;
// initialize ProcessInfoRec before calling
// GetProcessInformation() or die horribly.
pInfo.processName = nil;
pInfo.processAppSpec = &tempSpec;
pInfo.processInfoLength = sizeof(ProcessInfoRec);
if (!(err = GetProcessInformation(&psn, &pInfo)))
{
ProcessInfoRec pInfo;
FSSpec tempSpec;
FSSpec appFSSpec = *(pInfo.processAppSpec);
long theDirID = appFSSpec.parID;
// initialize ProcessInfoRec before calling
// GetProcessInformation() or die horribly.
pInfo.processName = nil;
pInfo.processAppSpec = &tempSpec;
pInfo.processInfoLength = sizeof(ProcessInfoRec);
Str255 name;
CInfoPBRec catInfo;
catInfo.dirInfo.ioCompletion = NULL;
catInfo.dirInfo.ioNamePtr = (StringPtr)&name;
catInfo.dirInfo.ioVRefNum = appFSSpec.vRefNum;
catInfo.dirInfo.ioDrDirID = theDirID;
catInfo.dirInfo.ioFDirIndex = -1; // -1 = query dir in ioDrDirID
if (!(err = GetProcessInformation(&psn, &pInfo)))
if (!(err = PBGetCatInfoSync(&catInfo)))
{
FSSpec appFSSpec = *(pInfo.processAppSpec);
long theDirID = appFSSpec.parID;
aFileSpec = nsFileSpec(appFSSpec.vRefNum,
catInfo.dirInfo.ioDrParID,
name,
PR_TRUE);
return;
}
}
#if defined(DEBUG)
else
{
// In the absence of a good way to get the executable directory let
// us try this for unix:
// - if MOZILLA_FIVE_HOME is defined, that is it
char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");
if (moz5)
{
printf( "nsSpecialSystemDirectory::MOZILLA_FIVE_HOME is set to %s\n", moz5 );
aFileSpec = moz5;
return;
}
else
{
static PRBool firstWarning = PR_TRUE;
Str255 name;
CInfoPBRec catInfo;
catInfo.dirInfo.ioCompletion = NULL;
catInfo.dirInfo.ioNamePtr = (StringPtr)&name;
catInfo.dirInfo.ioVRefNum = appFSSpec.vRefNum;
catInfo.dirInfo.ioDrDirID = theDirID;
catInfo.dirInfo.ioFDirIndex = -1; // -1 = query dir in ioDrDirID
if (!(err = PBGetCatInfoSync(&catInfo)))
{
aFileSpec = nsFileSpec(appFSSpec.vRefNum,
catInfo.dirInfo.ioDrParID,
name,
PR_TRUE);
return;
if(firstWarning) {
// Warn that MOZILLA_FIVE_HOME not set, once.
printf("***Warning: MOZILLA_FIVE_HOME not set.\n");
firstWarning = PR_FALSE;
}
}
}
#endif /* DEBUG */
#elif defined(XP_UNIX)
@ -502,7 +524,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
if (needToAppend) {
// XXX We need to unify these names across all platforms
#ifdef XP_MAC
#if defined(XP_MAC)
*this += "Component Registry";
#else
*this += "component.reg";
@ -540,7 +562,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
if (needToAppend) {
// XXX We need to unify these names across all platforms
#ifdef XP_MAC
#if defined(XP_MAC)
*this += "Components";
#else
*this += "components";
@ -567,7 +589,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
}
break;
#ifdef XP_MAC
#if defined(XP_MAC)
case Mac_SystemDirectory:
*this = kSystemFolderType;
break;
@ -827,7 +849,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
}
#endif // XP_WIN
#ifdef XP_UNIX
#if defined(XP_UNIX)
case Unix_LocalDirectory:
*this = "/usr/local/netscape/";
break;
@ -997,7 +1019,7 @@ nsSpecialSystemDirectory::Set(SystemDirectories dirToSet, nsFileSpec *dirSpec)
return;
}
#ifdef XP_MAC
#if defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsSpecialSystemDirectory::nsSpecialSystemDirectory(OSType folderType)
//----------------------------------------------------------------------------------------

Просмотреть файл

@ -29,7 +29,7 @@
#include "nscore.h"
#include "nsFileSpec.h"
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Types.h>
#endif
@ -122,7 +122,7 @@ class NS_COM nsSpecialSystemDirectory : public nsFileSpec
void operator = (SystemDirectories aSystemSystemDirectory);
#ifdef XP_MAC
#if defined(XP_MAC) || defined(XP_MACOSX)
void operator = (OSType folderType);
nsSpecialSystemDirectory(OSType folderType);
enum {

Просмотреть файл

@ -96,7 +96,7 @@ PRFileDesc* nsFileStreamHelpers::open(
if (!nspr_modes[ind])
return 0;
#ifdef XP_MAC
#if defined(XP_MAC)
// Use the file spec to open the file, because one path can be common to
// several files on the Macintosh (you can have several volumes with the
// same name, see).

Просмотреть файл

@ -214,7 +214,7 @@ CPPSRCS := xptcinvoke_ppc_netbsd.cpp xptcstubs_ppc_netbsd.cpp
ASFILES := xptcinvoke_asm_ppc_netbsd.s xptcstubs_asm_ppc_netbsd.s
endif
ifeq ($(OS_ARCH),Rhapsody)
ifeq ($(OS_ARCH),Darwin)
CPPSRCS := xptcinvoke_ppc_rhapsody.cpp xptcstubs_ppc_rhapsody.cpp
ASFILES := xptcinvoke_asm_ppc_rhapsody.s xptcstubs_asm_ppc_rhapsody.s
endif

Просмотреть файл

@ -127,7 +127,7 @@ void FilesTest::WriteStuff(nsOutputStream& s)
//----------------------------------------------------------------------------------------
{
// Initialize a URL from a string without suffix. Change the path to suit your machine.
nsFileURL fileURL("file:///Development/MPW/MPW%20Shell", PR_FALSE);
nsFileURL fileURL("file:///X/Developer/Headers", PR_FALSE);
s << "File URL initialized to: \"" << fileURL << "\""<< nsEndl;
// Initialize a Unix path from a URL
@ -147,7 +147,7 @@ void FilesTest::WriteStuff(nsOutputStream& s)
s << "File URL assigned from spec: \"" << fileURL.GetURLString() << "\""<< nsEndl;
// Assign a unix path using a string with a suffix.
filePath = "/Development/MPW/SysErrs.err";
filePath = "/X/Developer/Headers/FlatCarbon/vfp.h";
s << "File path reassigned to: \"" << (const char*)filePath << "\""<< nsEndl;
// Assign to a file spec using a unix path.

Просмотреть файл

@ -47,14 +47,14 @@
#include <kernel/OS.h>
#endif
#if defined(RHAPSODY)
#if defined(XP_MACOSX)
#undef XP_UNIX
#define XP_MAC 1
#endif
#if defined(XP_MAC)
#include <AppleEvents.h>
#if !defined(RHAPSODY)
#if !defined(DARWIN)
#include "pprthred.h"
#endif
#else

Просмотреть файл

@ -130,14 +130,14 @@
// HACK for M4, should be removed by M5
// ... its now M15
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Menus.h>
#endif
#include "nsIMenuItem.h"
#include "nsIDOMXULDocument.h"
// End hack
#if defined(XP_MAC) || defined(RHAPSODY)
#if defined(XP_MAC) || defined(XP_MACOSX)
#define USE_NATIVE_MENUS
#endif

Просмотреть файл

@ -211,6 +211,11 @@ endif
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),Darwin)
# don't let us build with "-dynamiclib"
EXTRA_DSO_LDOPTS = -execute
endif
# This code removes the console from release builds
# (unless you've set MOZ_WINCONSOLE=1).
ifndef MOZ_WINCONSOLE
@ -290,3 +295,11 @@ nsStaticComponents.cpp: nsStaticComponents.cpp.in Makefile Makefile.in $(FINAL_L
sed -e "s|%MODULE_LIST%|$(foreach m, $(_COMPONENT_LIST),MODULE($(m)),)|" \
> $@
ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
install:: $(PROGRAM)
rm -rf $(DIST)/Mozilla.app
mkdir $(DIST)/Mozilla.app
cp -R $(srcdir)/macbuild/Contents $(DIST)/Mozilla.app
cp -RL $(DIST)/bin $(DIST)/Mozilla.app/Contents/MacOS
endif

Просмотреть файл

@ -246,6 +246,24 @@ public:
};
#endif // XP_MAC
#if defined(XP_MACOSX)
static void InitializeMacOSXApp(int argc, char* argv[])
{
// use the location of the executable to learn where everything is, this
// is because the current working directory is ill-defined when the
// application is double-clicked from the Finder.
char* path = strdup(argv[0]);
char* lastSlash = strrchr(path, '/');
if (lastSlash) {
*lastSlash = '\0';
setenv("MOZILLA_FIVE_HOME", path, 1);
}
free(path);
}
#endif /* XP_MACOSX */
#ifdef MOZ_WIDGET_GTK
#include <gtk/gtk.h>
#endif //MOZ_WIDGET_GTK
@ -1527,6 +1545,10 @@ int main(int argc, char* argv[])
return 1;
#endif
#if defined(XP_MACOSX)
InitializeMacOSXApp(argc, argv);
#endif
// Handle -help and -version command line arguments.
// They should% return quick, so we deal with them here.
if (HandleDumpArguments(argc, argv))

Просмотреть файл

@ -53,6 +53,10 @@ LIBS = \
-lmozregsa_s \
$(NULL)
ifeq ($(OS_ARCH),Darwin)
LIBS += -lmacmorefiles_s
endif
DEFINES += -DSTANDALONE_REGISTRY
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -246,14 +246,12 @@ nsInstall::GetInstallPlatform(nsCString& aPlatform)
mInstallPlatform = "OS/2";
#elif defined(XP_PC)
mInstallPlatform = "Windows";
#elif defined(RHAPSODY)
#elif defined(XP_MAC) || defined(XP_MACOSX)
mInstallPlatform = "Macintosh";
#elif defined (XP_UNIX)
mInstallPlatform = "X11";
#elif defined(XP_BEOS)
mInstallPlatform = "BeOS";
#elif defined(XP_MAC)
mInstallPlatform = "Macintosh";
#endif
mInstallPlatform += "; ";