Fixing most ifdefs to mean libxul instead of saying 1.8

making xulrunner link dynamically against gtkmozembed (because ajschult and
I couldn't figure out how to deal with a profiledirectorylock and we know
of no reason to have gtkmozembed linked statically).
Hopefully fixed some cast complaints smaug had (presumably they relate to
the comments "I doubt this cast pair is correct").
Tried to clean up the REQUIRES a /bit/ in an effort to address the lock
problem.

Again, thanks to ajschult for his time and assistance.
This commit is contained in:
timeless%mozdev.org 2006-12-04 10:50:02 +00:00
parent f104c342d5
commit dfa70b2595
5 changed files with 45 additions and 23 deletions

View File

@ -76,7 +76,7 @@
// for the clipboard actions we need to do
#include "nsIClipboardCommands.h"
#ifdef MOZILLA_1_8_BRANCH
#ifndef MOZ_ENABLE_LIBXUL
// for profiles
#include <nsProfileDirServiceProvider.h>
#include <nsEmbedAPI.h>
@ -169,15 +169,16 @@ PRUint32 EmbedPrivate::sWidgetCount = 0;
char *EmbedPrivate::sPath = nsnull;
char *EmbedPrivate::sCompPath = nsnull;
nsVoidArray *EmbedPrivate::sWindowList = nsnull;
#ifdef MOZ_ENABLE_LIBXUL
nsILocalFile *EmbedPrivate::sProfileDir = nsnull;
nsISupports *EmbedPrivate::sProfileLock = nsnull;
#ifdef MOZILLA_1_8_BRANCH
#else
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
char *EmbedPrivate::sProfileDirS = nsnull;
char *EmbedPrivate::sProfileName = nsnull;
nsIPref *EmbedPrivate::sPrefs = nsnull;
nsIAppShell *EmbedPrivate::sAppShell = nsnull;
nsProfileDirServiceProvider *EmbedPrivate::sProfileDirServiceProvider = nsnull;
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#endif
GtkWidget *EmbedPrivate::sOffscreenWindow = 0;
GtkWidget *EmbedPrivate::sOffscreenFixed = 0;
@ -789,7 +790,7 @@ EmbedPrivate::PushStartup(void)
} else
NS_ASSERTION(EmbedPrivate::sCompPath, "Warning: Failed to init Component Path.\n");
#ifndef MOZILLA_1_8_BRANCH
#ifdef MOZ_ENABLE_LIBXUL
const char *grePath = sPath;
NS_ASSERTION(grePath, "Warning: Failed to init grePath.\n");
@ -816,6 +817,7 @@ EmbedPrivate::PushStartup(void)
if (EmbedPrivate::sProfileDir) {
XRE_NotifyProfile();
}
#else
rv = NS_InitEmbedding(binDir, sAppFileLocProvider);
@ -839,8 +841,10 @@ EmbedPrivate::PushStartup(void)
}
sAppShell = appShell.get();
NS_ADDREF(sAppShell);
#ifdef MOZILLA_1_8_BRANCH
sAppShell->Create(0, nsnull);
sAppShell->Spinup();
#endif
#endif
rv = RegisterAppComponents();
@ -857,20 +861,22 @@ EmbedPrivate::PopStartup(void)
// destroy the offscreen window
DestroyOffscreenWindow();
#ifdef MOZILLA_1_8_BRANCH
#ifndef MOZ_ENABLE_LIBXUL
// shut down the profiles
ShutdownProfile();
if (sAppShell) {
#ifdef MOZILLA_1_8_BRANCH
// Shutdown the appshell service.
sAppShell->Spindown();
#endif
NS_RELEASE(sAppShell);
sAppShell = 0;
}
// shut down XPCOM/Embedding
NS_TermEmbedding();
#endif
#else
// we no longer need a reference to the DirectoryServiceProvider
if (EmbedPrivate::sAppFileLocProvider) {
@ -880,6 +886,7 @@ EmbedPrivate::PopStartup(void)
// shut down XPCOM/Embedding
XRE_TermEmbedding();
#endif
EmbedGlobalHistory::DeleteInstance();
}
}
@ -925,11 +932,13 @@ EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
NS_ERROR("Cannot change profile directory during run.");
return;
}
#ifdef MOZ_ENABLE_LIBXUL
NS_RELEASE(EmbedPrivate::sProfileDir);
NS_RELEASE(EmbedPrivate::sProfileLock);
#endif
}
#ifdef MOZ_ENABLE_LIBXUL
nsresult rv =
NS_NewNativeLocalFile(nsDependentCString(aDir), PR_TRUE, &EmbedPrivate::sProfileDir);
@ -941,11 +950,8 @@ EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
if (!exists) {
rv = EmbedPrivate::sProfileDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
}
#ifndef MOZILLA_1_8_BRANCH
rv = XRE_LockProfileDirectory(EmbedPrivate::sProfileDir, &EmbedPrivate::sProfileLock);
#endif
}
#ifndef MOZILLA_1_8_BRANCH
if (NS_SUCCEEDED(rv)) {
if (sWidgetCount)
XRE_NotifyProfile();
@ -1418,7 +1424,7 @@ EmbedPrivate::GetAtkObjectForCurrentDocument()
}
#endif /* MOZ_ACCESSIBILITY_ATK */
#ifdef MOZILLA_1_8_BRANCH
#ifndef MOZ_ENABLE_LIBXUL
/* static */
nsresult
EmbedPrivate::StartupProfile(void)

