changes to let us build on MacOS X

This commit is contained in:
pavlov%netscape.com 2000-03-11 03:08:04 +00:00
Родитель 772f1f0cad
Коммит 33ce2d4e90
96 изменённых файлов: 1274 добавлений и 338 удалений

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

@ -128,6 +128,7 @@ gfx/src/ps/Makefile
gfx/src/motif/Makefile
gfx/src/photon/Makefile
gfx/src/rhapsody/Makefile
gfx/src/mac/Makefile
gfx/src/qt/Makefile
gfx/src/xlib/Makefile
gfx/src/xlibrgb/Makefile
@ -464,6 +465,7 @@ widget/src/motif/Makefile
widget/src/motif/app_context/Makefile
widget/src/photon/Makefile
widget/src/rhapsody/Makefile
widget/src/mac/Makefile
widget/src/unix_services/Makefile
widget/src/unix_services/toolkit_service/Makefile
widget/src/xlib/Makefile

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

@ -66,6 +66,10 @@ ifeq ($(OS_CONFIG),SunOS4.1)
NSPR_CFLAGS += -I$(srcdir)/../nsprpub/pr/include/md
endif
ifeq ($(OS_CONFIG),Rhapsody10.0)
NSPR_CFLAGS += -DGETCWD_CANT_MALLOC
endif
export:: $(TARGETS)
#update build number from within make script

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

@ -119,6 +119,11 @@ ifeq ($(OS_ARCH),UnixWare)
OS_ARCH := UNIXWARE
OS_RELEASE := $(shell uname -v)
endif
ifeq ($(OS_ARCH),Mac OS)
ifeq ($(OS_RELEASE),10.0)
OS_ARCH := Rhapsody
endif
endif
#
# Strip off the excessively long version numbers on these platforms,

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

@ -318,6 +318,18 @@ EXTRA_DSO_LDOPTS += -L$(DIST)/bin $(BEOS_LINK_LIBS) $(NSPR_LIBS)
endif
endif
#
# MacOS X specific stuff
#
ifeq ($(OS_ARCH),Rhapsody)
ifdef IS_COMPONENT
EXTRA_DSO_LDOPTS += -bundle
else
EXTRA_DSO_LDOPTS += -dynamiclib
endif
endif
#
# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
# which uses internal symbols first
@ -570,7 +582,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,$(OS_ARCH)))
ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Rhapsody,$(OS_ARCH)))
CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
else

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

@ -767,6 +767,20 @@ alpha*-*-osf*)
*-rhapsody*)
DLL_SUFFIX="dylib"
DSO_LDOPTS='-compatibility_version 1 -current_version 1'
AC_DEFINE(NO_X11)
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) -arch ppc $(DSO_LDOPTS)'
MKCSHLIB='$(CC) $(DSO_LDOPTS)'
MKSHLIB_FORCE_ALL=''
MKSHLIB_UNFORCE_ALL=''
;;
*-sco*)
@ -2878,6 +2892,13 @@ case "$target" in
;;
esac
# so does MacOS
case "$target" in
*-rhapsody*)
MOZ_TIMER_LIBS='$(DIST)/lib/libtimer_mac.dylib'
;;
esac
dnl ========================================================
dnl =
dnl = End MOZ_TIMER_LIBS
@ -3279,6 +3300,11 @@ elif test "$OS_TARGET" = "WINNT"; then
AC_DEFINE(XP_PC)
elif test "$OS_TARGET" = "BeOS"; then
AC_DEFINE(XP_BEOS)
elif test "$OS_TARGET" = "Mac OS"; then
AC_DEFINE(XP_UNIX)
AC_DEFINE(UNIX_EMBED)
AC_DEFINE(UNIX_LDAP)
AC_DEFINE(UNIX_ASYNC_DNS)
else
AC_DEFINE(XP_UNIX)
AC_DEFINE(UNIX_ASYNC_DNS)

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

@ -42,8 +42,10 @@ EXTRA_DSO_LDOPTS= \
$(SHARED_LIBRARY_LIBS) \
$(MKSHLIB_UNFORCE_ALL) \
-L$(DIST)/bin \
-lmozjs \
-ljsdom \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_TIMER_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -26,7 +26,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public src idl
DIRS = public idl src
ifdef ENABLE_TESTS
DIRS += tests

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

@ -32,6 +32,7 @@ XPIDL_MODULE = gfx
XPIDLSRCS = \
nsIFontEnumerator.idl \
nsIScriptableRegion.idl \
nsIGraphics.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -35,6 +35,7 @@ EXPORTS = \
nsCoord.h \
nsFont.h \
nsRect.h \
nsRepeater.h \
nsPoint.h \
nsSize.h \
nsMargin.h \

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

@ -74,6 +74,7 @@ CPPSRCS = \
nsRect.cpp \
nsTransform2D.cpp \
nsScriptableRegion.cpp \
nsGraphicsImpl.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = \

64
gfx/src/mac/Makefile.in Normal file
Просмотреть файл

