зеркало из https://github.com/mozilla/pjs.git
Bug 627277 - Remove (broken) BeOS support. r=biesi,dwitte,gavin,joe,jorendorff,josh,khuey,mfinkle,neil,Pike,roc,shaver,smontagu,taras
This commit is contained in:
Родитель
0382524daa
Коммит
e48da647b0
|
@ -83,7 +83,7 @@ include $(topsrcdir)/config/config.mk
|
||||||
|
|
||||||
GARBAGE_DIRS += dist _javagen _profile _tests staticlib
|
GARBAGE_DIRS += dist _javagen _profile _tests staticlib
|
||||||
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
|
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
|
||||||
dependencies.beos config/autoconf.mk \
|
config/autoconf.mk \
|
||||||
unallmakefiles mozilla-config.h \
|
unallmakefiles mozilla-config.h \
|
||||||
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
|
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
|
||||||
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
|
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
|
||||||
|
|
|
@ -199,13 +199,6 @@ RCFLAGS += -DDEBUG
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
|
|
||||||
ifdef BUILD_STATIC_LIBS
|
|
||||||
OS_LIBS += -ltracker -lgame
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),OS2)
|
ifeq ($(OS_ARCH),OS2)
|
||||||
RESFILE=splashos2.res
|
RESFILE=splashos2.res
|
||||||
RCFLAGS += -DMOZ_PHOENIX
|
RCFLAGS += -DMOZ_PHOENIX
|
||||||
|
|
Двоичные данные
browser/app/apprunner-beos.rsrc
Двоичные данные
browser/app/apprunner-beos.rsrc
Двоичный файл не отображается.
|
@ -52,9 +52,7 @@
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
|
|
||||||
#include "nsProfileMigrator.h"
|
#include "nsProfileMigrator.h"
|
||||||
#if !defined(XP_BEOS)
|
|
||||||
#include "nsDogbertProfileMigrator.h"
|
#include "nsDogbertProfileMigrator.h"
|
||||||
#endif
|
|
||||||
#if !defined(XP_OS2)
|
#if !defined(XP_OS2)
|
||||||
#include "nsOperaProfileMigrator.h"
|
#include "nsOperaProfileMigrator.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -95,9 +93,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
|
||||||
|
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
|
|
||||||
#if !defined(XP_BEOS)
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDogbertProfileMigrator)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDogbertProfileMigrator)
|
||||||
#endif
|
|
||||||
#if !defined(XP_OS2)
|
#if !defined(XP_OS2)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOperaProfileMigrator)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOperaProfileMigrator)
|
||||||
#endif
|
#endif
|
||||||
|
@ -143,9 +139,7 @@ NS_DEFINE_NAMED_CID(NS_ICABPROFILEMIGRATOR_CID);
|
||||||
#if !defined(XP_OS2)
|
#if !defined(XP_OS2)
|
||||||
NS_DEFINE_NAMED_CID(NS_OPERAPROFILEMIGRATOR_CID);
|
NS_DEFINE_NAMED_CID(NS_OPERAPROFILEMIGRATOR_CID);
|
||||||
#endif
|
#endif
|
||||||
#if !defined(XP_BEOS)
|
|
||||||
NS_DEFINE_NAMED_CID(NS_DOGBERTPROFILEMIGRATOR_CID);
|
NS_DEFINE_NAMED_CID(NS_DOGBERTPROFILEMIGRATOR_CID);
|
||||||
#endif
|
|
||||||
NS_DEFINE_NAMED_CID(NS_PHOENIXPROFILEMIGRATOR_CID);
|
NS_DEFINE_NAMED_CID(NS_PHOENIXPROFILEMIGRATOR_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_SEAMONKEYPROFILEMIGRATOR_CID);
|
NS_DEFINE_NAMED_CID(NS_SEAMONKEYPROFILEMIGRATOR_CID);
|
||||||
#endif /* WINCE */
|
#endif /* WINCE */
|
||||||
|
@ -175,9 +169,7 @@ static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
|
||||||
#if !defined(XP_OS2)
|
#if !defined(XP_OS2)
|
||||||
{ &kNS_OPERAPROFILEMIGRATOR_CID, false, NULL, nsOperaProfileMigratorConstructor },
|
{ &kNS_OPERAPROFILEMIGRATOR_CID, false, NULL, nsOperaProfileMigratorConstructor },
|
||||||
#endif
|
#endif
|
||||||
#if !defined(XP_BEOS)
|
|
||||||
{ &kNS_DOGBERTPROFILEMIGRATOR_CID, false, NULL, nsDogbertProfileMigratorConstructor },
|
{ &kNS_DOGBERTPROFILEMIGRATOR_CID, false, NULL, nsDogbertProfileMigratorConstructor },
|
||||||
#endif
|
|
||||||
{ &kNS_PHOENIXPROFILEMIGRATOR_CID, false, NULL, nsPhoenixProfileMigratorConstructor },
|
{ &kNS_PHOENIXPROFILEMIGRATOR_CID, false, NULL, nsPhoenixProfileMigratorConstructor },
|
||||||
{ &kNS_SEAMONKEYPROFILEMIGRATOR_CID, false, NULL, nsSeamonkeyProfileMigratorConstructor },
|
{ &kNS_SEAMONKEYPROFILEMIGRATOR_CID, false, NULL, nsSeamonkeyProfileMigratorConstructor },
|
||||||
#endif /* WINCE */
|
#endif /* WINCE */
|
||||||
|
@ -221,9 +213,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
||||||
#if !defined(XP_OS2)
|
#if !defined(XP_OS2)
|
||||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "opera", &kNS_OPERAPROFILEMIGRATOR_CID },
|
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "opera", &kNS_OPERAPROFILEMIGRATOR_CID },
|
||||||
#endif
|
#endif
|
||||||
#if !defined(XP_BEOS)
|
|
||||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert", &kNS_DOGBERTPROFILEMIGRATOR_CID },
|
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert", &kNS_DOGBERTPROFILEMIGRATOR_CID },
|
||||||
#endif
|
|
||||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix", &kNS_PHOENIXPROFILEMIGRATOR_CID },
|
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix", &kNS_PHOENIXPROFILEMIGRATOR_CID },
|
||||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey", &kNS_SEAMONKEYPROFILEMIGRATOR_CID },
|
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey", &kNS_SEAMONKEYPROFILEMIGRATOR_CID },
|
||||||
#endif /* WINCE */
|
#endif /* WINCE */
|
||||||
|
|
|
@ -55,12 +55,9 @@ CPPSRCS = nsProfileMigrator.cpp \
|
||||||
nsNetscapeProfileMigratorBase.cpp \
|
nsNetscapeProfileMigratorBase.cpp \
|
||||||
nsSeamonkeyProfileMigrator.cpp \
|
nsSeamonkeyProfileMigrator.cpp \
|
||||||
nsPhoenixProfileMigrator.cpp \
|
nsPhoenixProfileMigrator.cpp \
|
||||||
|
nsDogbertProfileMigrator.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifneq ($(OS_ARCH),BeOS)
|
|
||||||
CPPSRCS += nsDogbertProfileMigrator.cpp
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(OS_ARCH),OS2)
|
ifneq ($(OS_ARCH),OS2)
|
||||||
CPPSRCS += nsOperaProfileMigrator.cpp
|
CPPSRCS += nsOperaProfileMigrator.cpp
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -85,19 +85,11 @@
|
||||||
#define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("opera6.ini")
|
#define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("opera6.ini")
|
||||||
#define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("global.dat")
|
#define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("global.dat")
|
||||||
#define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("opera6.adr")
|
#define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("opera6.adr")
|
||||||
#elif defined (XP_BEOS)
|
|
||||||
#define OPERA_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING("Opera")
|
|
||||||
#define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("opera.ini")
|
|
||||||
#define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("global.dat")
|
|
||||||
#define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("opera.adr")
|
|
||||||
#else
|
#else
|
||||||
#error Need to define location of Opera Profile data.
|
#error Need to define location of Opera Profile data.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OPERA_COOKIES_FILE_NAME NS_LITERAL_STRING("cookies4.dat")
|
#define OPERA_COOKIES_FILE_NAME NS_LITERAL_STRING("cookies4.dat")
|
||||||
#ifdef XP_BEOS
|
|
||||||
#define OPERA_COOKIES_FILE_NAME NS_LITERAL_STRING("cookies.dat")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// nsBrowserProfileMigrator
|
// nsBrowserProfileMigrator
|
||||||
|
|
|
@ -289,11 +289,6 @@ nsPhoenixProfileMigrator::FillProfileDataFromPhoenixRegistry()
|
||||||
|
|
||||||
phoenixRegistry->Append(NS_LITERAL_STRING(".phoenix"));
|
phoenixRegistry->Append(NS_LITERAL_STRING(".phoenix"));
|
||||||
phoenixRegistry->Append(NS_LITERAL_STRING("appreg"));
|
phoenixRegistry->Append(NS_LITERAL_STRING("appreg"));
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
fileLocator->Get(NS_BEOS_SETTINGS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
|
|
||||||
|
|
||||||
phoenixRegistry->Append(NS_LITERAL_STRING("Phoenix"));
|
|
||||||
phoenixRegistry->Append(NS_LITERAL_STRING("appreg"));
|
|
||||||
#elif defined(XP_OS2)
|
#elif defined(XP_OS2)
|
||||||
fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
|
fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
|
||||||
|
|
||||||
|
|
|
@ -324,12 +324,6 @@ nsProfileMigrator::ImportRegistryProfiles(const nsACString& aAppName)
|
||||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||||
regFile->AppendNative(aAppName);
|
regFile->AppendNative(aAppName);
|
||||||
regFile->AppendNative(NS_LITERAL_CSTRING("registry.dat"));
|
regFile->AppendNative(NS_LITERAL_CSTRING("registry.dat"));
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
rv = dirService->Get(NS_BEOS_SETTINGS_DIR, NS_GET_IID(nsILocalFile),
|
|
||||||
getter_AddRefs(regFile));
|
|
||||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
|
||||||
regFile->AppendNative(aAppName);
|
|
||||||
regFile->AppendNative(NS_LITERAL_CSTRING("appreg"));
|
|
||||||
#else
|
#else
|
||||||
rv = dirService->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile),
|
rv = dirService->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile),
|
||||||
getter_AddRefs(regFile));
|
getter_AddRefs(regFile));
|
||||||
|
|
|
@ -322,11 +322,6 @@ nsSeamonkeyProfileMigrator::FillProfileDataFromSeamonkeyRegistry()
|
||||||
|
|
||||||
seamonkeyRegistry->Append(NS_LITERAL_STRING(".mozilla"));
|
seamonkeyRegistry->Append(NS_LITERAL_STRING(".mozilla"));
|
||||||
seamonkeyRegistry->Append(NS_LITERAL_STRING("appreg"));
|
seamonkeyRegistry->Append(NS_LITERAL_STRING("appreg"));
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
fileLocator->Get(NS_BEOS_SETTINGS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(seamonkeyRegistry));
|
|
||||||
|
|
||||||
seamonkeyRegistry->Append(NS_LITERAL_STRING("Mozilla"));
|
|
||||||
seamonkeyRegistry->Append(NS_LITERAL_STRING("appreg"));
|
|
||||||
#elif defined(XP_OS2)
|
#elif defined(XP_OS2)
|
||||||
fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(seamonkeyRegistry));
|
fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(seamonkeyRegistry));
|
||||||
|
|
||||||
|
|
|
@ -333,12 +333,6 @@ LIBPATH=${MOZ_DIST_BIN}:${MRE_HOME}${LIBPATH:+":$LIBPATH"}
|
||||||
## Set DYLD_LIBRARY_PATH for Mac OS X (Darwin)
|
## Set DYLD_LIBRARY_PATH for Mac OS X (Darwin)
|
||||||
DYLD_LIBRARY_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${DYLD_LIBRARY_PATH:+":$DYLD_LIBRARY_PATH"}
|
DYLD_LIBRARY_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${DYLD_LIBRARY_PATH:+":$DYLD_LIBRARY_PATH"}
|
||||||
#
|
#
|
||||||
## Set LIBRARY_PATH for BeOS
|
|
||||||
LIBRARY_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/components:${MRE_HOME}${LIBRARY_PATH:+":$LIBRARY_PATH"}
|
|
||||||
#
|
|
||||||
## Set ADDON_PATH for BeOS
|
|
||||||
ADDON_PATH=${MOZ_DIST_BIN}${ADDON_PATH:+":$ADDON_PATH"}
|
|
||||||
#
|
|
||||||
## Solaris Xserver(Xsun) tuning - use shared memory transport if available
|
## Solaris Xserver(Xsun) tuning - use shared memory transport if available
|
||||||
if [ "$XSUNTRANSPORT" = "" ]
|
if [ "$XSUNTRANSPORT" = "" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -130,9 +130,6 @@ else
|
||||||
LD := $(CC)
|
LD := $(CC)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
BEOS_ADDON_WORKAROUND = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Strip off the excessively long version numbers on these platforms,
|
# Strip off the excessively long version numbers on these platforms,
|
||||||
|
|
|
@ -914,9 +914,6 @@ ifndef NO_COMPONENTS_MANIFEST
|
||||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
|
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
|
||||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
|
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
|
||||||
endif
|
endif
|
||||||
ifdef BEOS_ADDON_WORKAROUND
|
|
||||||
( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
|
|
||||||
endif
|
|
||||||
else # ! IS_COMPONENT
|
else # ! IS_COMPONENT
|
||||||
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
||||||
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
|
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
|
||||||
|
@ -924,9 +921,6 @@ else
|
||||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
|
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
|
||||||
endif
|
endif
|
||||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
|
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
|
||||||
ifdef BEOS_ADDON_WORKAROUND
|
|
||||||
( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
|
|
||||||
endif
|
|
||||||
endif # IS_COMPONENT
|
endif # IS_COMPONENT
|
||||||
endif # SHARED_LIBRARY
|
endif # SHARED_LIBRARY
|
||||||
ifdef PROGRAM
|
ifdef PROGRAM
|
||||||
|
@ -1060,12 +1054,6 @@ endif
|
||||||
ifdef MOZ_POST_PROGRAM_COMMAND
|
ifdef MOZ_POST_PROGRAM_COMMAND
|
||||||
$(MOZ_POST_PROGRAM_COMMAND) $@
|
$(MOZ_POST_PROGRAM_COMMAND) $@
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
ifdef BEOS_PROGRAM_RESOURCE
|
|
||||||
xres -o $@ $(BEOS_PROGRAM_RESOURCE)
|
|
||||||
mimeset $@
|
|
||||||
endif
|
|
||||||
endif # BeOS
|
|
||||||
|
|
||||||
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
|
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
|
||||||
ifeq (WINCE,$(OS_ARCH))
|
ifeq (WINCE,$(OS_ARCH))
|
||||||
|
|
50
configure.in
50
configure.in
|
@ -1841,12 +1841,6 @@ dnl ========================================================
|
||||||
dnl System overrides of the defaults for host
|
dnl System overrides of the defaults for host
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-beos*)
|
|
||||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
|
|
||||||
HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
|
|
||||||
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*mingw*|*wince|*winmo)
|
*mingw*|*wince|*winmo)
|
||||||
if test -n "$_WIN32_MSVC"; then
|
if test -n "$_WIN32_MSVC"; then
|
||||||
HOST_AR=lib
|
HOST_AR=lib
|
||||||
|
@ -1989,24 +1983,6 @@ case "$target" in
|
||||||
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*-beos*)
|
|
||||||
no_x=yes
|
|
||||||
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
|
|
||||||
_PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
|
|
||||||
DSO_LDOPTS='-nostart'
|
|
||||||
TK_LIBS='-lbe -lroot'
|
|
||||||
LIBS="$LIBS -lbe"
|
|
||||||
if test "$COMPILE_ENVIRONMENT"; then
|
|
||||||
AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
|
|
||||||
AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
|
|
||||||
fi
|
|
||||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
|
|
||||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
|
|
||||||
_MOZ_USE_RTTI=1
|
|
||||||
USE_DEPENDENT_LIBS=
|
|
||||||
MOZ_USER_DIR="Mozilla"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-bsdi*)
|
*-bsdi*)
|
||||||
dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
|
dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
|
||||||
_PEDANTIC=
|
_PEDANTIC=
|
||||||
|
@ -3374,16 +3350,14 @@ case $target in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dnl We don't want to link with libdl even if it's present on OS X, since
|
dnl We don't want to link with libdl even if it's present on OS X, since
|
||||||
dnl it's not used and not part of the default installation.
|
dnl it's not used and not part of the default installation. OS/2 has dlfcn
|
||||||
dnl The same goes for BeOS. OS/2 has dlfcn in libc.
|
dnl in libc.
|
||||||
dnl We don't want to link against libm or libpthread on Darwin since
|
dnl We don't want to link against libm or libpthread on Darwin since
|
||||||
dnl they both are just symlinks to libSystem and explicitly linking
|
dnl they both are just symlinks to libSystem and explicitly linking
|
||||||
dnl against libSystem causes issues when debugging (see bug 299601).
|
dnl against libSystem causes issues when debugging (see bug 299601).
|
||||||
case $target in
|
case $target in
|
||||||
*-darwin*)
|
*-darwin*)
|
||||||
;;
|
;;
|
||||||
*-beos*)
|
|
||||||
;;
|
|
||||||
*-os2*)
|
*-os2*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -5123,7 +5097,6 @@ MOZ_ARG_HEADER(Toolkit Options)
|
||||||
[ --enable-default-toolkit=TK
|
[ --enable-default-toolkit=TK
|
||||||
Select default toolkit
|
Select default toolkit
|
||||||
Platform specific defaults:
|
Platform specific defaults:
|
||||||
BeOS - cairo-beos
|
|
||||||
Mac OS X - cairo-cocoa
|
Mac OS X - cairo-cocoa
|
||||||
Neutrino/QNX - photon
|
Neutrino/QNX - photon
|
||||||
OS/2 - cairo-os2
|
OS/2 - cairo-os2
|
||||||
|
@ -5140,7 +5113,6 @@ MOZ_ARG_HEADER(Toolkit Options)
|
||||||
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
|
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
|
||||||
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
|
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
|
||||||
-o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
|
-o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
|
||||||
-o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
|
|
||||||
-o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
|
-o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
|
||||||
-o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
|
-o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
|
||||||
-o "$_DEFAULT_TOOLKIT" = "cairo-android"
|
-o "$_DEFAULT_TOOLKIT" = "cairo-android"
|
||||||
|
@ -5226,13 +5198,6 @@ cairo-qt)
|
||||||
MOZ_PDF_PRINTING=1
|
MOZ_PDF_PRINTING=1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
cairo-beos)
|
|
||||||
MOZ_WIDGET_TOOLKIT=beos
|
|
||||||
USE_FC_FREETYPE=1
|
|
||||||
TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
|
|
||||||
TK_LIBS='$(MOZ_CAIRO_LIBS)'
|
|
||||||
;;
|
|
||||||
|
|
||||||
cairo-os2)
|
cairo-os2)
|
||||||
MOZ_WIDGET_TOOLKIT=os2
|
MOZ_WIDGET_TOOLKIT=os2
|
||||||
USE_FC_FREETYPE=1
|
USE_FC_FREETYPE=1
|
||||||
|
@ -8679,12 +8644,6 @@ if test "$MOZ_TREE_CAIRO"; then
|
||||||
CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
|
CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
|
||||||
CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
|
CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
|
||||||
fi
|
fi
|
||||||
if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
|
|
||||||
PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
|
|
||||||
BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
|
|
||||||
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
|
|
||||||
MOZ_ENABLE_CAIRO_FT=1
|
|
||||||
fi
|
|
||||||
if test "$USE_FC_FREETYPE"; then
|
if test "$USE_FC_FREETYPE"; then
|
||||||
FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
|
FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
|
||||||
fi
|
fi
|
||||||
|
@ -8714,7 +8673,6 @@ if test "$MOZ_TREE_CAIRO"; then
|
||||||
AC_SUBST(XCB_SURFACE_FEATURE)
|
AC_SUBST(XCB_SURFACE_FEATURE)
|
||||||
AC_SUBST(WIN32_SURFACE_FEATURE)
|
AC_SUBST(WIN32_SURFACE_FEATURE)
|
||||||
AC_SUBST(OS2_SURFACE_FEATURE)
|
AC_SUBST(OS2_SURFACE_FEATURE)
|
||||||
AC_SUBST(BEOS_SURFACE_FEATURE)
|
|
||||||
AC_SUBST(DIRECTFB_SURFACE_FEATURE)
|
AC_SUBST(DIRECTFB_SURFACE_FEATURE)
|
||||||
AC_SUBST(FT_FONT_FEATURE)
|
AC_SUBST(FT_FONT_FEATURE)
|
||||||
AC_SUBST(FC_FONT_FEATURE)
|
AC_SUBST(FC_FONT_FEATURE)
|
||||||
|
@ -9329,9 +9287,7 @@ fi
|
||||||
dnl Set various defines and substitutions
|
dnl Set various defines and substitutions
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
|
||||||
if test "$OS_ARCH" = "BeOS"; then
|
if test "$OS_ARCH" = "Darwin"; then
|
||||||
AC_DEFINE(XP_BEOS)
|
|
||||||
elif test "$OS_ARCH" = "Darwin"; then
|
|
||||||
AC_DEFINE(XP_UNIX)
|
AC_DEFINE(XP_UNIX)
|
||||||
AC_DEFINE(UNIX_ASYNC_DNS)
|
AC_DEFINE(UNIX_ASYNC_DNS)
|
||||||
elif test "$OS_ARCH" = "OpenVMS"; then
|
elif test "$OS_ARCH" = "OpenVMS"; then
|
||||||
|
|
|
@ -68,13 +68,9 @@
|
||||||
#define MORK_UNIX 1
|
#define MORK_UNIX 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
#define MORK_BEOS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// } %%%%% end platform defs peculiar to Mork %%%%%
|
// } %%%%% end platform defs peculiar to Mork %%%%%
|
||||||
|
|
||||||
#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_BEOS) || defined(MORK_OS2)
|
#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_OS2)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -143,10 +139,10 @@ FILE* mork_fileopen(const char* name, const char* mode);
|
||||||
# define mork_kNewline "\015\012"
|
# define mork_kNewline "\015\012"
|
||||||
# define mork_kNewlineSize 2
|
# define mork_kNewlineSize 2
|
||||||
# else
|
# else
|
||||||
# if defined(MORK_UNIX) || defined(MORK_BEOS)
|
# if defined(MORK_UNIX)
|
||||||
# define mork_kNewline "\012"
|
# define mork_kNewline "\012"
|
||||||
# define mork_kNewlineSize 1
|
# define mork_kNewlineSize 1
|
||||||
# endif /* MORK_UNIX || MORK_BEOS */
|
# endif /* MORK_UNIX */
|
||||||
# endif /* MORK_WIN */
|
# endif /* MORK_WIN */
|
||||||
#endif /* MORK_MAC */
|
#endif /* MORK_MAC */
|
||||||
|
|
||||||
|
@ -161,7 +157,7 @@ extern void mork_assertion_signal(const char* inMessage);
|
||||||
|
|
||||||
// { %%%%% begin standard c utility methods %%%%%
|
// { %%%%% begin standard c utility methods %%%%%
|
||||||
|
|
||||||
#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_BEOS) || defined(MORK_OS2)
|
#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_OS2)
|
||||||
#define MORK_USE_C_STDLIB 1
|
#define MORK_USE_C_STDLIB 1
|
||||||
#endif /*MORK_WIN*/
|
#endif /*MORK_WIN*/
|
||||||
|
|
||||||
|
|
|
@ -261,11 +261,11 @@ morkFile::NewFileErrnoError(morkEnv* ev) const
|
||||||
"\015\012\015\012\015\012\015\012\015\012\015\012\015\012\015\012";
|
"\015\012\015\012\015\012\015\012\015\012\015\012\015\012\015\012";
|
||||||
# define morkFile_kNewlinesCount 8
|
# define morkFile_kNewlinesCount 8
|
||||||
# else
|
# else
|
||||||
# if defined(MORK_UNIX) || defined(MORK_BEOS)
|
# ifdef MORK_UNIX
|
||||||
static const char morkFile_kNewlines[] =
|
static const char morkFile_kNewlines[] =
|
||||||
"\012\012\012\012\012\012\012\012\012\012\012\012\012\012\012\012";
|
"\012\012\012\012\012\012\012\012\012\012\012\012\012\012\012\012";
|
||||||
# define morkFile_kNewlinesCount 16
|
# define morkFile_kNewlinesCount 16
|
||||||
# endif /* MORK_UNIX || MORK_BEOS */
|
# endif /* MORK_UNIX */
|
||||||
# endif /* MORK_WIN */
|
# endif /* MORK_WIN */
|
||||||
#endif /* MORK_MAC */
|
#endif /* MORK_MAC */
|
||||||
|
|
||||||
|
|
|
@ -327,12 +327,12 @@ morkStream::PutLineBreak(morkEnv* ev)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
# else
|
# else
|
||||||
# if defined(MORK_UNIX) || defined(MORK_BEOS)
|
# ifdef MORK_UNIX
|
||||||
|
|
||||||
this->Putc(ev, mork_kLF);
|
this->Putc(ev, mork_kLF);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
# endif /* MORK_UNIX || MORK_BEOS */
|
# endif /* MORK_UNIX */
|
||||||
# endif /* MORK_WIN */
|
# endif /* MORK_WIN */
|
||||||
#endif /* MORK_MAC */
|
#endif /* MORK_MAC */
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,7 +607,7 @@ nsresult nsDefaultURIFixup::ConvertFileToStringURI(const nsACString& aIn,
|
||||||
{
|
{
|
||||||
attemptFixup = PR_TRUE;
|
attemptFixup = PR_TRUE;
|
||||||
}
|
}
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
#elif defined(XP_UNIX)
|
||||||
// Check if it starts with / (UNIX)
|
// Check if it starts with / (UNIX)
|
||||||
if(aIn.First() == '/')
|
if(aIn.First() == '/')
|
||||||
{
|
{
|
||||||
|
|
|
@ -450,7 +450,7 @@ public:
|
||||||
NS_IMETHOD GetTextDimensions(const PRUnichar* aString, PRUint32 aLength,
|
NS_IMETHOD GetTextDimensions(const PRUnichar* aString, PRUint32 aLength,
|
||||||
nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull) = 0;
|
nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull) = 0;
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
|
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11)
|
||||||
/**
|
/**
|
||||||
* Given an available width and an array of break points,
|
* Given an available width and an array of break points,
|
||||||
* returns the dimensions (in app units) of the text that fit and
|
* returns the dimensions (in app units) of the text that fit and
|
||||||
|
|
|
@ -89,10 +89,6 @@ CPPSRCS += nsSystemFontsOS2.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
CPPSRCS += nsSystemFontsBeOS.cpp
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||||
CMMSRCS = nsSystemFontsMac.mm
|
CMMSRCS = nsSystemFontsMac.mm
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
/* vim: set sw=2 sts=2 et cin: */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 BeOS system font code in Thebes.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Parts of this file used to live in nsDeviceContextBeos.cpp. The Original
|
|
||||||
* Author of that code is Netscape Communications Corporation.
|
|
||||||
*
|
|
||||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include <Font.h>
|
|
||||||
#include <Menu.h>
|
|
||||||
|
|
||||||
#include "nsIDeviceContext.h"
|
|
||||||
#include "nsSystemFontsBeOS.h"
|
|
||||||
|
|
||||||
nsSystemFontsBeOS::nsSystemFontsBeOS()
|
|
||||||
: mDefaultFontName(NS_LITERAL_STRING("sans-serif"))
|
|
||||||
, mMenuFontName(NS_LITERAL_STRING("sans-serif"))
|
|
||||||
, mCaptionFontName(NS_LITERAL_STRING("sans-serif"))
|
|
||||||
{
|
|
||||||
menu_info info;
|
|
||||||
get_menu_info(&info);
|
|
||||||
BFont menuFont;
|
|
||||||
menuFont.SetFamilyAndStyle(info.f_family, info.f_style);
|
|
||||||
menuFont.SetSize(info.font_size);
|
|
||||||
|
|
||||||
GetSystemFontInfo(be_plain_font, &mDefaultFontName, &mDefaultFontStyle);
|
|
||||||
GetSystemFontInfo(be_bold_font, &mCaptionFontName, &mCaptionFontStyle);
|
|
||||||
GetSystemFontInfo(&menuFont, &mMenuFontName, &mMenuFontStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsSystemFontsBeOS::GetSystemFont(nsSystemFontID aID,
|
|
||||||
nsString *aFontName,
|
|
||||||
gfxFontStyle *aFontStyle) const
|
|
||||||
{
|
|
||||||
switch (aID) {
|
|
||||||
case eSystemFont_PullDownMenu:
|
|
||||||
case eSystemFont_Menu:
|
|
||||||
*aFontName = mMenuFontName;
|
|
||||||
*aFontStyle = mMenuFontStyle;
|
|
||||||
return NS_OK;
|
|
||||||
case eSystemFont_Caption: // css2 bold
|
|
||||||
*aFontName = mCaptionFontName;
|
|
||||||
*aFontStyle = mCaptionFontStyle;
|
|
||||||
return NS_OK;
|
|
||||||
case eSystemFont_List:
|
|
||||||
case eSystemFont_Field:
|
|
||||||
case eSystemFont_Icon :
|
|
||||||
case eSystemFont_MessageBox :
|
|
||||||
case eSystemFont_SmallCaption :
|
|
||||||
case eSystemFont_StatusBar :
|
|
||||||
case eSystemFont_Window: // css3
|
|
||||||
case eSystemFont_Document:
|
|
||||||
case eSystemFont_Workspace:
|
|
||||||
case eSystemFont_Desktop:
|
|
||||||
case eSystemFont_Info:
|
|
||||||
case eSystemFont_Dialog:
|
|
||||||
case eSystemFont_Button:
|
|
||||||
case eSystemFont_Tooltips: // moz
|
|
||||||
case eSystemFont_Widget:
|
|
||||||
default:
|
|
||||||
*aFontName = mDefaultFontName;
|
|
||||||
*aFontStyle = mDefaultFontStyle;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
NS_NOTREACHED("huh?");
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsSystemFontsBeOS::GetSystemFontInfo(const BFont *theFont, nsString *aFontName,
|
|
||||||
gfxFontStyle *aFontStyle) const
|
|
||||||
{
|
|
||||||
|
|
||||||
aFontStyle->style = FONT_STYLE_NORMAL;
|
|
||||||
aFontStyle->weight = FONT_WEIGHT_NORMAL;
|
|
||||||
aFontStyle->decorations = FONT_DECORATION_NONE;
|
|
||||||
aFontStyle->stretch = NS_FONT_STRETCH_NORMAL;
|
|
||||||
|
|
||||||
font_family family;
|
|
||||||
theFont->GetFamilyAndStyle(&family, NULL);
|
|
||||||
|
|
||||||
uint16 face = theFont->Face();
|
|
||||||
CopyUTF8toUTF16(family, *aFontName);
|
|
||||||
aFontStyle->size = theFont->Size();
|
|
||||||
|
|
||||||
if (face & B_ITALIC_FACE)
|
|
||||||
aFontStyle->style = FONT_STYLE_ITALIC;
|
|
||||||
|
|
||||||
if (face & B_BOLD_FACE)
|
|
||||||
aFontStyle->weight = FONT_WEIGHT_BOLD;
|
|
||||||
|
|
||||||
// FIXME: Set aFontStyle->stretch correctly!
|
|
||||||
|
|
||||||
if (face & B_UNDERSCORE_FACE)
|
|
||||||
aFontStyle->decorations |= FONT_DECORATION_UNDERLINE;
|
|
||||||
|
|
||||||
if (face & B_STRIKEOUT_FACE)
|
|
||||||
aFontStyle->decorations |= FONT_DECORATION_STRIKEOUT;
|
|
||||||
|
|
||||||
aFontStyle->systemFont = PR_TRUE;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 BeOS system font code in Thebes.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef _NS_SYSTEMFONTSBEOS_H_
|
|
||||||
#define _NS_SYSTEMFONTSBEOS_H_
|
|
||||||
|
|
||||||
#include <gfxFont.h>
|
|
||||||
|
|
||||||
class BFont;
|
|
||||||
|
|
||||||
class nsSystemFontsBeOS
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsSystemFontsBeOS();
|
|
||||||
|
|
||||||
nsresult GetSystemFont(nsSystemFontID anID, nsString *aFontName,
|
|
||||||
gfxFontStyle *aFontStyle) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsresult GetSystemFontInfo(const BFont *theFont, nsString *aFontName,
|
|
||||||
gfxFontStyle *aFontStyle) const;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following system font constants exist:
|
|
||||||
*
|
|
||||||
* css2: http://www.w3.org/TR/REC-CSS2/fonts.html#x27
|
|
||||||
* eSystemFont_Caption, eSystemFont_Icon, eSystemFont_Menu,
|
|
||||||
* eSystemFont_MessageBox, eSystemFont_SmallCaption,
|
|
||||||
* eSystemFont_StatusBar,
|
|
||||||
* // css3
|
|
||||||
* eSystemFont_Window, eSystemFont_Document,
|
|
||||||
* eSystemFont_Workspace, eSystemFont_Desktop,
|
|
||||||
* eSystemFont_Info, eSystemFont_Dialog,
|
|
||||||
* eSystemFont_Button, eSystemFont_PullDownMenu,
|
|
||||||
* eSystemFont_List, eSystemFont_Field,
|
|
||||||
* // moz
|
|
||||||
* eSystemFont_Tooltips, eSystemFont_Widget
|
|
||||||
*/
|
|
||||||
nsString mDefaultFontName, mMenuFontName, mCaptionFontName;
|
|
||||||
gfxFontStyle mDefaultFontStyle, mMenuFontStyle, mCaptionFontStyle;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _NS_SYSTEMFONTSBEOS_H_ */
|
|
|
@ -77,9 +77,6 @@ static nsSystemFontsWin *gSystemFonts = nsnull;
|
||||||
#include "nsSystemFontsOS2.h"
|
#include "nsSystemFontsOS2.h"
|
||||||
#include "gfxPDFSurface.h"
|
#include "gfxPDFSurface.h"
|
||||||
static nsSystemFontsOS2 *gSystemFonts = nsnull;
|
static nsSystemFontsOS2 *gSystemFonts = nsnull;
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
#include "nsSystemFontsBeOS.h"
|
|
||||||
static nsSystemFontsBeOS *gSystemFonts = nsnull;
|
|
||||||
#elif XP_MACOSX
|
#elif XP_MACOSX
|
||||||
#include "nsSystemFontsMac.h"
|
#include "nsSystemFontsMac.h"
|
||||||
#include "gfxQuartzSurface.h"
|
#include "gfxQuartzSurface.h"
|
||||||
|
@ -809,8 +806,6 @@ nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
|
||||||
gSystemFonts = new nsSystemFontsWin();
|
gSystemFonts = new nsSystemFontsWin();
|
||||||
#elif XP_OS2
|
#elif XP_OS2
|
||||||
gSystemFonts = new nsSystemFontsOS2();
|
gSystemFonts = new nsSystemFontsOS2();
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
gSystemFonts = new nsSystemFontsBeOS();
|
|
||||||
#elif XP_MACOSX
|
#elif XP_MACOSX
|
||||||
gSystemFonts = new nsSystemFontsMac();
|
gSystemFonts = new nsSystemFontsMac();
|
||||||
#elif defined(MOZ_WIDGET_QT)
|
#elif defined(MOZ_WIDGET_QT)
|
||||||
|
|
|
@ -990,7 +990,7 @@ nsThebesRenderingContext::GetTextDimensions(const PRUnichar* aString,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
|
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsThebesRenderingContext::GetTextDimensions(const char* aString,
|
nsThebesRenderingContext::GetTextDimensions(const char* aString,
|
||||||
PRInt32 aLength,
|
PRInt32 aLength,
|
||||||
|
@ -1311,7 +1311,7 @@ nsThebesRenderingContext::GetTextDimensionsInternal(const PRUnichar* aString,
|
||||||
return GetWidth(aString, aLength, aDimensions.width, aFontID);
|
return GetWidth(aString, aLength, aDimensions.width, aFontID);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS) || defined(XP_MACOSX) || defined (MOZ_DFB)
|
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_MACOSX) || defined (MOZ_DFB)
|
||||||
nsresult
|
nsresult
|
||||||
nsThebesRenderingContext::GetTextDimensionsInternal(const char* aString,
|
nsThebesRenderingContext::GetTextDimensionsInternal(const char* aString,
|
||||||
PRInt32 aLength,
|
PRInt32 aLength,
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
NS_IMETHOD GetTextDimensions(const PRUnichar* aString, PRUint32 aLength,
|
NS_IMETHOD GetTextDimensions(const PRUnichar* aString, PRUint32 aLength,
|
||||||
nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull);
|
nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull);
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
|
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11)
|
||||||
NS_IMETHOD GetTextDimensions(const char* aString,
|
NS_IMETHOD GetTextDimensions(const char* aString,
|
||||||
PRInt32 aLength,
|
PRInt32 aLength,
|
||||||
PRInt32 aAvailWidth,
|
PRInt32 aAvailWidth,
|
||||||
|
|
|
@ -63,16 +63,6 @@ EXPORTS += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
EXPORTS += \
|
|
||||||
gfxBeOSPlatform.h \
|
|
||||||
gfxBeOSSurface.h \
|
|
||||||
gfxFT2FontBase.h \
|
|
||||||
gfxPDFSurface.h \
|
|
||||||
gfxPangoFonts.h \
|
|
||||||
$(NULL)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||||
EXPORTS += \
|
EXPORTS += \
|
||||||
gfxPlatformMac.h \
|
gfxPlatformMac.h \
|
||||||
|
@ -368,17 +358,6 @@ CPPSRCS += gfxPDFSurface.cpp
|
||||||
EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(ZLIB_LIBS) $(XLDFLAGS) $(XLIBS) $(CAIRO_FT_LIBS) $(XEXT_LIBS)
|
EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(ZLIB_LIBS) $(XLDFLAGS) $(XLIBS) $(CAIRO_FT_LIBS) $(XEXT_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
CPPSRCS += gfxBeOSSurface.cpp gfxBeOSPlatform.cpp
|
|
||||||
CPPSRCS += gfxPangoFonts.cpp
|
|
||||||
CPPSRCS += gfxFT2FontBase.cpp
|
|
||||||
CPPSRCS += gfxFT2Utils.cpp
|
|
||||||
#CPPSRCS += gfxPDFSurface.cpp
|
|
||||||
CPPSRCS += gfxFontconfigUtils.cpp
|
|
||||||
CPPSRCS += nsUnicodeRange.cpp
|
|
||||||
EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(CAIRO_FT_LIBS) -lfontconfig
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||||
CPPSRCS += \
|
CPPSRCS += \
|
||||||
gfxQuartzSurface.cpp \
|
gfxQuartzSurface.cpp \
|
||||||
|
@ -474,10 +453,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||||
CXXFLAGS += $(MOZ_PANGO_CFLAGS)
|
CXXFLAGS += $(MOZ_PANGO_CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
CXXFLAGS += $(CAIRO_FT_CFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||||
CXXFLAGS += $(CAIRO_FT_CFLAGS)
|
CXXFLAGS += $(CAIRO_FT_CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 BeOS code in Thebes.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Masayuki Nakano <masayuki@d-toybox.com>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "gfxBeOSPlatform.h"
|
|
||||||
#include "gfxFontconfigUtils.h"
|
|
||||||
#include "gfxPangoFonts.h"
|
|
||||||
|
|
||||||
#include "gfxImageSurface.h"
|
|
||||||
#include "gfxBeOSSurface.h"
|
|
||||||
|
|
||||||
#include "nsTArray.h"
|
|
||||||
|
|
||||||
gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nsnull;
|
|
||||||
|
|
||||||
gfxBeOSPlatform::gfxBeOSPlatform()
|
|
||||||
{
|
|
||||||
if (!sFontconfigUtils)
|
|
||||||
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
|
|
||||||
}
|
|
||||||
|
|
||||||
gfxBeOSPlatform::~gfxBeOSPlatform()
|
|
||||||
{
|
|
||||||
gfxFontconfigUtils::Shutdown();
|
|
||||||
sFontconfigUtils = nsnull;
|
|
||||||
|
|
||||||
gfxPangoFontGroup::Shutdown();
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// It would be nice to do this (although it might need to be after
|
|
||||||
// the cairo shutdown that happens in ~gfxPlatform). It even looks
|
|
||||||
// idempotent. But it has fatal assertions that fire if stuff is
|
|
||||||
// leaked, and we hit them.
|
|
||||||
FcFini();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<gfxASurface>
|
|
||||||
gfxBeOSPlatform::CreateOffscreenSurface (PRUint32 width,
|
|
||||||
PRUint32 height,
|
|
||||||
gfxASurface::gfxContentType contentType)
|
|
||||||
{
|
|
||||||
gfxASurface *newSurface = nsnull;
|
|
||||||
|
|
||||||
if (contentType == gfxASurface::CONTENT_ALPHA) {
|
|
||||||
newSurface = new gfxImageSurface(imageFormat, width, height);
|
|
||||||
} else {
|
|
||||||
newSurface = new gfxBeOSSurface(width, height,
|
|
||||||
contentType == gfxASurface::CONTENT_COLOR_ALPHA ? B_RGBA32 : B_RGB32);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_ADDREF(newSurface);
|
|
||||||
return newSurface;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
gfxBeOSPlatform::GetFontList(nsIAtom *aLangGroup,
|
|
||||||
const nsACString& aGenericFamily,
|
|
||||||
nsTArray<nsString>& aListOfFonts)
|
|
||||||
{
|
|
||||||
return sFontconfigUtils->GetFontList(aLangGroup, aGenericFamily,
|
|
||||||
aListOfFonts);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
gfxBeOSPlatform::UpdateFontList()
|
|
||||||
{
|
|
||||||
return sFontconfigUtils->UpdateFontList();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
gfxBeOSPlatform::ResolveFontName(const nsAString& aFontName,
|
|
||||||
FontResolverCallback aCallback,
|
|
||||||
void *aClosure,
|
|
||||||
PRBool& aAborted)
|
|
||||||
{
|
|
||||||
return sFontconfigUtils->ResolveFontName(aFontName, aCallback,
|
|
||||||
aClosure, aAborted);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
gfxBeOSPlatform::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
|
|
||||||
{
|
|
||||||
return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName);
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
/* vim:set sw=4 sts=4 et cin: */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 BeOS code in Thebes.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GFX_PLATFORM_BEOS_H
|
|
||||||
#define GFX_PLATFORM_BEOS_H
|
|
||||||
|
|
||||||
#include "gfxPlatform.h"
|
|
||||||
#include "gfxTArray.h"
|
|
||||||
|
|
||||||
class gfxFontconfigUtils;
|
|
||||||
|
|
||||||
class NS_EXPORT gfxBeOSPlatform : public gfxPlatform {
|
|
||||||
public:
|
|
||||||
gfxBeOSPlatform();
|
|
||||||
virtual ~gfxBeOSPlatform();
|
|
||||||
|
|
||||||
static gfxBeOSPlatform *GetPlatform() {
|
|
||||||
return (gfxBeOSPlatform*) gfxPlatform::GetPlatform();
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<gfxASurface>
|
|
||||||
CreateOffscreenSurface(PRUint32 width,
|
|
||||||
PRUint32 height,
|
|
||||||
gfxASurface::gfxContentType contentType);
|
|
||||||
|
|
||||||
nsresult GetFontList(nsIAtom *aLangGroup,
|
|
||||||
const nsACString& aGenericFamily,
|
|
||||||
nsTArray<nsString>& aListOfFonts);
|
|
||||||
|
|
||||||
nsresult UpdateFontList();
|
|
||||||
|
|
||||||
nsresult ResolveFontName(const nsAString& aFontName,
|
|
||||||
FontResolverCallback aCallback,
|
|
||||||
void *aClosure, PRBool& aAborted);
|
|
||||||
|
|
||||||
nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
|
|
||||||
protected:
|
|
||||||
static gfxFontconfigUtils *sFontconfigUtils;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* GFX_PLATFORM_BEOS_H */
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* vim:set sw=4 sts=4 et cin: */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 BeOS code in Thebes.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
|
|
||||||
#include <Bitmap.h>
|
|
||||||
|
|
||||||
#include "gfxBeOSSurface.h"
|
|
||||||
|
|
||||||
gfxBeOSSurface::gfxBeOSSurface(BView* aView) :
|
|
||||||
mOwnsView(PR_FALSE), mView(aView), mBitmap(nsnull)
|
|
||||||
{
|
|
||||||
Init(cairo_beos_surface_create(aView));
|
|
||||||
}
|
|
||||||
|
|
||||||
gfxBeOSSurface::gfxBeOSSurface(BView* aView, BBitmap* aBitmap) :
|
|
||||||
mOwnsView(PR_FALSE), mView(aView), mBitmap(nsnull)
|
|
||||||
{
|
|
||||||
Init(cairo_beos_surface_create_for_bitmap(aView, aBitmap));
|
|
||||||
}
|
|
||||||
|
|
||||||
gfxBeOSSurface::gfxBeOSSurface(unsigned long width, unsigned long height, color_space space)
|
|
||||||
{
|
|
||||||
BRect bounds(0.0, 0.0, width - 1, height - 1);
|
|
||||||
mBitmap = new BBitmap(bounds, space, true);
|
|
||||||
mView = new BView(bounds, "Mozilla Bitmap view", B_FOLLOW_ALL_SIDES, 0);
|
|
||||||
mBitmap->AddChild(mView);
|
|
||||||
|
|
||||||
mOwnsView = PR_TRUE;
|
|
||||||
Init(cairo_beos_surface_create_for_bitmap(mView, mBitmap));
|
|
||||||
}
|
|
||||||
|
|
||||||
gfxBeOSSurface::~gfxBeOSSurface()
|
|
||||||
{
|
|
||||||
if (mOwnsView) {
|
|
||||||
mBitmap->RemoveChild(mView);
|
|
||||||
|
|
||||||
delete mView;
|
|
||||||
delete mBitmap;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
/* vim:set sw=4 sts=4 et cin: */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 BeOS code in Thebes.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GFX_BEOSSURFACE_H
|
|
||||||
#define GFX_BEOSSURFACE_H
|
|
||||||
|
|
||||||
#include "gfxASurface.h"
|
|
||||||
|
|
||||||
#include <cairo-beos.h>
|
|
||||||
|
|
||||||
class gfxBeOSSurface : public gfxASurface {
|
|
||||||
public:
|
|
||||||
gfxBeOSSurface(BView* aView);
|
|
||||||
gfxBeOSSurface(BView* aView, BBitmap* aBitmap);
|
|
||||||
gfxBeOSSurface(unsigned long width, unsigned long height, color_space space = B_RGBA32);
|
|
||||||
virtual ~gfxBeOSSurface();
|
|
||||||
|
|
||||||
private:
|
|
||||||
PRBool mOwnsView;
|
|
||||||
BView* mView;
|
|
||||||
BBitmap* mBitmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* GFX_BEOSSURFACE_H */
|
|
|
@ -50,8 +50,6 @@
|
||||||
#include "gfxPlatformGtk.h"
|
#include "gfxPlatformGtk.h"
|
||||||
#elif defined(MOZ_WIDGET_QT)
|
#elif defined(MOZ_WIDGET_QT)
|
||||||
#include "gfxQtPlatform.h"
|
#include "gfxQtPlatform.h"
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
#include "gfxBeOSPlatform.h"
|
|
||||||
#elif defined(XP_OS2)
|
#elif defined(XP_OS2)
|
||||||
#include "gfxOS2Platform.h"
|
#include "gfxOS2Platform.h"
|
||||||
#elif defined(ANDROID)
|
#elif defined(ANDROID)
|
||||||
|
@ -270,8 +268,6 @@ gfxPlatform::Init()
|
||||||
gPlatform = new gfxPlatformGtk;
|
gPlatform = new gfxPlatformGtk;
|
||||||
#elif defined(MOZ_WIDGET_QT)
|
#elif defined(MOZ_WIDGET_QT)
|
||||||
gPlatform = new gfxQtPlatform;
|
gPlatform = new gfxQtPlatform;
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
gPlatform = new gfxBeOSPlatform;
|
|
||||||
#elif defined(XP_OS2)
|
#elif defined(XP_OS2)
|
||||||
gPlatform = new gfxOS2Platform;
|
gPlatform = new gfxOS2Platform;
|
||||||
#elif defined(ANDROID)
|
#elif defined(ANDROID)
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#define USE_MAC_LOCALE
|
#define USE_MAC_LOCALE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_BEOS)
|
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||||
#define USE_UNIX_LOCALE
|
#define USE_UNIX_LOCALE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
#elif defined(XP_MACOSX)
|
#elif defined(XP_MACOSX)
|
||||||
# include <Carbon/Carbon.h>
|
# include <Carbon/Carbon.h>
|
||||||
# include "nsIMacLocale.h"
|
# include "nsIMacLocale.h"
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
#elif defined(XP_UNIX)
|
||||||
# include <locale.h>
|
# include <locale.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include "nsIPosixLocale.h"
|
# include "nsIPosixLocale.h"
|
||||||
|
@ -84,7 +84,7 @@ const char* LocaleList[LocaleListLength] =
|
||||||
#define NSILOCALE_MAX_ACCEPT_LANGUAGE 16
|
#define NSILOCALE_MAX_ACCEPT_LANGUAGE 16
|
||||||
#define NSILOCALE_MAX_ACCEPT_LENGTH 18
|
#define NSILOCALE_MAX_ACCEPT_LENGTH 18
|
||||||
|
|
||||||
#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_BEOS) || defined(XP_OS2)
|
#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_OS2)
|
||||||
static int posix_locale_category[LocaleListLength] =
|
static int posix_locale_category[LocaleListLength] =
|
||||||
{
|
{
|
||||||
LC_COLLATE,
|
LC_COLLATE,
|
||||||
|
@ -167,7 +167,7 @@ nsLocaleService::nsLocaleService(void)
|
||||||
if (NS_FAILED(result)) { return;}
|
if (NS_FAILED(result)) { return;}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_BEOS)
|
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||||
nsCOMPtr<nsIPosixLocale> posixConverter = do_GetService(NS_POSIXLOCALE_CONTRACTID);
|
nsCOMPtr<nsIPosixLocale> posixConverter = do_GetService(NS_POSIXLOCALE_CONTRACTID);
|
||||||
|
|
||||||
nsAutoString xpLocale, platformLocale;
|
nsAutoString xpLocale, platformLocale;
|
||||||
|
@ -218,7 +218,7 @@ nsLocaleService::nsLocaleService(void)
|
||||||
mApplicationLocale = do_QueryInterface(resultLocale);
|
mApplicationLocale = do_QueryInterface(resultLocale);
|
||||||
} // if ( NS_SUCCEEDED )...
|
} // if ( NS_SUCCEEDED )...
|
||||||
|
|
||||||
#endif // XP_UNIX || XP_BEOS
|
#endif // XP_UNIX
|
||||||
#ifdef XP_OS2
|
#ifdef XP_OS2
|
||||||
nsCOMPtr<nsIOS2Locale> os2Converter = do_GetService(NS_OS2LOCALE_CONTRACTID);
|
nsCOMPtr<nsIOS2Locale> os2Converter = do_GetService(NS_OS2LOCALE_CONTRACTID);
|
||||||
nsAutoString xpLocale;
|
nsAutoString xpLocale;
|
||||||
|
@ -322,7 +322,7 @@ nsLocaleService::NewLocale(const nsAString &aLocale, nsILocale **_retval)
|
||||||
nsString category; category.AssignWithConversion(LocaleList[i]);
|
nsString category; category.AssignWithConversion(LocaleList[i]);
|
||||||
result = resultLocale->AddCategory(category, aLocale);
|
result = resultLocale->AddCategory(category, aLocale);
|
||||||
if (NS_FAILED(result)) return result;
|
if (NS_FAILED(result)) return result;
|
||||||
#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_BEOS)
|
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||||
category.AppendLiteral("##PLATFORM");
|
category.AppendLiteral("##PLATFORM");
|
||||||
result = resultLocale->AddCategory(category, aLocale);
|
result = resultLocale->AddCategory(category, aLocale);
|
||||||
if (NS_FAILED(result)) return result;
|
if (NS_FAILED(result)) return result;
|
||||||
|
|
|
@ -102,9 +102,6 @@ else
|
||||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||||
CPPSRCS += nsMacCharset.cpp
|
CPPSRCS += nsMacCharset.cpp
|
||||||
else
|
else
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
CPPSRCS += nsBeOSCharset.cpp
|
|
||||||
else
|
|
||||||
CPPSRCS += nsUNIXCharset.cpp
|
CPPSRCS += nsUNIXCharset.cpp
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,114 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* Sergei Dolgov (sergei_d@fi.tartu.ee); Tartu University
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsIPlatformCharset.h"
|
|
||||||
#include "nsReadableUtils.h"
|
|
||||||
#include "nsPlatformCharset.h"
|
|
||||||
|
|
||||||
// In BeOS, each window runs in its own thread. Because of this,
|
|
||||||
// we have a proxy layer between the mozilla UI thread, and calls made
|
|
||||||
// within the window's thread via CallMethod(). However, since the windows
|
|
||||||
// are still running in their own thread, and reference counting takes place within
|
|
||||||
// that thread, we need to reference and de-reference outselves atomically.
|
|
||||||
// See BugZilla Bug# 92793
|
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset)
|
|
||||||
|
|
||||||
nsPlatformCharset::nsPlatformCharset()
|
|
||||||
{
|
|
||||||
mCharset.AssignLiteral("UTF-8");
|
|
||||||
}
|
|
||||||
|
|
||||||
nsPlatformCharset::~nsPlatformCharset()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& aResult)
|
|
||||||
{
|
|
||||||
aResult = mCharset;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACString& aResult)
|
|
||||||
{
|
|
||||||
aResult = mCharset;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsPlatformCharset::Init()
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
nsresult
|
|
||||||
nsPlatformCharset::MapToCharset(short script, short region, nsACString& aCharset)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsACString& aCharset)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsPlatformCharset::InitGetCharset(nsACString &aString)
|
|
||||||
{
|
|
||||||
aString = mCharset;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsPlatformCharset::ConvertLocaleToCharsetUsingDeprecatedConfig(nsAString& locale, nsACString& aResult)
|
|
||||||
{
|
|
||||||
aResult = mCharset;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsPlatformCharset::VerifyCharset(nsCString &aCharset)
|
|
||||||
{
|
|
||||||
aCharset = mCharset;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsPlatformCharset::InitInfo()
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
|
@ -650,8 +650,8 @@ EXTRA_DSO_LDOPTS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
|
||||||
LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
|
LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# BeOS and HP-UX do not require the extra linking of "-lm"
|
# HP-UX does not require the extra linking of "-lm"
|
||||||
ifeq (,$(filter BeOS HP-UX WINNT WINCE OpenVMS OS2,$(OS_ARCH)))
|
ifeq (,$(filter HP-UX WINNT WINCE OpenVMS OS2,$(OS_ARCH)))
|
||||||
EXTRA_LIBS += -lm
|
EXTRA_LIBS += -lm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -130,9 +130,6 @@ else
|
||||||
LD := $(CC)
|
LD := $(CC)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
BEOS_ADDON_WORKAROUND = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Strip off the excessively long version numbers on these platforms,
|
# Strip off the excessively long version numbers on these platforms,
|
||||||
|
|
|
@ -914,9 +914,6 @@ ifndef NO_COMPONENTS_MANIFEST
|
||||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
|
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
|
||||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
|
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
|
||||||
endif
|
endif
|
||||||
ifdef BEOS_ADDON_WORKAROUND
|
|
||||||
( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
|
|
||||||
endif
|
|
||||||
else # ! IS_COMPONENT
|
else # ! IS_COMPONENT
|
||||||
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
||||||
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
|
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
|
||||||
|
@ -924,9 +921,6 @@ else
|
||||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
|
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
|
||||||
endif
|
endif
|
||||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
|
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
|
||||||
ifdef BEOS_ADDON_WORKAROUND
|
|
||||||
( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
|
|
||||||
endif
|
|
||||||
endif # IS_COMPONENT
|
endif # IS_COMPONENT
|
||||||
endif # SHARED_LIBRARY
|
endif # SHARED_LIBRARY
|
||||||
ifdef PROGRAM
|
ifdef PROGRAM
|
||||||
|
@ -1060,12 +1054,6 @@ endif
|
||||||
ifdef MOZ_POST_PROGRAM_COMMAND
|
ifdef MOZ_POST_PROGRAM_COMMAND
|
||||||
$(MOZ_POST_PROGRAM_COMMAND) $@
|
$(MOZ_POST_PROGRAM_COMMAND) $@
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
ifdef BEOS_PROGRAM_RESOURCE
|
|
||||||
xres -o $@ $(BEOS_PROGRAM_RESOURCE)
|
|
||||||
mimeset $@
|
|
||||||
endif
|
|
||||||
endif # BeOS
|
|
||||||
|
|
||||||
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
|
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
|
||||||
ifeq (WINCE,$(OS_ARCH))
|
ifeq (WINCE,$(OS_ARCH))
|
||||||
|
|
|
@ -1822,12 +1822,6 @@ dnl ========================================================
|
||||||
dnl System overrides of the defaults for host
|
dnl System overrides of the defaults for host
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-beos*)
|
|
||||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
|
|
||||||
HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
|
|
||||||
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*mingw*|*wince|*winmo)
|
*mingw*|*wince|*winmo)
|
||||||
# we need Python 2.5 on Windows
|
# we need Python 2.5 on Windows
|
||||||
PYTHON_VERSION=2.5
|
PYTHON_VERSION=2.5
|
||||||
|
@ -1961,24 +1955,6 @@ case "$target" in
|
||||||
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*-beos*)
|
|
||||||
no_x=yes
|
|
||||||
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
|
|
||||||
_PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
|
|
||||||
DSO_LDOPTS='-nostart'
|
|
||||||
TK_LIBS='-lbe -lroot'
|
|
||||||
LIBS="$LIBS -lbe"
|
|
||||||
if test "$COMPILE_ENVIRONMENT"; then
|
|
||||||
AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
|
|
||||||
AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
|
|
||||||
fi
|
|
||||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
|
|
||||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
|
|
||||||
_MOZ_USE_RTTI=1
|
|
||||||
USE_DEPENDENT_LIBS=
|
|
||||||
MOZ_USER_DIR="Mozilla"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-bsdi*)
|
*-bsdi*)
|
||||||
dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
|
dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
|
||||||
_PEDANTIC=
|
_PEDANTIC=
|
||||||
|
@ -3458,16 +3434,14 @@ case $target in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dnl We don't want to link with libdl even if it's present on OS X, since
|
dnl We don't want to link with libdl even if it's present on OS X, since
|
||||||
dnl it's not used and not part of the default installation.
|
dnl it's not used and not part of the default installation. OS/2 has dlfcn
|
||||||
dnl The same goes for BeOS. OS/2 has dlfcn in libc.
|
dnl in libc.
|
||||||
dnl We don't want to link against libm or libpthread on Darwin since
|
dnl We don't want to link against libm or libpthread on Darwin since
|
||||||
dnl they both are just symlinks to libSystem and explicitly linking
|
dnl they both are just symlinks to libSystem and explicitly linking
|
||||||
dnl against libSystem causes issues when debugging (see bug 299601).
|
dnl against libSystem causes issues when debugging (see bug 299601).
|
||||||
case $target in
|
case $target in
|
||||||
*-darwin*)
|
*-darwin*)
|
||||||
;;
|
;;
|
||||||
*-beos*)
|
|
||||||
;;
|
|
||||||
*-os2*)
|
*-os2*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -5860,9 +5834,7 @@ fi # COMPILE_ENVIRONMENT
|
||||||
dnl Set various defines and substitutions
|
dnl Set various defines and substitutions
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
|
||||||
if test "$OS_ARCH" = "BeOS"; then
|
if test "$OS_ARCH" = "Darwin"; then
|
||||||
AC_DEFINE(XP_BEOS)
|
|
||||||
elif test "$OS_ARCH" = "Darwin"; then
|
|
||||||
AC_DEFINE(XP_MACOSX)
|
AC_DEFINE(XP_MACOSX)
|
||||||
AC_DEFINE(XP_UNIX)
|
AC_DEFINE(XP_UNIX)
|
||||||
AC_DEFINE(UNIX_ASYNC_DNS)
|
AC_DEFINE(UNIX_ASYNC_DNS)
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
#endif /* _WIN32 || XP_OS2 || WINCE*/
|
#endif /* _WIN32 || XP_OS2 || WINCE*/
|
||||||
|
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
#elif defined(XP_UNIX)
|
||||||
|
|
||||||
#error "This file is supposed to be auto-generated on UNIX platforms, but the"
|
#error "This file is supposed to be auto-generated on UNIX platforms, but the"
|
||||||
#error "static version for Mac and Windows platforms is being used."
|
#error "static version for Mac and Windows platforms is being used."
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#error "Must define one of XP_BEOS, XP_OS2, XP_WIN, or XP_UNIX"
|
#error "Must define one of XP_OS2, XP_WIN, or XP_UNIX"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
# include <mach/vm_map.h>
|
# include <mach/vm_map.h>
|
||||||
# include <malloc/malloc.h>
|
# include <malloc/malloc.h>
|
||||||
|
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
#elif defined(XP_UNIX)
|
||||||
|
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
|
@ -288,7 +288,7 @@ UnmapPages(void *addr, size_t size)
|
||||||
== KERN_SUCCESS);
|
== KERN_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
#elif defined(XP_UNIX)
|
||||||
|
|
||||||
/* Required on Solaris 10. Might improve performance elsewhere. */
|
/* Required on Solaris 10. Might improve performance elsewhere. */
|
||||||
# if defined(SOLARIS) && defined(MAP_ALIGN)
|
# if defined(SOLARIS) && defined(MAP_ALIGN)
|
||||||
|
|
|
@ -51,21 +51,6 @@
|
||||||
#ifndef PROTYPES_H
|
#ifndef PROTYPES_H
|
||||||
#define PROTYPES_H
|
#define PROTYPES_H
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
/* BeOS defines most int types in SupportDefs.h (int8, uint8, int16,
|
|
||||||
* uint16, int32, uint32, int64, uint64), so in the interest of
|
|
||||||
* not conflicting with other definitions elsewhere we have to skip the
|
|
||||||
* #ifdef jungle below, duplicate some definitions, and do our stuff.
|
|
||||||
*/
|
|
||||||
#include <SupportDefs.h>
|
|
||||||
|
|
||||||
typedef JSUintn uintn;
|
|
||||||
#ifndef _XP_Core_
|
|
||||||
typedef JSIntn intn;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* SVR4 typedef of uint is commonly found on UNIX machines. */
|
/* SVR4 typedef of uint is commonly found on UNIX machines. */
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -108,8 +93,6 @@ typedef JSInt16 int16;
|
||||||
typedef JSInt8 int8;
|
typedef JSInt8 int8;
|
||||||
#endif /* AIX && HAVE_SYS_INTTYPES_H */
|
#endif /* AIX && HAVE_SYS_INTTYPES_H */
|
||||||
|
|
||||||
#endif /* XP_BEOS */
|
|
||||||
|
|
||||||
typedef JSFloat64 float64;
|
typedef JSFloat64 float64;
|
||||||
|
|
||||||
/* Re: jsbit.h */
|
/* Re: jsbit.h */
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#ifdef XP_UNIX
|
||||||
|
|
||||||
#ifdef _SVID_GETTOD /* Defined only on Solaris, see Solaris <sys/types.h> */
|
#ifdef _SVID_GETTOD /* Defined only on Solaris, see Solaris <sys/types.h> */
|
||||||
extern int gettimeofday(struct timeval *tv);
|
extern int gettimeofday(struct timeval *tv);
|
||||||
|
@ -326,7 +326,7 @@ PRMJ_Now(void)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
#elif defined(XP_UNIX)
|
||||||
JSInt64
|
JSInt64
|
||||||
PRMJ_Now(void)
|
PRMJ_Now(void)
|
||||||
{
|
{
|
||||||
|
@ -575,7 +575,7 @@ size_t
|
||||||
PRMJ_FormatTime(char *buf, int buflen, const char *fmt, PRMJTime *prtm)
|
PRMJ_FormatTime(char *buf, int buflen, const char *fmt, PRMJTime *prtm)
|
||||||
{
|
{
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS)
|
#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2)
|
||||||
struct tm a;
|
struct tm a;
|
||||||
int fake_tm_year = 0;
|
int fake_tm_year = 0;
|
||||||
#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
|
#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
|
||||||
|
|
|
@ -5259,7 +5259,7 @@ static JSBool
|
||||||
env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
||||||
{
|
{
|
||||||
/* XXX porting may be easy, but these don't seem to supply setenv by default */
|
/* XXX porting may be easy, but these don't seem to supply setenv by default */
|
||||||
#if !defined XP_BEOS && !defined XP_OS2 && !defined SOLARIS
|
#if !defined XP_OS2 && !defined SOLARIS
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
IdToString idstr(cx, id, JS_TRUE);
|
IdToString idstr(cx, id, JS_TRUE);
|
||||||
|
@ -5295,7 +5295,7 @@ env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
*vp = valstr.getJSVal();
|
*vp = valstr.getJSVal();
|
||||||
#endif /* !defined XP_BEOS && !defined XP_OS2 && !defined SOLARIS */
|
#endif /* !defined XP_OS2 && !defined SOLARIS */
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ static const char kXPConnectServiceContractID[] = "@mozilla.org/js/xpc/XPConnect
|
||||||
static const char kObserverServiceContractID[] = "@mozilla.org/observer-service;1";
|
static const char kObserverServiceContractID[] = "@mozilla.org/observer-service;1";
|
||||||
|
|
||||||
/* Some platforms don't have an implementation of PR_MemMap(). */
|
/* Some platforms don't have an implementation of PR_MemMap(). */
|
||||||
#if !defined(XP_BEOS) && !defined(XP_OS2)
|
#ifndef XP_OS2
|
||||||
#define HAVE_PR_MEMMAP
|
#define HAVE_PR_MEMMAP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -892,7 +892,7 @@ static JSBool
|
||||||
env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
||||||
{
|
{
|
||||||
/* XXX porting may be easy, but these don't seem to supply setenv by default */
|
/* XXX porting may be easy, but these don't seem to supply setenv by default */
|
||||||
#if !defined XP_BEOS && !defined XP_OS2 && !defined SOLARIS
|
#if !defined XP_OS2 && !defined SOLARIS
|
||||||
JSString *idstr, *valstr;
|
JSString *idstr, *valstr;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
|
@ -938,7 +938,7 @@ env_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
*vp = STRING_TO_JSVAL(valstr);
|
*vp = STRING_TO_JSVAL(valstr);
|
||||||
#endif /* !defined XP_BEOS && !defined XP_OS2 && !defined SOLARIS */
|
#endif /* !defined XP_OS2 && !defined SOLARIS */
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1071,12 +1071,10 @@ nsPresContext::UpdateCharSet(const nsAFlatCString& aCharSet)
|
||||||
// this will be a language group (or script) code rather than a true language code
|
// this will be a language group (or script) code rather than a true language code
|
||||||
|
|
||||||
// bug 39570: moved from nsLanguageAtomService::LookupCharSet()
|
// bug 39570: moved from nsLanguageAtomService::LookupCharSet()
|
||||||
#if !defined(XP_BEOS)
|
|
||||||
if (mLanguage == nsGkAtoms::Unicode) {
|
if (mLanguage == nsGkAtoms::Unicode) {
|
||||||
NS_RELEASE(mLanguage);
|
NS_RELEASE(mLanguage);
|
||||||
NS_IF_ADDREF(mLanguage = mLangService->GetLocaleLanguage());
|
NS_IF_ADDREF(mLanguage = mLangService->GetLocaleLanguage());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
GetFontPreferences();
|
GetFontPreferences();
|
||||||
}
|
}
|
||||||
#ifdef IBMBIDI
|
#ifdef IBMBIDI
|
||||||
|
|
|
@ -83,8 +83,6 @@ nsRecyclingAllocator *gZlibAllocator = NULL;
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef __SYMBIAN32__
|
||||||
|
@ -115,7 +113,7 @@ static const PRUint16 kSyntheticDate = (1 + (1 << 5) + (0 << 9));
|
||||||
static PRUint16 xtoint(const PRUint8 *ii);
|
static PRUint16 xtoint(const PRUint8 *ii);
|
||||||
static PRUint32 xtolong(const PRUint8 *ll);
|
static PRUint32 xtolong(const PRUint8 *ll);
|
||||||
static PRUint32 HashName(const char* aName, PRUint16 nameLen);
|
static PRUint32 HashName(const char* aName, PRUint16 nameLen);
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#ifdef XP_UNIX
|
||||||
static nsresult ResolveSymlink(const char *path);
|
static nsresult ResolveSymlink(const char *path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -440,7 +438,7 @@ nsresult nsZipArchive::ExtractFile(nsZipItem *item, const char *outname,
|
||||||
PR_Close(aFd);
|
PR_Close(aFd);
|
||||||
if (rv != NS_OK)
|
if (rv != NS_OK)
|
||||||
PR_Delete(outname);
|
PR_Delete(outname);
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#ifdef XP_UNIX
|
||||||
else if (item->IsSymlink())
|
else if (item->IsSymlink())
|
||||||
rv = ResolveSymlink(outname);
|
rv = ResolveSymlink(outname);
|
||||||
#endif
|
#endif
|
||||||
|
@ -550,7 +548,7 @@ MOZ_WIN_MEM_TRY_CATCH(return NS_ERROR_FAILURE)
|
||||||
return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
|
return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#ifdef XP_UNIX
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
// ResolveSymlink
|
// ResolveSymlink
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
|
@ -987,7 +985,7 @@ PRTime nsZipItem::LastModTime()
|
||||||
return GetModTime(Date(), Time());
|
return GetModTime(Date(), Time());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#ifdef XP_UNIX
|
||||||
bool nsZipItem::IsSymlink()
|
bool nsZipItem::IsSymlink()
|
||||||
{
|
{
|
||||||
if (isSynthetic) return false;
|
if (isSynthetic) return false;
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
const PRUint8* GetExtraField(PRUint16 aTag, PRUint16 *aBlockSize);
|
const PRUint8* GetExtraField(PRUint16 aTag, PRUint16 *aBlockSize);
|
||||||
PRTime LastModTime();
|
PRTime LastModTime();
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#ifdef XP_UNIX
|
||||||
bool IsSymlink();
|
bool IsSymlink();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,6 @@ endif
|
||||||
ifeq ($(OS_ARCH),OS2)
|
ifeq ($(OS_ARCH),OS2)
|
||||||
DIRS = icon/os2 icon
|
DIRS = icon/os2 icon
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
DIRS = icon/beos icon
|
|
||||||
endif
|
|
||||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||||
DIRS = icon/mac icon
|
DIRS = icon/mac icon
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -72,11 +72,6 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||||
PLATFORM = mac
|
PLATFORM = mac
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
PLATFORM = beos
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
nsIconURI.cpp \
|
nsIconURI.cpp \
|
||||||
nsIconModule.cpp \
|
nsIconModule.cpp \
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
# ***** BEGIN LICENSE BLOCK *****
|
|
||||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
#
|
|
||||||
# The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
#
|
|
||||||
# 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 the Makefile for the Gnome icon decoder.
|
|
||||||
#
|
|
||||||
# The Initial Developer of the Original Code is
|
|
||||||
# Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
|
||||||
# the Initial Developer. All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Contributor(s):
|
|
||||||
#
|
|
||||||
# Alternatively, the contents of this file may be used under the terms of
|
|
||||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
# of those above. If you wish to allow use of your version of this file only
|
|
||||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
# use your version of this file under the terms of the MPL, indicate your
|
|
||||||
# decision by deleting the provisions above and replace them with the notice
|
|
||||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
# the provisions above, a recipient may use your version of this file under
|
|
||||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
#
|
|
||||||
# ***** END LICENSE BLOCK *****
|
|
||||||
|
|
||||||
|
|
||||||
DEPTH = ../../../../..
|
|
||||||
topsrcdir = @top_srcdir@
|
|
||||||
srcdir = @srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
|
|
||||||
include $(DEPTH)/config/autoconf.mk
|
|
||||||
|
|
||||||
MODULE = imgicon
|
|
||||||
LIBRARY_NAME = imgiconbeos_s
|
|
||||||
LIBXUL_LIBRARY = 1
|
|
||||||
|
|
||||||
|
|
||||||
CPPSRCS = nsIconChannel.cpp
|
|
||||||
|
|
||||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
|
||||||
FORCE_STATIC_LIB = 1
|
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
|
||||||
|
|
|
@ -1,486 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
||||||
*
|
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* Brian Ryner.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Scott MacGregor <mscott@netscape.com>
|
|
||||||
* Neil Rashbrook <neil@parkwaycc.co.uk>
|
|
||||||
* Ben Goodger <ben@mozilla.org>
|
|
||||||
* Simon Taylor <simontaylor2@gawab.com>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
|
|
||||||
#include "nsIconChannel.h"
|
|
||||||
#include "nsIIconURI.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsIInterfaceRequestor.h"
|
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
|
||||||
#include "nsMimeTypes.h"
|
|
||||||
#include "nsMemory.h"
|
|
||||||
#include "nsIStringStream.h"
|
|
||||||
#include "nsIURL.h"
|
|
||||||
#include "nsNetUtil.h"
|
|
||||||
#include "nsInt64.h"
|
|
||||||
#include "nsIFile.h"
|
|
||||||
#include "nsIFileURL.h"
|
|
||||||
#include "nsIMIMEService.h"
|
|
||||||
#include "nsDirectoryServiceDefs.h"
|
|
||||||
|
|
||||||
#include <Mime.h>
|
|
||||||
#include <Bitmap.h>
|
|
||||||
#include <Screen.h>
|
|
||||||
#include <Node.h>
|
|
||||||
#include <NodeInfo.h>
|
|
||||||
|
|
||||||
// nsIconChannel methods
|
|
||||||
nsIconChannel::nsIconChannel()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIconChannel::~nsIconChannel()
|
|
||||||
{}
|
|
||||||
|
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS4(nsIconChannel,
|
|
||||||
nsIChannel,
|
|
||||||
nsIRequest,
|
|
||||||
nsIRequestObserver,
|
|
||||||
nsIStreamListener)
|
|
||||||
|
|
||||||
nsresult nsIconChannel::Init(nsIURI* uri)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(uri, "no uri");
|
|
||||||
mUrl = uri;
|
|
||||||
mOriginalURI = uri;
|
|
||||||
nsresult rv;
|
|
||||||
mPump = do_CreateInstance(NS_INPUTSTREAMPUMP_CONTRACTID, &rv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// nsIRequest methods:
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetName(nsACString &result)
|
|
||||||
{
|
|
||||||
return mUrl->GetSpec(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::IsPending(PRBool *result)
|
|
||||||
{
|
|
||||||
return mPump->IsPending(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetStatus(nsresult *status)
|
|
||||||
{
|
|
||||||
return mPump->GetStatus(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::Cancel(nsresult status)
|
|
||||||
{
|
|
||||||
return mPump->Cancel(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::Suspend(void)
|
|
||||||
{
|
|
||||||
return mPump->Suspend();
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::Resume(void)
|
|
||||||
{
|
|
||||||
return mPump->Resume();
|
|
||||||
}
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
|
||||||
{
|
|
||||||
*aLoadGroup = mLoadGroup;
|
|
||||||
NS_IF_ADDREF(*aLoadGroup);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
|
||||||
{
|
|
||||||
mLoadGroup = aLoadGroup;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetLoadFlags(PRUint32 *aLoadAttributes)
|
|
||||||
{
|
|
||||||
return mPump->GetLoadFlags(aLoadAttributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::SetLoadFlags(PRUint32 aLoadAttributes)
|
|
||||||
{
|
|
||||||
return mPump->SetLoadFlags(aLoadAttributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// nsIChannel methods:
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetOriginalURI(nsIURI* *aURI)
|
|
||||||
{
|
|
||||||
*aURI = mOriginalURI;
|
|
||||||
NS_ADDREF(*aURI);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::SetOriginalURI(nsIURI* aURI)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aURI);
|
|
||||||
mOriginalURI = aURI;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetURI(nsIURI* *aURI)
|
|
||||||
{
|
|
||||||
*aURI = mUrl;
|
|
||||||
NS_IF_ADDREF(*aURI);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsIconChannel::Open(nsIInputStream **_retval)
|
|
||||||
{
|
|
||||||
return MakeInputStream(_retval, PR_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
nsCOMPtr<nsIMozIconURI> iconURI (do_QueryInterface(mUrl, &rv));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
iconURI->GetImageSize(aDesiredImageSize);
|
|
||||||
iconURI->GetContentType(aContentType);
|
|
||||||
iconURI->GetFileExtension(aFileExtension);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> fileURI;
|
|
||||||
rv = iconURI->GetIconFile(getter_AddRefs(fileURI));
|
|
||||||
if (NS_FAILED(rv) || !fileURI) return NS_OK;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(fileURI, &rv);
|
|
||||||
if (NS_FAILED(rv) || !fileURL) return NS_OK;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> file;
|
|
||||||
rv = fileURL->GetFile(getter_AddRefs(file));
|
|
||||||
if (NS_FAILED(rv) || !file) return NS_OK;
|
|
||||||
|
|
||||||
*aLocalFile = file;
|
|
||||||
NS_IF_ADDREF(*aLocalFile);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIInputStream> inStream;
|
|
||||||
nsresult rv = MakeInputStream(getter_AddRefs(inStream), PR_TRUE);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
// Init our streampump
|
|
||||||
rv = mPump->Init(inStream, nsInt64(-1), nsInt64(-1), 0, 0, PR_FALSE);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
rv = mPump->AsyncRead(this, ctxt);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
// Store our real listener
|
|
||||||
mListener = aListener;
|
|
||||||
// Add ourself to the load group, if available
|
|
||||||
if (mLoadGroup)
|
|
||||||
mLoadGroup->AddRequest(this, nsnull);
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
|
|
||||||
{
|
|
||||||
nsXPIDLCString contentType;
|
|
||||||
nsCAutoString filePath;
|
|
||||||
nsCAutoString fileExtension;
|
|
||||||
nsCOMPtr<nsIFile> localFile; // File we want an icon for
|
|
||||||
PRUint32 desiredImageSize;
|
|
||||||
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, fileExtension);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
PRUint32 iconSize = 16;
|
|
||||||
if (desiredImageSize > 16)
|
|
||||||
iconSize = 32;
|
|
||||||
|
|
||||||
PRUint32 alphaBytesPerRow = (iconSize / 8);
|
|
||||||
if (iconSize % 32 != 0)
|
|
||||||
alphaBytesPerRow = ((iconSize / 32) + 1) * 4;
|
|
||||||
|
|
||||||
PRBool fileExists = PR_FALSE;
|
|
||||||
if (localFile)
|
|
||||||
{
|
|
||||||
localFile->GetNativePath(filePath);
|
|
||||||
localFile->Exists(&fileExists);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the native icon.
|
|
||||||
// 1) If it is for an actual local file, BNodeInfo::GetTrackerIcon.
|
|
||||||
// 2) If the local file does not exist, use the content type
|
|
||||||
// and BMimeType::GetIcon
|
|
||||||
BBitmap nativeIcon(BRect(0, 0, iconSize - 1, iconSize - 1), B_CMAP8);
|
|
||||||
if (!nativeIcon.IsValid())
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
PRBool gotBitmap = PR_FALSE;
|
|
||||||
if (fileExists)
|
|
||||||
{
|
|
||||||
BNode localNode(filePath.get());
|
|
||||||
// BeOS doesn't MIME type foreign files immediately -
|
|
||||||
// If there is no type attribute then we can force an identify
|
|
||||||
if (localNode.ReadAttr("BEOS:TYPE", B_STRING_TYPE, 0, NULL, 0) != B_OK)
|
|
||||||
update_mime_info(filePath.get(), 0, 1, 1);
|
|
||||||
|
|
||||||
BNodeInfo localNodeInfo(&localNode);
|
|
||||||
if (iconSize == 16)
|
|
||||||
{
|
|
||||||
if (localNodeInfo.GetTrackerIcon(&nativeIcon, B_MINI_ICON) == B_OK)
|
|
||||||
gotBitmap = PR_TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (localNodeInfo.GetTrackerIcon(&nativeIcon, B_LARGE_ICON) == B_OK)
|
|
||||||
gotBitmap = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we haven't got a bitmap yet, use the content type
|
|
||||||
if (!gotBitmap)
|
|
||||||
{
|
|
||||||
// If no content type specified, use mozilla's mime service to guess a mime type
|
|
||||||
if (contentType.IsEmpty())
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIMIMEService> mimeService (do_GetService("@mozilla.org/mime;1", &rv));
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
mimeService->GetTypeFromExtension(fileExtension, contentType);
|
|
||||||
// If unrecognised extension - set to generic file
|
|
||||||
if (contentType.IsEmpty())
|
|
||||||
contentType = "application/octet-stream";
|
|
||||||
}
|
|
||||||
// Create BeOS-Native MIME type info - if unheard of, set to generic file
|
|
||||||
BMimeType mimeType(contentType.get());
|
|
||||||
if (!mimeType.IsInstalled())
|
|
||||||
mimeType.SetTo("application/octet-stream");
|
|
||||||
if (iconSize == 16)
|
|
||||||
{
|
|
||||||
if (mimeType.GetIcon(&nativeIcon, B_MINI_ICON) == B_OK)
|
|
||||||
gotBitmap = PR_TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mimeType.GetIcon(&nativeIcon, B_LARGE_ICON) == B_OK)
|
|
||||||
gotBitmap = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gotBitmap)
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
BScreen mainScreen(B_MAIN_SCREEN_ID);
|
|
||||||
if (!mainScreen.IsValid())
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
// Got a bitmap and color space info - convert data to mozilla's icon format
|
|
||||||
PRUint32 iconLength = 2 + iconSize * iconSize * 4;
|
|
||||||
uint8 *buffer = new uint8[iconLength];
|
|
||||||
if (!buffer)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
uint8* destByte = buffer;
|
|
||||||
*(destByte++) = iconSize;
|
|
||||||
*(destByte++) = iconSize;
|
|
||||||
|
|
||||||
// RGB data
|
|
||||||
uint8* sourceByte = (uint8*)nativeIcon.Bits();
|
|
||||||
for(PRUint32 iconRow = 0; iconRow < iconSize; iconRow++)
|
|
||||||
{
|
|
||||||
sourceByte = (uint8*)nativeIcon.Bits() + nativeIcon.BytesPerRow() * iconRow;
|
|
||||||
for(PRUint32 iconCol = 0; iconCol < iconSize; iconCol++)
|
|
||||||
{
|
|
||||||
if (*sourceByte != B_TRANSPARENT_MAGIC_CMAP8)
|
|
||||||
{
|
|
||||||
rgb_color colorVal = mainScreen.ColorForIndex(*sourceByte);
|
|
||||||
#ifdef IS_LITTLE_ENDIAN
|
|
||||||
*(destByte++) = colorVal.blue;
|
|
||||||
*(destByte++) = colorVal.green;
|
|
||||||
*(destByte++) = colorVal.red;
|
|
||||||
*(destByte++) = uint8(255);
|
|
||||||
#else
|
|
||||||
*(destByte++) = uint8(255);
|
|
||||||
*(destByte++) = colorVal.red;
|
|
||||||
*(destByte++) = colorVal.green;
|
|
||||||
*(destByte++) = colorVal.blue;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*destByte++ = 0;
|
|
||||||
*destByte++ = 0;
|
|
||||||
*destByte++ = 0;
|
|
||||||
*destByte++ = 0;
|
|
||||||
}
|
|
||||||
// original code had a conditional here:
|
|
||||||
// if (iconCol < iconSize - 1)
|
|
||||||
// Leaving this comment in case complications arise later
|
|
||||||
sourceByte++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_ASSERTION(buffer + iconLength == destByte, "size miscalculation");
|
|
||||||
|
|
||||||
// Now, create a pipe and stuff our data into it
|
|
||||||
nsCOMPtr<nsIInputStream> inStream;
|
|
||||||
nsCOMPtr<nsIOutputStream> outStream;
|
|
||||||
rv = NS_NewPipe(getter_AddRefs(inStream), getter_AddRefs(outStream),
|
|
||||||
iconLength, iconLength, nonBlocking);
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
PRUint32 written;
|
|
||||||
rv = outStream->Write((char*)buffer, iconLength, &written);
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
NS_ADDREF(*_retval = inStream);
|
|
||||||
}
|
|
||||||
delete [] buffer;
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetContentType(nsACString &aContentType)
|
|
||||||
{
|
|
||||||
aContentType.AssignLiteral("image/icon");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsIconChannel::SetContentType(const nsACString &aContentType)
|
|
||||||
{
|
|
||||||
// It doesn't make sense to set the content-type on this type
|
|
||||||
// of channel...
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetContentCharset(nsACString &aContentCharset)
|
|
||||||
{
|
|
||||||
aContentCharset.Truncate();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
|
||||||
{
|
|
||||||
// It doesn't make sense to set the content-charset on this type
|
|
||||||
// of channel...
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
|
||||||
{
|
|
||||||
*aContentLength = mContentLength;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
|
||||||
{
|
|
||||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetOwner(nsISupports* *aOwner)
|
|
||||||
{
|
|
||||||
*aOwner = mOwner.get();
|
|
||||||
NS_IF_ADDREF(*aOwner);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::SetOwner(nsISupports* aOwner)
|
|
||||||
{
|
|
||||||
mOwner = aOwner;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
|
||||||
{
|
|
||||||
*aNotificationCallbacks = mCallbacks.get();
|
|
||||||
NS_IF_ADDREF(*aNotificationCallbacks);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
|
|
||||||
{
|
|
||||||
mCallbacks = aNotificationCallbacks;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
|
||||||
{
|
|
||||||
*aSecurityInfo = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nsIRequestObserver methods
|
|
||||||
NS_IMETHODIMP nsIconChannel::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
|
||||||
{
|
|
||||||
if (mListener)
|
|
||||||
return mListener->OnStartRequest(this, aContext);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsIconChannel::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatus)
|
|
||||||
{
|
|
||||||
if (mListener) {
|
|
||||||
mListener->OnStopRequest(this, aContext, aStatus);
|
|
||||||
mListener = nsnull;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove from load group
|
|
||||||
if (mLoadGroup)
|
|
||||||
mLoadGroup->RemoveRequest(this, nsnull, aStatus);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nsIStreamListener methods
|
|
||||||
NS_IMETHODIMP nsIconChannel::OnDataAvailable(nsIRequest* aRequest,
|
|
||||||
nsISupports* aContext,
|
|
||||||
nsIInputStream* aStream,
|
|
||||||
PRUint32 aOffset,
|
|
||||||
PRUint32 aCount)
|
|
||||||
{
|
|
||||||
if (mListener)
|
|
||||||
return mListener->OnDataAvailable(this, aContext, aStream, aOffset, aCount);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
||||||
*
|
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* Brian Ryner.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Scott MacGregor <mscott@netscape.com>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsIconChannel_h___
|
|
||||||
#define nsIconChannel_h___
|
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIChannel.h"
|
|
||||||
#include "nsILoadGroup.h"
|
|
||||||
#include "nsIInterfaceRequestor.h"
|
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
|
||||||
#include "nsIURI.h"
|
|
||||||
#include "nsIInputStreamPump.h"
|
|
||||||
#include "nsIStreamListener.h"
|
|
||||||
|
|
||||||
class nsIFile;
|
|
||||||
|
|
||||||
class nsIconChannel : public nsIChannel, public nsIStreamListener
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIREQUEST
|
|
||||||
NS_DECL_NSICHANNEL
|
|
||||||
NS_DECL_NSIREQUESTOBSERVER
|
|
||||||
NS_DECL_NSISTREAMLISTENER
|
|
||||||
|
|
||||||
nsIconChannel();
|
|
||||||
~nsIconChannel();
|
|
||||||
|
|
||||||
nsresult Init(nsIURI* uri);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsCOMPtr<nsIURI> mUrl;
|
|
||||||
nsCOMPtr<nsIURI> mOriginalURI;
|
|
||||||
PRInt32 mContentLength;
|
|
||||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
|
||||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
|
||||||
nsCOMPtr<nsISupports> mOwner;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIInputStreamPump> mPump;
|
|
||||||
nsCOMPtr<nsIStreamListener> mListener;
|
|
||||||
|
|
||||||
nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension);
|
|
||||||
nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* nsIconChannel_h___ */
|
|
|
@ -81,7 +81,7 @@ include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, \
|
GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, \
|
||||||
mailnews.js editor.js \
|
mailnews.js editor.js \
|
||||||
aix.js beos.js unix.js winpref.js os2prefs.js openvms.js)
|
aix.js unix.js winpref.js os2prefs.js openvms.js)
|
||||||
|
|
||||||
GARBAGE += greprefs.js
|
GARBAGE += greprefs.js
|
||||||
|
|
||||||
|
|
|
@ -2452,102 +2452,6 @@ pref("mousewheel.system_scroll_override_on_root_content.enabled", false);
|
||||||
# OS2
|
# OS2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
|
|
||||||
pref("intl.font_charset", "");
|
|
||||||
pref("intl.font_spec_list", "");
|
|
||||||
pref("mail.signature_date", 0);
|
|
||||||
|
|
||||||
pref("font.alias-list", "sans,sans-serif,serif,monospace");
|
|
||||||
|
|
||||||
pref("font.default.ar", "sans-serif");
|
|
||||||
pref("font.size.variable.ar", 16);
|
|
||||||
pref("font.size.fixed.ar", 13);
|
|
||||||
|
|
||||||
pref("font.default.el", "serif");
|
|
||||||
pref("font.size.variable.el", 16);
|
|
||||||
pref("font.size.fixed.el", 13);
|
|
||||||
|
|
||||||
pref("font.default.he", "sans-serif");
|
|
||||||
pref("font.size.variable.he", 16);
|
|
||||||
pref("font.size.fixed.he", 13);
|
|
||||||
|
|
||||||
pref("font.default.ja", "sans-serif");
|
|
||||||
pref("font.size.variable.ja", 16);
|
|
||||||
pref("font.size.fixed.ja", 16);
|
|
||||||
|
|
||||||
pref("font.default.ko", "sans-serif");
|
|
||||||
pref("font.size.variable.ko", 16);
|
|
||||||
pref("font.size.fixed.ko", 16);
|
|
||||||
|
|
||||||
pref("font.default.th", "serif");
|
|
||||||
pref("font.size.variable.th", 16);
|
|
||||||
pref("font.size.fixed.th", 13);
|
|
||||||
|
|
||||||
pref("font.default.tr", "serif");
|
|
||||||
pref("font.size.variable.tr", 16);
|
|
||||||
pref("font.size.fixed.tr", 13);
|
|
||||||
|
|
||||||
pref("font.default.x-baltic", "serif");
|
|
||||||
pref("font.size.variable.x-baltic", 16);
|
|
||||||
pref("font.size.fixed.x-baltic", 13);
|
|
||||||
|
|
||||||
pref("font.default.x-central-euro", "serif");
|
|
||||||
pref("font.size.variable.x-central-euro", 16);
|
|
||||||
pref("font.size.fixed.x-central-euro", 13);
|
|
||||||
|
|
||||||
pref("font.default.x-cyrillic", "serif");
|
|
||||||
pref("font.size.variable.x-cyrillic", 16);
|
|
||||||
pref("font.size.fixed.x-cyrillic", 13);
|
|
||||||
|
|
||||||
pref("font.default.x-unicode", "serif");
|
|
||||||
pref("font.size.variable.x-unicode", 16);
|
|
||||||
pref("font.size.fixed.x-unicode", 13);
|
|
||||||
|
|
||||||
pref("font.default.x-western", "serif");
|
|
||||||
pref("font.size.variable.x-western", 16);
|
|
||||||
pref("font.size.fixed.x-western", 13);
|
|
||||||
|
|
||||||
pref("font.default.zh-CN", "sans-serif");
|
|
||||||
pref("font.size.variable.zh-CN", 16);
|
|
||||||
pref("font.size.fixed.zh-CN", 16);
|
|
||||||
|
|
||||||
pref("font.default.zh-TW", "sans-serif");
|
|
||||||
pref("font.size.variable.zh-TW", 16);
|
|
||||||
pref("font.size.fixed.zh-TW", 16);
|
|
||||||
|
|
||||||
pref("font.default.zh-HK", "sans-serif");
|
|
||||||
pref("font.size.variable.zh-HK", 16);
|
|
||||||
pref("font.size.fixed.zh-HK", 16);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set default accelKey to "Alt", which is the default under BeOS.
|
|
||||||
* The generalAccessKey is used for shortcuts on web pages, set to
|
|
||||||
* Ctrl+Shift. The menuAccessKey is now the "windows" key.
|
|
||||||
*/
|
|
||||||
pref("ui.key.accelKey", 18);
|
|
||||||
pref("ui.key.menuAccessKey", 17);
|
|
||||||
pref("ui.key.generalAccessKey", -1);
|
|
||||||
|
|
||||||
// If generalAccessKey is -1, use the following two prefs instead.
|
|
||||||
// Use 0 for disabled, 1 for Shift, 2 for Ctrl, 4 for Alt, 8 for Meta
|
|
||||||
// (values can be combined, e.g. 3 for Ctrl+Shift)
|
|
||||||
pref("ui.key.chromeAccess", 2);
|
|
||||||
pref("ui.key.contentAccess", 3);
|
|
||||||
|
|
||||||
// xxx toolkit?
|
|
||||||
pref("browser.download.dir", "/boot/home/Downloads");
|
|
||||||
|
|
||||||
// IMEs of BeOS might use non-topmost windows for topmost <panel> element,
|
|
||||||
// see bug 451015. If there are other problems by this value, we may need to
|
|
||||||
// change this value.
|
|
||||||
pref("ui.panel.default_level_parent", false);
|
|
||||||
|
|
||||||
pref("mousewheel.system_scroll_override_on_root_content.enabled", false);
|
|
||||||
|
|
||||||
# BeOS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
// Handled differently under Mac/Windows
|
// Handled differently under Mac/Windows
|
||||||
pref("network.protocol-handler.warn-external.file", false);
|
pref("network.protocol-handler.warn-external.file", false);
|
||||||
|
|
|
@ -72,10 +72,6 @@
|
||||||
#include <os2.h>
|
#include <os2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
#include "Alert.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BOGUS_DEFAULT_INT_PREF_VALUE (-5632)
|
#define BOGUS_DEFAULT_INT_PREF_VALUE (-5632)
|
||||||
#define BOGUS_DEFAULT_BOOL_PREF_VALUE (-2)
|
#define BOGUS_DEFAULT_BOOL_PREF_VALUE (-2)
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,6 @@ CPPSRCS = \
|
||||||
PluginPRLibrary.cpp \
|
PluginPRLibrary.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifeq ($(OS_ARCH), BeOS)
|
|
||||||
CPPSRCS += nsPluginsDirBeOS.cpp
|
|
||||||
CPPSRCS += nsPluginNativeWindow.cpp
|
|
||||||
else
|
|
||||||
ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
|
ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
|
||||||
CPPSRCS += nsPluginsDirWin.cpp
|
CPPSRCS += nsPluginsDirWin.cpp
|
||||||
CPPSRCS += nsPluginNativeWindowWin.cpp
|
CPPSRCS += nsPluginNativeWindowWin.cpp
|
||||||
|
@ -100,7 +96,6 @@ endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
LOCAL_INCLUDES = \
|
LOCAL_INCLUDES = \
|
||||||
-I$(topsrcdir)/xpcom/base/ \
|
-I$(topsrcdir)/xpcom/base/ \
|
||||||
|
|
|
@ -1,297 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Alex Musil
|
|
||||||
* Makoto Hamanaka <VYA04230@nifty.com>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
/*
|
|
||||||
nsPluginsDirBeOS.cpp
|
|
||||||
|
|
||||||
BeOS implementation of the nsPluginsDir/nsPluginsFile classes.
|
|
||||||
|
|
||||||
Based on nsPluginsDirUNIX.cpp r1.12 by Alex Musil
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nsPluginsDir.h"
|
|
||||||
#include "prlink.h"
|
|
||||||
#include "plstr.h"
|
|
||||||
#include "prmem.h"
|
|
||||||
#include "nsReadableUtils.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
#include <File.h>
|
|
||||||
#include <AppFileInfo.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
//#define NS_PLUGIN_BEOS_DEBUG
|
|
||||||
|
|
||||||
/* Local helper functions */
|
|
||||||
|
|
||||||
static char* GetFileName(const char* pathname)
|
|
||||||
{
|
|
||||||
const char* filename = nsnull;
|
|
||||||
|
|
||||||
// this is most likely a path, so skip to the filename
|
|
||||||
filename = PL_strrchr(pathname, '/');
|
|
||||||
if(filename)
|
|
||||||
++filename;
|
|
||||||
else
|
|
||||||
filename = pathname;
|
|
||||||
|
|
||||||
return PL_strdup(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsresult GetMimeExtensions(const char *mimeType, char *extensions, int extLen)
|
|
||||||
{
|
|
||||||
// check variables
|
|
||||||
if (!mimeType || !extensions || extLen < 1) return NS_ERROR_FAILURE;
|
|
||||||
extensions[0] = '\0';
|
|
||||||
|
|
||||||
// make mime object
|
|
||||||
BMimeType mime(mimeType) ;
|
|
||||||
if (mime.InitCheck() != B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// get extensions : comma separated (if multiple extensions in a mime-type)
|
|
||||||
// ex) "jpg,jpeg"
|
|
||||||
BString extStr("");
|
|
||||||
BMessage extMsg;
|
|
||||||
mime.GetFileExtensions(&extMsg);
|
|
||||||
uint32 type;
|
|
||||||
int32 types_num;
|
|
||||||
if (extMsg.GetInfo("extensions", &type, &types_num) != B_OK
|
|
||||||
|| type != B_STRING_TYPE || types_num == 0)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
for (int i = 0 ; i < types_num ; i ++) {
|
|
||||||
const char *ext;
|
|
||||||
if (extMsg.FindString("extensions", i, &ext) != B_OK) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i > 0)
|
|
||||||
extStr.Append(",");
|
|
||||||
extStr.Append(ext);
|
|
||||||
}
|
|
||||||
PL_strncpyz(extensions, extStr.String(), extLen) ;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/* nsPluginsDir implementation */
|
|
||||||
|
|
||||||
PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/* nsPluginFile implementation */
|
|
||||||
|
|
||||||
nsPluginFile::nsPluginFile(nsIFile* spec)
|
|
||||||
: mPlugin(spec)
|
|
||||||
{
|
|
||||||
// nada
|
|
||||||
}
|
|
||||||
|
|
||||||
nsPluginFile::~nsPluginFile()
|
|
||||||
{
|
|
||||||
// nada
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the plugin into memory using NSPR's shared-library loading
|
|
||||||
* mechanism. Handles platform differences in loading shared libraries.
|
|
||||||
*/
|
|
||||||
nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
|
|
||||||
{
|
|
||||||
nsCAutoString path;
|
|
||||||
nsresult rv = mPlugin->GetNativePath(path);
|
|
||||||
if (NS_OK != rv) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
pLibrary = *outLibrary = PR_LoadLibrary(path.get());
|
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
printf("LoadPlugin() %s returned %lx\n",path,(unsigned long)pLibrary);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef char* (*BeOS_Plugin_GetMIMEDescription)();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtains all of the information currently available for this plugin.
|
|
||||||
*/
|
|
||||||
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
|
|
||||||
{
|
|
||||||
*outLibrary = nsnull;
|
|
||||||
|
|
||||||
info.fVersion = nsnull;
|
|
||||||
|
|
||||||
nsCAutoString fullPath;
|
|
||||||
if (NS_FAILED(rv = mPlugin->GetNativePath(fullPath)))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
nsCAutoString fileName;
|
|
||||||
if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
const char *path = fullPath.get();
|
|
||||||
int i;
|
|
||||||
|
|
||||||
#ifdef NS_PLUGIN_BEOS_DEBUG
|
|
||||||
printf("nsPluginFile::GetPluginInfo() an attempt to load MIME String\n");
|
|
||||||
printf("path = <%s>\n", path);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// get supported mime types
|
|
||||||
BFile file(path, B_READ_ONLY);
|
|
||||||
if (file.InitCheck() != B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
BAppFileInfo appinfo(&file);
|
|
||||||
if (appinfo.InitCheck() != B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
BMessage msg;
|
|
||||||
if (appinfo.GetSupportedTypes(&msg) != B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
uint32 type;
|
|
||||||
int32 types_num;
|
|
||||||
if (msg.GetInfo("types", &type, &types_num) != B_OK
|
|
||||||
|| type != B_STRING_TYPE)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// set mime types to plugin info
|
|
||||||
info.fMimeTypeArray =(char **)PR_Malloc(types_num * sizeof(char *));
|
|
||||||
info.fMimeDescriptionArray =(char **)PR_Malloc(types_num * sizeof(char *));
|
|
||||||
info.fExtensionArray =(char **)PR_Malloc(types_num * sizeof(char *));
|
|
||||||
|
|
||||||
for (i = 0 ; i < types_num ; i ++) {
|
|
||||||
// get mime string
|
|
||||||
const char *mtype;
|
|
||||||
if (msg.FindString("types", i, &mtype) != B_OK) {
|
|
||||||
types_num = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get (short)description for the mime
|
|
||||||
char desc[B_MIME_TYPE_LENGTH+1] = "";
|
|
||||||
BMimeType mime(mtype) ;
|
|
||||||
if (mime.InitCheck() == B_OK)
|
|
||||||
mime.GetShortDescription(desc);
|
|
||||||
|
|
||||||
// get file extensions for the mime
|
|
||||||
char extensions[B_MIME_TYPE_LENGTH+1] = "";
|
|
||||||
GetMimeExtensions(mtype, extensions, B_MIME_TYPE_LENGTH+1);
|
|
||||||
|
|
||||||
#ifdef NS_PLUGIN_BEOS_DEBUG
|
|
||||||
printf(" mime = %30s | %10s | %15s |\n",
|
|
||||||
mtype, extensions, desc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
info.fMimeTypeArray[i] = PL_strdup( mtype ? mtype : (char *)"" ) ;
|
|
||||||
info.fMimeDescriptionArray[i] = PL_strdup( desc ) ;
|
|
||||||
info.fExtensionArray[i] = PL_strdup( extensions );
|
|
||||||
}
|
|
||||||
|
|
||||||
// get name and description of this plugin
|
|
||||||
version_info vinfo;
|
|
||||||
if (appinfo.GetVersionInfo(&vinfo, B_APP_VERSION_KIND) == B_OK
|
|
||||||
&& *vinfo.short_info) {
|
|
||||||
// XXX convert UTF-8 2byte chars to 1 byte chars, to avoid string corruption
|
|
||||||
info.fName = ToNewCString(NS_ConvertUTF8toUTF16(vinfo.short_info));
|
|
||||||
info.fDescription = ToNewCString(NS_ConvertUTF8toUTF16(vinfo.long_info));
|
|
||||||
} else {
|
|
||||||
// use filename as its name
|
|
||||||
info.fName = GetFileName(path);
|
|
||||||
info.fDescription = PL_strdup("");
|
|
||||||
}
|
|
||||||
|
|
||||||
info.fVariantCount = types_num;
|
|
||||||
info.fFullPath = PL_strdup(fullPath.get());
|
|
||||||
info.fFileName = PL_strdup(fileName.get());
|
|
||||||
|
|
||||||
#ifdef NS_PLUGIN_BEOS_DEBUG
|
|
||||||
printf("info.fFileName = %s\n", info.fFileName);
|
|
||||||
printf("info.fName = %s\n", info.fName);
|
|
||||||
printf("info.fDescription = %s\n", info.fDescription);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
|
|
||||||
{
|
|
||||||
if (info.fName)
|
|
||||||
PL_strfree(info.fName);
|
|
||||||
|
|
||||||
if (info.fDescription)
|
|
||||||
PL_strfree(info.fDescription);
|
|
||||||
|
|
||||||
for (PRUint32 i = 0; i < info.fVariantCount; i++) {
|
|
||||||
if (info.fMimeTypeArray[i])
|
|
||||||
PL_strfree(info.fMimeTypeArray[i]);
|
|
||||||
|
|
||||||
if (info.fMimeDescriptionArray[i])
|
|
||||||
PL_strfree(info.fMimeDescriptionArray[i]);
|
|
||||||
|
|
||||||
if (info.fExtensionArray[i])
|
|
||||||
PL_strfree(info.fExtensionArray[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
PR_FREEIF(info.fMimeTypeArray);
|
|
||||||
PR_FREEIF(info.fMimeDescriptionArray);
|
|
||||||
PR_FREEIF(info.fExtensionArray);
|
|
||||||
|
|
||||||
if (info.fFullPath)
|
|
||||||
PL_strfree(info.fFullPath);
|
|
||||||
|
|
||||||
if (info.fFileName)
|
|
||||||
PL_strfree(info.fFileName);
|
|
||||||
|
|
||||||
if (info.fVersion)
|
|
||||||
PL_strfree(info.fVersion);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
// include files for ftruncate (or equivalent)
|
// include files for ftruncate (or equivalent)
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#if defined(XP_UNIX)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(XP_WIN)
|
#elif defined(XP_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -316,7 +316,7 @@ nsDiskCache::Truncate(PRFileDesc * fd, PRUint32 newEOF)
|
||||||
{
|
{
|
||||||
// use modified SetEOF from nsFileStreams::SetEOF()
|
// use modified SetEOF from nsFileStreams::SetEOF()
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#if defined(XP_UNIX)
|
||||||
if (ftruncate(PR_FileDesc2NativeHandle(fd), newEOF) != 0) {
|
if (ftruncate(PR_FileDesc2NativeHandle(fd), newEOF) != 0) {
|
||||||
NS_ERROR("ftruncate failed");
|
NS_ERROR("ftruncate failed");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
#include "mozilla/net/NeckoChild.h"
|
#include "mozilla/net/NeckoChild.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
#if defined(XP_UNIX)
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -685,8 +685,6 @@ nsHttpHandler::InitUserAgentComponents()
|
||||||
"Windows"
|
"Windows"
|
||||||
#elif defined(XP_MACOSX)
|
#elif defined(XP_MACOSX)
|
||||||
"Macintosh"
|
"Macintosh"
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
"BeOS"
|
|
||||||
#elif defined(MOZ_PLATFORM_MAEMO)
|
#elif defined(MOZ_PLATFORM_MAEMO)
|
||||||
"Maemo"
|
"Maemo"
|
||||||
#elif defined(MOZ_X11)
|
#elif defined(MOZ_X11)
|
||||||
|
@ -751,7 +749,7 @@ nsHttpHandler::InitUserAgentComponents()
|
||||||
(::Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) {
|
(::Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) {
|
||||||
mOscpu += nsPrintfCString(" %d.%d", majorVersion, minorVersion);
|
mOscpu += nsPrintfCString(" %d.%d", majorVersion, minorVersion);
|
||||||
}
|
}
|
||||||
#elif defined (XP_UNIX) || defined (XP_BEOS)
|
#elif defined (XP_UNIX)
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
|
|
||||||
int ret = uname(&name);
|
int ret = uname(&name);
|
||||||
|
|
|
@ -69,18 +69,10 @@
|
||||||
#include "nsCRTGlue.h"
|
#include "nsCRTGlue.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "nsILineInputStream.h"
|
#include "nsILineInputStream.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
#include <File.h>
|
|
||||||
#include <NodeInfo.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(XP_WIN) || defined(XP_BEOS)
|
|
||||||
#include "nsDirectoryServiceDefs.h"
|
#include "nsDirectoryServiceDefs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -215,22 +207,6 @@ FileSystemDataSource::Init()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
nsCOMPtr<nsIFile> file;
|
|
||||||
NS_GetSpecialDirectory(NS_BEOS_SETTINGS_DIR, getter_AddRefs(file));
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
file->AppendNative(NS_LITERAL_CSTRING("NetPositive"));
|
|
||||||
file->AppendNative(NS_LITERAL_CSTRING("Bookmarks"));
|
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> furi;
|
|
||||||
NS_NewFileURI(getter_AddRefs(furi), file);
|
|
||||||
NS_ENSURE_TRUE(furi, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
file->GetNativePath(netPositiveDir);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +901,7 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_BEOS) || defined(WINCE)
|
#if defined(XP_UNIX) || defined(WINCE)
|
||||||
mRDFService->GetResource(NS_LITERAL_CSTRING("file:///"), getter_AddRefs(vol));
|
mRDFService->GetResource(NS_LITERAL_CSTRING("file:///"), getter_AddRefs(vol));
|
||||||
volumes->AppendElement(vol);
|
volumes->AppendElement(vol);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1320,48 +1296,6 @@ FileSystemDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral **aResult)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
// under BEOS, try and get the "META:title" attribute (if its a file)
|
|
||||||
if (strstr(uri, netPositiveDir.get()) != 0)
|
|
||||||
{
|
|
||||||
PRBool value;
|
|
||||||
if ((NS_SUCCEEDED(aFileLocal->IsFile(&value) && value)) ||
|
|
||||||
(NS_SUCCEEDED(aFileLocal->IsDirectory(&value) && value)))
|
|
||||||
{
|
|
||||||
nsXPIDLCString nativePath;
|
|
||||||
aFileLocal->GetNativePath(nativePath);
|
|
||||||
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
if (nativePath)
|
|
||||||
{
|
|
||||||
BFile bf(nativePath.get(), B_READ_ONLY);
|
|
||||||
if (bf.InitCheck() == B_OK)
|
|
||||||
{
|
|
||||||
char beNameAttr[4096];
|
|
||||||
ssize_t len;
|
|
||||||
|
|
||||||
if ((len = bf.ReadAttr("META:title", B_STRING_TYPE,
|
|
||||||
0, beNameAttr, sizeof(beNameAttr)-1)) > 0)
|
|
||||||
{
|
|
||||||
beNameAttr[len] = '\0';
|
|
||||||
CopyUTF8toUTF16(beNameAttr, name);
|
|
||||||
rv = NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (NS_OK != rv)
|
|
||||||
{
|
|
||||||
nsCAutoString leafName;
|
|
||||||
rv = aFileLocal->GetNativeLeafName(leafName);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
CopyUTF8toUTF16(leafName, name);
|
|
||||||
rv = NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mRDFService->GetLiteral(name.get(), aResult);
|
mRDFService->GetLiteral(name.get(), aResult);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1493,19 +1427,6 @@ FileSystemDataSource::GetURL(nsIRDFResource *source, PRBool *isFavorite, nsIRDFL
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
// under BEOS, try and get the "META:url" attribute
|
|
||||||
if (!netPositiveDir.IsEmpty())
|
|
||||||
{
|
|
||||||
if (strstr(uri.get(), netPositiveDir.get()) != 0)
|
|
||||||
{
|
|
||||||
if (isFavorite) *isFavorite = PR_TRUE;
|
|
||||||
rv = getNetPositiveURL(source, url, aResult);
|
|
||||||
return(rv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if we fall through to here, its not any type of bookmark
|
// if we fall through to here, its not any type of bookmark
|
||||||
// stored in the platform native file system, so just set the URL
|
// stored in the platform native file system, so just set the URL
|
||||||
|
|
||||||
|
@ -1513,51 +1434,3 @@ FileSystemDataSource::GetURL(nsIRDFResource *source, PRBool *isFavorite, nsIRDFL
|
||||||
|
|
||||||
return(NS_OK);
|
return(NS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
FileSystemDataSource::getNetPositiveURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_RDF_NO_VALUE;
|
|
||||||
|
|
||||||
*urlLiteral = nsnull;
|
|
||||||
|
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> f;
|
|
||||||
NS_GetFileFromURLSpec(NS_ConvertUTF16toUTF8(aFileURL), getter_AddRefs(f));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nsXPIDLCString nativePath;
|
|
||||||
f->GetNativePath(nativePath);
|
|
||||||
|
|
||||||
PRBool value;
|
|
||||||
if (NS_SUCCEEDED(f->IsFile(&value) && value))
|
|
||||||
{
|
|
||||||
if (nativePath)
|
|
||||||
{
|
|
||||||
BFile bf(nativePath.get(), B_READ_ONLY);
|
|
||||||
if (bf.InitCheck() == B_OK)
|
|
||||||
{
|
|
||||||
char beURLattr[4096];
|
|
||||||
ssize_t len;
|
|
||||||
|
|
||||||
if ((len = bf.ReadAttr("META:url", B_STRING_TYPE,
|
|
||||||
0, beURLattr, sizeof(beURLattr)-1)) > 0)
|
|
||||||
{
|
|
||||||
beURLattr[len] = '\0';
|
|
||||||
nsAutoString bookmarkURL;
|
|
||||||
CopyUTF8toUTF16(beURLattr, bookmarkURL);
|
|
||||||
rv = mRDFService->GetLiteral(bookmarkURL.get(),
|
|
||||||
urlLiteral);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(rv);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_WIN) || defined(XP_BEOS)
|
#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_WIN)
|
||||||
#define USE_NC_EXTENSION
|
#define USE_NC_EXTENSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -109,11 +109,6 @@ private:
|
||||||
nsCOMPtr<nsIRDFResource> mNC_IEFavoriteFolder;
|
nsCOMPtr<nsIRDFResource> mNC_IEFavoriteFolder;
|
||||||
nsCString ieFavoritesDir;
|
nsCString ieFavoritesDir;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
nsresult getNetPositiveURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral);
|
|
||||||
nsCString netPositiveDir;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsFileSystemDataSource_h__
|
#endif // nsFileSystemDataSource_h__
|
||||||
|
|
|
@ -64,9 +64,6 @@
|
||||||
#elif defined(XP_WIN)
|
#elif defined(XP_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
#include <Path.h>
|
|
||||||
#include <Directory.h>
|
|
||||||
#elif defined(XP_UNIX)
|
#elif defined(XP_UNIX)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(XP_OS2)
|
#elif defined(XP_OS2)
|
||||||
|
@ -315,38 +312,6 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult)
|
||||||
NS_ADDREF(*aResult = newfile);
|
NS_ADDREF(*aResult = newfile);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
nsCOMPtr<nsILocalFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
|
|
||||||
NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
if (aArgument.First() == '/') {
|
|
||||||
// absolute path
|
|
||||||
rv = lf->InitWithPath(aArgument);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
NS_ADDREF(*aResult = lf);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCAutoString carg;
|
|
||||||
NS_CopyUnicodeToNative(aArgument, carg);
|
|
||||||
|
|
||||||
nsCAutoString wd;
|
|
||||||
rv = mWorkingDir->GetNativePath(wd);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
BDirectory bwd(wd.get());
|
|
||||||
|
|
||||||
BPath resolved(&bwd, carg.get(), true);
|
|
||||||
if (resolved.InitCheck() != B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
rv = lf->InitWithNativePath(nsDependentCString(resolved.Path()));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
NS_ADDREF(*aResult = lf);
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
#elif defined(XP_UNIX)
|
#elif defined(XP_UNIX)
|
||||||
nsCOMPtr<nsILocalFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
|
nsCOMPtr<nsILocalFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
|
||||||
NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
|
@ -44,7 +44,7 @@ VPATH = @srcdir@
|
||||||
include $(DEPTH)/config/autoconf.mk
|
include $(DEPTH)/config/autoconf.mk
|
||||||
|
|
||||||
ifdef MOZ_XUL
|
ifdef MOZ_XUL
|
||||||
ifeq (,$(filter android qt beos os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
|
ifeq (,$(filter android qt os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
|
||||||
DIRS = public src
|
DIRS = public src
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -234,10 +234,6 @@ ifdef MOZ_ENABLE_LIBPROXY
|
||||||
EXTRA_DSO_LDOPTS += $(MOZ_LIBPROXY_LIBS)
|
EXTRA_DSO_LDOPTS += $(MOZ_LIBPROXY_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
EXTRA_DSO_LDOPTS += -lbe -ltracker
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),SunOS)
|
ifeq ($(OS_ARCH),SunOS)
|
||||||
ifdef GNU_CC
|
ifdef GNU_CC
|
||||||
EXTRA_DSO_LDOPTS += -lelf
|
EXTRA_DSO_LDOPTS += -lelf
|
||||||
|
|
|
@ -245,7 +245,7 @@ COMPONENT_LIBS += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (,$(filter android qt beos os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
|
ifeq (,$(filter android qt os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
|
||||||
ifdef MOZ_XUL
|
ifdef MOZ_XUL
|
||||||
COMPONENT_LIBS += fileview
|
COMPONENT_LIBS += fileview
|
||||||
DEFINES += -DMOZ_FILEVIEW
|
DEFINES += -DMOZ_FILEVIEW
|
||||||
|
@ -295,7 +295,7 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Platform-specific icon channel stuff - supported mostly-everywhere
|
# Platform-specific icon channel stuff - supported mostly-everywhere
|
||||||
ifneq (,$(filter beos windows os2 mac cocoa gtk2 qt,$(MOZ_WIDGET_TOOLKIT)))
|
ifneq (,$(filter windows os2 mac cocoa gtk2 qt,$(MOZ_WIDGET_TOOLKIT)))
|
||||||
DEFINES += -DICON_DECODER
|
DEFINES += -DICON_DECODER
|
||||||
COMPONENT_LIBS += imgicon
|
COMPONENT_LIBS += imgicon
|
||||||
endif
|
endif
|
||||||
|
@ -313,9 +313,6 @@ COMPONENT_LIBS += gkgfxthebes
|
||||||
ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
|
ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
|
||||||
COMPONENT_LIBS += gkwidget
|
COMPONENT_LIBS += gkwidget
|
||||||
endif
|
endif
|
||||||
ifeq (beos,$(MOZ_WIDGET_TOOLKIT))
|
|
||||||
COMPONENT_LIBS += widget_beos
|
|
||||||
endif
|
|
||||||
ifeq (os2,$(MOZ_WIDGET_TOOLKIT))
|
ifeq (os2,$(MOZ_WIDGET_TOOLKIT))
|
||||||
COMPONENT_LIBS += wdgtos2
|
COMPONENT_LIBS += wdgtos2
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -71,8 +71,6 @@
|
||||||
# define WIDGET_MODULES MODULE(nsWidgetModule)
|
# define WIDGET_MODULES MODULE(nsWidgetModule)
|
||||||
#elif defined(XP_MACOSX)
|
#elif defined(XP_MACOSX)
|
||||||
# define WIDGET_MODULES MODULE(nsWidgetMacModule)
|
# define WIDGET_MODULES MODULE(nsWidgetMacModule)
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
# define WIDGET_MODULES MODULE(nsWidgetBeOSModule)
|
|
||||||
#elif defined(XP_OS2)
|
#elif defined(XP_OS2)
|
||||||
# define WIDGET_MODULES MODULE(nsWidgetOS2Module)
|
# define WIDGET_MODULES MODULE(nsWidgetOS2Module)
|
||||||
#elif defined(MOZ_WIDGET_GTK2)
|
#elif defined(MOZ_WIDGET_GTK2)
|
||||||
|
|
|
@ -74,25 +74,6 @@ endif
|
||||||
ifeq ($(OS_ARCH),OS2)
|
ifeq ($(OS_ARCH),OS2)
|
||||||
MOZ_PKG_PLATFORM := os2
|
MOZ_PKG_PLATFORM := os2
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
ifeq (,$(filter-out 6.%, $(OS_RELEASE)))
|
|
||||||
MOZ_PKG_PLATFORM := Zeta
|
|
||||||
else
|
|
||||||
ifeq (,$(filter-out 5.1, $(OS_RELEASE)))
|
|
||||||
MOZ_PKG_PLATFORM := BeOS-bone
|
|
||||||
else
|
|
||||||
ifeq (,$(filter-out 5.0.4, $(OS_RELEASE)))
|
|
||||||
MOZ_PKG_PLATFORM := BeOS-bone
|
|
||||||
else
|
|
||||||
ifeq (,$(filter-out 5.0, $(OS_RELEASE)))
|
|
||||||
MOZ_PKG_PLATFORM := BeOS-net_server
|
|
||||||
else
|
|
||||||
MOZ_PKG_PLATFORM := BeOS-$(OS_RELEASE)
|
|
||||||
endif # 5.0
|
|
||||||
endif # 5.0.4
|
|
||||||
endif # 5.1
|
|
||||||
endif # 6.
|
|
||||||
endif # OS_ARCH BeOS
|
|
||||||
endif #MOZ_PKG_PLATFORM
|
endif #MOZ_PKG_PLATFORM
|
||||||
|
|
||||||
ifdef MOZ_PKG_SPECIAL
|
ifdef MOZ_PKG_SPECIAL
|
||||||
|
|
|
@ -46,7 +46,7 @@ ifndef MOZ_PKG_FORMAT
|
||||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||||
MOZ_PKG_FORMAT = DMG
|
MOZ_PKG_FORMAT = DMG
|
||||||
else
|
else
|
||||||
ifeq (,$(filter-out OS2 WINNT WINCE BeOS, $(OS_ARCH)))
|
ifeq (,$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
|
||||||
MOZ_PKG_FORMAT = ZIP
|
MOZ_PKG_FORMAT = ZIP
|
||||||
else
|
else
|
||||||
ifeq (,$(filter-out SunOS, $(OS_ARCH)))
|
ifeq (,$(filter-out SunOS, $(OS_ARCH)))
|
||||||
|
@ -444,10 +444,6 @@ GARBAGE += $(DIST)/$(PACKAGE) $(PACKAGE)
|
||||||
ifeq ($(OS_ARCH),IRIX)
|
ifeq ($(OS_ARCH),IRIX)
|
||||||
STRIP_FLAGS = -f
|
STRIP_FLAGS = -f
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS_ARCH),BeOS)
|
|
||||||
STRIP_FLAGS = -g
|
|
||||||
PLATFORM_EXCLUDE_LIST = ! -name "*.stub" ! -name "$(MOZ_PKG_APPNAME)-bin"
|
|
||||||
endif
|
|
||||||
ifeq ($(OS_ARCH),OS2)
|
ifeq ($(OS_ARCH),OS2)
|
||||||
STRIP = $(MOZILLA_DIR)/toolkit/mozapps/installer/os2/strip.cmd
|
STRIP = $(MOZILLA_DIR)/toolkit/mozapps/installer/os2/strip.cmd
|
||||||
STRIP_FLAGS =
|
STRIP_FLAGS =
|
||||||
|
|
|
@ -43,9 +43,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef XP_BEOS
|
|
||||||
#include <Path.h>
|
|
||||||
#endif
|
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -954,14 +951,6 @@ XRE_GetFileFromPath(const char *aPath, nsILocalFile* *aResult)
|
||||||
return NS_NewLocalFile(nsDependentString(fullPath), PR_TRUE,
|
return NS_NewLocalFile(nsDependentString(fullPath), PR_TRUE,
|
||||||
aResult);
|
aResult);
|
||||||
|
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
BPath fullPath;
|
|
||||||
if (fullPath.SetTo(aPath, NULL, true))
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return NS_NewNativeLocalFile(nsDependentCString(fullPath.Leaf()), PR_TRUE,
|
|
||||||
aResult);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error Platform-specific logic needed here.
|
#error Platform-specific logic needed here.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -473,7 +473,6 @@ MAKEFILES_widget="
|
||||||
widget/Makefile
|
widget/Makefile
|
||||||
widget/public/Makefile
|
widget/public/Makefile
|
||||||
widget/src/Makefile
|
widget/src/Makefile
|
||||||
widget/src/beos/Makefile
|
|
||||||
widget/src/build/Makefile
|
widget/src/build/Makefile
|
||||||
widget/src/gtk2/Makefile
|
widget/src/gtk2/Makefile
|
||||||
widget/src/gtkxtbin/Makefile
|
widget/src/gtkxtbin/Makefile
|
||||||
|
@ -733,7 +732,6 @@ MAKEFILES_libpr0n="
|
||||||
modules/libpr0n/decoders/icon/mac/Makefile
|
modules/libpr0n/decoders/icon/mac/Makefile
|
||||||
modules/libpr0n/decoders/icon/win/Makefile
|
modules/libpr0n/decoders/icon/win/Makefile
|
||||||
modules/libpr0n/decoders/icon/gtk/Makefile
|
modules/libpr0n/decoders/icon/gtk/Makefile
|
||||||
modules/libpr0n/decoders/icon/beos/Makefile
|
|
||||||
modules/libpr0n/encoders/Makefile
|
modules/libpr0n/encoders/Makefile
|
||||||
modules/libpr0n/encoders/png/Makefile
|
modules/libpr0n/encoders/png/Makefile
|
||||||
modules/libpr0n/encoders/jpeg/Makefile
|
modules/libpr0n/encoders/jpeg/Makefile
|
||||||
|
|
|
@ -98,9 +98,6 @@ else
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||||
CPPSRCS += nsNativeAppSupportOS2.cpp
|
CPPSRCS += nsNativeAppSupportOS2.cpp
|
||||||
else
|
else
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
CPPSRCS += nsNativeAppSupportBeOS.cpp
|
|
||||||
else
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||||
CPPSRCS += nsNativeAppSupportUnix.cpp
|
CPPSRCS += nsNativeAppSupportUnix.cpp
|
||||||
else
|
else
|
||||||
|
|
|
@ -163,13 +163,6 @@ using mozilla::dom::ContentParent;
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
// execv() behaves bit differently in R5 and Zeta, looks unreliable in such situation
|
|
||||||
//#include <unistd.h>
|
|
||||||
#include <AppKit.h>
|
|
||||||
#include <AppFileInfo.h>
|
|
||||||
#endif //XP_BEOS
|
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
@ -1615,18 +1608,6 @@ XRE_GetBinaryPath(const char* argv0, nsILocalFile* *aResult)
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
int32 cookie = 0;
|
|
||||||
image_info info;
|
|
||||||
|
|
||||||
if(get_next_image_info(0, &cookie, &info) != B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
rv = NS_NewNativeLocalFile(nsDependentCString(info.name), PR_TRUE,
|
|
||||||
getter_AddRefs(lf));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error Oops, you need platform-specific code here
|
#error Oops, you need platform-specific code here
|
||||||
#endif
|
#endif
|
||||||
|
@ -1795,12 +1776,6 @@ static nsresult LaunchChild(nsINativeAppSupport* aNative,
|
||||||
#elif defined(XP_UNIX)
|
#elif defined(XP_UNIX)
|
||||||
if (execv(exePath.get(), gRestartArgv) == -1)
|
if (execv(exePath.get(), gRestartArgv) == -1)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
extern char **environ;
|
|
||||||
status_t res;
|
|
||||||
res = resume_thread(load_image(gRestartArgc,(const char **)gRestartArgv,(const char **)environ));
|
|
||||||
if (res != B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
#else
|
#else
|
||||||
PRProcess* process = PR_CreateProcess(exePath.get(), gRestartArgv,
|
PRProcess* process = PR_CreateProcess(exePath.get(), gRestartArgv,
|
||||||
nsnull, nsnull);
|
nsnull, nsnull);
|
||||||
|
|
|
@ -1,382 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Mozilla Browser.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Fredrik Holmqvist <thesuckiestemail@yahoo.se>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Sergei Dolgov <sergei_d@fi.tartu.ee>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
//This define requires DebugConsole (see BeBits.com) to be installed
|
|
||||||
//#define DC_PROGRAMNAME "firefox-bin"
|
|
||||||
# ifdef DC_PROGRAMNAME
|
|
||||||
#include <DebugConsole.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsNativeAppSupportBase.h"
|
|
||||||
#include "nsICommandLineRunner.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIProxyObjectManager.h"
|
|
||||||
//#include "nsIBrowserDOMWindow.h"
|
|
||||||
#include "nsPIDOMWindow.h"
|
|
||||||
#include "nsIDOMChromeWindow.h"
|
|
||||||
#include "nsIWindowMediator.h"
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIBaseWindow.h"
|
|
||||||
#include "nsIWidget.h"
|
|
||||||
#include "nsIDocShell.h"
|
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
#include <AppFileInfo.h>
|
|
||||||
#include <Resources.h>
|
|
||||||
#include <Path.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
// Two static helpers for future - if we decide to use OpenBrowserWindow, like we do in SeaMonkey
|
|
||||||
static nsresult
|
|
||||||
GetMostRecentWindow(const PRUnichar* aType, nsIDOMWindowInternal** aWindow)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsIWindowMediator> med(do_GetService( NS_WINDOWMEDIATOR_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
if (med)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIWindowMediator> medProxy;
|
|
||||||
rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD, NS_GET_IID(nsIWindowMediator),
|
|
||||||
med, NS_PROXY_SYNC | NS_PROXY_ALWAYS,
|
|
||||||
getter_AddRefs(medProxy));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
return medProxy->GetMostRecentWindow( aType, aWindow );
|
|
||||||
}
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsresult
|
|
||||||
ActivateWindow(nsIDOMWindowInternal* aWindow)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWindow));
|
|
||||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
|
||||||
nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(window->GetDocShell()));
|
|
||||||
NS_ENSURE_TRUE(baseWindow, NS_ERROR_FAILURE);
|
|
||||||
nsCOMPtr<nsIWidget> mainWidget;
|
|
||||||
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
|
|
||||||
NS_ENSURE_TRUE(mainWidget, NS_ERROR_FAILURE);
|
|
||||||
BWindow *bwindow = (BWindow *)(mainWidget->GetNativeData(NS_NATIVE_WINDOW));
|
|
||||||
if (bwindow)
|
|
||||||
bwindow->Activate(true);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
//End static helpers
|
|
||||||
|
|
||||||
class nsNativeAppSupportBeOS : public nsNativeAppSupportBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSINATIVEAPPSUPPORT
|
|
||||||
static void HandleCommandLine( int32 argc, char **argv, PRUint32 aState);
|
|
||||||
}; // nsNativeAppSupportBeOS
|
|
||||||
|
|
||||||
|
|
||||||
class nsBeOSApp : public BApplication
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsBeOSApp(sem_id sem) : BApplication( GetAppSig() ), init(sem), mMessage(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
~nsBeOSApp()
|
|
||||||
{
|
|
||||||
delete mMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReadyToRun()
|
|
||||||
{
|
|
||||||
release_sem(init);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32 Main( void *args )
|
|
||||||
{
|
|
||||||
nsBeOSApp *app = new nsBeOSApp((sem_id)args);
|
|
||||||
if (app == NULL)
|
|
||||||
return B_ERROR;
|
|
||||||
return app->Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArgvReceived(int32 argc, char **argv)
|
|
||||||
{
|
|
||||||
if (IsLaunching())
|
|
||||||
{
|
|
||||||
#ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("ArgvReceived Launching\n");
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PRInt32 aState = /*IsLaunching() ?
|
|
||||||
nsICommandLine::STATE_INITIAL_LAUNCH :*/
|
|
||||||
nsICommandLine::STATE_REMOTE_AUTO;
|
|
||||||
nsNativeAppSupportBeOS::HandleCommandLine(argc, argv, aState);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RefsReceived(BMessage* msg)
|
|
||||||
{
|
|
||||||
#ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("RefsReceived\n");
|
|
||||||
#endif
|
|
||||||
if (IsLaunching())
|
|
||||||
{
|
|
||||||
mMessage = new BMessage(*msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BPath path;
|
|
||||||
entry_ref er;
|
|
||||||
for (uint32 i = 0; msg->FindRef("refs", i, &er) == B_OK; i++)
|
|
||||||
{
|
|
||||||
int Argc = 2;
|
|
||||||
char **Argv = new char*[ 3 ];
|
|
||||||
BEntry entry(&er, true);
|
|
||||||
BEntry fentry(GetAppFile(), false);
|
|
||||||
entry.GetPath(&path);
|
|
||||||
|
|
||||||
Argv[0] = strdup( GetAppFile() ? GetAppFile() : "" );
|
|
||||||
Argv[1] = strdup( path.Path() ? path.Path() : "" );
|
|
||||||
// Safety measure
|
|
||||||
Argv[2] = 0;
|
|
||||||
// Is started, call ArgReceived, delete mArgv, else store for future usage
|
|
||||||
// after ::Enable() was called
|
|
||||||
ArgvReceived(2, Argv);
|
|
||||||
Argc = 0;
|
|
||||||
delete [] Argv;
|
|
||||||
Argv = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageReceived(BMessage* msg)
|
|
||||||
{
|
|
||||||
// BMessage from nsNativeAppBeOS::Enable() received.
|
|
||||||
// Services are ready, so we can supply stored refs
|
|
||||||
if (msg->what == 'enbl' && mMessage)
|
|
||||||
{
|
|
||||||
#ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("enbl received");
|
|
||||||
#endif
|
|
||||||
be_app_messenger.SendMessage(mMessage);
|
|
||||||
}
|
|
||||||
// Processing here file drop events from BWindow
|
|
||||||
// - until we implement native DnD in widget.
|
|
||||||
else if (msg->what == B_SIMPLE_DATA)
|
|
||||||
{
|
|
||||||
RefsReceived(msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
BApplication::MessageReceived(msg);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
char *GetAppSig()
|
|
||||||
{
|
|
||||||
image_info info;
|
|
||||||
int32 cookie = 0;
|
|
||||||
BFile file;
|
|
||||||
BAppFileInfo appFileInfo;
|
|
||||||
static char sig[B_MIME_TYPE_LENGTH];
|
|
||||||
|
|
||||||
sig[0] = 0;
|
|
||||||
if (get_next_image_info(0, &cookie, &info) == B_OK &&
|
|
||||||
file.SetTo(info.name, B_READ_ONLY) == B_OK &&
|
|
||||||
appFileInfo.SetTo(&file) == B_OK &&
|
|
||||||
appFileInfo.GetSignature(sig) == B_OK)
|
|
||||||
return sig;
|
|
||||||
|
|
||||||
return "application/x-vnd.Mozilla";
|
|
||||||
}
|
|
||||||
|
|
||||||
char *GetAppFile()
|
|
||||||
{
|
|
||||||
image_info info;
|
|
||||||
int32 cookie = 0;
|
|
||||||
if (get_next_image_info(0, &cookie, &info) == B_OK && strlen(info.name) > 0)
|
|
||||||
return info.name;
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
sem_id init;
|
|
||||||
BMessage *mMessage;
|
|
||||||
}; //class nsBeOSApp
|
|
||||||
|
|
||||||
// Create and return an instance of class nsNativeAppSupportBeOS.
|
|
||||||
nsresult
|
|
||||||
NS_CreateNativeAppSupport(nsINativeAppSupport **aResult)
|
|
||||||
{
|
|
||||||
if (!aResult)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsNativeAppSupportBeOS *pNative = new nsNativeAppSupportBeOS;
|
|
||||||
if (!pNative)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
*aResult = pNative;
|
|
||||||
NS_ADDREF(*aResult);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsNativeAppSupportBeOS, nsINativeAppSupport)
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
nsNativeAppSupportBeOS::HandleCommandLine(int32 argc, char **argv, PRUint32 aState)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
// Here we get stuck when starting from file-click or "OpenWith".
|
|
||||||
// No cmdLine or any other service can be created
|
|
||||||
// To workaround the problem, we store arguments if IsLaunching()
|
|
||||||
// and using this after ::Enable() was called.
|
|
||||||
nsCOMPtr<nsICommandLineRunner> cmdLine(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
|
|
||||||
if (!cmdLine)
|
|
||||||
{
|
|
||||||
#ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("Couldn't create command line!");
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nsICommandLineRunner::Init() should be called from main mozilla thread
|
|
||||||
// but we are at be_app thread. Using proxy to switch thread
|
|
||||||
nsCOMPtr<nsICommandLineRunner> cmdLineProxy;
|
|
||||||
rv = NS_GetProxyForObject( NS_PROXY_TO_MAIN_THREAD, NS_GET_IID(nsICommandLineRunner),
|
|
||||||
cmdLine, NS_PROXY_ASYNC | NS_PROXY_ALWAYS, getter_AddRefs(cmdLineProxy));
|
|
||||||
if (rv != NS_OK)
|
|
||||||
{
|
|
||||||
#ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("Couldn't get command line Proxy!");
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nsICommandLineRunner::Init(,,workingdir,) requires some folder to be provided
|
|
||||||
// but that's unclear if we need it, so using 0 instead atm
|
|
||||||
rv = cmdLine->Init(argc, argv, 0 , aState);
|
|
||||||
if (rv != NS_OK)
|
|
||||||
{
|
|
||||||
#ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("Couldn't init command line!");
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMWindowInternal> navWin;
|
|
||||||
GetMostRecentWindow( NS_LITERAL_STRING( "navigator:browser" ).get(),
|
|
||||||
getter_AddRefs(navWin ));
|
|
||||||
if (navWin)
|
|
||||||
{
|
|
||||||
# ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("GotNavWin!");
|
|
||||||
# endif
|
|
||||||
cmdLine->SetWindowContext(navWin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: try to use OpenURI here if there is navWin, maybe using special function
|
|
||||||
// OpenBrowserWindow which calls OpenURI like we do for SeaMonkey,
|
|
||||||
// else let CommandLineRunner to do its work.
|
|
||||||
// Problem with current implementation is unsufficient tabbed browsing support
|
|
||||||
cmdLineProxy->Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNativeAppSupportBeOS::Start(PRBool *aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG(aResult);
|
|
||||||
NS_ENSURE_TRUE(be_app == NULL, NS_ERROR_NOT_INITIALIZED);
|
|
||||||
sem_id initsem = create_sem(0, "Mozilla BApplication init");
|
|
||||||
if (initsem < B_OK)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
thread_id tid = spawn_thread(nsBeOSApp::Main, "Mozilla XUL BApplication", B_NORMAL_PRIORITY, (void *)initsem);
|
|
||||||
#ifdef DC_PROGRAMNAME
|
|
||||||
TRACE("BeApp created");
|
|
||||||
#endif
|
|
||||||
*aResult = PR_TRUE;
|
|
||||||
if (tid < B_OK || B_OK != resume_thread(tid))
|
|
||||||
*aResult = PR_FALSE;
|
|
||||||
|
|
||||||
if (B_OK != acquire_sem(initsem))
|
|
||||||
*aResult = PR_FALSE;
|
|
||||||
|
|
||||||
if (B_OK != delete_sem(initsem))
|
|
||||||
*aResult = PR_FALSE;
|
|
||||||
return *aResult == PR_TRUE ? NS_OK : NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNativeAppSupportBeOS::Stop(PRBool *aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG(aResult);
|
|
||||||
NS_ENSURE_TRUE(be_app, NS_ERROR_NOT_INITIALIZED);
|
|
||||||
|
|
||||||
*aResult = PR_TRUE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNativeAppSupportBeOS::Quit()
|
|
||||||
{
|
|
||||||
if (be_app->Lock())
|
|
||||||
{
|
|
||||||
be_app->Quit();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNativeAppSupportBeOS::ReOpen()
|
|
||||||
{
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNativeAppSupportBeOS::Enable()
|
|
||||||
{
|
|
||||||
// Informing be_app that UI and services are ready to use.
|
|
||||||
if (be_app)
|
|
||||||
{
|
|
||||||
be_app_messenger.SendMessage('enbl');
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNativeAppSupportBeOS::OnLastWindowClosing()
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
|
@ -70,15 +70,6 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
#include <be/app/Application.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsIAppStartup.h"
|
|
||||||
#include "nsToolkitCompsCID.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char _progname[1024] = "huh?";
|
static char _progname[1024] = "huh?";
|
||||||
static unsigned int _gdb_sleep_duration = 300;
|
static unsigned int _gdb_sleep_duration = 300;
|
||||||
|
|
||||||
|
@ -148,26 +139,6 @@ child_ah_crap_handler(int signum)
|
||||||
|
|
||||||
#endif // CRAWL_STACK_ON_SIGSEGV
|
#endif // CRAWL_STACK_ON_SIGSEGV
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
void beos_signal_handler(int signum) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr, "beos_signal_handler: %d\n", signum);
|
|
||||||
#endif
|
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
// Failed to get the appstartup service so shutdown the hard way
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr, "beos_signal_handler: appShell->do_GetService() failed\n");
|
|
||||||
#endif
|
|
||||||
exit(13);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exit the appshell so that the app can shutdown normally
|
|
||||||
appStartup->Quit(nsIAppStartup::eAttemptQuit);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_GTK2
|
#ifdef MOZ_WIDGET_GTK2
|
||||||
// Need this include for version test below.
|
// Need this include for version test below.
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -351,10 +322,6 @@ void InstallSignalHandlers(const char *ProgramName)
|
||||||
}
|
}
|
||||||
#endif //SOLARIS
|
#endif //SOLARIS
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
|
||||||
signal(SIGTERM, beos_signal_handler);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_GTK2) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
|
#if defined(MOZ_WIDGET_GTK2) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
|
||||||
const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
|
const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
|
||||||
if (assertString &&
|
if (assertString &&
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# define INCL_DOSFILEMGR
|
# define INCL_DOSFILEMGR
|
||||||
# include <os2.h>
|
# include <os2.h>
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
#elif defined(XP_UNIX)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,6 @@
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
#include "nsILocalFileMac.h"
|
#include "nsILocalFileMac.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef XP_BEOS
|
|
||||||
#include <be/kernel/image.h>
|
|
||||||
#include <FindDirectory.h>
|
|
||||||
#endif
|
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1095,17 +1091,6 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsILocalFile** aFile, PRBool aLocal)
|
||||||
*strrchr(appDir, '\\') = '\0';
|
*strrchr(appDir, '\\') = '\0';
|
||||||
rv = NS_NewNativeLocalFile(nsDependentCString(appDir), PR_TRUE, getter_AddRefs(localDir));
|
rv = NS_NewNativeLocalFile(nsDependentCString(appDir), PR_TRUE, getter_AddRefs(localDir));
|
||||||
}
|
}
|
||||||
#elif defined(XP_BEOS)
|
|
||||||
char appDir[MAXPATHLEN];
|
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, NULL, true, appDir, MAXPATHLEN))
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
int len = strlen(appDir);
|
|
||||||
appDir[len] = '/';
|
|
||||||
appDir[len+1] = '\0';
|
|
||||||
|
|
||||||
rv = NS_NewNativeLocalFile(nsDependentCString(appDir), PR_TRUE,
|
|
||||||
getter_AddRefs(localDir));
|
|
||||||
#elif defined(XP_UNIX)
|
#elif defined(XP_UNIX)
|
||||||
const char* homeDir = getenv("HOME");
|
const char* homeDir = getenv("HOME");
|
||||||
if (!homeDir || !*homeDir)
|
if (!homeDir || !*homeDir)
|
||||||
|
@ -1282,7 +1267,7 @@ nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile)
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
#if defined (XP_MACOSX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS)
|
#if defined (XP_MACOSX) || defined(XP_WIN) || defined(XP_OS2)
|
||||||
|
|
||||||
static const char* const sXR = "Mozilla";
|
static const char* const sXR = "Mozilla";
|
||||||
rv = aFile->AppendNative(nsDependentCString(sXR));
|
rv = aFile->AppendNative(nsDependentCString(sXR));
|
||||||
|
@ -1331,7 +1316,7 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile)
|
||||||
}
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
#elif defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS)
|
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||||
if (gAppData->profile) {
|
if (gAppData->profile) {
|
||||||
rv = AppendProfileString(aFile, gAppData->profile);
|
rv = AppendProfileString(aFile, gAppData->profile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,6 @@ else
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||||
OSDIR = mac
|
OSDIR = mac
|
||||||
else
|
else
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
OSDIR = beos
|
|
||||||
else
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
|
||||||
OSDIR = android
|
OSDIR = android
|
||||||
else
|
else
|
||||||
|
@ -117,10 +114,6 @@ OSHELPER += nsGNOMERegistry.cpp
|
||||||
OSHELPER += nsMIMEInfoUnix.cpp
|
OSHELPER += nsMIMEInfoUnix.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
OSHELPER += nsMIMEInfoBeOS.cpp
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||||
OSHELPER += nsMIMEInfoWin.cpp
|
OSHELPER += nsMIMEInfoWin.cpp
|
||||||
LOCAL_INCLUDES += -I$(srcdir)/win
|
LOCAL_INCLUDES += -I$(srcdir)/win
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 nsOSHelperAppService.cpp.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Paul Ashford.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
|
|
||||||
#include "nsMIMEInfoBeOS.h"
|
|
||||||
#include "nsILocalFile.h"
|
|
||||||
|
|
||||||
nsMIMEInfoBeOS::~nsMIMEInfoBeOS()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsMIMEInfoBeOS::LaunchDefaultWithFile(nsIFile* aFile)
|
|
||||||
{
|
|
||||||
// Launch the file, unless it is an executable.
|
|
||||||
nsCOMPtr<nsILocalFile> local(do_QueryInterface(aFile));
|
|
||||||
if (!local)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
PRBool executable = PR_TRUE;
|
|
||||||
local->IsExecutable(&executable);
|
|
||||||
if (executable)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return local->Launch();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsMIMEInfoBeOS::LoadUriInternal(nsIURI * aURL)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
|
|
||||||
if (aURL) {
|
|
||||||
// Get the Protocol
|
|
||||||
nsCAutoString scheme;
|
|
||||||
aURL->GetScheme(scheme);
|
|
||||||
BString protoStr(scheme.get());
|
|
||||||
protoStr.Prepend("application/x-vnd.Be.URL.");
|
|
||||||
// Get the Spec
|
|
||||||
nsCAutoString spec;
|
|
||||||
aURL->GetAsciiSpec(spec);
|
|
||||||
const char* args[] = { spec.get() };
|
|
||||||
|
|
||||||
//Launch the app
|
|
||||||
BMimeType protocol;
|
|
||||||
bool isInstalled = false;
|
|
||||||
if (protocol.SetTo(protoStr.String()) == B_OK)
|
|
||||||
{
|
|
||||||
if(protocol.IsInstalled())
|
|
||||||
{
|
|
||||||
isInstalled = true;
|
|
||||||
be_roster->Launch(protoStr.String(), NS_ARRAY_LENGTH(args), (char **)args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((!isInstalled) && (!strcmp("mailto", scheme.get())))
|
|
||||||
be_roster->Launch("text/x-email", NS_ARRAY_LENGTH(args), (char **)args);
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the BeOS MIME Info Implementation.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Christian Biesinger <cbiesinger@web.de>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsMIMEInfoBeOS_h_
|
|
||||||
#define nsMIMEInfoBeOS_h_
|
|
||||||
|
|
||||||
#include "nsMIMEInfoImpl.h"
|
|
||||||
|
|
||||||
class nsMIMEInfoBeOS : public nsMIMEInfoImpl {
|
|
||||||
public:
|
|
||||||
nsMIMEInfoBeOS(const char* aType = "") : nsMIMEInfoImpl(aType) {}
|
|
||||||
nsMIMEInfoBeOS(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) {}
|
|
||||||
nsMIMEInfoBeOS(const nsACString& aType, HandlerClass aClass) :
|
|
||||||
nsMIMEInfoImpl(aType, aClass) {}
|
|
||||||
virtual ~nsMIMEInfoBeOS();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile* aFile);
|
|
||||||
virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,264 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 nsOSHelperAppService.cpp.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Paul Ashford.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsOSHelperAppService.h"
|
|
||||||
#include "nsMIMEInfoBeOS.h"
|
|
||||||
#include "nsISupports.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIURL.h"
|
|
||||||
#include "nsILocalFile.h"
|
|
||||||
#include "nsIProcess.h"
|
|
||||||
#include "prenv.h" // for PR_GetEnv()
|
|
||||||
#include <stdlib.h> // for system()
|
|
||||||
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Mime.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <Path.h>
|
|
||||||
#include <Entry.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
|
|
||||||
#define LOG(args) PR_LOG(mLog, PR_LOG_DEBUG, args)
|
|
||||||
#define LOG_ENABLED() PR_LOG_TEST(mLog, PR_LOG_DEBUG)
|
|
||||||
|
|
||||||
nsOSHelperAppService::nsOSHelperAppService() : nsExternalHelperAppService()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsOSHelperAppService::~nsOSHelperAppService()
|
|
||||||
{}
|
|
||||||
|
|
||||||
nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolScheme, PRBool * aHandlerExists)
|
|
||||||
{
|
|
||||||
LOG(("-- nsOSHelperAppService::OSProtocolHandlerExists for '%s'\n",
|
|
||||||
aProtocolScheme));
|
|
||||||
// look up the protocol scheme in the MIME database
|
|
||||||
*aHandlerExists = PR_FALSE;
|
|
||||||
if (aProtocolScheme && *aProtocolScheme)
|
|
||||||
{
|
|
||||||
BString protoStr(aProtocolScheme);
|
|
||||||
protoStr.Prepend("application/x-vnd.Be.URL.");
|
|
||||||
BMimeType protocol;
|
|
||||||
if (protocol.SetTo(protoStr.String()) == B_OK)
|
|
||||||
{
|
|
||||||
if (protocol.IsInstalled())
|
|
||||||
*aHandlerExists = PR_TRUE;
|
|
||||||
}
|
|
||||||
if ((!*aHandlerExists) && (!strcmp("mailto", aProtocolScheme)))
|
|
||||||
{
|
|
||||||
// mailto link, no x-vnd.Be.URL.mailto entry
|
|
||||||
if (protocol.SetTo("text/x-email") == B_OK)
|
|
||||||
{
|
|
||||||
if (protocol.IsInstalled())
|
|
||||||
*aHandlerExists = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nsresult nsOSHelperAppService::SetMIMEInfoForType(const char *aMIMEType, nsMIMEInfoBeOS**_retval) {
|
|
||||||
|
|
||||||
LOG(("-- nsOSHelperAppService::SetMIMEInfoForType: %s\n",aMIMEType));
|
|
||||||
|
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsMIMEInfoBeOS* mimeInfo = new nsMIMEInfoBeOS(aMIMEType);
|
|
||||||
if (mimeInfo) {
|
|
||||||
NS_ADDREF(mimeInfo);
|
|
||||||
BMimeType mimeType(aMIMEType);
|
|
||||||
BMessage data;
|
|
||||||
int32 index = 0;
|
|
||||||
BString strData;
|
|
||||||
LOG((" Adding extensions:\n"));
|
|
||||||
if (mimeType.GetFileExtensions(&data) == B_OK) {
|
|
||||||
while (data.FindString("extensions",index,&strData) == B_OK) {
|
|
||||||
// if the file extension includes the '.' then we don't want to include that when we append
|
|
||||||
// it to the mime info object.
|
|
||||||
if (strData.ByteAt(0) == '.')
|
|
||||||
strData.RemoveFirst(".");
|
|
||||||
mimeInfo->AppendExtension(nsDependentCString(strData.String()));
|
|
||||||
LOG((" %s\n",strData.String()));
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char desc[B_MIME_TYPE_LENGTH + 1];
|
|
||||||
if (mimeType.GetShortDescription(desc) == B_OK) {
|
|
||||||
mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(desc));
|
|
||||||
} else {
|
|
||||||
if (mimeType.GetLongDescription(desc) == B_OK) {
|
|
||||||
mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(desc));
|
|
||||||
} else {
|
|
||||||
mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(aMIMEType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG((" Description: %s\n",desc));
|
|
||||||
|
|
||||||
//set preferred app and app description
|
|
||||||
char appSig[B_MIME_TYPE_LENGTH + 1];
|
|
||||||
bool doSave = true;
|
|
||||||
if (mimeType.GetPreferredApp(appSig) == B_OK) {
|
|
||||||
LOG((" Got preferred ap\n"));
|
|
||||||
BMimeType app(appSig);
|
|
||||||
entry_ref ref;
|
|
||||||
BEntry entry;
|
|
||||||
BPath path;
|
|
||||||
if ((app.GetAppHint(&ref) == B_OK) &&
|
|
||||||
(entry.SetTo(&ref, false) == B_OK) &&
|
|
||||||
(entry.GetPath(&path) == B_OK)) {
|
|
||||||
|
|
||||||
LOG((" Got our path!\n"));
|
|
||||||
nsCOMPtr<nsIFile> handlerFile;
|
|
||||||
rv = GetFileTokenForPath(NS_ConvertUTF8toUTF16(path.Path()).get(), getter_AddRefs(handlerFile));
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
mimeInfo->SetDefaultApplication(handlerFile);
|
|
||||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
|
||||||
mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(path.Leaf()));
|
|
||||||
LOG((" Preferred App: %s\n",path.Leaf()));
|
|
||||||
doSave = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (doSave) {
|
|
||||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk);
|
|
||||||
LOG((" No Preferred App\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
*_retval = mimeInfo;
|
|
||||||
rv = NS_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsOSHelperAppService::GetMimeInfoFromExtension(const char *aFileExt,
|
|
||||||
nsMIMEInfoBeOS ** _retval) {
|
|
||||||
// if the extension is null, return immediately
|
|
||||||
if (!aFileExt || !*aFileExt)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
LOG(("Here we do an extension lookup for '%s'\n", aFileExt));
|
|
||||||
|
|
||||||
BMimeType mimeType;
|
|
||||||
|
|
||||||
if (BMimeType::GuessMimeType(aFileExt, &mimeType) == B_OK)
|
|
||||||
return SetMIMEInfoForType(mimeType.Type(), _retval);
|
|
||||||
|
|
||||||
// Extension not found
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsOSHelperAppService::GetMimeInfoFromMIMEType(const char *aMIMEType,
|
|
||||||
nsMIMEInfoBeOS ** _retval) {
|
|
||||||
// if the mime type is null, return immediately
|
|
||||||
if (!aMIMEType || !*aMIMEType)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
LOG(("Here we do a mimetype lookup for '%s'\n", aMIMEType));
|
|
||||||
|
|
||||||
BMimeType mimeType(aMIMEType);
|
|
||||||
if (mimeType.IsInstalled())
|
|
||||||
return SetMIMEInfoForType(aMIMEType, _retval);
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsIMIMEInfo>
|
|
||||||
nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, const nsACString& aFileExt, PRBool* aFound)
|
|
||||||
{
|
|
||||||
*aFound = PR_TRUE;
|
|
||||||
nsMIMEInfoBeOS* mi = nsnull;
|
|
||||||
const nsCString& flatType = PromiseFlatCString(aMIMEType);
|
|
||||||
const nsCString& flatExt = PromiseFlatCString(aFileExt);
|
|
||||||
GetMimeInfoFromMIMEType(flatType.get(), &mi);
|
|
||||||
if (mi)
|
|
||||||
return mi;
|
|
||||||
|
|
||||||
GetMimeInfoFromExtension(flatExt.get(), &mi);
|
|
||||||
if (mi && !aMIMEType.IsEmpty())
|
|
||||||
mi->SetMIMEType(aMIMEType);
|
|
||||||
if (mi)
|
|
||||||
return mi;
|
|
||||||
|
|
||||||
*aFound = PR_FALSE;
|
|
||||||
mi = new nsMIMEInfoBeOS(flatType);
|
|
||||||
if (!mi)
|
|
||||||
return nsnull;
|
|
||||||
NS_ADDREF(mi);
|
|
||||||
if (!aFileExt.IsEmpty())
|
|
||||||
mi->AppendExtension(aFileExt);
|
|
||||||
|
|
||||||
return mi;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsOSHelperAppService::GetProtocolHandlerInfoFromOS(const nsACString &aScheme,
|
|
||||||
PRBool *found,
|
|
||||||
nsIHandlerInfo **_retval)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(!aScheme.IsEmpty(), "No scheme was specified!");
|
|
||||||
|
|
||||||
nsresult rv = OSProtocolHandlerExists(nsPromiseFlatCString(aScheme).get(),
|
|
||||||
found);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
nsMIMEInfoBeOS *handlerInfo =
|
|
||||||
new nsMIMEInfoBeOS(aScheme, nsMIMEInfoBase::eProtocolInfo);
|
|
||||||
NS_ENSURE_TRUE(handlerInfo, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
NS_ADDREF(*_retval = handlerInfo);
|
|
||||||
|
|
||||||
if (!*found) {
|
|
||||||
// Code that calls this requires an object regardless if the OS has
|
|
||||||
// something for us, so we return the empty object.
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString desc;
|
|
||||||
GetApplicationDescription(aScheme, desc);
|
|
||||||
handlerInfo->SetDefaultDescription(desc);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 nsOSHelperAppService.h.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Paul Ashford.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsOSHelperAppService_h__
|
|
||||||
#define nsOSHelperAppService_h__
|
|
||||||
|
|
||||||
// The OS helper app service is a subclass of nsExternalHelperAppService and is implemented on each
|
|
||||||
// platform. It contains platform specific code for finding helper applications for a given mime type
|
|
||||||
// in addition to launching those applications.
|
|
||||||
|
|
||||||
#include "nsExternalHelperAppService.h"
|
|
||||||
#include "nsCExternalHandlerService.h"
|
|
||||||
#include "nsMIMEInfoImpl.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
|
|
||||||
class nsMIMEInfoBeOS;
|
|
||||||
|
|
||||||
class nsOSHelperAppService : public nsExternalHelperAppService
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsOSHelperAppService();
|
|
||||||
virtual ~nsOSHelperAppService();
|
|
||||||
|
|
||||||
already_AddRefed<nsIMIMEInfo> GetMIMEInfoFromOS(const nsACString& aMIMEType, const nsACString& aFileExt, PRBool *aFound);
|
|
||||||
NS_IMETHOD GetProtocolHandlerInfoFromOS(const nsACString &aScheme,
|
|
||||||
PRBool *found,
|
|
||||||
nsIHandlerInfo **_retval);
|
|
||||||
|
|
||||||
// override nsIExternalProtocolService methods
|
|
||||||
nsresult OSProtocolHandlerExists(const char * aProtocolScheme, PRBool * aHandlerExists);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsresult SetMIMEInfoForType(const char *aMIMEType, nsMIMEInfoBeOS **_retval);
|
|
||||||
nsresult GetMimeInfoFromExtension(const char *aFileExt, nsMIMEInfoBeOS **_retval);
|
|
||||||
nsresult GetMimeInfoFromMIMEType(const char *aMIMEType, nsMIMEInfoBeOS **_retval);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // nsOSHelperAppService_h__
|
|
|
@ -78,10 +78,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||||
EXPORTS += nsIDragSessionOS2.h
|
EXPORTS += nsIDragSessionOS2.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
|
|
||||||
EXPORTS += nsIDragSessionBeOS.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
|
||||||
EXPORTS += \
|
EXPORTS += \
|
||||||
nsIPrintDialogService.h \
|
nsIPrintDialogService.h \
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 nsMime.cpp for the BeOS port of Mozilla.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Paul Ashford.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Paul Ashford <arougthopher@lizardland.net>
|
|
||||||
* Fredrik Holmqvist <thesuckiestemail@yahoo.se>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsIDragSessionBeOS_h__
|
|
||||||
#define nsIDragSessionBeOS_h__
|
|
||||||
|
|
||||||
|
|
||||||
#include "nsISupports.h"
|
|
||||||
|
|
||||||
#include <Message.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define NS_IDRAGSESSIONBEOS_IID \
|
|
||||||
{ 0x36c4c381, 0x09e3, 0x11d4, { 0xb0, 0x33, 0xa4, 0x20, 0xf4, 0x2c, 0xfd, 0x7c } };
|
|
||||||
|
|
||||||
class nsIDragSessionBeOS : public nsISupports
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDRAGSESSIONBEOS_IID)
|
|
||||||
NS_IMETHOD TransmitData( BMessage *aNegotiationReply) = 0;
|
|
||||||
NS_IMETHOD UpdateDragMessageIfNeeded(BMessage *aDragMessage) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDragSessionBeOS, NS_IDRAGSESSIONBEOS_IID)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -46,7 +46,7 @@ MODULE = widget
|
||||||
|
|
||||||
DIRS = shared xpwidgets
|
DIRS = shared xpwidgets
|
||||||
|
|
||||||
ifneq (,$(filter beos os2 cocoa qt android,$(MOZ_WIDGET_TOOLKIT)))
|
ifneq (,$(filter os2 cocoa qt android,$(MOZ_WIDGET_TOOLKIT)))
|
||||||
DIRS += $(MOZ_WIDGET_TOOLKIT)
|
DIRS += $(MOZ_WIDGET_TOOLKIT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
#
|
|
||||||
# ***** BEGIN LICENSE BLOCK *****
|
|
||||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
#
|
|
||||||
# The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
#
|
|
||||||
# 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
# the Initial Developer. All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Contributor(s):
|
|
||||||
#
|
|
||||||
# Alternatively, the contents of this file may be used under the terms of
|
|
||||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
# of those above. If you wish to allow use of your version of this file only
|
|
||||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
# use your version of this file under the terms of the MPL, indicate your
|
|
||||||
# decision by deleting the provisions above and replace them with the notice
|
|
||||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
# the provisions above, a recipient may use your version of this file under
|
|
||||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
#
|
|
||||||
# ***** END LICENSE BLOCK *****
|
|
||||||
|
|
||||||
DEPTH = ../../..
|
|
||||||
topsrcdir = @top_srcdir@
|
|
||||||
srcdir = @srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
|
|
||||||
include $(DEPTH)/config/autoconf.mk
|
|
||||||
|
|
||||||
MODULE = widget
|
|
||||||
LIBRARY_NAME = widget_beos
|
|
||||||
EXPORT_LIBRARY = 1
|
|
||||||
IS_COMPONENT = 1
|
|
||||||
MODULE_NAME = nsWidgetBeOSModule
|
|
||||||
GRE_MODULE = 1
|
|
||||||
LIBXUL_LIBRARY = 1
|
|
||||||
|
|
||||||
|
|
||||||
CPPSRCS = \
|
|
||||||
nsAppShell.cpp \
|
|
||||||
nsBidiKeyboard.cpp \
|
|
||||||
nsClipboard.cpp \
|
|
||||||
nsDragService.cpp \
|
|
||||||
nsFilePicker.cpp \
|
|
||||||
nsLookAndFeel.cpp \
|
|
||||||
nsSound.cpp \
|
|
||||||
nsToolkit.cpp \
|
|
||||||
nsWidgetFactory.cpp \
|
|
||||||
nsWindow.cpp \
|
|
||||||
nsPopupWindow.cpp \
|
|
||||||
nsChildView.cpp \
|
|
||||||
nsScreenBeOS.cpp \
|
|
||||||
nsScreenManagerBeOS.cpp \
|
|
||||||
nsDeviceContextSpecB.cpp \
|
|
||||||
nsPrintOptionsBeOS.cpp \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
SHARED_LIBRARY_LIBS = $(DIST)/lib/libxpwidgets_s.a
|
|
||||||
|
|
||||||
EXTRA_DSO_LDOPTS = \
|
|
||||||
-ltracker \
|
|
||||||
-lgame \
|
|
||||||
$(TOOLKIT_DSO_LDOPTS) \
|
|
||||||
$(MOZ_COMPONENT_LIBS) \
|
|
||||||
-lgkgfx \
|
|
||||||
$(TK_LIBS) \
|
|
||||||
-lthebes \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
|
||||||
|
|
||||||
DEFINES += -D_IMPL_NS_WIDGET -I$(srcdir)/../xpwidgets -I$(srcdir)
|
|
||||||
|
|
||||||
CXXFLAGS += $(TK_CFLAGS)
|
|
||||||
|
|
||||||
INCLUDES += \
|
|
||||||
-I$(srcdir)/../xpwidgets \
|
|
||||||
-I$(srcdir) \
|
|
||||||
$(NULL)
|
|
|
@ -1,200 +0,0 @@
|
||||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Duncan Wilcox <duncan@be.com>
|
|
||||||
* Yannick Koehler <ykoehler@mythrium.com>
|
|
||||||
* Makoto Hamanaka <VYA04230@nifty.com>
|
|
||||||
* Fredrik Holmqvist <thesuckiestemail@yahoo.se>
|
|
||||||
* Sergei Dolgov <sergei_d@fi.tartu.ee>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsAppShell.h"
|
|
||||||
#include "nsSwitchToUIThread.h"
|
|
||||||
#include "prprf.h"
|
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsAppShell constructor
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
nsAppShell::nsAppShell()
|
|
||||||
: is_port_error(false), scheduled (false)
|
|
||||||
{
|
|
||||||
eventport = -1; // 0 is legal value for port_id!
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Create the application shell
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsAppShell::Init()
|
|
||||||
{
|
|
||||||
// system wide unique names
|
|
||||||
// NOTE: this needs to be run from within the main application thread
|
|
||||||
|
|
||||||
char portname[B_OS_NAME_LENGTH];
|
|
||||||
PR_snprintf(portname, sizeof(portname), "event%lx", (long unsigned) PR_GetCurrentThread());
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("nsAppShell::Create portname: %s\n", portname);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Clean up things. Restart process in toolkit may leave old port alive.
|
|
||||||
if ((eventport = find_port(portname)) >= 0)
|
|
||||||
{
|
|
||||||
close_port(eventport);
|
|
||||||
delete_port(eventport);
|
|
||||||
}
|
|
||||||
|
|
||||||
eventport = create_port(200, portname);
|
|
||||||
return nsBaseAppShell::Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsAppShell destructor
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
nsAppShell::~nsAppShell()
|
|
||||||
{
|
|
||||||
close_port(eventport);
|
|
||||||
delete_port(eventport);
|
|
||||||
|
|
||||||
if (be_app->Lock())
|
|
||||||
{
|
|
||||||
be_app->Quit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
|
|
||||||
{
|
|
||||||
bool gotMessage = false;
|
|
||||||
|
|
||||||
// should we check for eventport initialization ?
|
|
||||||
if (eventport < 0)
|
|
||||||
{
|
|
||||||
char portname[B_OS_NAME_LENGTH];
|
|
||||||
PR_snprintf(portname, sizeof(portname), "event%lx", (long unsigned) PR_GetCurrentThread());
|
|
||||||
// XXX - Do we really need to search eventport every time? There is one istance of AppShell per app
|
|
||||||
// and finding it once in Init() might be sufficient.
|
|
||||||
if((eventport = find_port(portname)) < 0)
|
|
||||||
{
|
|
||||||
// not initialized
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("nsAppShell::DispatchNativeEvent() was called before init\n");
|
|
||||||
#endif
|
|
||||||
return gotMessage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Currently we ignoring event type, previously we had 5 priority levels, different for mouse, kbd etc.
|
|
||||||
// MS Windows code sets some priority for kbd and IME events by ignoring mayWait
|
|
||||||
|
|
||||||
if (port_count(eventport))
|
|
||||||
gotMessage = InvokeBeOSMessage(0);
|
|
||||||
|
|
||||||
// There is next message in port queue
|
|
||||||
if (port_count(eventport) && !mayWait)
|
|
||||||
{
|
|
||||||
if (!scheduled)
|
|
||||||
{
|
|
||||||
// There is new (not scheduled) event and we cannot wait.
|
|
||||||
// So inform AppShell about existence of new event.
|
|
||||||
// Actually it should be called from something like BLooper::MessageReceived(),
|
|
||||||
// or, in our case, in nsToolkit CallMethod*()
|
|
||||||
NativeEventCallback();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scheduled = false;
|
|
||||||
gotMessage = InvokeBeOSMessage(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hack. Emulating logic for mayWait.
|
|
||||||
// Allow next event to pass through (if it appears inside 100000 uS)
|
|
||||||
// Actually it should block and then be unblocked from independent thread
|
|
||||||
// In that case read_port() should be used.
|
|
||||||
if (mayWait)
|
|
||||||
gotMessage = InvokeBeOSMessage(100000);
|
|
||||||
return gotMessage;
|
|
||||||
}
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void nsAppShell::ScheduleNativeEventCallback()
|
|
||||||
{
|
|
||||||
if (eventport < 0)
|
|
||||||
return;
|
|
||||||
port_info portinfo;
|
|
||||||
if (get_port_info(eventport, &portinfo) != B_OK)
|
|
||||||
return;
|
|
||||||
if (port_count(eventport) < portinfo.capacity - 20)
|
|
||||||
{
|
|
||||||
// This should be done from different thread in reality in order to unblock
|
|
||||||
ThreadInterfaceData id;
|
|
||||||
id.data = 0;
|
|
||||||
id.waitingThread = find_thread(NULL);
|
|
||||||
write_port_etc(eventport, 'natv', &id, sizeof(id), B_TIMEOUT, 1000000);
|
|
||||||
scheduled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nsAppShell::InvokeBeOSMessage(bigtime_t timeout)
|
|
||||||
{
|
|
||||||
int32 code;
|
|
||||||
ThreadInterfaceData id;
|
|
||||||
if (read_port_etc(eventport, &code, &id, sizeof(id), B_TIMEOUT, timeout) < 0)
|
|
||||||
{
|
|
||||||
is_port_error = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
id.waitingThread = 0;
|
|
||||||
MethodInfo *mInfo = (MethodInfo *)id.data;
|
|
||||||
if (code != 'natv')
|
|
||||||
mInfo->Invoke();
|
|
||||||
|
|
||||||
if (id.waitingThread != 0)
|
|
||||||
resume_thread(id.waitingThread);
|
|
||||||
delete mInfo;
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Sergei Dolgov <sergei_d@fi.tartu.ee>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsAppShell_h__
|
|
||||||
#define nsAppShell_h__
|
|
||||||
|
|
||||||
#include "nsBaseAppShell.h"
|
|
||||||
#include <OS.h>
|
|
||||||
|
|
||||||
struct ThreadInterfaceData
|
|
||||||
{
|
|
||||||
void* data;
|
|
||||||
thread_id waitingThread;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EventItem
|
|
||||||
{
|
|
||||||
int32 code;
|
|
||||||
ThreadInterfaceData ifdata;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MethodInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Native BeOS Application shell wrapper
|
|
||||||
*/
|
|
||||||
|
|
||||||
class nsAppShell : public nsBaseAppShell
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsAppShell();
|
|
||||||
nsresult Init();
|
|
||||||
protected:
|
|
||||||
virtual void ScheduleNativeEventCallback();
|
|
||||||
virtual PRBool ProcessNextNativeEvent(PRBool mayWait);
|
|
||||||
virtual ~nsAppShell();
|
|
||||||
|
|
||||||
private:
|
|
||||||
port_id eventport;
|
|
||||||
volatile bool scheduled;
|
|
||||||
bool is_port_error;
|
|
||||||
bool InvokeBeOSMessage(bigtime_t timeout);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // nsAppShell_h__
|
|
|
@ -1,246 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Yannick Koehler <koehler@mythrium.com>
|
|
||||||
* Paul Ashford <arougthopher@lizardland.net>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsBeOSCursors_h__
|
|
||||||
#define nsBeOSCursors_h__
|
|
||||||
|
|
||||||
#include <app/Cursor.h>
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned char cursorHyperlink[] = {16,1,2,2,
|
|
||||||
0,0,0,0,56,0,36,0,36,0,19,224,18,92,9,42,
|
|
||||||
8,1,60,33,76,113,66,113,48,249,12,249,2,0,1,0,
|
|
||||||
0,0,0,0,56,0,60,0,60,0,31,224,31,252,15,254,
|
|
||||||
15,255,63,255,127,255,127,255,63,255,15,255,3,254,1,248
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorHelp[] = {16,1,2,2,
|
|
||||||
0,0,0,0,56,0,36,0,36,0,19,224,18,92,9,42,
|
|
||||||
8,1,60,121,76,205,66,25,48,49,12,49,2,0,1,48,
|
|
||||||
0,0,0,0,56,0,60,0,60,0,31,224,31,252,15,254,
|
|
||||||
15,255,63,255,127,255,127,255,63,255,15,255,3,254,1,248
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorCrosshair[] = {16,1,8,8,
|
|
||||||
0,0,0,128,0,128,0,128,0,128,0,128,0,128,0,128,
|
|
||||||
127,255,0,128,0,128,0,128,0,128,0,128,0,128,0,128,
|
|
||||||
0,0,0,128,0,128,0,128,0,128,0,128,0,128,0,128,
|
|
||||||
127,255,0,128,0,128,0,128,0,128,0,128,0,128,0,128
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorCopy[] = {16,1,2,2,
|
|
||||||
0,0,0,0,56,0,36,0,36,0,19,224,18,92,9,42,
|
|
||||||
8,1,60,1,76,1,66,17,48,17,12,125,2,17,1,16,
|
|
||||||
0,0,0,0,56,0,60,0,60,0,31,224,31,252,15,254,
|
|
||||||
15,255,63,255,127,255,127,255,63,255,15,255,3,255,1,248
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorAlias[] = {16,1,2,2,
|
|
||||||
0,0,0,0,56,0,36,0,36,0,19,224,18,92,9,42,
|
|
||||||
8,1,60,1,76,113,66,137,48,157,12,137,2,65,1,0,
|
|
||||||
0,0,0,0,56,0,60,0,60,0,31,224,31,252,15,254,
|
|
||||||
15,255,63,255,127,255,127,255,63,255,15,255,3,255,1,248
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorGrabbing[] = {16,1,8,2,
|
|
||||||
0,0,0,0,0,0,0,0,15,224,18,92,33,42,40,1,
|
|
||||||
60,1,20,1,18,1,8,1,4,1,2,1,1,0,0,128,
|
|
||||||
0,0,0,0,0,0,0,0,15,224,31,252,63,254,63,255,
|
|
||||||
63,255,31,255,31,255,15,255,7,255,3,255,1,254,0,248
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorGrab[] = {16,1,2,2,
|
|
||||||
0,0,0,0,59,64,36,168,36,148,18,74,18,74,9,37,
|
|
||||||
8,1,60,1,76,1,68,1,48,1,12,1,2,0,1,0,
|
|
||||||
0,0,0,0,59,64,63,232,63,252,31,254,31,254,15,255,
|
|
||||||
15,255,63,255,127,255,127,255,63,255,15,255,3,254,1,248
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorLowerRight[] = {16,1,13,13,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,4,6,2,38,1,38,
|
|
||||||
0,166,0,102,3,230,0,6,0,6,7,254,7,254,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,4,15,14,127,7,127,3,255,
|
|
||||||
1,255,7,255,7,255,7,255,15,255,15,255,15,255,15,255
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorLowerLeft[] = {16,1,13,2,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,96,32,100,64,100,128,
|
|
||||||
101,0,102,0,103,192,96,0,96,0,127,224,127,224,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,240,32,254,112,254,224,255,192,
|
|
||||||
255,128,255,224,255,224,255,224,255,240,255,240,255,240,255,240
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorUpperLeft[] = {16,1,2,2,
|
|
||||||
0,0,127,224,127,224,96,0,96,0,103,192,102,0,101,0,
|
|
||||||
100,128,100,64,96,32,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
255,240,255,240,255,240,255,240,255,224,255,224,255,224,255,128,
|
|
||||||
255,192,254,224,254,112,240,32,0,0,0,0,0,0,0,0
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorUpperRight[] = {16,1,2,13,
|
|
||||||
0,0,7,254,7,254,0,6,0,6,3,230,0,102,0,166,
|
|
||||||
1,38,2,38,4,6,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
15,255,15,255,15,255,15,255,7,255,7,255,7,255,1,255,
|
|
||||||
3,255,7,127,14,127,4,15,0,0,0,0,0,0,0,0
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorRight[] = {16,1,6,13,
|
|
||||||
0,0,0,6,0,6,1,6,0,134,0,70,15,230,0,70,
|
|
||||||
0,134,1,6,0,6,0,6,0,0,0,0,0,0,0,0,
|
|
||||||
0,15,0,15,1,15,3,143,1,207,31,239,31,255,31,239,
|
|
||||||
1,207,3,143,1,15,0,15,0,15,0,0,0,0,0,0
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorLeft[] = {16,1,6,2,
|
|
||||||
0,0,96,0,96,0,96,128,97,0,98,0,103,224,98,0,
|
|
||||||
97,0,96,128,96,0,96,0,0,0,0,0,0,0,0,0,
|
|
||||||
240,0,240,0,240,128,241,192,243,128,247,240,255,240,247,240,
|
|
||||||
243,128,241,192,240,128,240,0,240,0,0,0,0,0,0,0
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorTop[] = {16,1,2,7,
|
|
||||||
0,0,63,248,63,248,0,0,0,0,1,0,3,128,5,64,
|
|
||||||
9,32,1,0,1,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
127,252,127,252,127,252,127,252,1,0,3,128,7,192,15,224,
|
|
||||||
31,240,11,160,3,128,3,128,0,0,0,0,0,0,0,0
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorBottom[] = {16,1,13,7,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,1,0,1,0,9,32,
|
|
||||||
5,64,3,128,1,0,0,0,0,0,63,248,63,248,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,3,128,3,128,11,160,31,240,
|
|
||||||
15,224,7,192,3,128,1,0,127,252,127,252,127,252,127,252
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorHorizontalDrag[] = {16,1,7,7,
|
|
||||||
1,128,1,128,1,128,1,128,1,128,17,136,49,140,125,190,
|
|
||||||
125,190,49,140,17,136,1,128,1,128,1,128,1,128,1,128,
|
|
||||||
3,192,3,192,3,192,3,192,27,216,59,220,127,254,255,255,
|
|
||||||
255,255,127,254,59,220,27,216,3,192,3,192,3,192,3,192
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorVerticalDrag[] = {16,1,7,7,
|
|
||||||
0,0,1,128,3,192,7,224,1,128,1,128,0,0,255,255,
|
|
||||||
255,255,0,0,1,128,1,128,7,224,3,192,1,128,0,0,
|
|
||||||
1,128,3,192,7,224,15,240,15,240,3,192,255,255,255,255,
|
|
||||||
255,255,255,255,3,192,15,240,15,240,7,224,3,192,1,128
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorCell[] = {16,1,2,2,
|
|
||||||
0,0,0,0,56,0,36,0,36,0,19,224,18,92,9,42,
|
|
||||||
8,1,60,49,76,49,66,205,48,205,12,49,2,49,1,0,
|
|
||||||
0,0,0,0,56,0,60,0,60,0,31,224,31,252,15,254,
|
|
||||||
15,255,63,255,127,255,127,255,63,255,15,255,3,255,1,248
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorZoomIn[] = {16,1,5,6,
|
|
||||||
15,128,16,64,32,32,66,16,66,16,79,144,66,16,66,16,
|
|
||||||
32,32,16,112,15,184,0,28,0,14,0,7,0,2,0,0,
|
|
||||||
15,128,31,192,63,224,127,240,127,240,127,240,127,240,127,240,
|
|
||||||
63,224,31,240,15,184,0,28,0,14,0,7,0,2,0,0
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorZoomOut[] = {16,1,5,6,
|
|
||||||
15,128,16,64,32,32,64,16,64,16,79,144,64,16,64,16,
|
|
||||||
32,32,16,112,15,184,0,28,0,14,0,7,0,2,0,0,
|
|
||||||
15,128,31,192,63,224,127,240,127,240,127,240,127,240,127,240,
|
|
||||||
63,224,31,240,15,184,0,28,0,14,0,7,0,2,0,0
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorWatch2[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,70,4,138,2,146,1,130,0,197,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// keeping these in case we want to animate the spinner at some point
|
|
||||||
static unsigned char cursorWatch1[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,86,4,146,2,146,1,130,0,197,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorWatch3[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,70,4,130,2,158,1,130,0,197,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorWatch4[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,70,4,130,2,146,1,138,0,197,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorWatch5[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,70,4,130,2,146,1,146,0,213,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorWatch6[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,70,4,130,2,146,1,162,0,197,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorWatch7[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,70,4,130,2,242,1,130,0,197,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
|
|
||||||
static unsigned char cursorWatch8[] = {16,1,0,1,
|
|
||||||
112,0,72,0,72,0,39,192,36,184,18,84,16,2,120,2,
|
|
||||||
152,2,132,2,96,58,24,70,4,162,2,146,1,130,0,197,
|
|
||||||
112,0,120,0,120,0,63,192,63,248,31,252,31,254,127,254,
|
|
||||||
255,254,255,254,127,254,31,254,7,254,3,254,1,254,0,255
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // nsBeOSCursors_h__
|
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 IBM code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* IBM.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Simon Montagu
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsBidiKeyboard.h"
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
|
|
||||||
|
|
||||||
nsBidiKeyboard::nsBidiKeyboard() : nsIBidiKeyboard()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsBidiKeyboard::~nsBidiKeyboard()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL)
|
|
||||||
{
|
|
||||||
*aIsRTL = PR_FALSE;
|
|
||||||
// XXX Insert platform specific code to determine keyboard direction
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel)
|
|
||||||
{
|
|
||||||
// XXX Insert platform specific code to set keyboard language
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 IBM code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* IBM.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Simon Montagu
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef __nsBidiKeyboard
|
|
||||||
#define __nsBidiKeyboard
|
|
||||||
#include "nsIBidiKeyboard.h"
|
|
||||||
|
|
||||||
class nsBidiKeyboard : public nsIBidiKeyboard
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIBIDIKEYBOARD
|
|
||||||
|
|
||||||
nsBidiKeyboard();
|
|
||||||
virtual ~nsBidiKeyboard();
|
|
||||||
/* additional members */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __nsBidiKeyboard
|
|
|
@ -1,121 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef CLIST_H
|
|
||||||
#define CLIST_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Simple circular linked-list implementation...
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Foreward declarations...
|
|
||||||
struct CList;
|
|
||||||
|
|
||||||
#define OBJECT_PTR_FROM_CLIST(className, listElement) \
|
|
||||||
((char*)listElement - offsetof(className, m_link))
|
|
||||||
|
|
||||||
|
|
||||||
struct CList {
|
|
||||||
CList *next;
|
|
||||||
CList *prev;
|
|
||||||
|
|
||||||
CList() {
|
|
||||||
next = prev = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
~CList() {
|
|
||||||
Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Append an element to the end of this list
|
|
||||||
//
|
|
||||||
void Append(CList &element) {
|
|
||||||
element.next = this;
|
|
||||||
element.prev = prev;
|
|
||||||
prev->next = &element;
|
|
||||||
prev = &element;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Add an element to the beginning of this list
|
|
||||||
//
|
|
||||||
void Add(CList &element) {
|
|
||||||
element.next = next;
|
|
||||||
element.prev = this;
|
|
||||||
next->prev = &element;
|
|
||||||
next = &element;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Append this element to the end of a list
|
|
||||||
//
|
|
||||||
void AppendToList(CList &list) {
|
|
||||||
list.Append(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Add this element to the beginning of a list
|
|
||||||
//
|
|
||||||
void AddToList(CList &list) {
|
|
||||||
list.Add(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Remove this element from the list and re-initialize
|
|
||||||
//
|
|
||||||
void Remove(void) {
|
|
||||||
prev->next = next;
|
|
||||||
next->prev = prev;
|
|
||||||
|
|
||||||
next = prev = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Is this list empty ?
|
|
||||||
//
|
|
||||||
bool IsEmpty(void) {
|
|
||||||
return (next == this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CLIST_H
|
|
||||||
|
|
|
@ -1,170 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Mozilla Browser.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Fredrik Holmqvist <thesuckiestemail@yahoo.se>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsChildView.h"
|
|
||||||
|
|
||||||
nsChildView::nsChildView() : nsWindow()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nsresult nsChildView::Create(nsIWidget *aParent,
|
|
||||||
nsNativeWidget aNativeParent,
|
|
||||||
const nsRect &aRect,
|
|
||||||
EVENT_CALLBACK aHandleEventFunction,
|
|
||||||
nsIDeviceContext *aContext,
|
|
||||||
nsIAppShell *aAppShell,
|
|
||||||
nsIToolkit *aToolkit,
|
|
||||||
nsWidgetInitData *aInitData)
|
|
||||||
{
|
|
||||||
|
|
||||||
NS_ASSERTION(aInitData->mWindowType == eWindowType_child
|
|
||||||
|| aInitData->mWindowType == eWindowType_plugin,
|
|
||||||
"The windowtype is not handled by this class." );
|
|
||||||
|
|
||||||
mIsTopWidgetWindow = PR_FALSE;
|
|
||||||
|
|
||||||
BaseCreate(aParent, aRect, aHandleEventFunction, aContext, aAppShell,
|
|
||||||
aToolkit, aInitData);
|
|
||||||
|
|
||||||
mListenForResizes = aNativeParent ? PR_TRUE : aInitData->mListenForResizes;
|
|
||||||
|
|
||||||
// Switch to the "main gui thread" if necessary... This method must
|
|
||||||
// be executed on the "gui thread"...
|
|
||||||
//
|
|
||||||
nsToolkit* toolkit = (nsToolkit *)mToolkit;
|
|
||||||
if (toolkit && !toolkit->IsGuiThread())
|
|
||||||
{
|
|
||||||
uint32 args[7];
|
|
||||||
args[0] = (uint32)aParent;
|
|
||||||
args[1] = (uint32)&aRect;
|
|
||||||
args[2] = (uint32)aHandleEventFunction;
|
|
||||||
args[3] = (uint32)aContext;
|
|
||||||
args[4] = (uint32)aAppShell;
|
|
||||||
args[5] = (uint32)aToolkit;
|
|
||||||
args[6] = (uint32)aInitData;
|
|
||||||
|
|
||||||
if (nsnull != aParent)
|
|
||||||
{
|
|
||||||
// nsIWidget parent dispatch
|
|
||||||
MethodInfo info(this, this, nsSwitchToUIThread::CREATE, 7, args);
|
|
||||||
toolkit->CallMethod(&info);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Native parent dispatch
|
|
||||||
MethodInfo info(this, this, nsSwitchToUIThread::CREATE_NATIVE, 7, args);
|
|
||||||
toolkit->CallMethod(&info);
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
mParent = aParent;
|
|
||||||
// Useful shortcut, wondering if we can use it also in GetParent() instead
|
|
||||||
// nsIWidget* type mParent.
|
|
||||||
mWindowParent = (nsWindow *) aParent;
|
|
||||||
SetBounds(aRect);
|
|
||||||
|
|
||||||
//NS_NATIVE_GRAPHIC maybe?
|
|
||||||
//Parent may be a BView if we embed.
|
|
||||||
BView *parent= (BView *)
|
|
||||||
(aParent ? aParent->GetNativeData(NS_NATIVE_WIDGET) : aNativeParent);
|
|
||||||
//There seems to be three of these on startup,
|
|
||||||
//but I believe that these are because of bugs in
|
|
||||||
//other code as they existed before rewriting this
|
|
||||||
//function.
|
|
||||||
NS_PRECONDITION(parent, "Childviews without parents don't get added to anything.");
|
|
||||||
// A childview that is never added to a parent is very strange.
|
|
||||||
if (!parent)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
mView = new nsViewBeOS(this,
|
|
||||||
BRect(aRect.x, aRect.y, aRect.x + aRect.width - 1, aRect.y + aRect.height - 1)
|
|
||||||
, "Child view", 0, B_WILL_DRAW);
|
|
||||||
#if defined(BeIME)
|
|
||||||
mView->SetFlags(mView->Flags() | B_INPUT_METHOD_AWARE);
|
|
||||||
#endif
|
|
||||||
bool mustUnlock = parent->Parent() && parent->LockLooper();
|
|
||||||
parent->AddChild(mView);
|
|
||||||
if (mustUnlock)
|
|
||||||
parent->UnlockLooper();
|
|
||||||
DispatchStandardEvent(NS_CREATE);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Hide or show this component
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_METHOD nsChildView::Show(PRBool bState)
|
|
||||||
{
|
|
||||||
if (!mEnabled)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
if (!mView || !mView->LockLooper())
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
//We need to do the IsHidden() checks
|
|
||||||
//because BeOS counts no of Hide()
|
|
||||||
//and Show() checks. BeBook:
|
|
||||||
// For a hidden view to become visible again, the number of Hide() calls
|
|
||||||
// must be matched by an equal number of Show() calls.
|
|
||||||
if (PR_FALSE == bState)
|
|
||||||
{
|
|
||||||
if (!mView->IsHidden())
|
|
||||||
mView->Hide();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mView->IsHidden())
|
|
||||||
mView->Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
mView->UnlockLooper();
|
|
||||||
mIsVisible = bState;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NS_METHOD nsChildView::SetTitle(const nsAString& aTitle)
|
|
||||||
{
|
|
||||||
if (mView)
|
|
||||||
mView->SetName(NS_ConvertUTF16toUTF8(aTitle).get());
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Mozilla Browser.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Fredrik Holmqvist <thesuckiestemail@yahoo.se>.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsChildView_h__
|
|
||||||
#define nsChildView_h__
|
|
||||||
|
|
||||||
#include "nsWindow.h"
|
|
||||||
|
|
||||||
class nsChildView : public nsWindow
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsChildView();
|
|
||||||
virtual PRBool IsChild() { return(PR_TRUE); };
|
|
||||||
|
|
||||||
NS_IMETHOD Show(PRBool bState);
|
|
||||||
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
|
||||||
};
|
|
||||||
#endif //nsChildView_h__
|
|
|
@ -1,336 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
|
||||||
* Takashi Toyoshima <toyoshim@be-in.org>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsClipboard.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsITransferable.h"
|
|
||||||
#include "nsWidgetsCID.h"
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsPrimitiveHelpers.h"
|
|
||||||
#include "nsXPCOM.h"
|
|
||||||
#include "nsISupportsPrimitives.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
#include <Clipboard.h>
|
|
||||||
#include <Message.h>
|
|
||||||
|
|
||||||
// The class statics:
|
|
||||||
BView *nsClipboard::sView = 0;
|
|
||||||
|
|
||||||
#if defined(DEBUG_akkana) || defined(DEBUG_mcafee) || defined(DEBUG_toyoshim)
|
|
||||||
# define DEBUG_CLIPBOARD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsClipboard constructor
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
nsClipboard::nsClipboard() : nsBaseClipboard()
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf(" nsClipboard::nsClipboard()\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
|
|
||||||
mIgnoreEmptyNotification = PR_FALSE;
|
|
||||||
mClipboardOwner = nsnull;
|
|
||||||
mTransferable = nsnull;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsClipboard destructor
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
nsClipboard::~nsClipboard()
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf(" nsClipboard::~nsClipboard()\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsClipboard::SetTopLevelView(BView *v)
|
|
||||||
{
|
|
||||||
// Don't set up any more event handlers if we're being called twice
|
|
||||||
// for the same toplevel widget
|
|
||||||
if (sView == v)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (sView != 0 && sView->Window() != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(v == 0 || v->Window() == 0)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf(" nsClipboard::SetTopLevelView: widget passed in is null or has no window!\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf(" nsClipboard::SetTopLevelView\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// The copy routine
|
|
||||||
//
|
|
||||||
NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard)
|
|
||||||
{
|
|
||||||
mIgnoreEmptyNotification = PR_TRUE;
|
|
||||||
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf(" nsClipboard::SetNativeClipboardData()\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
|
|
||||||
// make sure we have a good transferable
|
|
||||||
if (nsnull == mTransferable) {
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf(" SetNativeClipboardData: no transferable!\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// lock the native clipboard
|
|
||||||
if (!be_clipboard->Lock())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// clear the native clipboard
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
if (B_OK == be_clipboard->Clear()) {
|
|
||||||
// set data to the native clipboard
|
|
||||||
if (BMessage *msg = be_clipboard->Data()) {
|
|
||||||
// Get the transferable list of data flavors
|
|
||||||
nsCOMPtr<nsISupportsArray> dfList;
|
|
||||||
mTransferable->FlavorsTransferableCanExport(getter_AddRefs(dfList));
|
|
||||||
|
|
||||||
// Walk through flavors that contain data and register them
|
|
||||||
// into the BMessage as supported flavors
|
|
||||||
PRUint32 i;
|
|
||||||
PRUint32 cnt;
|
|
||||||
dfList->Count(&cnt);
|
|
||||||
for (i = 0; i < cnt && rv == NS_OK; i++) {
|
|
||||||
nsCOMPtr<nsISupports> genericFlavor;
|
|
||||||
dfList->GetElementAt(i, getter_AddRefs(genericFlavor));
|
|
||||||
nsCOMPtr<nsISupportsCString> currentFlavor (do_QueryInterface(genericFlavor));
|
|
||||||
if (currentFlavor) {
|
|
||||||
nsXPIDLCString flavorStr;
|
|
||||||
currentFlavor->ToString(getter_Copies(flavorStr));
|
|
||||||
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("nsClipboard: %d/%d = %s\n", i, cnt, (const char *)flavorStr);
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
if (0 == strncmp(flavorStr, "text/", 5)) {
|
|
||||||
// [NS] text/ * => [Be] text/ *
|
|
||||||
void *data = nsnull;
|
|
||||||
PRUint32 dataSize = 0;
|
|
||||||
nsCOMPtr<nsISupports> genericDataWrapper;
|
|
||||||
rv = mTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &dataSize);
|
|
||||||
nsPrimitiveHelpers::CreateDataFromPrimitive(flavorStr, genericDataWrapper, &data, dataSize);
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
printf("nsClipboard: Error getting data from transferable\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
if (dataSize && data != nsnull) {
|
|
||||||
NS_ConvertUTF16toUTF8 cv((const PRUnichar *)data, (PRUint32)dataSize / 2);
|
|
||||||
const char *utf8Str = cv.get();
|
|
||||||
uint32 utf8Len = strlen(utf8Str);
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
if (0 == strcmp(flavorStr, kUnicodeMime))
|
|
||||||
printf(" => [%s]%s\n", kTextMime, utf8Str);
|
|
||||||
else
|
|
||||||
printf(" => [%s]%s\n", (const char *)flavorStr, utf8Str);
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
status_t rc;
|
|
||||||
if (0 == strcmp(flavorStr, kUnicodeMime)) {
|
|
||||||
// [NS] text/unicode => [Be] text/plain
|
|
||||||
rc = msg->AddData(kTextMime, B_MIME_TYPE, (void *)utf8Str, utf8Len);
|
|
||||||
} else {
|
|
||||||
// [NS] text/ * => [Be] text/ *
|
|
||||||
rc = msg->AddData((const char *)flavorStr, B_MIME_TYPE, (void *)utf8Str, utf8Len);
|
|
||||||
}
|
|
||||||
if (rc != B_OK)
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
} else {
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("nsClipboard: Error null data from transferable\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
// not fatal. force to continue...
|
|
||||||
rv = NS_OK;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// [NS] * / * => [Be] * / *
|
|
||||||
void *data = nsnull;
|
|
||||||
PRUint32 dataSize = 0;
|
|
||||||
nsCOMPtr<nsISupports> genericDataWrapper;
|
|
||||||
rv = mTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &dataSize);
|
|
||||||
nsPrimitiveHelpers::CreateDataFromPrimitive(flavorStr, genericDataWrapper, &data, dataSize);
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
printf("nsClipboard: Error getting data from transferable\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
if (dataSize && data != nsnull) {
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("[%s](binary)\n", (const char *)flavorStr);
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
if (B_OK != msg->AddData((const char *)flavorStr, B_MIME_TYPE, data, dataSize))
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("nsClipboard: Error getting flavor\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
} /* for */
|
|
||||||
} else {
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
if (B_OK != be_clipboard->Commit())
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
be_clipboard->Unlock();
|
|
||||||
|
|
||||||
mIgnoreEmptyNotification = PR_FALSE;
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// The blocking Paste routine
|
|
||||||
//
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWhichClipboard )
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf(" nsClipboard::GetNativeClipboardData()\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
|
|
||||||
// make sure we have a good transferable
|
|
||||||
if (nsnull == aTransferable) {
|
|
||||||
printf(" GetNativeClipboardData: Transferable is null!\n");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get flavor list
|
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsISupportsArray> flavorList;
|
|
||||||
rv = aTransferable->FlavorsTransferableCanImport(getter_AddRefs(flavorList));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// get native clipboard data
|
|
||||||
if (!be_clipboard->Lock())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
BMessage *msg = be_clipboard->Data();
|
|
||||||
if (!msg)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
msg->PrintToStream();
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
|
|
||||||
PRUint32 cnt;
|
|
||||||
flavorList->Count(&cnt);
|
|
||||||
for (PRUint32 i = 0; i < cnt; i++) {
|
|
||||||
nsCOMPtr<nsISupports> genericFlavor;
|
|
||||||
flavorList->GetElementAt(i, getter_AddRefs(genericFlavor));
|
|
||||||
nsCOMPtr<nsISupportsCString> currentFlavor(do_QueryInterface(genericFlavor));
|
|
||||||
if (currentFlavor) {
|
|
||||||
nsXPIDLCString flavorStr;
|
|
||||||
currentFlavor->ToString(getter_Copies(flavorStr));
|
|
||||||
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("nsClipboard: %d/%d = %s\n", i, cnt, (const char *)flavorStr);
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
const void *data;
|
|
||||||
ssize_t size;
|
|
||||||
if (0 == strncmp(flavorStr, "text/", 5)) {
|
|
||||||
// [Be] text/ * => [NS] text/ *
|
|
||||||
status_t rc;
|
|
||||||
if (0 == strcmp(flavorStr, kUnicodeMime))
|
|
||||||
rc = msg->FindData(kTextMime, B_MIME_TYPE, &data, &size);
|
|
||||||
else
|
|
||||||
rc = msg->FindData(flavorStr, B_MIME_TYPE, &data, &size);
|
|
||||||
if (rc != B_OK || !data || !size) {
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("nsClipboard: not found in BMessage\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
} else {
|
|
||||||
NS_ConvertUTF8toUTF16 ucs2Str((const char *)data, (PRUint32)size);
|
|
||||||
nsCOMPtr<nsISupports> genericDataWrapper;
|
|
||||||
nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, (void *)ucs2Str.get(), ucs2Str.Length() * 2, getter_AddRefs(genericDataWrapper));
|
|
||||||
rv = aTransferable->SetTransferData(flavorStr, genericDataWrapper, ucs2Str.Length() * 2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// [Be] * / * => [NS] * / *
|
|
||||||
if (B_OK != msg->FindData(flavorStr, B_MIME_TYPE, &data, &size)) {
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("nsClipboard: not found in BMessage\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
} else {
|
|
||||||
nsCOMPtr<nsISupports> genericDataWrapper;
|
|
||||||
nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, (void *)data, (PRUint32)size, getter_AddRefs(genericDataWrapper));
|
|
||||||
rv = aTransferable->SetTransferData(flavorStr, genericDataWrapper, size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
printf("nsClipboard: Error SetTransferData\n");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
} else {
|
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
#ifdef DEBUG_CLIPBOARD
|
|
||||||
printf("nsClipboard: Error gerring flavor");
|
|
||||||
#endif /* DEBUG_CLIPBOARD */
|
|
||||||
}
|
|
||||||
if (rv != NS_OK)
|
|
||||||
break;
|
|
||||||
} /* for */
|
|
||||||
|
|
||||||
be_clipboard->Unlock();
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Takashi Toyoshima <toyoshim@be-in.org>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsClipboard_h__
|
|
||||||
#define nsClipboard_h__
|
|
||||||
|
|
||||||
#include "nsBaseClipboard.h"
|
|
||||||
#include <Clipboard.h>
|
|
||||||
|
|
||||||
class BView;
|
|
||||||
class nsITransferable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Native BeOS Clipboard wrapper
|
|
||||||
*/
|
|
||||||
|
|
||||||
class nsClipboard : public nsBaseClipboard
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
nsClipboard();
|
|
||||||
virtual ~nsClipboard();
|
|
||||||
|
|
||||||
static void SetTopLevelView(BView *v);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
NS_IMETHOD SetNativeClipboardData( PRInt32 aWhichClipboard );
|
|
||||||
NS_IMETHOD GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWhichClipboard);
|
|
||||||
|
|
||||||
PRBool mIgnoreEmptyNotification;
|
|
||||||
|
|
||||||
static BView *sView;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // nsClipboard_h__
|
|
|
@ -1,260 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
||||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsIWidget.h"
|
|
||||||
#include "nsDeviceContextSpecB.h"
|
|
||||||
|
|
||||||
#include "nsIPrefService.h"
|
|
||||||
#include "nsIPrefBranch.h"
|
|
||||||
#include "prenv.h" /* for PR_GetEnv */
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsReadableUtils.h"
|
|
||||||
#include "nsStringEnumerator.h"
|
|
||||||
#include "nsTArray.h"
|
|
||||||
#include "nsCRT.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// The printer data is shared between the PrinterEnumerator and the nsDeviceContextSpecG
|
|
||||||
// The PrinterEnumerator creates the printer info
|
|
||||||
// but the nsDeviceContextSpecG cleans it up
|
|
||||||
// If it gets created (via the Page Setup Dialog) but the user never prints anything
|
|
||||||
// then it will never be delete, so this class takes care of that.
|
|
||||||
class GlobalPrinters {
|
|
||||||
public:
|
|
||||||
static GlobalPrinters* GetInstance() { return &mGlobalPrinters; }
|
|
||||||
~GlobalPrinters() { FreeGlobalPrinters(); }
|
|
||||||
|
|
||||||
void FreeGlobalPrinters();
|
|
||||||
nsresult InitializeGlobalPrinters();
|
|
||||||
|
|
||||||
PRBool PrintersAreAllocated() { return mGlobalPrinterList != nsnull; }
|
|
||||||
PRUint32 GetNumPrinters() { return mGlobalNumPrinters; }
|
|
||||||
nsString* GetStringAt(PRInt32 aInx) { return &mGlobalPrinterList->ElementAt(aInx); }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
GlobalPrinters() {}
|
|
||||||
|
|
||||||
static GlobalPrinters mGlobalPrinters;
|
|
||||||
static nsTArray<nsString>* mGlobalPrinterList;
|
|
||||||
static PRUint32 mGlobalNumPrinters;
|
|
||||||
|
|
||||||
};
|
|
||||||
//---------------
|
|
||||||
// static members
|
|
||||||
GlobalPrinters GlobalPrinters::mGlobalPrinters;
|
|
||||||
nsTArray<nsString>* GlobalPrinters::mGlobalPrinterList = nsnull;
|
|
||||||
PRUint32 GlobalPrinters::mGlobalNumPrinters = 0;
|
|
||||||
|
|
||||||
nsDeviceContextSpecBeOS::nsDeviceContextSpecBeOS()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsDeviceContextSpecBeOS::~nsDeviceContextSpecBeOS()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecBeOS, nsIDeviceContextSpec)
|
|
||||||
|
|
||||||
/** -------------------------------------------------------
|
|
||||||
* Initialize the nsDeviceContextSpecBeOS
|
|
||||||
* @update dc 2/15/98
|
|
||||||
* @update syd 3/2/99
|
|
||||||
*/
|
|
||||||
NS_IMETHODIMP nsDeviceContextSpecBeOS::Init(nsIWidget *aWidget,
|
|
||||||
nsIPrintSettings* aPS,
|
|
||||||
PRBool aIsPrintPreview)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
|
||||||
NS_ASSERTION(nsnull != aPS, "No print settings.");
|
|
||||||
|
|
||||||
mPrintSettings = aPS;
|
|
||||||
|
|
||||||
// if there is a current selection then enable the "Selection" radio button
|
|
||||||
if (aPS != nsnull) {
|
|
||||||
PRBool isOn;
|
|
||||||
aPS->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn);
|
|
||||||
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
(void) pPrefs->SetBoolPref("print.selection_radio_enabled", isOn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters();
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GlobalPrinters::GetInstance()->FreeGlobalPrinters();
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** -------------------------------------------------------
|
|
||||||
* Closes the printmanager if it is open.
|
|
||||||
* @update dc 2/15/98
|
|
||||||
*/
|
|
||||||
NS_IMETHODIMP nsDeviceContextSpecBeOS :: ClosePrintManager()
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Printer Enumerator
|
|
||||||
nsPrinterEnumeratorBeOS::nsPrinterEnumeratorBeOS()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsPrinterEnumeratorBeOS, nsIPrinterEnumerator)
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsPrinterEnumeratorBeOS::GetPrinterNameList(nsIStringEnumerator **aPrinterNameList)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aPrinterNameList);
|
|
||||||
*aPrinterNameList = nsnull;
|
|
||||||
|
|
||||||
nsresult rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters();
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRUint32 numPrinters = GlobalPrinters::GetInstance()->GetNumPrinters();
|
|
||||||
nsTArray<nsString> *printers = new nsTArray<nsString>(numPrinters);
|
|
||||||
if (!printers) {
|
|
||||||
GlobalPrinters::GetInstance()->FreeGlobalPrinters();
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRUint32 count = 0;
|
|
||||||
while( count < numPrinters )
|
|
||||||
{
|
|
||||||
printers->AppendElement(*GlobalPrinters::GetInstance()->GetStringAt(count++));
|
|
||||||
}
|
|
||||||
GlobalPrinters::GetInstance()->FreeGlobalPrinters();
|
|
||||||
|
|
||||||
return NS_NewAdoptingStringEnumerator(aPrinterNameList, printers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* readonly attribute wstring defaultPrinterName; */
|
|
||||||
NS_IMETHODIMP nsPrinterEnumeratorBeOS::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aDefaultPrinterName);
|
|
||||||
*aDefaultPrinterName = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* void initPrintSettingsFromPrinter (in wstring aPrinterName, in nsIPrintSettings aPrintSettings); */
|
|
||||||
NS_IMETHODIMP nsPrinterEnumeratorBeOS::InitPrintSettingsFromPrinter(const PRUnichar *aPrinterName, nsIPrintSettings *aPrintSettings)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsPrinterEnumeratorBeOS::DisplayPropertiesDlg(const PRUnichar *aPrinter, nsIPrintSettings *aPrintSettings)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
nsresult GlobalPrinters::InitializeGlobalPrinters ()
|
|
||||||
{
|
|
||||||
if (PrintersAreAllocated())
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
mGlobalNumPrinters = 0;
|
|
||||||
|
|
||||||
mGlobalPrinterList = new nsTArray<nsString>();
|
|
||||||
if (!mGlobalPrinterList)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
/* add an entry for the default printer (see nsPostScriptObj.cpp) */
|
|
||||||
mGlobalPrinterList->AppendElement(
|
|
||||||
nsString(NS_ConvertASCIItoUTF16(NS_POSTSCRIPT_DRIVER_NAME "default")));
|
|
||||||
mGlobalNumPrinters++;
|
|
||||||
|
|
||||||
/* get the list of printers */
|
|
||||||
char *printerList = nsnull;
|
|
||||||
|
|
||||||
/* the env var MOZILLA_PRINTER_LIST can "override" the prefs */
|
|
||||||
printerList = PR_GetEnv("MOZILLA_PRINTER_LIST");
|
|
||||||
|
|
||||||
if (!printerList) {
|
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID,
|
|
||||||
&rv);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
(void) pPrefs->GetCharPref("print.printer_list", &printerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (printerList) {
|
|
||||||
char *tok_lasts;
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
/* PL_strtok_r() will modify the string - copy it! */
|
|
||||||
printerList = strdup(printerList);
|
|
||||||
if (!printerList)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
for( name = PL_strtok_r(printerList, " ", &tok_lasts) ;
|
|
||||||
name != nsnull ;
|
|
||||||
name = PL_strtok_r(nsnull, " ", &tok_lasts) )
|
|
||||||
{
|
|
||||||
mGlobalPrinterList->AppendElement(
|
|
||||||
nsString(NS_ConvertASCIItoUTF16(NS_POSTSCRIPT_DRIVER_NAME)) +
|
|
||||||
nsString(NS_ConvertASCIItoUTF16(name)));
|
|
||||||
mGlobalNumPrinters++;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_Free(printerList);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mGlobalNumPrinters == 0)
|
|
||||||
return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void GlobalPrinters::FreeGlobalPrinters()
|
|
||||||
{
|
|
||||||
delete mGlobalPrinterList;
|
|
||||||
mGlobalPrinterList = nsnull;
|
|
||||||
mGlobalNumPrinters = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,113 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
||||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsDeviceContextSpecB_h___
|
|
||||||
#define nsDeviceContextSpecB_h___
|
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIDeviceContextSpec.h"
|
|
||||||
#include "nsIPrintSettings.h"
|
|
||||||
#include "nsIPrintOptions.h"
|
|
||||||
// For public interface?
|
|
||||||
#include "nsIWidget.h"
|
|
||||||
#include "nsPrintdBeOS.h"
|
|
||||||
|
|
||||||
class nsDeviceContextSpecBeOS : public nsIDeviceContextSpec
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Construct a nsDeviceContextSpecBeOS, which is an object which contains and manages a mac printrecord
|
|
||||||
* @update dc 12/02/98
|
|
||||||
*/
|
|
||||||
nsDeviceContextSpecBeOS();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the nsDeviceContextSpecBeOS for use. This will allocate a printrecord for use
|
|
||||||
* @update dc 2/16/98
|
|
||||||
* @param aWidget Unused
|
|
||||||
* @param aPS Settings for this print job
|
|
||||||
* @param aIsPrintPreview Unused
|
|
||||||
* @return error status
|
|
||||||
*/
|
|
||||||
NS_IMETHOD Init(nsIWidget *aWidget,
|
|
||||||
nsIPrintSettings* aPS,
|
|
||||||
PRBool aIsPrintPreview);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the printmanager if it is open.
|
|
||||||
* @update dc 2/13/98
|
|
||||||
* @return error status
|
|
||||||
*/
|
|
||||||
NS_IMETHOD ClosePrintManager();
|
|
||||||
|
|
||||||
NS_IMETHOD GetSurfaceForPrinter(gfxASurface **nativeSurface) {
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor for nsDeviceContextSpecBeOS, this will release the printrecord
|
|
||||||
* @update dc 2/16/98
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
virtual ~nsDeviceContextSpecBeOS();
|
|
||||||
|
|
||||||
public:
|
|
||||||
int InitializeGlobalPrinters();
|
|
||||||
void FreeGlobalPrinters();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// Printer Enumerator
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
class nsPrinterEnumeratorBeOS : public nsIPrinterEnumerator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsPrinterEnumeratorBeOS();
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIPRINTERENUMERATOR
|
|
||||||
|
|
||||||
protected:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,768 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
|
||||||
* Paul Ashford
|
|
||||||
* Fredrik Holmqvist <thesuckiestemail@yahoo.se>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "nsDragService.h"
|
|
||||||
#include "nsIDocument.h"
|
|
||||||
#include "nsIRegion.h"
|
|
||||||
#include "nsITransferable.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsISupportsPrimitives.h"
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsPrimitiveHelpers.h"
|
|
||||||
#include "nsWidgetsCID.h"
|
|
||||||
#include "nsCRT.h"
|
|
||||||
|
|
||||||
#include <AppDefs.h>
|
|
||||||
#include <TypeConstants.h>
|
|
||||||
#include <DataIO.h>
|
|
||||||
#include <Mime.h>
|
|
||||||
#include <Rect.h>
|
|
||||||
#include <Region.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
#include "prlog.h"
|
|
||||||
#include "nsPresContext.h"
|
|
||||||
#include "nsIFrame.h"
|
|
||||||
#include "nsIView.h"
|
|
||||||
#include "nsIWidget.h"
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
|
|
||||||
|
|
||||||
static PRLogModuleInfo *sDragLm = NULL;
|
|
||||||
|
|
||||||
static nsIFrame*
|
|
||||||
GetPrimaryFrameFor(nsIDOMNode *aDOMNode)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIContent> aContent = do_QueryInterface(aDOMNode);
|
|
||||||
if (nsnull == aContent)
|
|
||||||
return nsnull;
|
|
||||||
|
|
||||||
return aContent->GetPrimaryFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
IsInternalDrag(BMessage * aMsg)
|
|
||||||
{
|
|
||||||
BString orig;
|
|
||||||
// We started this drag if originater is 'BeZilla'
|
|
||||||
return (nsnull != aMsg && B_OK == aMsg->FindString("be:originator", &orig) &&
|
|
||||||
0 == orig.Compare("BeZilla"));
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS3(nsDragService, nsIDragService, nsIDragSession, nsIDragSessionBeOS)
|
|
||||||
//NS_IMPL_THREADSAFE_ISUPPORTS1(nsBaseDragService, nsIDragSessionBeOS)
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// DragService constructor
|
|
||||||
// Enable logging: 'export NSPR_LOG_MODULES=nsDragService:5'
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
nsDragService::nsDragService()
|
|
||||||
{
|
|
||||||
// set up our logging module
|
|
||||||
if (!sDragLm)
|
|
||||||
sDragLm = PR_NewLogModule("nsDragService");
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("\n\nnsDragService::nsDragService"));
|
|
||||||
|
|
||||||
mDragMessage = NULL;
|
|
||||||
mCanDrop = PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// DragService destructor
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
nsDragService::~nsDragService()
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::~nsDragService"));
|
|
||||||
ResetDragInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragService : InvokeDragSession
|
|
||||||
//
|
|
||||||
// Called when a drag is being initiated from within mozilla
|
|
||||||
// The code here gets the BView, the dragRect, builds the DragMessage and
|
|
||||||
// starts the drag.
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode,
|
|
||||||
nsISupportsArray * aArrayTransferables,
|
|
||||||
nsIScriptableRegion * aRegion,
|
|
||||||
PRUint32 aActionType)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::InvokeDragSession"));
|
|
||||||
nsresult rv = nsBaseDragService::InvokeDragSession(aDOMNode,
|
|
||||||
aArrayTransferables,
|
|
||||||
aRegion, aActionType);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
ResetDragInfo();
|
|
||||||
// make sure that we have an array of transferables to use
|
|
||||||
if (nsnull == aArrayTransferables)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
// set our reference to the transferables. this will also addref
|
|
||||||
// the transferables since we're going to hang onto this beyond the
|
|
||||||
// length of this call
|
|
||||||
mSourceDataItems = aArrayTransferables;
|
|
||||||
|
|
||||||
// Get a box or a bitmap to drag
|
|
||||||
bool haveRect = false;
|
|
||||||
BRect dragRect;
|
|
||||||
|
|
||||||
if (nsnull != aRegion)
|
|
||||||
{
|
|
||||||
PRInt32 aX, aY, aWidth, aHeight;
|
|
||||||
// TODO. Region may represent multiple rects - when dragging multiple items.
|
|
||||||
aRegion->GetBoundingBox(&aX, &aY, &aWidth, &aHeight);
|
|
||||||
dragRect.Set( aX, aY, aX + aWidth, aY + aHeight);
|
|
||||||
haveRect = true;
|
|
||||||
// does this need to be offset?
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the frame for this content node (note: frames are not refcounted)
|
|
||||||
nsIFrame *aFrame = GetPrimaryFrameFor(aDOMNode);
|
|
||||||
if (nsnull == aFrame)
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
// Now that we have the frame, we have to convert its coordinates into global screen
|
|
||||||
// coordinates.
|
|
||||||
nsRect aRect = aFrame->GetRect();
|
|
||||||
|
|
||||||
// Find offset from our view
|
|
||||||
nsIView *containingView = nsnull;
|
|
||||||
nsPoint viewOffset(0,0);
|
|
||||||
aFrame->GetOffsetFromView(viewOffset, &containingView);
|
|
||||||
NS_ASSERTION(containingView, "No containing view!");
|
|
||||||
if (nsnull == containingView)
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
// get the widget associated with the containing view.
|
|
||||||
nsPoint aWidgetOffset;
|
|
||||||
nsCOMPtr<nsIWidget> aWidget = containingView->GetNearestWidget(&aWidgetOffset);
|
|
||||||
if (nsnull == aWidget)
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
BView *view = (BView *) aWidget->GetNativeData(NS_NATIVE_WIDGET);
|
|
||||||
// Don't have the rect yet, try to get it from the dom node
|
|
||||||
if (nsnull==haveRect)
|
|
||||||
{
|
|
||||||
float t2p = aFrame->GetPresContext()->TwipsToPixels();
|
|
||||||
// GetOffsetFromWidget() actually returns the _parent's_ offset from its widget, so we
|
|
||||||
// still have to add in the offset to |containingView|'s parent ourselves.
|
|
||||||
nsPoint aViewPos = containingView->GetPosition();
|
|
||||||
|
|
||||||
// Shift our offset rect by offset into our view, the view's offset to its parent, and
|
|
||||||
// the parent's offset to the closest widget. Then convert that to global coordinates.
|
|
||||||
// Recall that WidgetToScreen() will give us the global coordinates of the rectangle we
|
|
||||||
// give it, but it expects everything to be in pixels.
|
|
||||||
nsRect screenOffset;
|
|
||||||
screenOffset.MoveBy ( NSTwipsToIntPixels(aWidgetOffset.x + aViewPos.x + viewOffset.x, t2p),
|
|
||||||
NSTwipsToIntPixels(aWidgetOffset.y + aViewPos.y + viewOffset.y, t2p));
|
|
||||||
aWidget->WidgetToScreen ( screenOffset, screenOffset );
|
|
||||||
|
|
||||||
dragRect.Set(screenOffset.x, screenOffset.y,
|
|
||||||
screenOffset.x + NSTwipsToIntPixels(aRect.width, t2p),
|
|
||||||
screenOffset.y + NSTwipsToIntPixels(aRect.height, t2p));
|
|
||||||
haveRect = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mDragAction = aActionType;
|
|
||||||
mDragMessage = CreateDragMessage();
|
|
||||||
|
|
||||||
if (!view || !mDragMessage)
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
// Set the original click location, how to get this or is it needed ?
|
|
||||||
// sourceMessage->AddPoint("click_location", mPoint);
|
|
||||||
|
|
||||||
if (!view->LockLooper())
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
// Well, let's just use the view frame, maybe?
|
|
||||||
if (!haveRect)
|
|
||||||
{
|
|
||||||
dragRect = view->Frame();
|
|
||||||
// do we need to offset?
|
|
||||||
}
|
|
||||||
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("invoking mDragView->DragMessage"));
|
|
||||||
bool noBitmap = true;
|
|
||||||
|
|
||||||
//This is the code for image-dragging, currently disabled. See comments in beginning of file.
|
|
||||||
# ifdef 0
|
|
||||||
do
|
|
||||||
{
|
|
||||||
PRUint32 dataSize;
|
|
||||||
PRUint32 noItems;
|
|
||||||
mSourceDataItems->Count(&noItems);
|
|
||||||
if (noItems!=1)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("Transferables are not ==1, no drag bitmap!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> genericItem;
|
|
||||||
aArrayTransferables->GetElementAt(0, getter_AddRefs(genericItem));
|
|
||||||
nsCOMPtr<nsITransferable> aTransferable (do_QueryInterface(genericItem));
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> genericDataWrapper;
|
|
||||||
nsresult rv = aTransferable->GetTransferData(kNativeImageMime, getter_AddRefs(genericDataWrapper), &dataSize);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("Could not get nativeimage, no drag bitmap!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupportsInterfacePointer> ptrPrimitive (do_QueryInterface(genericDataWrapper));
|
|
||||||
if (ptrPrimitive == NULL)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("Could not get ptrPrimitive, no drag bitmap!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> genericData;
|
|
||||||
ptrPrimitive->GetData(getter_AddRefs(genericData));
|
|
||||||
if (genericData == NULL)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("Could not get data, no drag bitmap!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//dependent on bug 294234 and how it's implemented. This code was for attachment 183634.
|
|
||||||
nsCOMPtr<nsIImageBeOS> image (do_QueryInterface(genericData));
|
|
||||||
if (image == NULL)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("Could not get nsImage, no drag bitmap!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
BBitmap *aBitmap;
|
|
||||||
image->GetBitmap(&aBitmap);
|
|
||||||
if (aBitmap==NULL || !aBitmap->IsValid())
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("Could not get BBitmap, no drag bitmap %s!", aBitmap==NULL?"(null)":"(not valid)" ));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
view->DragMessage(mDragMessage, aBitmap, B_OP_OVER, BPoint(-4,-4), view);
|
|
||||||
noBitmap = false;
|
|
||||||
} while(false);
|
|
||||||
# endif
|
|
||||||
|
|
||||||
if (noBitmap)
|
|
||||||
view->DragMessage(mDragMessage, dragRect, view);
|
|
||||||
|
|
||||||
StartDragSession();
|
|
||||||
view->UnlockLooper();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragService : StartDragSession
|
|
||||||
//
|
|
||||||
// We overwrite this so we can log it
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::StartDragSession()
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::StartDragSession()"));
|
|
||||||
return nsBaseDragService::StartDragSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragService : EndDragSession
|
|
||||||
//
|
|
||||||
// We overwrite this so we can log it
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::EndDragSession(PRBool aDoneDrag)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::EndDragSession()"));
|
|
||||||
//Don't reset drag info, keep it until there is a new drag, in case a negotiated drag'n'drop wants the info.
|
|
||||||
//We need the draginfo as we are ending starting the dragsession
|
|
||||||
//on entering/exiting different views (nsWindows) now.
|
|
||||||
//That way the dragsession is always ended when we go outside mozilla windows, but we do throw away the
|
|
||||||
// mSourceDocument and mSourceNode. We do hold on to the nsTransferable if it was a internal drag.
|
|
||||||
//ResetDragInfo();
|
|
||||||
return nsBaseDragService::EndDragSession(aDoneDrag);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragSession : SetCanDrop
|
|
||||||
//
|
|
||||||
// We overwrite this so we can log it
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::SetCanDrop(PRBool aCanDrop)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::SetCanDrop(%s)",
|
|
||||||
aCanDrop ? "TRUE" : "FALSE"));
|
|
||||||
return nsBaseDragService::SetCanDrop(aCanDrop);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragSession : GetCanDrop
|
|
||||||
//
|
|
||||||
// We overwrite this so we can log it
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::GetCanDrop(PRBool *aCanDrop)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetCanDrop()"));
|
|
||||||
return nsBaseDragService::GetCanDrop(aCanDrop);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragSession : GetNumDropItems
|
|
||||||
//
|
|
||||||
// Gets the number of items currently being dragged
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::GetNumDropItems(PRUint32 * aNumItems)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems()"));
|
|
||||||
if (nsnull == mDragMessage)
|
|
||||||
{
|
|
||||||
*aNumItems = 0;
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems(): WARNING! No dragmessage"));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
// Did we start this drag?
|
|
||||||
if (IsInternalDrag(mDragMessage))
|
|
||||||
mSourceDataItems->Count(aNumItems);
|
|
||||||
else
|
|
||||||
// The only thing native that I can think of that may have multiple items
|
|
||||||
// would be file references, DND-docs don't say anything about multiple items.
|
|
||||||
*aNumItems = 1;
|
|
||||||
|
|
||||||
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems():%d", *aNumItems));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragSession : GetData
|
|
||||||
//
|
|
||||||
// Copies the data at the given index into the given nsITransferable
|
|
||||||
//
|
|
||||||
// This is usually called on Drop, but can be called before that
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::GetData(nsITransferable * aTransferable, PRUint32 aItemIndex)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetData %d", aItemIndex));
|
|
||||||
|
|
||||||
if (nsnull==mDragMessage)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
// get flavor list that includes all acceptable flavors (including
|
|
||||||
// ones obtained through conversion). Flavors are nsISupportsStrings
|
|
||||||
// so that they can be seen from JS.
|
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
|
||||||
nsCOMPtr<nsISupportsArray> flavorList;
|
|
||||||
rv = aTransferable->FlavorsTransferableCanImport(getter_AddRefs(flavorList));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
// count the number of flavors
|
|
||||||
PRUint32 cnt;
|
|
||||||
flavorList->Count (&cnt);
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> genericWrapper;
|
|
||||||
nsCOMPtr<nsISupportsCString> currentFlavor;
|
|
||||||
nsXPIDLCString flavorStr;
|
|
||||||
nsCOMPtr<nsISupports> genericItem;
|
|
||||||
nsCOMPtr<nsISupports> data;
|
|
||||||
PRUint32 tmpDataLen = 0;
|
|
||||||
for (unsigned int i= 0; i < cnt; ++i )
|
|
||||||
{
|
|
||||||
flavorList->GetElementAt(i, getter_AddRefs(genericWrapper));
|
|
||||||
currentFlavor = do_QueryInterface(genericWrapper);
|
|
||||||
if (!currentFlavor)
|
|
||||||
continue;
|
|
||||||
currentFlavor->ToString(getter_Copies(flavorStr));
|
|
||||||
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("tnsDragService::GetData trying to get transfer data for %s",
|
|
||||||
(const char *)flavorStr));
|
|
||||||
|
|
||||||
if (IsInternalDrag(mDragMessage))
|
|
||||||
{
|
|
||||||
mSourceDataItems->GetElementAt(aItemIndex, getter_AddRefs(genericItem));
|
|
||||||
nsCOMPtr<nsITransferable> item (do_QueryInterface(genericItem));
|
|
||||||
if (!item)
|
|
||||||
continue;
|
|
||||||
rv = item->GetTransferData(flavorStr, getter_AddRefs(data), &tmpDataLen);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
continue;
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("tnsDragService::GetData setting data."));
|
|
||||||
return aTransferable->SetTransferData(flavorStr, data, tmpDataLen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Check if transfer message is simple_data or older type of DND
|
|
||||||
//Check if message has data else continue
|
|
||||||
//Negotiate for data (if possible) or get data
|
|
||||||
//set and return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("tnsDragService::GetData failed"));
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragSession : IsDataFlavorSupported
|
|
||||||
//
|
|
||||||
// Tells whether the given flavor is supported by the current drag object
|
|
||||||
//
|
|
||||||
// Called on MouseOver events
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::IsDataFlavorSupported (const char *aDataFlavor,
|
|
||||||
PRBool *_retval)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported %s", aDataFlavor));
|
|
||||||
if (!_retval)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
// set this to no by default
|
|
||||||
*_retval = PR_FALSE;
|
|
||||||
|
|
||||||
// check to make sure that we have a drag object set, here
|
|
||||||
if (nsnull == mDragMessage)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("*** warning: IsDataFlavorSupported called without a valid drag context!"));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsInternalDrag(mDragMessage))
|
|
||||||
{
|
|
||||||
PRUint32 numDragItems = 0;
|
|
||||||
// if we don't have mDataItems we didn't start this drag so it's
|
|
||||||
// an external client trying to fool us.
|
|
||||||
if (nsnull == mSourceDataItems)
|
|
||||||
return NS_OK;
|
|
||||||
mSourceDataItems->Count(&numDragItems);
|
|
||||||
if (0 == numDragItems)
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("*** warning: Number of dragged items is zero!"));
|
|
||||||
|
|
||||||
// For all dragged items compare their flavors to the one wanted. If there is a match DataFlavor is supported.
|
|
||||||
nsCOMPtr<nsISupports> genericItem;
|
|
||||||
nsCOMPtr <nsISupportsArray> flavorList;
|
|
||||||
PRUint32 numFlavors;
|
|
||||||
for (PRUint32 itemIndex = 0; itemIndex < numDragItems; ++itemIndex)
|
|
||||||
{
|
|
||||||
mSourceDataItems->GetElementAt(itemIndex, getter_AddRefs(genericItem));
|
|
||||||
nsCOMPtr<nsITransferable> currItem (do_QueryInterface(genericItem));
|
|
||||||
if (nsnull == currItem)
|
|
||||||
continue;
|
|
||||||
currItem->FlavorsTransferableCanExport(getter_AddRefs(flavorList));
|
|
||||||
if (nsnull == flavorList)
|
|
||||||
continue;
|
|
||||||
flavorList->Count( &numFlavors );
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> genericWrapper;
|
|
||||||
nsXPIDLCString flavorStr;
|
|
||||||
for ( PRUint32 flavorIndex = 0; flavorIndex < numFlavors ; ++flavorIndex )
|
|
||||||
{
|
|
||||||
flavorList->GetElementAt (flavorIndex, getter_AddRefs(genericWrapper));
|
|
||||||
nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryInterface(genericWrapper);
|
|
||||||
if (nsnull == currentFlavor)
|
|
||||||
continue;
|
|
||||||
currentFlavor->ToString ( getter_Copies(flavorStr) );
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported checking %s against %s", (const char *)flavorStr, aDataFlavor));
|
|
||||||
if (0 != strcmp(flavorStr, aDataFlavor))
|
|
||||||
continue;
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported Got the flavor!"));
|
|
||||||
*_retval = PR_TRUE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("*** warning: Native drag not implemented."));
|
|
||||||
// TODO: implement native checking
|
|
||||||
}
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported FALSE"));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsDragServoce : CreateDragMessage
|
|
||||||
//
|
|
||||||
// Builds the drag message needed for BeOS negotiated DND.
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
BMessage *
|
|
||||||
nsDragService::CreateDragMessage()
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetInitialDragMessage"));
|
|
||||||
if (nsnull == mSourceDataItems)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
unsigned int numDragItems = 0;
|
|
||||||
mSourceDataItems->Count(&numDragItems);
|
|
||||||
|
|
||||||
BMessage * returnMsg = new BMessage(B_SIMPLE_DATA);
|
|
||||||
|
|
||||||
returnMsg->AddString("be:originator", "BeZilla");
|
|
||||||
returnMsg->AddString("be:clip_name","BeZilla Drag Item");
|
|
||||||
|
|
||||||
if (mDragAction & DRAGDROP_ACTION_COPY)
|
|
||||||
returnMsg->AddInt32("be:actions",B_COPY_TARGET);
|
|
||||||
if (mDragAction & DRAGDROP_ACTION_MOVE)
|
|
||||||
returnMsg->AddInt32("be:actions",B_MOVE_TARGET);
|
|
||||||
if (mDragAction & DRAGDROP_ACTION_LINK)
|
|
||||||
returnMsg->AddInt32("be:actions",B_LINK_TARGET);
|
|
||||||
|
|
||||||
// Check to see if we're dragging > 1 item. If we are then we use
|
|
||||||
// an internal only type.
|
|
||||||
if (numDragItems > 1)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService:: Dragging a list of items ..."));
|
|
||||||
// returnMsg->AddString("be:types", gMimeListType);
|
|
||||||
// returnMsg->AddString("be:types", B_FILE_MIME_TYPE);
|
|
||||||
// returnMsg->AddString("be:filetypes", gMimeListType);
|
|
||||||
// returnMsg->AddString("be:type_descriptions", gMimeListType);
|
|
||||||
return returnMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool addedType = PR_FALSE;
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> genericItem;
|
|
||||||
nsCOMPtr <nsISupportsArray> flavorList;
|
|
||||||
PRUint32 numFlavors;
|
|
||||||
nsCOMPtr<nsISupports> genericWrapper;
|
|
||||||
nsXPIDLCString flavorStr;
|
|
||||||
|
|
||||||
for (unsigned int itemIndex = 0; itemIndex < numDragItems; ++itemIndex)
|
|
||||||
{
|
|
||||||
mSourceDataItems->GetElementAt(itemIndex, getter_AddRefs(genericItem));
|
|
||||||
nsCOMPtr<nsITransferable> currItem (do_QueryInterface(genericItem));
|
|
||||||
if (nsnull == currItem)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
currItem->FlavorsTransferableCanExport(getter_AddRefs(flavorList));
|
|
||||||
if (nsnull == flavorList)
|
|
||||||
continue;
|
|
||||||
flavorList->Count( &numFlavors );
|
|
||||||
for (PRUint32 flavorIndex = 0; flavorIndex < numFlavors ; ++flavorIndex )
|
|
||||||
{
|
|
||||||
flavorList->GetElementAt(flavorIndex, getter_AddRefs(genericWrapper));
|
|
||||||
nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryInterface(genericWrapper);
|
|
||||||
if (nsnull == currentFlavor)
|
|
||||||
continue;
|
|
||||||
currentFlavor->ToString ( getter_Copies(flavorStr) );
|
|
||||||
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService:: Adding a flavor to our message: %s",flavorStr.get()));
|
|
||||||
|
|
||||||
type_code aCode;
|
|
||||||
if (B_OK == returnMsg->GetInfo(flavorStr.get(), &aCode))
|
|
||||||
continue;
|
|
||||||
returnMsg->AddString("be:types",flavorStr.get());
|
|
||||||
|
|
||||||
//returnMsg->AddString("be:types", B_FILE_MIME_TYPE);
|
|
||||||
returnMsg->AddString("be:filetypes",flavorStr.get());
|
|
||||||
returnMsg->AddString("be:type_descriptions",flavorStr.get());
|
|
||||||
|
|
||||||
addedType = PR_TRUE;
|
|
||||||
// Check to see if this is text/unicode. If it is, add
|
|
||||||
// text/plain since we automatically support text/plain if
|
|
||||||
// we support text/unicode.
|
|
||||||
//tqh: but this may cause duplicates?
|
|
||||||
if (0 == strcmp(flavorStr, kUnicodeMime))
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService:: Adding a TextMime for the UnicodeMime"));
|
|
||||||
returnMsg->AddString("be:types",kTextMime);
|
|
||||||
//returnMsg->AddString("be:types", B_FILE_MIME_TYPE);
|
|
||||||
returnMsg->AddString("be:filetypes",kTextMime);
|
|
||||||
returnMsg->AddString("be:type_descriptions",kTextMime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addedType)
|
|
||||||
{
|
|
||||||
returnMsg->AddString("be:types", B_FILE_MIME_TYPE);
|
|
||||||
}
|
|
||||||
returnMsg->PrintToStream();
|
|
||||||
// If we did not add a type, we can't drag
|
|
||||||
NS_ASSERTION(addedType, "No flavor/mime in the drag message!");
|
|
||||||
return returnMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragSessionBeOS : UpdateDragMessageIfNeeded
|
|
||||||
//
|
|
||||||
// Updates the drag message from the old one if we enter a mozilla view with
|
|
||||||
// a dragmessage from outside. IE one where "be:originator"-key != "BeZilla"
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::UpdateDragMessageIfNeeded(BMessage *aDragMessage)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::UpdateDragMessageIfNeeded()"));
|
|
||||||
if (aDragMessage == mDragMessage)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
// Did we start this drag?
|
|
||||||
//It's already set properly by InvokeDragSession, so don't do anything and avoid throwing away
|
|
||||||
//mSourceDataItems
|
|
||||||
if (IsInternalDrag(aDragMessage))
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("updating."));
|
|
||||||
ResetDragInfo();
|
|
||||||
mDragMessage = aDragMessage;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragSessionBeOS : TransmitData
|
|
||||||
//
|
|
||||||
// When a negotiated drag'n'drop to another app occurs nsWindow
|
|
||||||
// calls this method with the other apps message which contains
|
|
||||||
// the info on what data the app wants. This function checks the
|
|
||||||
// message and transmits the data to the app, thereby ending the
|
|
||||||
// drag'n'drop to another app.
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDragService::TransmitData(BMessage *aNegotiationReply)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TransmitData()"));
|
|
||||||
/*
|
|
||||||
unsigned int numDragItems = 0;
|
|
||||||
mSourceDataItems->Count(&numDragItems);
|
|
||||||
|
|
||||||
returnMsg->AddString("be:originator", "BeZilla");
|
|
||||||
returnMsg->AddString("be:clip_name","BeZilla Drag Item");
|
|
||||||
|
|
||||||
// Check to see if we're dragging > 1 item. If we are then we use
|
|
||||||
// an internal only type.
|
|
||||||
if (numDragItems > 1)
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService:: Dragging a list of items ..."));
|
|
||||||
delete aNegotiationReply;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BMessage aReply = new BMessage(B_MIME_DATA);
|
|
||||||
char * aMimeType;
|
|
||||||
aNegotiationReply->FindString("be:types", &aMimeType);
|
|
||||||
nsCOMPtr<nsITransferable> item;
|
|
||||||
item->addDataFlavor(aMimeType);
|
|
||||||
GetData(item, 0);
|
|
||||||
aReply->AddData(aMimeType, item->);
|
|
||||||
*/
|
|
||||||
aNegotiationReply->PrintToStream();
|
|
||||||
delete aNegotiationReply;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// nsIDragService : ResetDragInfo
|
|
||||||
//
|
|
||||||
// Resets the stored drag information.
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
void
|
|
||||||
nsDragService::ResetDragInfo()
|
|
||||||
{
|
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::ResetDragInfo()"));
|
|
||||||
if (nsnull != mDragMessage) delete mDragMessage;
|
|
||||||
mDragMessage = NULL;
|
|
||||||
mSourceDataItems = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
nsDragService::FlavorToBeMime(const char * flavor)
|
|
||||||
{
|
|
||||||
//text/plain ok
|
|
||||||
//text/unicode -> text/plain
|
|
||||||
if (0 == strcmp(flavor,kUnicodeMime)) return kTextMime;
|
|
||||||
//text/html ok
|
|
||||||
//AOLMAIL ignore!!
|
|
||||||
//image/png ok
|
|
||||||
//image/jpg
|
|
||||||
if (0 == strcmp(flavor,kJPEGImageMime)) return "image/jpeg";
|
|
||||||
//image/gif ok
|
|
||||||
//application/x-moz-file
|
|
||||||
if (0 == strcmp(flavor,kFileMime)) return "application/octet-stream";
|
|
||||||
//text/x-moz-url (only support this as a filetype (Be bookmark))
|
|
||||||
if (0 == strcmp(flavor,kURLMime)) return "application/x-vnd.Be-bookmark";
|
|
||||||
//text/x-moz-url-data - we need to read data to find out what type of URL.
|
|
||||||
//text/x-moz-url-desc - a url-description (same as title?)
|
|
||||||
//kNativeImageMime - don't support as BeOS image
|
|
||||||
//kNativeHTMLMime - don't support on BeOS side
|
|
||||||
//kFilePromiseURLMime
|
|
||||||
//kFilePromiseDestFilename
|
|
||||||
//kFilePromiseMime
|
|
||||||
//kFilePromiseDirectoryMime
|
|
||||||
|
|
||||||
// if (0==strcmp(flavor,kUnicodeMime))
|
|
||||||
}
|
|
|
@ -1,106 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
||||||
*
|
|
||||||
* 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 the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Fredrik Holmqvist <thesuckiestemail@yahoo.se>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef nsDragService_h__
|
|
||||||
#define nsDragService_h__
|
|
||||||
|
|
||||||
#include "nsBaseDragService.h"
|
|
||||||
#include "nsIDragSessionBeOS.h"
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
class BMessage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Native BeOS DragService wrapper
|
|
||||||
*/
|
|
||||||
class nsDragService : public nsBaseDragService, public nsIDragSessionBeOS
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
nsDragService();
|
|
||||||
virtual ~nsDragService();
|
|
||||||
|
|
||||||
//nsISupports
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
|
||||||
|
|
||||||
//nsIDragService
|
|
||||||
NS_IMETHOD InvokeDragSession(nsIDOMNode *aDOMNode,
|
|
||||||
nsISupportsArray * anArrayTransferables,
|
|
||||||
nsIScriptableRegion * aRegion,
|
|
||||||
PRUint32 aActionType);
|
|
||||||
NS_IMETHOD StartDragSession();
|
|
||||||
NS_IMETHOD EndDragSession(PRBool aDoneDrag);
|
|
||||||
|
|
||||||
// nsIDragSession
|
|
||||||
NS_IMETHOD GetNumDropItems (PRUint32 * aNumItems);
|
|
||||||
NS_IMETHOD GetData (nsITransferable * aTransferable,
|
|
||||||
PRUint32 aItemIndex);
|
|
||||||
NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor,
|
|
||||||
PRBool *_retval);
|
|
||||||
|
|
||||||
NS_IMETHOD GetCanDrop(PRBool * aCanDrop);
|
|
||||||
NS_IMETHOD SetCanDrop(PRBool aCanDrop);
|
|
||||||
|
|
||||||
// nsIDragSessionBeOS
|
|
||||||
NS_IMETHOD UpdateDragMessageIfNeeded(BMessage *aDragMessage);
|
|
||||||
NS_IMETHOD TransmitData(BMessage *aNegotiationReply);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsCOMPtr<nsISupportsArray> mSourceDataItems;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// BeOS specific methods
|
|
||||||
void ResetDragInfo(void);
|
|
||||||
|
|
||||||
BMessage *mDragMessage;
|
|
||||||
|
|
||||||
//If we want to do image-dragging
|
|
||||||
//BBitmap *dragBitmap;
|
|
||||||
|
|
||||||
// internal drag identifier for lists
|
|
||||||
BString gMimeListType;
|
|
||||||
PRPackedBool IsDragList(void);
|
|
||||||
PRPackedBool mDragIsList;
|
|
||||||
|
|
||||||
// get the initial drag message for this drag
|
|
||||||
BMessage * CreateDragMessage();
|
|
||||||
static const char * FlavorToBeMime(const char * flavor);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // nsDragService_h__
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче