Bug 654736 - Remove WinCE code from XULRunner; r=mfinkle
authorEd Morley <bmo@edmorley.co.uk>
Thu, 05 May 2011 09:40:04 -0700
changeset 69170 192bc9af9a0dac4539ee4399ebfd8b011ff12fb4
parent 69169 cefb7b2e556544d3e3c91393a0cb1100fac02d0a
child 69171 50c8d71956021015727abe6ed9bf8381329c0e1a
push idunknown
push userunknown
push dateunknown
reviewersmfinkle
bugs654736
milestone6.0a1
Bug 654736 - Remove WinCE code from XULRunner; r=mfinkle
xulrunner/Makefile.in
xulrunner/app/Makefile.in
xulrunner/app/nsXULRunnerApp.cpp
xulrunner/stub/Makefile.in
xulrunner/stub/nsXULStub.cpp
xulrunner/tools/redit/Makefile.in
--- a/xulrunner/Makefile.in
+++ b/xulrunner/Makefile.in
@@ -51,13 +51,13 @@ PARALLEL_DIRS = \
   $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 ifdef MOZ_INSTALLER
 DIRS += installer/windows
 endif
 endif
 
-ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
+ifeq ($(OS_ARCH),WINNT)
 PARALLEL_DIRS += tools/redit
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -49,17 +49,17 @@ include $(DEPTH)/config/autoconf.mk
 
 DIRS = profile
 
 PREF_JS_EXPORTS = $(srcdir)/xulrunner.js
 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/,xulrunner.js)
 
 DEFINES += -DAB_CD=$(AB_CD)
 
-ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
+ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
 PROGRAM = xulrunner$(BIN_SUFFIX)
 else
 PROGRAM = xulrunner-bin$(BIN_SUFFIX)
 endif
 
 DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\"
 
 ifdef TARGET_XPCOM_ABI
@@ -111,22 +111,18 @@ DEFINES += -DMOZ_WINCONSOLE=$(MOZ_WINCON
 # shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
 NSDISTMODE = copy
 
 include $(topsrcdir)/config/config.mk
 
 ifdef _MSC_VER
 # Always enter a Windows program through wmain, whether or not we're
 # a console application.
-ifdef WINCE
-WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
-else
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
-endif
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
 RCINCLUDE = splash.rc
 ifndef GNU_CC
 RCFLAGS += -DMOZ_XULRUNNER -I$(srcdir)
 else
 RCFLAGS += -DMOZ_XULRUNNER --include-dir $(srcdir)
@@ -170,17 +166,17 @@ ifndef GNU_CC
 LDFLAGS += /HEAP:0x40000
 ifeq ($(OS_TEST),x86_64)
 # set stack to 2MB on x64 build.  See bug 582910
 LDFLAGS += -STACK:2097152
 endif
 endif
 endif
 
-ifneq (,$(filter-out OS2 WINCE WINNT,$(OS_ARCH)))
+ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
 ifeq (unix, $(MOZ_FS_LAYOUT))
 
 xulrunner:: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
 	cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
                 -e "s|%MOZ_USER_DIR%|.mozilla/xulrunner|" \
                 -e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
 	chmod +x $@
 
--- a/xulrunner/app/nsXULRunnerApp.cpp
+++ b/xulrunner/app/nsXULRunnerApp.cpp
@@ -69,17 +69,17 @@
  * @param fmt
  *        printf-style format string followed by arguments.
  */
 static void Output(PRBool isError, const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
-#if (defined(XP_WIN) && !MOZ_WINCONSOLE) || defined(WINCE)
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE)
   char *msg = PR_vsmprintf(fmt, ap);
   if (msg)
   {
     UINT flags = MB_OK;
     if (isError)
       flags |= MB_ICONERROR;
     else
       flags |= MB_ICONINFORMATION;
--- a/xulrunner/stub/Makefile.in
+++ b/xulrunner/stub/Makefile.in
@@ -68,17 +68,17 @@ LIBS = \
 
 # Need to link with CoreFoundation on Mac
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 LIBS            += \
 		$(TK_LIBS) \
 		$(NULL)
 endif
 
-ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
+ifeq ($(OS_ARCH),WINNT)
 RCINCLUDE = xulrunner-stub.rc
 ifndef GNU_CC
 RCFLAGS += -DMOZ_XULRUNNER -I$(srcdir)
 else
 RCFLAGS += -DMOZ_XULRUNNER --include-dir $(srcdir)
 endif
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 endif
@@ -89,22 +89,18 @@ MOZ_WINCONSOLE = 1
 else
 MOZ_WINCONSOLE = 0
 endif
 endif
 
 include $(topsrcdir)/config/config.mk
 
 ifdef _MSC_VER
-ifdef WINCE
-WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
-else
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
-endif
 
 LIBS += $(JEMALLOC_LIBS)
 
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,shell32)
 endif
--- a/xulrunner/stub/nsXULStub.cpp
+++ b/xulrunner/stub/nsXULStub.cpp
@@ -81,17 +81,17 @@
 
 #define VERSION_MAXLEN 128
 
 static void Output(PRBool isError, const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
-#if (defined(XP_WIN) && !MOZ_WINCONSOLE) || defined(WINCE)
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE)
   char msg[2048];
 
   vsnprintf(msg, sizeof(msg), fmt, ap);
 
   UINT flags = MB_OK;
   if (isError)
     flags |= MB_ICONERROR;
   else
@@ -186,53 +186,16 @@ public:
 private:
   nsXREAppData* mAppData;
 };
 
 XRE_CreateAppDataType XRE_CreateAppData;
 XRE_FreeAppDataType XRE_FreeAppData;
 XRE_mainType XRE_main;
 