@ -0,0 +1,64 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.1 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gfx_mac
MODULE = raptor
IS_COMPONENT = 1
REQUIRES = util img xpcom raptor netlib
CPPSRCS = \
nsATSUIUtils.cpp \
nsDeviceContextMac.cpp \
nsDeviceContextSpecFactoryM.cpp \
nsDeviceContextSpecMac.cpp \
nsDrawingSurfaceMac.cpp \
nsFontMetricsMac.cpp \
nsGfxFactoryMac.cpp \
nsGraphicState.cpp \
nsImageMac.cpp \
nsRegionMac.cpp \
nsRenderingContextMac.cpp \
nsUnicodeFontMappingMac.cpp \
nsUnicodeMappingUtil.cpp \
nsUnicodeRenderingToolkit.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = \
$(MKSHLIB_FORCE_ALL) \
$(MOZ_TIMER_LIBS) \
$(DIST)/lib/libimg_s.a \
$(DIST)/lib/libmozutil_s.a \
-lraptorgfx \
$(MKSHLIB_UNFORCE_ALL) \
$(TK_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(TK_CFLAGS)
CFLAGS += $(TK_CFLAGS)
INCLUDES += $(TK_CFLAGS) -I$(srcdir)/..

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

@ -247,14 +247,17 @@ ATSUTextLayout nsATSUIToolkit::GetTextLayout(short aFontNum, short aSize, PRBool
err = ::ATSUCreateTextLayoutWithTextPtr (dmy, 0,0,0,0,NULL, NULL, &txLayout);
if(noErr != err) {
NS_WARNING("ATSUCreateTextLayoutWithTextPtr failed");
goto errorDone;
// goto errorDone;
return nsnull;
}
ATSUStyle theStyle;
err = ::ATSUCreateStyle(&theStyle);
if(noErr != err) {
NS_WARNING("ATSUCreateStyle failed");
goto errorDoneDestroyTextLayout;
// goto errorDoneDestroyTextLayout;
err = ::ATSUDisposeTextLayout(txLayout);
return nsnull;
}
ATSUAttributeTag theTag[3];
@ -267,7 +270,10 @@ ATSUTextLayout nsATSUIToolkit::GetTextLayout(short aFontNum, short aSize, PRBool
err = ::ATSUFONDtoFontID(aFontNum, (StyleField)((aBold ? bold : normal) | (aItalic ? italic : normal)), &atsuFontID);
if(noErr != err) {
NS_WARNING("ATSUFONDtoFontID failed");
goto errorDoneDestroyStyle;
// goto errorDoneDestroyStyle;
err = ::ATSUDisposeStyle(theStyle);
err = ::ATSUDisposeTextLayout(txLayout);
return nsnull;
}
theTag[0] = kATSUFontTag;
@ -280,7 +286,8 @@ ATSUTextLayout nsATSUIToolkit::GetTextLayout(short aFontNum, short aSize, PRBool
short fontsize = aSize;
mContext->GetDevUnitsToAppUnits(dev2app);
Fixed size = FloatToFixed( roundf(float(fontsize) / dev2app));
// Fixed size = FloatToFixed( roundf(float(fontsize) / dev2app));
Fixed size = FloatToFixed( (float) rint(float(fontsize) / dev2app));
if( FixRound ( size ) < 9 && !nsDeviceContextMac::DisplayVerySmallFonts())
size = X2Fix(9);
@ -305,33 +312,33 @@ ATSUTextLayout nsATSUIToolkit::GetTextLayout(short aFontNum, short aSize, PRBool
err = ::ATSUSetAttributes(theStyle, 3, theTag, theValueSize, theValue);
if(noErr != err) {
NS_WARNING("ATSUSetAttributes failed");
goto errorDoneDestroyStyle;
// goto errorDoneDestroyStyle;
err = ::ATSUDisposeStyle(theStyle);
err = ::ATSUDisposeTextLayout(txLayout);
return nsnull;
}
err = ::ATSUSetRunStyle(txLayout, theStyle, kATSUFromTextBeginning, kATSUToTextEnd);
if(noErr != err) {
NS_WARNING("ATSUSetRunStyle failed");
goto errorDoneDestroyStyle;
// goto errorDoneDestroyStyle;
err = ::ATSUDisposeStyle(theStyle);
err = ::ATSUDisposeTextLayout(txLayout);
return nsnull;
}
err = ::ATSUSetTransientFontMatching(txLayout, true);
if(noErr != err) {
NS_WARNING( "ATSUSetTransientFontMatching failed");
goto errorDoneDestroyStyle;
// goto errorDoneDestroyStyle;
err = ::ATSUDisposeStyle(theStyle);
err = ::ATSUDisposeTextLayout(txLayout);
return nsnull;
}
nsATSUIUtils::gTxLayoutCache->Set(aFontNum, aSize, aBold, aItalic, aColor, txLayout);
okDone:
return txLayout;
errorDoneDestroyStyle:
err = ::ATSUDisposeStyle(theStyle);
errorDoneDestroyTextLayout:
err = ::ATSUDisposeTextLayout(txLayout);
errorDone:
return nsnull;
}
//------------------------------------------------------------------------
// PrepareToDraw
@ -397,20 +404,25 @@ NS_IMETHODIMP nsATSUIToolkit::GetWidth(
StartDraw(aCharPt, aSize, aFontNum, aBold, aItalic, aColor , savePort, aTxtLayout);
if (nsnull == aTxtLayout)
goto done;
{
// goto done;
return res;
}
OSStatus err = noErr;
ATSUTextMeasurement iAfter;
err = ATSUMeasureText( aTxtLayout, 0, 1, NULL, &iAfter, NULL, NULL );
if(noErr != err) {
NS_WARNING("ATSUMeasureText failed");
goto done1;
NS_WARNING("ATSUMeasureText failed");
// goto done1;
EndDraw(savePort);
return res;
}
oWidth = FixRound(iAfter);
res = NS_OK;
done1:
/* done1: */
EndDraw(savePort);
done:
/* done: */
return res;
}
@ -436,25 +448,28 @@ NS_IMETHODIMP nsATSUIToolkit::DrawString(
StartDraw(aCharPt, aSize, aFontNum, aBold, aItalic, aColor , savePort, aTxtLayout);
if (nsnull == aTxtLayout)
goto done;
{
return res;
}
OSStatus err = noErr;
ATSUTextMeasurement iAfter;
err = ATSUMeasureText( aTxtLayout, 0, 1, NULL, &iAfter, NULL, NULL );
if(noErr != err) {
NS_WARNING("ATSUMeasureText failed");
goto done1;
EndDraw(savePort);
return res;
}
err = ATSUDrawText( aTxtLayout, 0, 1, Long2Fix(x), Long2Fix(y));
if(noErr != err) {
NS_WARNING("ATSUDrawText failed");
goto done1;
EndDraw(savePort);
return res;
}
oWidth = FixRound(iAfter);
res = NS_OK;
done1:
EndDraw(savePort);
done:
return res;
}

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

@ -141,8 +141,11 @@ inline Boolean IsRegionRectangular ( RgnHandle rgn )
return (**rgn).rgnSize == 10;
}
inline GrafPtr GetQDGlobalsThePort ( )
{
return qd.thePort;
}
#endif /* !TARGET_CARBON */
#endif /* CarbonHelpers_h__ */
#endif /* CarbonHelpers_h__ */

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

@ -29,6 +29,8 @@
#include "nsIView.h"
#include "nsIRenderingContext.h"
#include "nsIFontEnumerator.h"
#include <Types.h>
#include <QuickDraw.h>
class nsDeviceContextMac : public DeviceContextImpl
{

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

@ -338,7 +338,7 @@ NS_EXPORT void nsFontMetricsMac::GetNativeTextStyle(nsIFontMetrics& inMetrics,
const nsIDeviceContext& inDevContext, TextStyle &outStyle)
{
nsFont *aFont;
const nsFont *aFont;
inMetrics.GetFont(aFont);
nsFontHandle fontNum;

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

@ -22,6 +22,10 @@
#include "nsImageMac.h"
#include "nsRenderingContextMac.h"
#include "nsDeviceContextMac.h"
#include "nsCarbonHelpers.h"
#include <Types.h>
#include <QuickDraw.h>
#include "nspr.h"
@ -230,6 +234,7 @@ nsImageMac::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirem
break;
case nsMaskRequirements_kNeeds8Bit:
{
mAlphaDepth = 8;
// make 8-bit grayscale color table
@ -244,6 +249,7 @@ nsImageMac::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirem
::DisposeHandle((Handle)grayRamp);
break;
}
default:
NS_NOTREACHED("Uknown mask depth");
@ -327,12 +333,16 @@ NS_IMETHODIMP nsImageMac::Draw(nsIRenderingContext &aContext, nsDrawingSurface a
// 1-bit masks?
#if !TARGET_CARBON
// can only do this if we are NOT printing
aContext.GetDeviceContext(theDevContext);
if(!theDevContext->IsPrinter()){
#endif
::CopyDeepMask((BitMap*)*imagePixMap, (BitMap*)*maskPixMap, (BitMap*)*destPixels, &srcRect, &maskRect, &dstRect, srcCopy, nsnull);
#if !TARGET_CARBON
}
#endif
}
else
{
@ -444,7 +454,10 @@ void nsImageMac::ClearGWorld(GWorldPtr theGWorld)
::SetGWorld(theGWorld, nil);
::BackColor(whiteColor);
::EraseRect(&theGWorld->portRect);
Rect portRect;
::GetPortBounds(reinterpret_cast<GrafPtr>(theGWorld), &portRect);
::EraseRect(&portRect);
::UnlockPixels(thePixels);
}

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

@ -311,7 +311,7 @@ NS_IMETHODIMP nsRegionMac::GetRects(nsRegionRectSet **aRects)
typedef struct {
short size;
Rect bbox;
short data[];
short data[0];
} ** Internal;
Internal region;

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

@ -39,6 +39,7 @@
#include <FixMath.h>
#include <Gestalt.h>
#include <Quickdraw.h>
#include "nsCarbonHelpers.h"
#define STACK_TREASHOLD 1000
@ -51,7 +52,7 @@
class StPortSetter {
public:
StPortSetter(GrafPtr newPort)
: mNewPort(newPort), mOldPort(qd.thePort)
: mNewPort(newPort), mOldPort(::GetQDGlobalsThePort())
{
if (mOldPort != newPort)
::SetPort(newPort);
@ -541,7 +542,7 @@ NS_IMETHODIMP nsRenderingContextMac::DestroyDrawingSurface(nsDrawingSurface aSur
// delete the offscreen
nsDrawingSurfaceMac* surface = static_cast<nsDrawingSurfaceMac*>(aSurface);
GWorldPtr offscreenGWorld;
surface->GetGrafPtr(&(GrafPtr)offscreenGWorld);
surface->GetGrafPtr(reinterpret_cast<GrafPtr*>(&offscreenGWorld));
::UnlockPixels(::GetGWorldPixMap(offscreenGWorld));
::DisposeGWorld(offscreenGWorld);
@ -578,8 +579,12 @@ NS_IMETHODIMP nsRenderingContextMac::Reset(void)
NS_IMETHODIMP nsRenderingContextMac::GetDeviceContext(nsIDeviceContext *&aContext)
{
NS_IF_ADDREF(mContext);
aContext = mContext;
if (mContext) {
aContext = mContext;
NS_ADDREF(aContext);
} else {
aContext = nsnull;
}
return NS_OK;
}
@ -666,7 +671,7 @@ NS_IMETHODIMP nsRenderingContextMac::GetClipRect(nsRect &aRect, PRBool &aClipVal
NS_IMETHODIMP nsRenderingContextMac::SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty)
{
RgnHandle regionH;
aRegion.GetNativeRegion(regionH);
aRegion.GetNativeRegion((void*&)regionH);
RgnHandle clipRgn = mGS->mClipRegion;
if (!clipRgn) return NS_ERROR_OUT_OF_MEMORY;

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

@ -246,7 +246,7 @@ PrefEnumCallback(const char* aName, void* aClosure)
curPrefName.Mid(langGroup, p1+1, curPrefName.Length()-p1-1);
curPrefName.Mid(genName, p2+1, p1-p2-1);
if(langGroup == "x-unicode")
if(langGroup == nsCAutoString("x-unicode"))
return;
ScriptCode script = Self->MapLangGroupToScriptCode(langGroup);
if(script >= smUninterp)

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

@ -449,7 +449,7 @@ nsresult nsUnicodeRenderingToolkit :: GetTextSegmentWidth(
#ifndef DISABLE_ATSUI_FALLBACK
// Fallback by using ATSUI
if(! fallbackDone) {
nsFont *font;
const nsFont *font;
mGS->mFontMetrics->GetFont(font);
fallbackDone = ATSUIFallbackGetWidth(aString, thisWidth, fontNum,
font->size,
@ -571,7 +571,7 @@ nsresult nsUnicodeRenderingToolkit :: DrawTextSegment(
#ifndef DISABLE_ATSUI_FALLBACK
// Fallback by using ATSUI
if(! fallbackDone) {
nsFont *font;
const nsFont *font;
mGS->mFontMetrics->GetFont(font);
fallbackDone = ATSUIFallbackDrawChar(aString, x, y, thisWidth, fontNum,
font->size,
@ -746,4 +746,4 @@ NS_IMETHODIMP nsUnicodeRenderingToolkit :: PrepareToDraw(float aP2T, nsIDeviceCo
mGS = aGS;
mPort = aPort;
return NS_OK;
}
}

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

@ -30,9 +30,10 @@ class nsGraphicState;
class nsUnicodeRenderingToolkit
{
public:
nsUnicodeRenderingToolkit() {};
~nsUnicodeRenderingToolkit() {};
public:
NS_IMETHOD PrepareToDraw(float aP2T, nsIDeviceContext* aContext, nsGraphicState* aGS, GrafPtr aPort);
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth,
PRInt32 *aFontID);

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

@ -183,10 +183,7 @@ public:
~CSharedVSContext() {
}
static CSharedVSContext& GetSharedContext() {
static CSharedVSContext gSharedVSContext;
return gSharedVSContext;
}
static CSharedVSContext& GetSharedContext();
nsCParserNode mEndNode;
nsCParserNode mStartNode;
@ -223,7 +220,12 @@ CViewSourceHTML::CViewSourceHTML() : nsIDTD(),
}
static CSharedVSContext __CSharedVSContext_gSharedVSContext;
static CSharedVSContext& CSharedVSContext::GetSharedContext()
{
return __CSharedVSContext_gSharedVSContext;
}
/**
* Default destructor

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

@ -28,16 +28,15 @@
#include "nsISupports.h"
// {CCD4D374-CCDC-11d2-B3B1-00805F8A6670}
NS_DECLARE_ID(kICharsetAliasIID,\
0xccd4d374, 0xccdc, 0x11d2, 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 );
#define NS_ICHARSETALIAS_IID \
{ 0xccd4d374, 0xccdc, 0x11d2, { 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}
static NS_DEFINE_IID(kICharsetAliasIID, NS_ICHARSETALIAS_IID);
// {98D41C21-CCF3-11d2-B3B1-00805F8A6670}
NS_DECLARE_ID(kCharsetAliasCID,\
0x98d41c21, 0xccf3, 0x11d2, 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 );
#define NS_CHARSETALIAS_CID \
{ 0x98d41c21, 0xccf3, 0x11d2, { 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}
static NS_DEFINE_IID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
#define NS_CHARSETALIAS_CID \
{ 0x98d41c21, 0xccf3, 0x11d2, { 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}

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

@ -28,12 +28,13 @@
// Interface ID for our Unicode Decoder interface
// {B2F178E1-832A-11d2-8A8E-00600811A836}
NS_DECLARE_ID(kIUnicodeDecoderIID,
0xb2f178e1, 0x832a, 0x11d2, 0x8a, 0x8e, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
//NS_DECLARE_ID(kIUnicodeDecoderIID,
// 0xb2f178e1, 0x832a, 0x11d2, 0x8a, 0x8e, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
#define NS_IUNICODEDECODER_IID \
{ 0xb2f178e1, 0x832a, 0x11d2, \
{ 0x8a, 0x8e, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
static NS_DEFINE_IID(kIUnicodeDecoderIID, NS_IUNICODEDECODER_IID);
// XXX deprecated
/*---------- BEGIN DEPRECATED */

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

@ -59,6 +59,8 @@ class nsIUnicodeEncodeHelper : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(kIUnicodeEncodeHelperIID)
/**
* Converts data using a lookup table.
*/

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

@ -29,21 +29,17 @@
// Interface ID for our Unicode Encoder interface
// {2B2CA3D0-A4C9-11d2-8AA1-00600811A836}
NS_DECLARE_ID(kIUnicodeEncoderIID,
0x2b2ca3d0, 0xa4c9, 0x11d2, 0x8a, 0xa1, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
#define NS_IUNICODEENCODER_IID \
{ 0x2b2ca3d0, 0xa4c9, 0x11d2, \
{ 0x8a, 0xa1, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
static NS_DEFINE_IID(kIUnicodeEncoderIID, NS_IUNICODEENCODER_IID);
// Interface ID for our Unicode Character Encoder interface
// {299BCCD0-C6DF-11d2-8AA8-00600811A836}
NS_DECLARE_ID(kIUnicharEncoderIID,
0x299bccd0, 0xc6df, 0x11d2, 0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
#define NS_IUNICHARENCODER_IID \
{ 0x299bccd0, 0xc6df, 0x11d2, \
{0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
static NS_DEFINE_IID(kIUnicharEncoderIID, NS_IUNICHARENCODER_IID);
#define NS_OK_UENC_EXACTLENGTH \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 0x21)

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

@ -551,7 +551,7 @@ NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeEncoder(
PL_strncpy(progid, NS_UNICODEENCODER_PROGID_BASE, 256);
aDest->ToCString(progid + baselen, 256 - baselen);
res = comMgr->CreateInstanceByProgID(progid,NULL,
kIUnicodeEncoderIID ,(void**)aResult);
NS_GET_IID(nsIUnicodeEncoder),(void**)aResult);
if(NS_FAILED(res))
res = NS_ERROR_UCONV_NOCONV;
return res;
@ -572,7 +572,7 @@ NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeDecoder(
PL_strncpy(progid, NS_UNICODEDECODER_PROGID_BASE, 256);
aSrc->ToCString(progid + baselen, 256 - baselen);
res = comMgr->CreateInstanceByProgID(progid,NULL,
kIUnicodeDecoderIID,(void**)aResult);
NS_GET_IID(nsIUnicodeDecoder),(void**)aResult);
if(NS_FAILED(res))
res = NS_ERROR_UCONV_NOCONV;
return res;

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

@ -75,7 +75,7 @@ public:
//----------------------------------------------------------------------
// Class nsUnicodeEncodeHelper [implementation]
NS_IMPL_ISUPPORTS(nsUnicodeEncodeHelper, kIUnicodeEncodeHelperIID);
NS_IMPL_ISUPPORTS1(nsUnicodeEncodeHelper, nsIUnicodeEncodeHelper)
nsUnicodeEncodeHelper::nsUnicodeEncodeHelper()
{

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

@ -62,7 +62,7 @@ nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeDecoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
NS_ADDREF_THIS();
return NS_OK;
@ -369,7 +369,7 @@ nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeEncoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeEncoder))) {
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -75,7 +75,7 @@ nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeDecoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
NS_ADDREF_THIS();
return NS_OK;
@ -382,7 +382,7 @@ nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeEncoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeEncoder))) {
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -62,7 +62,7 @@ nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeDecoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -62,7 +62,7 @@ nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeDecoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -69,7 +69,7 @@ nsresult nsUnicodeToX11Johab::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeEncoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeEncoder))) {
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -62,7 +62,7 @@ nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeDecoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -62,7 +62,7 @@ nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeDecoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -62,7 +62,7 @@ nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeDecoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
NS_ADDREF_THIS();
return NS_OK;
@ -369,7 +369,7 @@ nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIUnicodeEncoderIID)) {
if (aIID.Equals(NS_GET_IID(nsIUnicodeEncoder))) {
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
NS_ADDREF_THIS();
return NS_OK;

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

@ -37,10 +37,17 @@
const char mozJSComponentLoaderProgID[] = "moz.jsloader.1";
const char jsComponentTypeName[] = "text/javascript";
/* XXX export properly from libxpcom, for now this will let Mac build */
#ifdef RHAPSODY
extern const char fileSizeValueName[]; // = "FileSize";
extern const char lastModValueName[]; // = "LastModTimeStamp";
extern const char xpcomKeyName[]; // = "Software/Mozilla/XPCOM";
#else
const char fileSizeValueName[] = "FileSize";
const char lastModValueName[] = "LastModTimeStamp";
const char xpcomKeyName[] = "software/mozilla/XPCOM/components";
#endif
const char kJSRuntimeServiceProgID[] = "nsJSRuntimeService";
const char kXPConnectServiceProgID[] = "nsIXPConnect";

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

@ -4129,7 +4129,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
}
else if (aTag == nsXULAtoms::menubar) {
#ifdef XP_MAC // The Mac uses its native menu bar.
#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar.
aHaltProcessing = PR_TRUE;
return NS_OK;
#else

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

@ -57,7 +57,7 @@ SHARED_LIBRARY_LIBS = \
$(DIST)/lib/libraptorxmldoc_s.a \
$(DIST)/lib/libraptorxulcontent_s.a \
$(DIST)/lib/libraptorxulbase_s.a \
$(DIST)/lib/libraptorxbl_s.a \
$(DIST)/lib/libraptorxbl_s.a \
$(DIST)/lib/libraptorlayout_s.a \
$(NULL)

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

@ -4129,7 +4129,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
}
else if (aTag == nsXULAtoms::menubar) {
#ifdef XP_MAC // The Mac uses its native menu bar.
#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar.
aHaltProcessing = PR_TRUE;
return NS_OK;
#else

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

@ -32,10 +32,10 @@ IS_COMPONENT = 1
CPPSRCS = \
nsImportFactory.cpp \
nsImportService.cpp \
nsImportMail.cpp \
nsImportMailboxDescriptor.cpp \
nsImportABDescriptor.cpp \
nsImportService.cpp \
nsImportMail.cpp \
nsImportMailboxDescriptor.cpp \
nsImportABDescriptor.cpp \
nsImportAddressBooks.cpp \
nsImportStringBundle.cpp \
ImportTranslate.cpp \
@ -51,7 +51,7 @@ CPPSRCS = \
include $(topsrcdir)/config/rules.mk
EXTRA_DSO_LDOPTS = \
EXTRA_DSO_LDOPTS += \
-L$(DIST)/bin \
$(NSPR_LIBS) \
-lxpcom \

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

@ -598,6 +598,8 @@ nsHTTPHandler::InitUserAgentComponents()
// Gather platform.
#if defined(XP_PC)
mAppPlatform = "Windows";
#elif defined(RHAPSODY)
mAppPlatform = "Macintosh";
#elif defined (XP_UNIX)
mAppPlatform = "X11";
#else

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

@ -183,10 +183,7 @@ public:
~CSharedVSContext() {
}
static CSharedVSContext& GetSharedContext() {
static CSharedVSContext gSharedVSContext;
return gSharedVSContext;
}
static CSharedVSContext& GetSharedContext();
nsCParserNode mEndNode;
nsCParserNode mStartNode;
@ -223,7 +220,12 @@ CViewSourceHTML::CViewSourceHTML() : nsIDTD(),
}
static CSharedVSContext __CSharedVSContext_gSharedVSContext;
static CSharedVSContext& CSharedVSContext::GetSharedContext()
{
return __CSharedVSContext_gSharedVSContext;
}
/**
* Default destructor

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

@ -43,7 +43,6 @@ EXTRA_DSO_LDOPTS = \
$(SHARED_LIBRARY_LIBS) \
$(MKSHLIB_UNFORCE_ALL) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_TIMER_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -29,6 +29,10 @@ include $(DEPTH)/config/autoconf.mk
MODULE = raptor
LIBRARY_NAME = raptorwebwidget
ifeq ($(OS_ARCH),Rhapsody)
IS_COMPONENT = 1
endif
CPPSRCS = \
dlldeps.cpp \
nsDLLFactory.cpp \
@ -39,6 +43,7 @@ EXTRA_DSO_LDOPTS = \
$(MOZ_TIMER_LIBS) \
-L$(DIST)/bin \
-ljsdom \
-lmozjs \
$(MOZ_COMPONENT_LIBS) \
-ldocshell \
$(NULL)

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

@ -76,7 +76,7 @@ EXPORT_RESOURCE_SAMPLES := \
EXPORT_RESOURCE_THROBBER := $(wildcard $(srcdir)/throbber/anim*.gif)
ifeq (,$(filter beos os2 rhapsody photon,$(MOZ_WIDGET_TOOLKIT)))
ifeq (,$(filter beos os2 photon mac,$(MOZ_WIDGET_TOOLKIT)))
DIRS += unix
UNIX_VIEWER_TK_LIBS = unix/$(MOZ_WIDGET_TOOLKIT)/libviewer_$(MOZ_WIDGET_TOOLKIT)_s.a
else
@ -87,6 +87,9 @@ endif
ifeq ($(MOZ_WIDGET_TOOLKIT),photon)
TOOLKIT_CPPSRCS = nsPhMain.cpp nsPhMenu.cpp
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
TOOLKIT_CPPSRCS = nsMacMain.cpp
endif
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk)
@ -154,6 +157,10 @@ install::
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),Rhapsody)
INCLUDES += -I$(topsrcdir)/widget/src/mac
endif
CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS)
GARBAGE += $(PROGRAM)_gtk $(PROGRAM)_motif $(PROGRAM)_qt $(PROGRAM)_xlib

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

@ -37,9 +37,10 @@
#include <Dialogs.h>
#include "nsMacMessagePump.h" // for the windowless menu event handler
#if !TARGET_CARBON
#include "nsILeakDetector.h"
#include "macstdlibextras.h"
#endif
typedef SInt32 MessageT;
typedef PRUint32 Uint32;
@ -128,7 +129,7 @@ static nsNativeViewerApp* gTheApp;
nsNativeViewerApp::nsNativeViewerApp()
{
nsMacMessagePump::SetWindowlessMenuEventHandler(DispatchMenuItemWithoutWindow);
//nsMacMessagePump::SetWindowlessMenuEventHandler(DispatchMenuItemWithoutWindow);
}
nsNativeViewerApp::~nsNativeViewerApp()
@ -173,9 +174,9 @@ void nsNativeViewerApp::DispatchMenuItemWithoutWindow(PRInt32 menuResult)
gTheApp->OpenWindow();
break;
case cmd_Open:
nsBrowserWindow * newWindow;
gTheApp->OpenWindow(0, newWindow);
newWindow->DoFileOpen();
nsIBrowserWindow * newWindow;
gTheApp->OpenWindow((PRUint32)0, newWindow);
((nsBrowserWindow*)newWindow)->DoFileOpen();
break;
case cmd_Quit:
gTheApp->Exit();
@ -340,9 +341,11 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
case cmd_DumpLeaks:
{
nsresult rv;
#if !TARGET_CARBON
NS_WITH_SERVICE(nsILeakDetector, leakDetector, "component://netscape/xpcom/leakdetector", &rv)
if (NS_SUCCEEDED(rv))
leakDetector->DumpLeaks();
#endif
}
break;
}
@ -385,7 +388,7 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
/**
* Quit AppleEvent handler.
*/
static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, long)
static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, UInt32)
{
if (gTheApp != nsnull) {
gTheApp->Exit();
@ -400,7 +403,9 @@ static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, long)
int main(int argc, char **argv)
{
// Set up the toolbox and (if DEBUG) the console
#if !TARGET_CARBON
InitializeMacToolbox();
#endif
// Install an a Quit AppleEvent handler.
OSErr err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
@ -424,6 +429,9 @@ int main(int argc, char **argv)
NS_RELEASE(gTheApp);
}
#ifdef RHAPSODY
#undef DETECT_WEBSHELL_LEAKS
#endif
#ifdef DETECT_WEBSHELL_LEAKS
if ( unsigned long count = NS_TotalWebShellsInExistence() ) {
printf("XXX WARNING: Number of webshells being leaked: %d \n", count);

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

@ -312,10 +312,6 @@ NS_SetupRegistry()
#endif /* defined(XP_UNIX) && !defined(MOZ_MONOLITHIC_TOOLKIT) */
// WIDGET
nsComponentManager::RegisterComponentLib(kCLookAndFeelCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponentLib(kCWindowCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);

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

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

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

@ -67,6 +67,7 @@ EXPORTS = \
nsIFontRetrieverService.h \
nsIContextMenu.h \
nsIDragSessionGTK.h \
nsIDragSessionMac.h \
$(NULL)
XPIDLSRCS = \

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

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

@ -0,0 +1,73 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.1 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = widget
LIBRARY_NAME = widget_mac
IS_COMPONENT = 1
REQUIRES = util img xpcom raptorgfx
CPPSRCS = nsAppShell.cpp \
nsButton.cpp \
nsChildWindow.cpp \
nsClipboard.cpp \
nsComboBox.cpp \
nsContextMenu.cpp \
nsDeleteObserver.cpp \
nsDragService.cpp \
nsFileWidget.cpp \
nsLabel.cpp \
nsListBox.cpp \
nsLookAndFeel.cpp \
nsMacControl.cpp \
nsMacEventHandler.cpp \
nsMacMessagePump.cpp \
nsMacMessageSink.cpp \
nsMacResources.cpp \
nsMacTSMMessagePump.cpp \
nsMacWindow.cpp \
nsMenu.cpp \
nsMenuBar.cpp \
nsMenuItem.cpp \
nsMimeMapper.cpp \
$(topsrcdir)/gfx/src/mac/nsRegionMac.cpp \
nsScrollbar.cpp \
nsSound.cpp \
nsTextWidget.cpp \
nsToolkit.cpp \
nsWidgetFactory.cpp \
nsWidgetSupport.cpp \
nsWindow.cpp
include $(topsrcdir)/config/rules.mk
EXTRA_DSO_LDOPTS += \
$(MOZ_TIMER_LIBS) \
$(DIST)/lib/libraptorbasewidget_s.a \
$(TK_LIBS) \
-lraptorgfx \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
INCLUDES += $(TK_CFLAGS) -I$(topsrcdir)/gfx/src/mac -I$(srcdir)/../xpwidgets

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

@ -48,8 +48,9 @@
#include <stdlib.h>
#ifndef RHAPSODY
#include "macstdlibextras.h"
#endif
PRBool nsAppShell::mInitializedToolbox = PR_FALSE;
@ -60,7 +61,7 @@ PRBool nsAppShell::mInitializedToolbox = PR_FALSE;
//-------------------------------------------------------------------------
NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
NS_IMPL_ISUPPORTS1(nsAppShell, nsIAppShell)
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAppShell, nsIAppShell)
NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
{
@ -170,7 +171,11 @@ NS_IMETHODIMP nsAppShell::Spindown(void)
//
//-------------------------------------------------------------------------
nsAppShell::nsAppShell()
{
{
#if TARGET_CARBON
mInitializedToolbox = PR_TRUE;
#else
// The toolbox initialization code has moved to NSStdLib (InitializeToolbox)
if (!mInitializedToolbox)
@ -178,6 +183,7 @@ nsAppShell::nsAppShell()
InitializeMacToolbox();
mInitializedToolbox = PR_TRUE;
}
#endif
mRefCnt = 0;
mExitCalled = PR_FALSE;
}

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

@ -84,8 +84,13 @@ nsClipboard :: SetNativeClipboardData()
return NS_ERROR_INVALID_ARG;
nsMimeMapperMac theMapper;
#if TARGET_CARBON
::ClearCurrentScrap();
#else
::ZeroScrap();
#endif
// get flavor list that includes all flavors that can be written (including ones
// obtained through conversion)
nsCOMPtr<nsISupportsArray> flavorList;
@ -116,14 +121,20 @@ nsClipboard :: SetNativeClipboardData()
nsCOMPtr<nsISupports> genericDataWrapper;
errCode = mTransferable->GetTransferData ( flavorStr, getter_AddRefs(genericDataWrapper), &dataSize );
nsPrimitiveHelpers::CreateDataFromPrimitive ( flavorStr, genericDataWrapper, &data, dataSize );
#ifdef NS_DEBUG
#ifdef NS_DEBUG
if ( NS_FAILED(errCode) ) printf("nsClipboard:: Error getting data from transferable\n");
#endif
#endif
// stash on clipboard
#if TARGET_CARBON
ScrapRef scrap;
::GetCurrentScrap(&scrap);
::PutScrapFlavor(scrap, macOSFlavor, 0L/*???*/, dataSize, data);
#else
long numBytes = ::PutScrap ( dataSize, macOSFlavor, data );
if ( numBytes != noErr )
errCode = NS_ERROR_FAILURE;
#endif
// if the flavor was unicode, then we also need to put it on as 'TEXT' after
// doing the conversion to the platform charset.
@ -133,9 +144,15 @@ nsClipboard :: SetNativeClipboardData()
PRInt32 plainTextLen = 0;
nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText ( castedUnicode, dataSize / 2, &plainTextData, &plainTextLen );
if ( plainTextData ) {
#if TARGET_CARBON
ScrapRef scrap;
::GetCurrentScrap(&scrap);
::PutScrapFlavor( scrap, 'TEXT', 0L/*???*/, plainTextLen, plainTextData );
#else
long numTextBytes = ::PutScrap ( plainTextLen, 'TEXT', plainTextData );
if ( numTextBytes != noErr )
errCode = NS_ERROR_FAILURE;
errCode = NS_ERROR_FAILURE;
#endif
nsAllocator::Free ( plainTextData );
}
} // if unicode
@ -149,9 +166,15 @@ nsClipboard :: SetNativeClipboardData()
short mappingLen = 0;
const char* mapping = theMapper.ExportMapping(&mappingLen);
if ( mapping && mappingLen ) {
#if TARGET_CARBON
ScrapRef scrap;
::GetCurrentScrap(&scrap);
::PutScrapFlavor(scrap, nsMimeMapperMac::MappingFlavor(), 0L/*???*/, mappingLen - 1, mapping);
#else
long numBytes = ::PutScrap ( mappingLen - 1, nsMimeMapperMac::MappingFlavor(), mapping );
if ( numBytes != noErr )
errCode = NS_ERROR_FAILURE;
#endif
nsCRT::free ( NS_CONST_CAST(char*, mapping) );
}
@ -184,7 +207,7 @@ nsClipboard :: GetNativeClipboardData(nsITransferable * aTransferable)
// create a mime mapper. It's ok for this to fail because the data may come from
// another app which obviously wouldn't put our mime mapping data on the clipboard.
char* mimeMapperData = nsnull;
GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), &mimeMapperData, nsnull );
GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), (void**)&mimeMapperData, 0 );
nsMimeMapperMac theMapper ( mimeMapperData );
nsCRT::free ( mimeMapperData );
@ -241,9 +264,9 @@ nsClipboard :: GetNativeClipboardData(nsITransferable * aTransferable)
nsCOMPtr<nsISupports> genericDataWrapper;
nsPrimitiveHelpers::CreatePrimitiveForData ( flavorStr, clipboardData, dataSize, getter_AddRefs(genericDataWrapper) );
errCode = aTransferable->SetTransferData ( flavorStr, genericDataWrapper, dataSize );
#ifdef NS_DEBUG
#ifdef NS_DEBUG
if ( errCode != NS_OK ) printf("nsClipboard:: Error setting data into transferable\n");
#endif
#endif
nsAllocator::Free ( clipboardData );
// we found one, get out of this loop!
@ -268,6 +291,33 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3
// check if it is on the clipboard
long offsetUnused = 0;
#if TARGET_CARBON
ScrapRef scrap;
long dataSize;
OSStatus err;
err = ::GetCurrentScrap(&scrap);
if (err != noErr) return NS_ERROR_FAILURE;
err = ::GetScrapFlavorSize(scrap, inMacFlavor, &dataSize);
// check err??
if (dataSize > 0) {
char* dataBuff = new char[dataSize];
if ( !dataBuff )
return NS_ERROR_OUT_OF_MEMORY;
err = ::GetScrapFlavorData(scrap, inMacFlavor, &dataSize, dataBuff);
if (err != noErr) return NS_ERROR_FAILURE;
// put it into the transferable
#ifdef NS_DEBUG
if ( err != NS_OK ) printf("nsClipboard:: Error setting data into transferable\n");
#endif
if ( outDataSize )
*outDataSize = dataSize;
*outData = dataBuff;
}
#else
long clipResult = ::GetScrap(NULL, inMacFlavor, &offsetUnused);
if ( clipResult > 0 ) {
Handle dataHand = ::NewHandle(0);
@ -289,13 +339,13 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3
*outData = dataBuff;
}
else {
#ifdef NS_DEBUG
#ifdef NS_DEBUG
printf("nsClipboard: Error getting data off the clipboard, #%d\n", dataSize);
#endif
#endif
return NS_ERROR_FAILURE;
}
}
#endif /* TARGET_CARBON */
return NS_OK;
} // GetDataOffClipboard
@ -319,7 +369,7 @@ nsClipboard :: HasDataMatchingFlavors ( nsISupportsArray* aFlavorList, PRBool *
// create a mime mapper. It's ok for this to fail because the data may come from
// another app which obviously wouldn't put our mime mapping data on the clipboard.
char* mimeMapperData = nsnull;
GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), &mimeMapperData, nsnull );
GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), (void**)&mimeMapperData, 0 );
nsMimeMapperMac theMapper ( mimeMapperData );
nsAllocator::Free ( mimeMapperData );
@ -371,9 +421,23 @@ nsClipboard :: CheckIfFlavorPresent ( ResType inMacFlavor )
{
PRBool retval = PR_FALSE;
long offsetUnused = 0;
long clipResult = ::GetScrap(NULL, inMacFlavor, &offsetUnused);
#if TARGET_CARBON
ScrapRef scrap;
long dataSize;
OSStatus err;
err = ::GetCurrentScrap(&scrap);
if (err != noErr) return NS_ERROR_FAILURE;
err = ::GetScrapFlavorSize(scrap, inMacFlavor, &dataSize);
// XXX ?
if ( dataSize > 0 )
retval = PR_TRUE;
#else
long clipResult = ::GetScrap(NULL, inMacFlavor, &offsetUnused);
if ( clipResult > 0 )
retval = PR_TRUE; // we found one!
#endif
return retval;
} // CheckIfFlavorPresent

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

@ -33,6 +33,8 @@
#include "nsBaseClipboard.h"
#include "Types.h"
class nsITransferable;

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

@ -332,7 +332,7 @@ nsEventStatus nsContextMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
//PRInt16 menuItemID = LoWord(((nsMenuEvent)aMenuEvent).mCommand);
PRInt16 menuItemID = mSelectedMenuItem;
nsIMenuListener * menuListener = nsnull;
((nsIMenuItem*)mMenuItemVoidArray[menuItemID-1])->QueryInterface(NS_GET_IID(nsIMenuListener), &menuListener);
((nsIMenuItem*)mMenuItemVoidArray[menuItemID-1])->QueryInterface(NS_GET_IID(nsIMenuListener), (void**)&menuListener);
if(menuListener) {
eventStatus = menuListener->MenuSelected(aMenuEvent);
NS_IF_RELEASE(menuListener);
@ -346,11 +346,11 @@ nsEventStatus nsContextMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
if(nsnull != mMenuItemVoidArray[i-1])
{
nsIMenu * submenu = nsnull;
((nsISupports*)mMenuItemVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenu), &submenu);
((nsISupports*)mMenuItemVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenu), (void**)&submenu);
if(submenu)
{
nsIMenuListener * menuListener = nsnull;
((nsISupports*)mMenuItemVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), &menuListener);
((nsISupports*)mMenuItemVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), (void**)&menuListener);
if(menuListener){
eventStatus = menuListener->MenuSelected(aMenuEvent);
NS_IF_RELEASE(menuListener);
@ -654,4 +654,4 @@ void nsContextMenu::NSStringSetMenuItemText(MenuHandle macMenuHandle, short menu
delete [] scriptRunText;
}

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

@ -42,8 +42,9 @@
#include "nsXPIDLString.h"
#include "nsPrimitiveHelpers.h"
#if !TARGET_CARBON
DragSendDataUPP nsDragService::sDragSendDataUPP = NewDragSendDataProc(DragSendDataProc);
#endif
// we need our own stuff for MacOS because of nsIDragSessionMac.
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
@ -114,7 +115,9 @@ printf("**** created drag ref %ld\n", theDragRef);
// register drag send proc which will call us back when asked for the actual
// flavor data (instead of placing it all into the drag manager)
#if !TARGET_CARBON
::SetDragSendProc ( theDragRef, sDragSendDataUPP, this );
#endif
// start the drag. Be careful, mDragRef will be invalid AFTER this call (it is
// reset by the dragTrackingHandler).
@ -155,7 +158,7 @@ nsDragService :: BuildDragRegion ( nsIScriptableRegion* inRegion, Point inGlobal
// At the end, we are left with an outline of the region in global coordinates.
if ( geckoRegion ) {
RgnHandle dragRegion = nsnull;
geckoRegion->GetNativeRegion(dragRegion);
geckoRegion->GetNativeRegion((void*&)dragRegion);
if ( dragRegion && ioDragRgn ) {
::CopyRgn ( dragRegion, ioDragRgn );
::InsetRgn ( ioDragRgn, 1, 1 );
@ -588,7 +591,7 @@ nsDragService :: LookupMimeMappingsForItem ( DragReference inDragRef, ItemRefere
{
char* mapperData = nsnull;
PRInt32 mapperSize = 0;
ExtractDataFromOS(inDragRef, inItemRef, nsMimeMapperMac::MappingFlavor(), &mapperData, &mapperSize);
ExtractDataFromOS(inDragRef, inItemRef, nsMimeMapperMac::MappingFlavor(), (void**)&mapperData, &mapperSize);
return mapperData;

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

@ -37,7 +37,7 @@
#include "nsBaseDragService.h"
#include "nsIDragSessionMac.h"
#include <Drag.h>
#include <MacWindows.h>
class nsNativeDragTarget;

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

@ -367,8 +367,9 @@ void nsMacControl::SetupMacControlFont()
NS_PRECONDITION(mContext != nsnull, "No context metrics in SetupMacControlFont");
TextStyle theStyle;
#if !TARGET_CARBON
nsFontMetricsMac::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
#endif
// if needed, impose a min size of 9pt on the control font
if (theStyle.tsSize < 9)
theStyle.tsSize = 9;
@ -482,7 +483,9 @@ void nsMacControl::NSStringSetControlTitle(ControlHandle theControl, nsString ti
//
// determine the script of the font that the control is supposed to be drawn in
//
#if !TARGET_CARBON
nsFontMetricsMac::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
#endif
fontScript = ::FontToScript(theStyle.tsFont);
//
@ -562,9 +565,10 @@ void nsMacControl::SetupMacControlFontForScript(short theScript)
NS_PRECONDITION(mFontMetrics != nsnull, "No font metrics in SetupMacControlFont");
NS_PRECONDITION(mContext != nsnull, "No context metrics in SetupMacControlFont");
#if !TARGET_CARBON
nsFontMetricsMac::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
#endif
//
// take the script and select and override font
//
@ -605,4 +609,4 @@ void nsMacControl::GetFileSystemCharset(nsString & fileSystemCharset)
}
fileSystemCharset = aCharset;
}

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

@ -34,8 +34,9 @@
#include <Script.h>
#include "nsCarbonHelpers.h"
#include "nsIRollupListener.h"
#ifndef RHAPSODY
#include <locale>
#endif
//#define DEBUG_TSM
extern nsIRollupListener * gRollupListener;
@ -297,6 +298,7 @@ nsMacEventHandler::nsMacEventHandler(nsMacWindow* aTopLevelWidget)
// each Mac window
//
mTSMDocument = nsnull;
#if !TARGET_CARBON
supportedServices[0] = kTextService;
err = ::NewTSMDocument(1,supportedServices,&mTSMDocument,(long)this);
NS_ASSERTION(err==noErr,"nsMacEventHandler::nsMacEventHandler: NewTSMDocument failed.");
@ -304,7 +306,8 @@ nsMacEventHandler::nsMacEventHandler(nsMacWindow* aTopLevelWidget)
#ifdef DEBUG_TSM
printf("nsMacEventHandler::nsMacEventHandler: created TSMDocument[%p]\n",mTSMDocument);
#endif
#endif
mIMEIsComposing = PR_FALSE;
mIMECompositionStr=nsnull;
@ -358,6 +361,7 @@ PRBool nsMacEventHandler::HandleOSEvent ( EventRecord& aOSEvent )
break;
case osEvt:
{
unsigned char eventType = ((aOSEvent.message >> 24) & 0x00ff);
if (eventType == suspendResumeMessage)
{
@ -375,7 +379,8 @@ PRBool nsMacEventHandler::HandleOSEvent ( EventRecord& aOSEvent )
if (! mInBackground)
retVal = HandleMouseMoveEvent(aOSEvent);
}
break;
}
break;
case nullEvent:
if (! mInBackground)
@ -1157,7 +1162,7 @@ PRBool nsMacEventHandler::HandleMouseDownEvent(
ConvertOSEventToMouseEvent(aOSEvent, mouseActivateEvent, NS_MOUSE_ACTIVATE);
widgetHit->DispatchMouseEvent(mouseActivateEvent);
//if( mouseActivateEvent.acceptActivation )
//gEventDispatchHandler.SetFocus(widgetHit);
gEventDispatchHandler.SetFocus(widgetHit);
//gEventDispatchHandler.Special(widgetHit);
}
@ -1457,6 +1462,9 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr
OSErr err;
ByteCount source_read;
nsresult res = NS_OK;
long committedLen = 0;
PRUnichar* ubuf;
//====================================================================================================
// 0. Create Unicode Converter
//====================================================================================================
@ -1496,7 +1504,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr
}
// Prepare buffer....
mIMECompositionStr->SetCapacity(text_size+1);
PRUnichar* ubuf = (PRUnichar*)mIMECompositionStr->GetUnicode();
ubuf = (PRUnichar*)mIMECompositionStr->GetUnicode();
size_t len;
//====================================================================================================
@ -1505,7 +1513,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr
//====================================================================================================
// 1. Handle the committed text
//====================================================================================================
long committedLen = (fixedLength == -1) ? text_size : fixedLength;
committedLen = (fixedLength == -1) ? text_size : fixedLength;
if(0 != committedLen)
{
#ifdef DEBUG_TSM

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

@ -56,7 +56,7 @@
#include <DiskInit.h>
#include <LowMem.h>
#include <Devices.h>
#include <quickdraw.h>
#include "nsCarbonHelpers.h"
#ifndef topLeft
@ -68,9 +68,11 @@
#endif
#if DEBUG
#if !TARGET_CARBON
#include <SIOUX.h>
#include "macstdlibextras.h"
#endif
#endif
#define DRAW_ON_RESIZE 0 // if 1, enable live-resize except when the command key is down
@ -255,11 +257,12 @@ PRBool nsMacMessagePump::GetEvent(EventRecord &theEvent)
::LMSetSysEvtMask(eventMask); // we need keyUp events
PRBool haveEvent = ::WaitNextEvent(eventMask, &theEvent, sleep, mMouseRgn) ? PR_TRUE : PR_FALSE;
#if !TARGET_CARBON
if (haveEvent && TSMEvent(&theEvent) )
{
haveEvent = PR_FALSE;
}
#endif
if (mMouseRgn)
{
Point globalMouse = theEvent.where;
@ -280,8 +283,10 @@ void nsMacMessagePump::DispatchEvent(PRBool aRealEvent, EventRecord *anEvent)
{
#if DEBUG
#if !TARGET_CARBON
if (SIOUXHandleOneEvent(anEvent))
return;
#endif
#endif
switch(anEvent->what)
@ -313,6 +318,7 @@ void nsMacMessagePump::DispatchEvent(PRBool aRealEvent, EventRecord *anEvent)
break;
case osEvt:
{
unsigned char eventType = ((anEvent->message >> 24) & 0x00ff);
switch (eventType)
{
@ -328,6 +334,7 @@ void nsMacMessagePump::DispatchEvent(PRBool aRealEvent, EventRecord *anEvent)
DoMouseMove(*anEvent);
break;
}
}
break;
case kHighLevelEvent:
@ -481,10 +488,12 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
Boolean haveEvent;
EventRecord updateEvent;
haveEvent = ::WaitNextEvent(updateMask, &updateEvent, 0, nil);
#if !TARGET_CARBON
if (haveEvent && TSMEvent(&updateEvent))
{
haveEvent = PR_FALSE;
}
#endif
if (haveEvent)
DoUpdate(updateEvent);
}
@ -712,7 +721,9 @@ extern const PRInt16 kAppleMenuID; // Danger Will Robinson!!! - this currently r
::GetMenuItemText(::GetMenuHandle(kAppleMenuID), theItem, daName);
::GetPort(&savePort);
#if !TARGET_CARBON
::OpenDeskAcc(daName);
#endif
::SetPort(savePort);
}
}

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

@ -27,6 +27,9 @@
#include <map>
#include <Events.h>
#include <Windows.h>
class nsMacWindow;
/*================================================

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

@ -27,14 +27,13 @@
short nsMacResources::mRefNum = kResFileNotOpened;
short nsMacResources::mSaveResFile = 0;
#if !TARGET_CARBON
pascal OSErr __NSInitialize(const CFragInitBlock *theInitBlock);
pascal OSErr __initializeResources(const CFragInitBlock *theInitBlock);
pascal void __NSTerminate(void);
pascal void __terminateResources(void);
//----------------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------------
@ -64,6 +63,7 @@ pascal void __terminateResources(void)
__NSTerminate();
}
#endif
//----------------------------------------------------------------------------------------
//

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

@ -220,7 +220,9 @@ pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent,
long fixLength;
nsresult res;
TextRangeArray* hiliteRangePtr;
#if !TARGET_CARBON
//
// refcon stores the nsMacEventHandler
//
@ -307,6 +309,6 @@ pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent,
(void)AEDisposeDesc(&text);
(void)AEDisposeDesc(&hiliteRangeArray);
#endif
return noErr;
}

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

@ -34,6 +34,7 @@
#include "nsGUIEvent.h"
#include "nsCarbonHelpers.h"
#include <Quickdraw.h>
// Define Class IDs -- i hate having to do this
static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
@ -61,9 +62,10 @@ const short kWindowMarginWidth = 6;
const short kDialogTitleBarHeight = 26;
const short kDialogMarginWidth = 6;
#if !TARGET_CARBON
DragTrackingHandlerUPP nsMacWindow::sDragTrackingHandlerUPP = NewDragTrackingHandlerProc(DragTrackingHandler);
DragReceiveHandlerUPP nsMacWindow::sDragReceiveHandlerUPP = NewDragReceiveHandlerProc(DragReceiveHandler);
#endif
void SetDragActionBasedOnModifiers ( nsIDragService* inDragService, short inModifiers ) ;
@ -264,7 +266,8 @@ nsMacWindow::nsMacWindow() : Inherited()
, mMacEventHandler(nsnull)
, mAcceptsActivation(PR_TRUE)
{
mMacEventHandler.reset(new nsMacEventHandler(this));
//mMacEventHandler.reset(new nsMacEventHandler(this));
mMacEventHandler = (auto_ptr<nsMacEventHandler>) new nsMacEventHandler(this);
gInstanceClassName = "nsMacWindow";
}
@ -282,9 +285,10 @@ nsMacWindow::~nsMacWindow()
::DisposeWindow(mWindowPtr);
// clean up DragManager stuff
#if !TARGET_CARBON
::RemoveTrackingHandler ( sDragTrackingHandlerUPP, mWindowPtr );
::RemoveReceiveHandler ( sDragReceiveHandlerUPP, mWindowPtr );
#endif
nsMacMessageSink::RemoveRaptorWindowFromList(mWindowPtr);
mWindowPtr = nsnull;
}
@ -410,11 +414,12 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
wRect.right --;
wRect.bottom --;
#endif
if (eWindowType_popup != mWindowType)
::OffsetRect(&wRect, hOffset, vOffset + ::GetMBarHeight());
else
::OffsetRect(&wRect, hOffset, vOffset);
// HACK!!!!! This really should be part of the window manager
// Make sure window bottom of window doesn't exceed max monitor size
Rect tempRect;
@ -425,7 +430,6 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
bottomPinDelta = wRect.bottom - tempRect.bottom;
wRect.bottom -= bottomPinDelta;
}
mWindowPtr = ::NewCWindow(nil, &wRect, "\p", false, wDefProcID, (WindowRef)-1, goAwayFlag, (long)nsnull);
mWindowMadeHere = PR_TRUE;
}
@ -458,6 +462,7 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
// register tracking and receive handlers with the native Drag Manager
#if !TARGET_CARBON
if ( sDragTrackingHandlerUPP ) {
OSErr result = ::InstallTrackingHandler ( sDragTrackingHandlerUPP, mWindowPtr, this );
NS_ASSERTION ( result == noErr, "can't install drag tracking handler");
@ -466,7 +471,7 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
OSErr result = ::InstallReceiveHandler ( sDragReceiveHandlerUPP, mWindowPtr, this );
NS_ASSERTION ( result == noErr, "can't install drag receive handler");
}
#endif
return NS_OK;
}
@ -588,6 +593,7 @@ NS_IMETHODIMP nsMacWindow::Move(PRInt32 aX, PRInt32 aY)
Rect portBounds;
::GetWindowPortBounds(mWindowPtr, &portBounds);
short windowWidth = portBounds.right - portBounds.left;
if (aX <= screenRect.left - windowWidth)
aX = screenRect.left;
else if (aX >= screenWidth)

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

@ -213,6 +213,7 @@ NS_METHOD nsMenu::SetLabel(const nsString &aText)
//mMacMenuHandle = NSStringNewChildMenu(mMacMenuID, mLabel);
mMacMenuHandle = ::GetMenuHandle(mMacMenuID);
} else {
#if !TARGET_CARBON
// Look at the label and figure out if it is the "Help" menu
if(mDOMElement) {
@ -223,7 +224,7 @@ NS_METHOD nsMenu::SetLabel(const nsString &aText)
::HMGetHelpMenuHandle(&mMacMenuHandle);
mMacMenuID = kHMHelpMenuID;
int numHelpItems = ::CountMItems(mMacMenuHandle);
int numHelpItems = ::CountMenuItems(mMacMenuHandle);
if ( mHelpMenuOSItemsCount == 0)
mHelpMenuOSItemsCount = numHelpItems;
for(int i=0; i<numHelpItems; ++i) {
@ -233,7 +234,7 @@ NS_METHOD nsMenu::SetLabel(const nsString &aText)
return NS_OK;
}
}
#endif
mMacMenuHandle = NSStringNewMenu(mMacMenuIDCount, mLabel);
mMacMenuID = mMacMenuIDCount;
#if DEBUG_saari
@ -242,6 +243,7 @@ NS_METHOD nsMenu::SetLabel(const nsString &aText)
#endif
mMacMenuIDCount++;
#if !TARGET_CARBON
// Replace standard MDEF with our stub MDEF
if(mMacMenuHandle) {
SInt8 state = ::HGetState((Handle)mMacMenuHandle);
@ -250,6 +252,7 @@ NS_METHOD nsMenu::SetLabel(const nsString &aText)
(**mMacMenuHandle).menuProc = gMDEF;
::HSetState((Handle)mMacMenuHandle, state);
}
#endif
}
//printf("MacMenuID = %d", mMacMenuID);
@ -349,9 +352,9 @@ NS_METHOD nsMenu::AddMenuItem(nsIMenuItem * aMenuItem)
PRBool isChecked;
aMenuItem->GetChecked(&isChecked);
if(isChecked)
::CheckItem(mMacMenuHandle, currItemIndex, true);
::CheckMenuItem(mMacMenuHandle, currItemIndex, true);
else
::CheckItem(mMacMenuHandle, currItemIndex, false);
::CheckMenuItem(mMacMenuHandle, currItemIndex, false);
}
}
return NS_OK;
@ -431,10 +434,12 @@ NS_METHOD nsMenu::RemoveItem(const PRUint32 aPos)
NS_METHOD nsMenu::RemoveAll()
{
#ifdef notdef
#if !TARGET_CARBON
MenuHandle helpmh;
::HMGetHelpMenuHandle(&helpmh);
if ( helpmh != mMacMenuHandle)
helpmh = nsnull;
#endif
#endif
while(mMenuItemVoidArray.Count())
@ -551,11 +556,14 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
return nsEventStatus_eIgnore;
}
}
/* set up a default event to query with */
nsMenuEvent event;
MenuHandle handle;
#if !TARGET_CARBON
// XXX fix me for carbon!
::HMGetHelpMenuHandle(&handle);
#endif
event.mCommand = (unsigned int) handle;
/* loop through the top-level menus in the menubar */
@ -794,7 +802,7 @@ nsEventStatus nsMenu::HelpMenuConstruct(
//printf("nsMenu::MenuConstruct called for %s = %d \n", mLabel.ToNewCString(), mMacMenuHandle);
// Begin menuitem inner loop
int numHelpItems = ::CountMItems(mMacMenuHandle);
int numHelpItems = ::CountMenuItems(mMacMenuHandle);
for(int i=0; i<numHelpItems; ++i)
mMenuItemVoidArray.AppendElement(nsnull);
@ -906,9 +914,9 @@ NS_METHOD nsMenu::SetEnabled(PRBool aIsEnabled)
// this menu (which would be bad).
if ( gCurrentMenuDepth < 2 ) {
if ( aIsEnabled )
::EnableItem(mMacMenuHandle, 0);
::EnableMenuItem(mMacMenuHandle, 0);
else
::DisableItem(mMacMenuHandle, 0);
::DisableMenuItem(mMacMenuHandle, 0);
}
return NS_OK;
@ -1422,7 +1430,7 @@ nsMenu::AttributeChanged(
//printf("AttributeChanged\n");
nsCOMPtr<nsIAtom> openAtom = NS_NewAtom("open");
if(aAttribute != openAtom) {
if(aAttribute != openAtom.get()) {
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
if(!element) {
@ -1437,10 +1445,10 @@ nsMenu::AttributeChanged(
return NS_OK;
}
if(aContent == contentNode){
if(aContent == contentNode.get()){
nsCOMPtr<nsIAtom> disabledAtom = NS_NewAtom("disabled");
nsCOMPtr<nsIAtom> valueAtom = NS_NewAtom("value");
if(aAttribute == disabledAtom) {
if(aAttribute == disabledAtom.get()) {
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aContent));
nsString valueString;
element->GetAttribute("disabled", valueString);
@ -1450,7 +1458,7 @@ nsMenu::AttributeChanged(
SetEnabled(PR_TRUE);
::DrawMenuBar();
} else if(aAttribute == valueAtom) {
} else if(aAttribute == valueAtom.get()) {
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aContent));
element->GetAttribute("value", mLabel);
::DeleteMenu(mMacMenuID);
@ -1458,6 +1466,7 @@ nsMenu::AttributeChanged(
mMacMenuHandle = NSStringNewMenu(mMacMenuID, mLabel);
// Replace standard MDEF with our stub MDEF
#if !TARGET_CARBON
if(mMacMenuHandle) {
SInt8 state = ::HGetState((Handle)mMacMenuHandle);
::HLock((Handle)mMacMenuHandle);
@ -1470,6 +1479,7 @@ nsMenu::AttributeChanged(
mMenuBarParent->SetNativeData(::GetMenuBar());
::DrawMenuBar();
}
#endif
}
}
@ -1733,4 +1743,4 @@ MenuHelpers :: WebShellToPresContext ( nsIWebShell* inWebShell, nsIPresContext**
return retval;
} // WebShellToPresContext
} // WebShellToPresContext

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

@ -58,7 +58,9 @@ MenuHandle gLevel3HierMenu = nsnull;
MenuHandle gLevel4HierMenu = nsnull;
MenuHandle gLevel5HierMenu = nsnull;
#if !TARGET_CARBON
extern nsVoidArray gPreviousMenuStack;
#endif
extern PRInt16 gCurrentMenuDepth;
// #if APPLE_MENU_HACK
@ -95,7 +97,7 @@ nsEventStatus nsMenuBar::MenuItemSelected(const nsMenuEvent & aMenuEvent)
for (int i = mMenuVoidArray.Count(); i > 0; --i)
{
nsIMenuListener * menuListener = nsnull;
((nsISupports*)mMenuVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), &menuListener);
((nsISupports*)mMenuVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), (void**)&menuListener);
if(menuListener){
eventStatus = menuListener->MenuItemSelected(aMenuEvent);
NS_RELEASE(menuListener);
@ -113,11 +115,12 @@ nsEventStatus nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent)
nsEventStatus eventStatus = nsEventStatus_eIgnore;
nsIMenuListener * menuListener = nsnull;
//((nsISupports*)mMenuVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), &menuListener);
//((nsISupports*)mMenuVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), (void**)&menuListener);
//printf("gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count());
#if !TARGET_CARBON
if (gPreviousMenuStack[gPreviousMenuStack.Count() - 1])
((nsIMenu*)gPreviousMenuStack[gPreviousMenuStack.Count() - 1])->QueryInterface(NS_GET_IID(nsIMenuListener), &menuListener);
((nsIMenu*)gPreviousMenuStack[gPreviousMenuStack.Count() - 1])->QueryInterface(NS_GET_IID(nsIMenuListener), (void**)&menuListener);
#endif
if (menuListener) {
//TODO: MenuSelected is the right thing to call...
//eventStatus = menuListener->MenuSelected(aMenuEvent);
@ -129,7 +132,7 @@ nsEventStatus nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent)
// If it's the help menu, gPreviousMenuStack won't be accurate so we need to get the listener a different way
// We'll do it the old fashioned way of looping through and finding it
for (int i = mMenuVoidArray.Count(); i > 0; --i) {
((nsISupports*)mMenuVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), &menuListener);
((nsISupports*)mMenuVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), (void**)&menuListener);
if (menuListener) {
//TODO: MenuSelected is the right thing to call...
//eventStatus = menuListener->MenuSelected(aMenuEvent);
@ -170,6 +173,7 @@ nsEventStatus nsMenuBar::MenuConstruct(
MenuHandle macMenuHandle = ::NewMenu(2, "\psubmenu");
if(macMenuHandle) {
gLevel2HierMenu = macMenuHandle;
#if !TARGET_CARBON
SInt8 state = ::HGetState((Handle)macMenuHandle);
::HLock((Handle)macMenuHandle);
gSystemMDEFHandle = (**macMenuHandle).menuProc;
@ -177,12 +181,14 @@ nsEventStatus nsMenuBar::MenuConstruct(
(**macMenuHandle).menuWidth = -1;
(**macMenuHandle).menuHeight = -1;
::HSetState((Handle)macMenuHandle, state);
#endif
::InsertMenu(macMenuHandle, hierMenu);
}
macMenuHandle = ::NewMenu(3, "\psubmenu");
if(macMenuHandle) {
gLevel3HierMenu = macMenuHandle;
#if !TARGET_CARBON
SInt8 state = ::HGetState((Handle)macMenuHandle);
::HLock((Handle)macMenuHandle);
gSystemMDEFHandle = (**macMenuHandle).menuProc;
@ -190,12 +196,14 @@ nsEventStatus nsMenuBar::MenuConstruct(
(**macMenuHandle).menuWidth = -1;
(**macMenuHandle).menuHeight = -1;
::HSetState((Handle)macMenuHandle, state);
#endif
::InsertMenu(macMenuHandle, hierMenu);
}
macMenuHandle = ::NewMenu(4, "\psubmenu");
if(macMenuHandle) {
gLevel4HierMenu = macMenuHandle;
#if !TARGET_CARBON
SInt8 state = ::HGetState((Handle)macMenuHandle);
::HLock((Handle)macMenuHandle);
gSystemMDEFHandle = (**macMenuHandle).menuProc;
@ -203,12 +211,14 @@ nsEventStatus nsMenuBar::MenuConstruct(
(**macMenuHandle).menuWidth = -1;
(**macMenuHandle).menuHeight = -1;
::HSetState((Handle)macMenuHandle, state);
#endif
::InsertMenu(macMenuHandle, hierMenu);
}
macMenuHandle = ::NewMenu(5, "\psubmenu");
if(macMenuHandle) {
gLevel5HierMenu = macMenuHandle;
#if !TARGET_CARBON
SInt8 state = ::HGetState((Handle)macMenuHandle);
::HLock((Handle)macMenuHandle);
gSystemMDEFHandle = (**macMenuHandle).menuProc;
@ -216,6 +226,7 @@ nsEventStatus nsMenuBar::MenuConstruct(
(**macMenuHandle).menuWidth = -1;
(**macMenuHandle).menuHeight = -1;
::HSetState((Handle)macMenuHandle, state);
#endif
::InsertMenu(macMenuHandle, hierMenu);
}
} else {
@ -281,7 +292,9 @@ nsEventStatus nsMenuBar::MenuConstruct(
if(menuIDstring == "menu_Help") {
nsMenuEvent event;
MenuHandle handle;
#ifndef RHAPSODY
::HMGetHelpMenuHandle(&handle);
#endif
event.mCommand = (unsigned int) handle;
nsCOMPtr<nsIMenuListener> listener(do_QueryInterface(pnsMenu));
listener->MenuSelected(event);
@ -333,8 +346,9 @@ nsEventStatus nsMenuBar::MenuDestruct(const nsMenuEvent & aMenuEvent)
nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
{
gCurrentMenuDepth = 1;
#if !TARGET_CARBON
nsPreviousMenuStackUnwind(nsnull, nsnull);
#endif
NS_INIT_REFCNT();
mNumMenus = 0;
mParent = nsnull;
@ -342,9 +356,11 @@ nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
mWebShell = nsnull;
mDOMNode = nsnull;
#if !TARGET_CARBON
MenuDefUPP mdef = NewMenuDefProc( nsDynamicMDEFMain );
InstallDefProc((short)nsMacResources::GetLocalResourceFile(), (ResType)'MDEF', (short)128, (Ptr) mdef );
#endif
mOriginalMacMBarHandle = nsnull;
mMacMBarHandle = nsnull;
@ -433,7 +449,7 @@ NS_METHOD nsMenuBar::AddMenu(nsIMenu * aMenu)
#endif
MenuHandle menuHandle = nsnull;
aMenu->GetNativeData(&menuHandle);
aMenu->GetNativeData((void**)&menuHandle);
mNumMenus++;
PRBool helpMenu;
@ -512,9 +528,10 @@ NS_METHOD nsMenuBar::Paint()
((nsIMenu*)mMenuVoidArray[i])->IsHelpMenu(&isHelpMenu);
if(isHelpMenu){
MenuHandle helpMenuHandle;
#if !TARGET_CARBON
::HMGetHelpMenuHandle(&helpMenuHandle);
((nsIMenu*)mMenuVoidArray[i])->SetNativeData((void*)helpMenuHandle);
#endif
nsMenuEvent event;
event.mCommand = (unsigned int) helpMenuHandle;
nsCOMPtr<nsIMenuListener> listener(do_QueryInterface((nsIMenu*)mMenuVoidArray[i]));

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

@ -27,6 +27,8 @@
#include "nsIMenuListener.h"
#include "nsVoidArray.h"
#include "Types.h"
extern nsIMenuBar * gMacMenubar;
class nsIWidget;

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

@ -250,7 +250,7 @@ nsEventStatus nsMenuItem::MenuItemSelected(const nsMenuEvent & aMenuEvent)
parent->GetFirstChild(getter_AddRefs(currSibling));
while ( currSibling ) {
// skip this node
if ( currSibling != mDOMNode ) {
if ( currSibling.get() != mDOMNode ) {
nsCOMPtr<nsIDOMElement> currElement = do_QueryInterface(currSibling);
if ( !currElement )
break;
@ -427,4 +427,4 @@ NS_METHOD nsMenuItem::GetShortcutChar(nsString &aText)
nsresult res = NS_OK;
aText = mKeyEquivalent;
return res;
}
}

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

@ -51,6 +51,7 @@
#define nsMimeMapper_h__
#include <vector>
#include <Types.h>
#include "nsString.h"

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

@ -76,6 +76,7 @@ NS_METHOD nsSound::Beep()
// this currently does no cacheing of the sound buffer. It should
NS_METHOD nsSound::Play(nsIURI *aURI)
{
#if !TARGET_CARBON
nsresult rv;
nsCOMPtr<nsIInputStream> inputStream;
@ -127,11 +128,13 @@ NS_METHOD nsSound::Play(nsIURI *aURI)
rv = PlaySound(dataHandle, writeOffset);
::DisposeHandle(dataHandle);
#endif
return NS_OK;
}
nsresult nsSound::PlaySound(Handle waveDataHandle, long waveDataSize)
{
#if !TARGET_CARBON
Handle dataRef = nil;
Movie movie = nil;
MovieImportComponent miComponent = nil;
@ -194,4 +197,7 @@ bail: // gasp, a goto label
::DisposeMovie(movie);
return (err == noErr) ? NS_OK : NS_ERROR_FAILURE;
#else
return NS_OK;
#endif
}

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

@ -1,98 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsTextAreaWidget_h__
#define nsTextAreaWidget_h__
#include "nsWindow.h"
#include "nsITextAreaWidget.h"
#include "WASTE.h"
#include "nsRepeater.h"
/**
* Native Mac single line edit control wrapper.
*/
class nsTextAreaWidget : public nsWindow, public nsITextAreaWidget, public Repeater
{
private:
typedef nsWindow Inherited;
public:
nsTextAreaWidget();
virtual ~nsTextAreaWidget();
NS_IMETHOD Create(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext = nsnull,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
NS_IMETHOD Destroy();
NS_IMETHOD Show(PRBool aState);
// nsISupports
NS_IMETHOD_(nsrefcnt) AddRef();
NS_IMETHOD_(nsrefcnt) Release();
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsITextAreaWidget interface
NS_IMETHOD SelectAll();
NS_IMETHOD SetMaxTextLength(PRUint32 aChars);
NS_IMETHOD GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize);
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize);
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize);
NS_IMETHOD RemoveText();
NS_IMETHOD SetPassword(PRBool aIsPassword);
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag);
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel);
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel);
NS_IMETHOD SetCaretPosition(PRUint32 aPosition);
NS_IMETHOD GetCaretPosition(PRUint32& aPosition);
NS_IMETHOD Resize(PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY,PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
virtual PRBool OnPaint(nsPaintEvent & aEvent);
// nsWindow Interface
virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent);
virtual PRBool DispatchWindowEvent(nsGUIEvent& event);
// Repeater interface
virtual void RepeatAction(const EventRecord& inMacEvent);
void PrimitiveKeyDown(PRInt16 aKey,PRInt16 aModifiers);
protected:
PRBool mIsPasswordCallBacksInstalled;
private:
PRBool mMakeReadOnly;
PRBool mMakePassword;
WEReference mTE_Data;
};
#endif // nsTextAreaWidget_h__

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

@ -155,6 +155,8 @@ PRBool nsTextWidget::DispatchMouseEvent(nsMouseEvent &aEvent)
{
PRBool eventHandled = nsWindow::DispatchMouseEvent(aEvent); // we don't want the 'Inherited' nsMacControl behavior
EventRecord* theOSEvent;
if ((! eventHandled) && (mControl != nsnull))
{
switch (aEvent.message)
@ -166,7 +168,7 @@ PRBool nsTextWidget::DispatchMouseEvent(nsMouseEvent &aEvent)
thePoint.v = aEvent.point.y;
short theModifiers;
EventRecord* theOSEvent = (EventRecord*)aEvent.nativeMsg;
theOSEvent = (EventRecord*)aEvent.nativeMsg;
if (theOSEvent)
{
theModifiers = theOSEvent->modifiers;
@ -287,9 +289,15 @@ PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
selection.ToCString(cRepOfSelection.get(), selectionLen + 1);
// copy it to the scrapMgr
#if TARGET_CARBON
::ClearCurrentScrap();
ScrapRef scrap;
::GetCurrentScrap(&scrap);
::PutScrapFlavor(scrap, 'TEXT', 0L /* ??? */, selectionLen, cRepOfSelection.get());
#else
::ZeroScrap();
::PutScrap ( selectionLen, 'TEXT', cRepOfSelection.get() );
#endif
// if we're cutting, remove the text from the widget
if ( menuItem == cmd_Cut ) {
unused = 0;
@ -305,9 +313,20 @@ PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
case cmd_Paste:
{
long scrapOffset;
Handle scrapH = ::NewHandle(0);
Handle scrapH = ::NewHandle(0);
#if TARGET_CARBON
ScrapRef scrap;
OSStatus err;
err = ::GetCurrentScrap(&scrap);
if (err != noErr) return NS_ERROR_FAILURE;
err = ::GetScrapFlavorSize(scrap, 'TEXT', &scrapOffset);
// XXX uhh.. i don't think this is right..
long scrapLen = scrapOffset;
if ( scrapOffset > 0 )
#else
long scrapLen = ::GetScrap(scrapH, 'TEXT', &scrapOffset);
if (scrapLen > 0)
#endif
{
::HLock(scrapH);

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

@ -105,7 +105,7 @@ void nsMacNSPREventQueueHandler::RepeatAction(const EventRecord& inMacEvent)
#pragma mark -
NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit);
NS_IMPL_THREADSAFE_ISUPPORTS1(nsToolkit, nsIToolkit);
//-------------------------------------------------------------------------
//

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

@ -65,6 +65,11 @@ static Boolean gNotificationInstalled = false;
// #define PAINT_DEBUGGING
// #define BLINK_DEBUGGING
#if TARGET_CARBON
#undef PAINT_DEBUGGING
#undef BLINK_DEBUGGING
#endif
#ifdef BLINK_DEBUGGING
static void blinkRect(Rect* r);
static void blinkRgn(RgnHandle rgn);
@ -1077,9 +1082,13 @@ NS_IMETHODIMP nsWindow::Update()
static Boolean control_key_down()
{
#if TARGET_CARBON
return PR_FALSE;
#else
EventRecord event;
::OSEventAvail(0, &event);
return (event.modifiers & controlKey) != 0;
#endif
}
static long long microseconds()
@ -1286,7 +1295,23 @@ nsWindow :: ScrollBits ( Rect & inRectToScroll, PRInt32 inLeftDelta, PRInt32 inT
if ( !updateRgn ) return;
::RectRgn(updateRgn, &frame);
::DiffRgn (updateRgn, destRgn, updateRgn);
#if TARGET_CARBON
RgnHandle visRgn = ::NewRgn();
::GetPortVisibleRegion(::GetWindowPort(mWindowPtr), visRgn);
if (::EmptyRgn(visRgn))
{
PixMapHandle portPixH = ::GetPortPixMap(::GetWindowPort(mWindowPtr));
::HLock((Handle) portPixH);
::CopyBits ( *((BitMapHandle) portPixH),
*((BitMapHandle) portPixH),
&source,
&dest,
srcCopy,
nil);
::HUnlock((Handle) portPixH);
}
#else
if(::EmptyRgn(mWindowPtr->visRgn))
{
::CopyBits (
@ -1297,12 +1322,18 @@ nsWindow :: ScrollBits ( Rect & inRectToScroll, PRInt32 inLeftDelta, PRInt32 inT
srcCopy,
nil);
}
#endif
else
{
// compute the non-visable region
StRegionFromPool nonVisableRgn;
if ( !nonVisableRgn ) return;
::DiffRgn ( totalVisRgn, mWindowPtr->visRgn, nonVisableRgn );
#if TARGET_CARBON
::DiffRgn ( totalVisRgn, visRgn, nonVisableRgn );
#else
::DiffRgn ( totalVisRgn, mWindowPtr->visRgn, nonVisableRgn );
#endif
// compute the extra area that may need to be updated
// scoll the non-visable region to determine what needs updating
@ -1319,7 +1350,17 @@ nsWindow :: ScrollBits ( Rect & inRectToScroll, PRInt32 inLeftDelta, PRInt32 inT
::RGBForeColor(&black);
::RGBBackColor(&white);
::PenNormal();
#if TARGET_CARBON
PixMapHandle portPixH = ::GetPortPixMap(::GetWindowPort(mWindowPtr));
::HLock((Handle) portPixH);
::CopyBits ( *((BitMapHandle) portPixH),
*((BitMapHandle) portPixH),
&source,
&dest,
srcCopy,
copyMaskRgn);
::HUnlock((Handle) portPixH);
#else
::CopyBits (
&mWindowPtr->portBits,
&mWindowPtr->portBits,
@ -1327,11 +1368,15 @@ nsWindow :: ScrollBits ( Rect & inRectToScroll, PRInt32 inLeftDelta, PRInt32 inT
&dest,
srcCopy,
copyMaskRgn);
#endif
// union the update regions together and invalidate them
::UnionRgn(nonVisableRgn, updateRgn, updateRgn);
}
#if TARGET_CARBON
::DisposeRgn(visRgn);
#endif
::InvalWindowRgn(mWindowPtr, updateRgn);
}
@ -1345,16 +1390,18 @@ NS_IMETHODIMP nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
{
if (! mVisible)
return NS_OK;
nsRect scrollRect;
// If the clipping region is non-rectangular, just force a full update, sorry.
if (IsRegionComplex(mWindowRegion)) {
// XXX ?
if (!IsRegionRectangular(mWindowRegion)) {
Invalidate(PR_TRUE);
goto scrollChildren;
}
//--------
// Scroll this widget
nsRect scrollRect;
if (aClipRect)
scrollRect = *aClipRect;
else

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

@ -36,6 +36,8 @@
#include "nsIMenuBar.h"
#include "nsplugindefs.h"
#include <QuickDraw.h>
#define NSRGB_2_COLOREF(color) \
RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))

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

@ -1,36 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifneq (,$(filter beos os2 rhapsody,$(MOZ_WIDGET_TOOLKIT)))
DIRS = $(MOZ_WIDGET_TOOLKIT)
else
DIRS = unix
endif
include $(topsrcdir)/config/rules.mk

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

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

@ -0,0 +1,43 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.1 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = timer
LIBRARY_NAME = timer_mac
REQUIRES = xpcom
EXPORTS = $(srcdir)/../unix/nsUnixTimerCIID.h
CPPSRCS = nsTimer.cpp $(topsrcdir)/gfx/src/mac/nsRepeater.cpp
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_TIMER
EXTRA_DSO_LDOPTS+= \
$(SHARED_LIBRARY_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(TK_LIBS) \
$(NULL)
INCLUDES += $(TK_CFLAGS) -I../../../public

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

@ -58,6 +58,7 @@ ifdef MOZ_ENABLE_PHOTON
DIRS += photon
endif
override NO_SHARED_LIB=1
override NO_STATIC_LIB=

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

@ -29,8 +29,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = xpcom
LIBRARY_NAME = xpcom
REQUIRES = xpcom
CPPSRCS = nsXPComInit.cpp
SHARED_LIBRARY_LIBS = \

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

@ -681,7 +681,6 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when,
PRBool validExtension = PR_FALSE;
#ifdef 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);

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

@ -36,9 +36,14 @@
{ 0x1a180f60, 0x93b2, 0x11d2, \
{ 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } }
#define NS_IPERSISTENTPROPERTIES_CID \
{ 0x2245e573, 0x9464, 0x11d2, \
{ 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } }
// {2245E573-9464-11d2-9B8B-00805F8A16D9}
NS_DECLARE_ID(kPersistentPropertiesCID,
0x2245e573, 0x9464, 0x11d2, 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9);
//NS_DECLARE_ID(kPersistentPropertiesCID,
// 0x2245e573, 0x9464, 0x11d2, 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9);
static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID);
#define NS_PERSISTENTPROPERTIES_PROGID "component://netscape/persistent-properties"
#define NS_PERSISTENTPROPERTIES_CLASSNAME "Persistent Properties"
@ -73,8 +78,12 @@ public:
{ 0xa4, 0x30, 0x0, 0x60, 0xb0, 0xeb, 0x59, 0x63 } }
// {579C0568-0E1B-11d3-A430-0060B0EB5963}
NS_DECLARE_ID(kPropertyElementCID,
0x579c0568, 0xe1b, 0x11d3, 0xa4, 0x30, 0x0, 0x60, 0xb0, 0xeb, 0x59, 0x63);
//NS_DECLARE_ID(kPropertyElementCID,
// 0x579c0568, 0xe1b, 0x11d3, 0xa4, 0x30, 0x0, 0x60, 0xb0, 0xeb, 0x59, 0x63);
#define NS_IPROPERTYELEMENT_CID \
{ 0x579c0568, 0xe1b, 0x11d3, \
{ 0xa4, 0x30, 0x0, 0x60, 0xb0, 0xeb, 0x59, 0x63 } }
static NS_DEFINE_CID(kPropertyElementCID, NS_IPROPERTYELEMENT_CID);
class nsIPropertyElement : public nsISupports
{

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

@ -480,6 +480,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)

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

@ -141,9 +141,11 @@
#endif
//=========================== End Compiler-specific macros ===============================
#ifdef XP_MAC
#if defined(XP_MAC) || defined(RHAPSODY)
#include <Files.h>
#elif defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS)
#endif
// this can't be elif because rhapsody needs both headers
#if defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS) || defined(RHAPSODY)
#if defined(XP_OS2)
#define INCL_DOS
#define INCL_DOSERRORS
@ -367,7 +369,7 @@ class NS_COM nsFileSpec
PRBool IsChildOf(nsFileSpec &possibleParent);
#ifdef XP_MAC
#if defined(XP_MAC) || defined(RHAPSODY)
// For Macintosh people, this is meant to be useful in its own right as a C++ version
// of the FSSpec struct.
nsFileSpec(
@ -563,7 +565,7 @@ class NS_COM nsFileSpec
friend class nsFilePath;
friend class nsFileURL;
friend class nsDirectoryIterator;
#ifdef XP_MAC
#if defined(XP_MAC) || defined(RHAPSODY)
FSSpec mSpec;
#endif
nsSimpleCharString mPath;

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

@ -29,9 +29,11 @@
#include "prtypes.h"
#include "nscore.h"
#ifndef RHAPSODY
#include "FullPath.h"
#include "FileCopy.h"
#include "MoreFilesExtras.h"
#endif
#include <Aliases.h>
#include <Folders.h>
@ -44,6 +46,7 @@
#include "nsEscape.h"
#ifndef RHAPSODY
const unsigned char* kAliasHavenFolderName = "\pnsAliasHaven";
//========================================================================================
@ -608,18 +611,22 @@ Clean:
return result;
} // MacFileHelpers::PathNameFromFSSpec
#endif
#pragma mark -
//========================================================================================
// Macintosh nsFileSpec implementation
//========================================================================================
#ifndef RHAPSODY
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec()
//----------------------------------------------------------------------------------------
{
Clear();
}
#endif
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec(const FSSpec& inSpec, PRBool resolveAlias)
@ -642,6 +649,7 @@ void nsFileSpec::operator = (const FSSpec& inSpec)
mError = NS_OK;
}
#ifndef RHAPSODY
//----------------------------------------------------------------------------------------
nsFileSpec::nsFileSpec(const nsFileSpec& inSpec)
//----------------------------------------------------------------------------------------
@ -1504,3 +1512,4 @@ nsDirectoryIterator& nsDirectoryIterator::operator ++ ()
return *this;
} // nsDirectoryIterator::operator ++
#endif

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

@ -51,10 +51,8 @@
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#ifdef __bsdi__
#undef Free
#endif
#endif
#ifdef HAVE_STATVFS
#define STATFS statvfs

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

@ -165,6 +165,11 @@ CPPSRCS := xptcinvoke_ppc_linux.cpp xptcstubs_ppc_linux.cpp
ASFILES := xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s
endif
ifeq ($(OS_ARCH),Rhapsody)
CPPSRCS := xptcinvoke_ppc_rhapsody.cpp xptcstubs_ppc_rhapsody.cpp
ASFILES := xptcinvoke_asm_ppc_rhapsody.s xptcstubs_asm_ppc_rhapsody.s
endif
######################################################################
# SPARC
######################################################################

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

@ -0,0 +1,120 @@
#
# -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
.data
.align 2
#
# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
# PRUint32 paramCount, nsXPTCVariant* params)
#
.globl __XPTC_InvokeByIndex
__XPTC_InvokeByIndex:
mflr r0
stw r31,-4(r1)
#
# save off the incoming values in the callers parameter area
#
stw r3,24(r1)
stw r4,28(r1)
stw r5,32(r1)
stw r6,36(r1)
stw r0,8(r1)
stwu r1,-136(r1)
# set up for and call 'invoke_count_words' to get new stack size
#
mr r3,r5
mr r4,r6
stwu r1,-24(r1)
bl _invoke_count_words
lwz r1,0(r1)
# nop
# prepare args for 'invoke_copy_to_stack' call
#
lwz r4,168(r1)
lwz r5,172(r1)
mr r6,r1
slwi r3,r3,2
addi r3,r3,28
mr r31,r1
sub r1,r1,r3
lwz r3,0(r31)
stw r3,0(r1)
addi r3,r1,28
# create "temporary" stack frame for _invoke_copy_to_stack to operate in.
stwu r1,-40(r1)
bl _invoke_copy_to_stack
# nop
# remove temporary stack frame.
lwz r1,0(r1)
lfd f1,0(r31)
lfd f2,8(r31)
lfd f3,16(r31)
lfd f4,24(r31)
lfd f5,32(r31)
lfd f6,40(r31)
lfd f7,48(r31)
lfd f8,56(r31)
lfd f9,64(r31)
lfd f10,72(r31)
lfd f11,80(r31)
lfd f12,88(r31)
lfd f13,96(r31)
lwz r3,160(r31)
lwz r4,0(r3)
lwz r5,164(r31)
slwi r5,r5,3
addi r5,r5,8
add r12,r5,r4
lwz r12,4(r12)
lwz r4,28(r1)
lwz r5,32(r1)
lwz r6,36(r1)
lwz r7,40(r1)
lwz r8,44(r1)
lwz r9,48(r1)
lwz r10,52(r1)
# bl .__ptr_glue
# nop
mtlr r12
blrl
mr r1,r31
lwz r0,144(r1)
addi r1,r1,136
mtlr r0
lwz r31,-4(r1)
blr

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

@ -0,0 +1,130 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* Platform specific code to invoke XPCOM methods on native objects */
#include "xptcprivate.h"
extern "C" uint32
invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s)
{
PRUint32 result = 0;
/* fprintf(stderr,"invoke_count_words(%d,%p)\n",paramCount, s);*/
for(PRUint32 i = 0; i < paramCount; i++, s++)
{
if(s->IsPtrData())
{
result++;
continue;
}
switch(s->type)
{
case nsXPTType::T_I8 :
case nsXPTType::T_I16 :
case nsXPTType::T_I32 :
result++;
break;
case nsXPTType::T_I64 :
result+=2;
break;
case nsXPTType::T_U8 :
case nsXPTType::T_U16 :
case nsXPTType::T_U32 :
result++;
break;
case nsXPTType::T_U64 :
result+=2;
break;
case nsXPTType::T_FLOAT :
result++;
break;
case nsXPTType::T_DOUBLE :
result+=2;
break;
case nsXPTType::T_BOOL :
case nsXPTType::T_CHAR :
case nsXPTType::T_WCHAR :
result++;
break;
default:
// all the others are plain pointer types
result++;
break;
}
}
return result;
}
extern "C" void
invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s, double *fprData)
{
PRUint32 fpCount = 0;
/* fprintf(stderr,"invoke_copy_to_stack(%p, %d, %p, %p)\n", d, paramCount, s, fprData);*/
for(PRUint32 i = 0; i < paramCount; i++, d++, s++)
{
if(s->IsPtrData())
{
*((void**)d) = s->ptr;
continue;
}
switch(s->type)
{
case nsXPTType::T_I8 : *((PRInt32*) d) = s->val.i8; break;
case nsXPTType::T_I16 : *((PRInt32*) d) = s->val.i16; break;
case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break;
case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break;
case nsXPTType::T_U8 : *((PRUint32*) d) = s->val.u8; break;
case nsXPTType::T_U16 : *((PRUint32*)d) = s->val.u16; break;
case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break;
case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break;
case nsXPTType::T_FLOAT : *((float*) d) = s->val.f;
if (fpCount < 13)
fprData[fpCount++] = s->val.f;
break;
case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++;
if (fpCount < 13)
fprData[fpCount++] = s->val.d;
break;
case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break;
case nsXPTType::T_CHAR : *((PRInt32*) d) = s->val.c; break;
case nsXPTType::T_WCHAR : *((PRUint32*) d) = s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)d) = s->val.p;
break;
}
}
}
extern "C" nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params);
extern "C"
XPTC_PUBLIC_API(nsresult)
XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params)
{
return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params);
}

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

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

@ -0,0 +1,260 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* Implement shared vtbl methods. */
#include "xptcprivate.h"
/*
For mac, the first 8 integral and the first 13 f.p. parameters arrive
in a separate chunk of data that has been loaded from the registers. The
args pointer has been set to the start of the parameters BEYOND the ones
arriving in registers
*/
extern "C" nsresult
PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args, PRUint32 *gprData, double *fprData)
{
#define PARAM_BUFFER_COUNT 16
#define PARAM_GPR_COUNT 7
fprintf(stderr, "PrepareAndDispatch %p, %d, %p, %p, %p\n", self, methodIndex, args, gprData, fprData);
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
nsXPTCMiniVariant* dispatchParams = NULL;
nsIInterfaceInfo* iface_info = NULL;
const nsXPTMethodInfo* info;
PRUint8 paramCount;
PRUint8 i;
nsresult result = NS_ERROR_FAILURE;
NS_ASSERTION(self,"no self");
self->GetInterfaceInfo(&iface_info);
NS_ASSERTION(iface_info,"no interface info");
iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
NS_ASSERTION(info,"no interface info");
paramCount = info->GetParamCount();
// setup variant array pointer
if(paramCount > PARAM_BUFFER_COUNT)
dispatchParams = new nsXPTCMiniVariant[paramCount];
else
dispatchParams = paramBuffer;
NS_ASSERTION(dispatchParams,"no place for params");
PRUint32* ap = args;
PRUint32 iCount = 0;
PRUint32 fpCount = 0;
for(i = 0; i < paramCount; i++)
{
const nsXPTParamInfo& param = info->GetParam(i);
const nsXPTType& type = param.GetType();
nsXPTCMiniVariant* dp = &dispatchParams[i];
if(param.IsOut() || !type.IsArithmetic())
{
if (iCount < PARAM_GPR_COUNT)
dp->val.p = (void*) gprData[iCount++];
else
dp->val.p = (void*) *ap++;
continue;
}
// else
switch(type)
{
case nsXPTType::T_I8 : if (iCount < PARAM_GPR_COUNT)
dp->val.i8 = (PRInt8) gprData[iCount++];
else
dp->val.i8 = (PRInt8) *ap++;
break;
case nsXPTType::T_I16 : if (iCount < PARAM_GPR_COUNT)
dp->val.i16 = (PRInt16) gprData[iCount++];
else
dp->val.i16 = (PRInt16) *ap++;
break;
case nsXPTType::T_I32 : if (iCount < PARAM_GPR_COUNT)
dp->val.i32 = (PRInt32) gprData[iCount++];
else
dp->val.i32 = (PRInt32) *ap++;
break;
case nsXPTType::T_I64 :
{
PRUint64 tempu64;
if (iCount & 1) iCount++; // longlongs are aligned in odd/even register pairs, eg. r5/r6
if ((iCount + 1) < PARAM_GPR_COUNT) {
tempu64 = *(PRUint64*) &gprData[iCount];
iCount += 2;
}
else {
if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack
tempu64 = *(PRUint64*) ap;
ap += 2;
}
dp->val.i64 = (PRUint64)tempu64;
}
#if 0
case nsXPTType::T_I64 : if (iCount < PARAM_GPR_COUNT)
dp->val.i64.hi = (PRInt32) gprData[iCount++];
else
dp->val.i64.hi = (PRInt32) *ap++;
if (iCount < PARAM_GPR_COUNT)
dp->val.i64.lo = (PRUint32) gprData[iCount++];
else
dp->val.i64.lo = (PRUint32) *ap++;
break;
#endif
case nsXPTType::T_U8 : if (iCount < PARAM_GPR_COUNT)
dp->val.i8 = (PRUint8) gprData[iCount++];
else
dp->val.i8 = (PRUint8) *ap++;
break;
case nsXPTType::T_U16 : if (iCount < PARAM_GPR_COUNT)
dp->val.i16 = (PRUint16) gprData[iCount++];
else
dp->val.i16 = (PRUint16) *ap++;
break;
case nsXPTType::T_U32 : if (iCount < PARAM_GPR_COUNT)
dp->val.i32 = (PRUint32) gprData[iCount++];
else
dp->val.i32 = (PRUint32) *ap++;
break;
case nsXPTType::T_U64 :
#if 0
if (iCount < PARAM_GPR_COUNT)
dp->val.i64.hi = (PRUint32) gprData[iCount++];
else
dp->val.i64.hi = (PRUint32) *ap++;
if (iCount < PARAM_GPR_COUNT)
dp->val.i64.lo = (PRUint32) gprData[iCount++];
else
dp->val.i64.lo = (PRUint32) *ap++;
#endif
{
PRUint64 tempu64;
if (iCount & 1) iCount++; // longlongs are aligned in odd/even register pairs, eg. r5/r6
if ((iCount + 1) < PARAM_GPR_COUNT) {
tempu64 = *(PRUint64*) &gprData[iCount];
iCount += 2;
}
else {
if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack
tempu64 = *(PRUint64*) ap;
ap += 2;
}
dp->val.i64 = (PRUint64)tempu64;
}
break;
case nsXPTType::T_FLOAT : if (fpCount < 13) {
dp->val.f = (float) fprData[fpCount++];
if (iCount < PARAM_GPR_COUNT)
++iCount;
else
++ap;
}
else
dp->val.f = *((float*) ap++);
break;
case nsXPTType::T_DOUBLE : if (fpCount < 13) {
dp->val.d = (double) fprData[fpCount++];
if (iCount < PARAM_GPR_COUNT)
++iCount;
else
++ap;
if (iCount < PARAM_GPR_COUNT)
++iCount;
else
++ap;
}
else {
dp->val.f = *((double*) ap);
ap += 2;
}
break;
case nsXPTType::T_BOOL : if (iCount < PARAM_GPR_COUNT)
dp->val.b = (PRBool) gprData[iCount++];
else
dp->val.b = (PRBool) *ap++;
break;
case nsXPTType::T_CHAR : if (iCount < PARAM_GPR_COUNT)
dp->val.c = (char) gprData[iCount++];
else
dp->val.c = (char) *ap++;
break;
case nsXPTType::T_WCHAR : if (iCount < PARAM_GPR_COUNT)
dp->val.wc = (wchar_t) gprData[iCount++];
else
dp->val.wc = (wchar_t) *ap++;
break;
default:
NS_ASSERTION(0, "bad type");
break;
}
}
result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
NS_RELEASE(iface_info);
if(dispatchParams != paramBuffer)
delete [] dispatchParams;
return result;
}
#if 1
//extern "C" void SharedStub();
#define STUB_ENTRY(n) \
__asm__ ( \
".data\n\t" \
".align 2\n\t" \
".globl _Stub"#n"__14nsXPTCStubBase\n" \
"_Stub"#n"__14nsXPTCStubBase:\n\t" \
"addi r12,0,"#n"\n\t" \
"b _SharedStub" \
);
#else
extern "C" nsresult SharedStub();
#define STUB_ENTRY(n) \
nsresult nsXPTCStubBase::Stub##n() \
{\
return SharedStub();\
}
#endif
#define SENTINEL_ENTRY(n) \
nsresult nsXPTCStubBase::Sentinel##n() \
{ \
NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
return NS_ERROR_NOT_IMPLEMENTED; \
}
#include "xptcstubsdef.inc"

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

@ -48,9 +48,16 @@ typedef MPARAM WPARAM,LPARAM;
#include <kernel/OS.h>
#endif
#if defined(RHAPSODY)
#undef XP_UNIX
#define XP_MAC 1
#endif
#if defined(XP_MAC)
#include <AppleEvents.h>
#if !defined(RHAPSODY)
#include "pprthred.h"
#endif
#else
#include "private/pprthred.h"
#endif /* XP_MAC */

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

@ -107,13 +107,19 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
// HACK for M4, should be removed by M5
#ifdef XP_MAC
// ... its now M15
#if defined(XP_MAC) || defined(RHAPSODY)
#include <Menus.h>
#endif
#include "nsIMenuItem.h"
#include "nsIDOMXULDocument.h"
// End hack
#if defined(XP_MAC) || defined(RHAPSODY)
#define USE_NATIVE_MENUS
#endif
#include "nsIWindowMediator.h"
#include "nsIPopupSetFrame.h"
@ -356,7 +362,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
NS_METHOD
nsWebShellWindow::Close()
{
#ifdef XP_MAC // Anyone still using native menus should add themselves here.
#ifdef USE_NATIVE_MENUS
// unregister as document listener
// this is needed for menus
nsCOMPtr<nsIContentViewer> cv;
@ -910,7 +916,7 @@ void nsWebShellWindow::DynamicLoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aP
nsMenuEvent fake;
menuListener->MenuConstruct(fake, aParentWindow, menubarNode, mWebShell);
#ifdef XP_MAC
#ifdef USE_NATIVE_MENUS
#else
// Resize around the menu.
rv = NS_ERROR_FAILURE;
@ -1017,7 +1023,8 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi
pnsMenuBar->Paint();
// HACK for M4, should be removed by M5
#ifdef XP_MAC
// ... it is now M15
#ifdef USE_NATIVE_MENUS
Handle tempMenuBar = ::GetMenuBar(); // Get a copy of the menu list
pnsMenuBar->SetNativeData((void*)tempMenuBar);
#endif
@ -1255,7 +1262,7 @@ nsWebShellWindow::OnEndDocumentLoad(nsIDocumentLoader* loader,
mLockedUntilChromeLoad = PR_FALSE;
#ifdef XP_MAC // Anyone still using native menus should add themselves here.
#ifdef USE_NATIVE_MENUS
// register as document listener
// this is needed for menus
nsCOMPtr<nsIContentViewer> cv;
@ -1277,7 +1284,7 @@ nsWebShellWindow::OnEndDocumentLoad(nsIDocumentLoader* loader,
ExecuteStartupCode();
#ifdef XP_MAC // Anyone still using native menus should add themselves here.
#ifdef USE_NATIVE_MENUS
///////////////////////////////
// Find the Menubar DOM and Load the menus, hooking them up to the loaded commands
///////////////////////////////
@ -1298,7 +1305,7 @@ nsWebShellWindow::OnEndDocumentLoad(nsIDocumentLoader* loader,
DynamicLoadMenus(menubarDOMDoc, mWindow);
#endif
}
#endif // XP_MAC
#endif // USE_NATIVE_MENUS
OnChromeLoaded();
LoadContentAreas();

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

@ -60,6 +60,10 @@ ifdef MOZ_MONOLITHIC_TOOLKIT
XP_LIBS += $(TK_LIBS)
endif
ifeq ($(OS_ARCH),Rhapsody)
DETECT_WEBSHELL_LEAKS=
endif
ifdef DETECT_WEBSHELL_LEAKS
XP_LIBS += -lraptorwebwidget -ldocshell -ljsdom
endif

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

@ -64,10 +64,15 @@
#include "nsIWebBrowserChrome.h"
#ifndef XP_MAC
#ifndef XP_MAC && !defined(RHAPSODY)
#include "nsTimeBomb.h"
#endif
#ifdef RHAPSODY
// XXX hack because we can't link against libraptorwebwidget (pav)
#undef DETECT_WEBSHELL_LEAKS
#endif
#if defined(DEBUG_sspitzer) || defined(DEBUG_seth)
#define DEBUG_CMD_LINE
#endif