View File

@ -55,7 +55,7 @@
#include <nsIDOMEventReceiver.h>
#include <nsVoidArray.h>
#ifdef MOZILLA_1_8_BRANCH
#ifndef MOZ_ENABLE_LIBXUL
// for profiles
#include <nsIPref.h>
#endif
@ -82,7 +82,7 @@ class EmbedEventListener;
class nsPIDOMWindow;
class nsIDirectoryServiceProvider;
#ifdef MOZILLA_1_8_BRANCH
#ifndef MOZ_ENABLE_LIBXUL
class nsProfileDirServiceProvider;
#endif
@ -124,7 +124,7 @@ class EmbedPrivate {
static void SetPath (const char *aPath);
static void SetCompPath (const char *aPath);
#ifdef MOZILLA_1_8_BRANCH
#ifndef MOZ_ENABLE_LIBXUL
static nsresult StartupProfile (void);
static void ShutdownProfile(void);
#endif
@ -217,11 +217,11 @@ class EmbedPrivate {
static nsIAppShell *sAppShell;
// the list of all open windows
static nsVoidArray *sWindowList;
#ifdef MOZ_ENABLE_LIBXUL
// what is our profile path?
static nsILocalFile *sProfileDir;
static nsISupports *sProfileLock;
#ifdef MOZILLA_1_8_BRANCH
#else
// what is our profile path?
static char *sProfileDirS;
static char *sProfileName;

View File

@ -51,8 +51,10 @@ FORCE_STATIC_LIB = 1
#Define for building GtkmozEmbed with MOZILLA_1_8_BRANCH
#MOZILLA_1_8_BRANCH = 1
ifdef MOZILLA_1_8_BRANCH
ifndef MOZ_ENABLE_LIBXUL
MOZ_GTKEMBED_DYN = 1
endif
ifdef MOZILLA_1_8_BRANCH
DEFINES += -DMOZILLA_1_8_BRANCH
endif
@ -104,7 +106,6 @@ REQUIRES = xpcom \
webshell \
pipnss \
history \
profdirserviceprovider \
pref \
nspr \
xulapp \
@ -164,9 +165,15 @@ CPPSRCS += \
endif
endif
ifndef MOZ_ENABLE_LIBXUL
REQUIRES += \
profdirserviceprovider \
$(NULL)
endif
include $(topsrcdir)/config/config.mk
ifdef MOZILLA_1_8_BRANCH
ifndef MOZ_ENABLE_LIBXUL
SHARED_LIBRARY_LIBS += \
$(DIST)/lib/libembed_base_s.$(LIB_SUFFIX) \
$(DIST)/lib/libprofdirserviceprovider_s.$(LIB_SUFFIX) \
@ -186,7 +193,16 @@ EXTRA_DSO_LDOPTS += -L$(DIST)/lib -lgtksuperwin
endif
ifneq (,$(filter gtk gtk2 qt xlib,$(MOZ_WIDGET_TOOLKIT)))
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(MOZ_GTK_LDFLAGS) $(MOZ_XFT_LIBS) $(MOZ_GTK2_LIBS) $(XT_LIBS) $(MOZ_COMPONENT_LIBS) $(MOZ_GNOMEVFS_LIBS) $(DIST)/lib/libxpcom_core.a
EXTRA_DSO_LDOPTS += \
$(XLDFLAGS) \
$(XLIBS) \
$(MOZ_GTK_LDFLAGS) \
$(MOZ_XFT_LIBS) \
$(MOZ_GTK2_LIBS) \
$(XT_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_GNOMEVFS_LIBS) \
$(NULL)
endif
endif

View File

@ -326,13 +326,13 @@ gtk_moz_embed_common_set_pref(GtkType type, gchar *name, gpointer value)
case GTK_TYPE_BOOL:
{
/* I doubt this cast pair is correct */
rv = pref->SetBoolPref (name, (int)(int*)value != 0 ? PR_TRUE : PR_FALSE);
rv = pref->SetBoolPref (name, !!*(int*)value);
break;
}
case GTK_TYPE_INT:
{
/* I doubt this cast pair is correct */
rv = pref->SetIntPref (name, (int)(int*)value);
rv = pref->SetIntPref (name, *(int*)value);
break;
}
case GTK_TYPE_STRING:

View File

@ -83,7 +83,7 @@ SHARED_LIBRARY_LIBS += \
ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2))
SHARED_LIBRARY_LIBS += \
$(DEPTH)/embedding/browser/gtk/src/$(LIB_PREFIX)gtkembedmoz.$(LIB_SUFFIX)
-lgtkembedmoz
endif