-
-#ifdef WINCE
-void
-ForwardToWindow(HWND wnd) {
-  // For WinCE, we're stuck with providing our own argv[0] for the remote
-  // command-line.
-  WCHAR wPath[MAX_PATH] = L"dummy ";
-  WCHAR *wCmd = ::GetCommandLineW();
-  WCHAR wCwd[MAX_PATH];
-  _wgetcwd(wCwd, MAX_PATH);
-
-  // Construct a narrow UTF8 buffer <path> <commandline>\0<workingdir>\0
-  size_t len = wcslen(wPath) + wcslen(wCmd) + wcslen(wCwd) + 2;
-  WCHAR *wMsg = (WCHAR *)malloc(len * sizeof(*wMsg));
-  wcscpy(wMsg, wPath);
-  wcscpy(wMsg + wcslen(wPath), wCmd);                // The command line
-  wcscpy(wMsg + wcslen(wPath) + wcslen(wCmd) + 1, wCwd); // Working dir
-
-  // Then convert to UTF-8, assuming worst-case explosion of characters
-  char *msg = (char *)malloc(len * 4);
-  WideCharToMultiByte(CP_UTF8, 0, wMsg, len, msg, len * 4, NULL, NULL);
-
-  // We used to set dwData to zero, when we didn't send the working dir.
-  // Now we're using it as a version number.
-  COPYDATASTRUCT cds = { 1, len, (void *)msg };
-
-  // Bring the already running Mozilla process to the foreground.
-  // nsWindow will restore the window (if minimized) and raise it.
-  // for activating the existing window on wince we need "| 0x01"
-  // see http://msdn.microsoft.com/en-us/library/ms940024.aspx for details
-  ::SetForegroundWindow((HWND)(((ULONG) wnd) | 0x01));
-  ::SendMessage(wnd, WM_COPYDATA, 0, (LPARAM)&cds);
-  free(wMsg);
-  free(msg);
-}
-#endif
-
 int
 main(int argc, char **argv)
 {
   nsresult rv;
   char *lastSlash;
 
   char iniPath[MAXPATHLEN];
   char tmpPath[MAXPATHLEN];
@@ -394,51 +357,16 @@ main(int argc, char **argv)
   
   nsINIParser parser;
   rv = parser.Init(iniPath);
   if (NS_FAILED(rv)) {
     fprintf(stderr, "Could not read application.ini\n");
     return 1;
   }
 
-#ifdef WINCE
-  // On Windows Mobile and WinCE, we can save a lot of time by not
-  // waiting for XUL and XPCOM to load up.  Let's see if we can find
-  // an existing app window to forward our command-line to now.
-
-  // Shouldn't attempt this if the -no-remote parameter has been provided.
-  bool noRemote = false;
-  for (int i = 1; i < argc; i++) {
-    if (IsArg(argv[i], "no-remote")) {
-      noRemote = true;
-      break;
-    }
-  }
-
-  if (!noRemote) {
-    char windowName[512];  // Is there a const for appname like VERSION_MAXLEN?
-    rv = parser.GetString("App", "Name", windowName, sizeof(windowName));
-    if (NS_FAILED(rv)) {
-      fprintf(stderr, "Couldn't figure out the application name\n");
-      return 1;
-    }
-
-    // Lookup the hidden message window created by nsNativeAppSupport
-    strncat(windowName, "MessageWindow", sizeof(windowName) - strlen(windowName));
-    WCHAR wWindowName[512];
-    MultiByteToWideChar(CP_UTF8, 0, windowName, -1, wWindowName, sizeof(wWindowName));
-    HWND wnd = ::FindWindowW(wWindowName, NULL);
-    if (wnd) {
-      // Forward the command-line and bail out
-      ForwardToWindow(wnd);
-      return 0;
-    }
-  }
-#endif
-
   if (!greFound) {
     Output(PR_FALSE,
            "Could not find the Mozilla runtime.\n");
       return 1;
   }
 
 #ifdef XP_OS2
   // On OS/2 we need to set BEGINLIBPATH to be able to find XULRunner DLLs
@@ -478,18 +406,17 @@ main(int argc, char **argv)
 
   NS_LogInit();
 
   int retval;
 
   { // Scope COMPtr and AutoAppData
     nsCOMPtr<nsILocalFile> iniFile;
 #ifdef XP_WIN
-    // On Windows and Windows CE, iniPath is UTF-8 encoded,
-    // so we need to convert it.
+    // On Windows iniPath is UTF-8 encoded so we need to convert it.
     rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(iniPath), PR_FALSE,
                          getter_AddRefs(iniFile));
 #else
     rv = NS_NewNativeLocalFile(nsDependentCString(iniPath), PR_FALSE,
                                getter_AddRefs(iniFile));
 #endif
     if (NS_FAILED(rv)) {
       Output(PR_TRUE, "Couldn't find application.ini file.\n");
--- a/xulrunner/tools/redit/Makefile.in
+++ b/xulrunner/tools/redit/Makefile.in
@@ -47,17 +47,9 @@ MODULE = redit
 ifeq ($(OS_ARCH),WINNT)
 CPPSRCS    = redit.cpp
 PROGRAM    = redit$(BIN_SUFFIX)
 SDK_BINARY =  \
 	$(PROGRAM) \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH),WINCE)
-HOST_CPPSRCS = redit.cpp
-HOST_PROGRAM = redit$(BIN_SUFFIX)
-SDK_BINARY   =  \
-	$(HOST_PROGRAM) \
-	$(NULL)
-endif
-
 include $(topsrcdir)/config/rules.mk