Bug 473687 - Remove widget WinCE support: Part B (Main ifdef removal); r=dougt
authorEd Morley <bmo@edmorley.co.uk>
Sun, 24 Apr 2011 20:10:12 -0700
changeset 68740 2460d5f02a5d7b370e64bbf43a50b97e3324b592
parent 68739 c4864738e3fd0e7e9083d72e553d5ec34940dbdc
child 68741 d33506667f79adf5ab494eaabcca39efba276b74
push id76
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:00:57 +0000
treeherdermozilla-beta@d3a2732c35f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt
bugs473687
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 473687 - Remove widget WinCE support: Part B (Main ifdef removal); r=dougt
widget/src/build/Makefile.in
widget/src/build/nsWinWidgetFactory.cpp
widget/src/build/widget.rc
widget/src/windows/Makefile.in
widget/src/windows/nsAppShell.cpp
widget/src/windows/nsDeviceContextSpecWin.cpp
widget/src/windows/nsFilePicker.cpp
widget/src/windows/nsIMM32Handler.cpp
widget/src/windows/nsIMM32Handler.h
widget/src/windows/nsIdleServiceWin.cpp
widget/src/windows/nsLookAndFeel.cpp
widget/src/windows/nsNativeThemeWin.cpp
widget/src/windows/nsScreenWin.cpp
widget/src/windows/nsToolkit.cpp
widget/src/windows/nsWinGesture.cpp
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindow.h
widget/src/windows/nsWindowDefs.h
widget/src/windows/nsWindowGfx.cpp
widget/src/xpwidgets/nsClipboardPrivacyHandler.cpp
widget/tests/Makefile.in
--- a/widget/src/build/Makefile.in
+++ b/widget/src/build/Makefile.in
@@ -58,24 +58,17 @@ EXTRA_DSO_LIBS	= gkgfx \
 		  $(NULL)
 
 LOCAL_INCLUDES	= \
 		-I$(srcdir) \
 		-I$(srcdir)/../xpwidgets \
 		-I$(srcdir)/../windows \
 		$(NULL)
 
-OS_LIBS += $(call EXPAND_LIBNAME, uuid ole32 oleaut32 ws2_32)
-
-ifneq ($(OS_ARCH), WINCE)
-OS_LIBS += $(call EXPAND_LIBNAME, comctl32 comdlg32 shell32 imm32 shlwapi winspool msimg32)
-else
-OS_LIBS += $(call EXPAND_LIBNAME, aygshell ddraw)
-EXTRA_DSO_LDOPTS += $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib
-endif
+OS_LIBS += $(call EXPAND_LIBNAME, uuid ole32 oleaut32 ws2_32 comctl32 comdlg32 shell32 imm32 shlwapi winspool msimg32)
 
 SHARED_LIBRARY_LIBS = \
 		../windows/$(LIB_PREFIX)widget_windows.$(LIB_SUFFIX) \
 		../xpwidgets/$(LIB_PREFIX)xpwidgets_s.$(LIB_SUFFIX) \
 		$(NULL)
 
 EXTRA_DSO_LDOPTS += \
 		$(LIBS_DIR) \
--- a/widget/src/build/nsWinWidgetFactory.cpp
+++ b/widget/src/build/nsWinWidgetFactory.cpp
@@ -58,23 +58,19 @@
 #include "JumpListBuilder.h"
 #include "JumpListItem.h"
 #include "GfxInfo.h"
 
 // Drag & Drop, Clipboard
 
 #include "nsClipboardHelper.h"
 
-#ifdef WINCE
-#include "nsClipboardCE.h"
-#else
 #include "nsClipboard.h"
 #include "nsBidiKeyboard.h"
 #include "nsDragService.h"
-#endif
 #include "nsTransferable.h"
 #include "nsHTMLFormatConverter.h"
 
 #ifdef NS_PRINTING
 #include "nsDeviceContextSpecWin.h"
 #include "nsPrintOptionsWin.h"
 #include "nsPrintSession.h"
 #endif
@@ -105,20 +101,18 @@ namespace mozilla {
 namespace widget {
 // This constructor should really be shared with all platforms.
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init);
 }
 }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
-#ifndef WINCE
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
-#endif
 
 #ifdef NS_PRINTING
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsWin, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin)
 #endif
 
@@ -132,28 +126,29 @@ NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
 NS_DEFINE_NAMED_CID(NS_LOOKANDFEEL_CID);
 NS_DEFINE_NAMED_CID(NS_THEMERENDERER_CID);
 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
 NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
 NS_DEFINE_NAMED_CID(NS_SOUND_CID);
 NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
-#ifndef WINCE
+
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
 NS_DEFINE_NAMED_CID(NS_WIN_TASKBAR_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTBUILDER_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTITEM_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSEPARATOR_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTLINK_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSHORTCUT_CID);
 #endif
+
 NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
-#endif
+
 #ifdef NS_PRINTING
 NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
 #endif
 
 
@@ -168,28 +163,26 @@ static const mozilla::Module::CIDEntry k
   { &kNS_LOOKANDFEEL_CID, false, NULL, nsLookAndFeelConstructor },
   { &kNS_THEMERENDERER_CID, false, NULL, NS_NewNativeTheme },
   { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceWinConstructor },
   { &kNS_CLIPBOARD_CID, false, NULL, nsClipboardConstructor },
   { &kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor },
   { &kNS_SOUND_CID, false, NULL, nsSoundConstructor },
   { &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor },
   { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor },
-#ifndef WINCE
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
   { &kNS_WIN_TASKBAR_CID, false, NULL, WinTaskbarConstructor },
   { &kNS_WIN_JUMPLISTBUILDER_CID, false, NULL, JumpListBuilderConstructor },
   { &kNS_WIN_JUMPLISTITEM_CID, false, NULL, JumpListItemConstructor },
   { &kNS_WIN_JUMPLISTSEPARATOR_CID, false, NULL, JumpListSeparatorConstructor },
   { &kNS_WIN_JUMPLISTLINK_CID, false, NULL, JumpListLinkConstructor },
   { &kNS_WIN_JUMPLISTSHORTCUT_CID, false, NULL, JumpListShortcutConstructor },
 #endif
   { &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor },
   { &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor },
-#endif
 #ifdef NS_PRINTING
   { &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsWinConstructor },
   { &kNS_PRINTER_ENUMERATOR_CID, false, NULL, nsPrinterEnumeratorWinConstructor },
   { &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor },
   { &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecWinConstructor },
 #endif
   { NULL }
 };
@@ -205,28 +198,26 @@ static const mozilla::Module::ContractID
   { "@mozilla.org/widget/lookandfeel;1", &kNS_LOOKANDFEEL_CID },
   { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID },
   { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
   { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID },
   { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID },
   { "@mozilla.org/sound;1", &kNS_SOUND_CID },
   { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
   { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
-#ifndef WINCE
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
   { "@mozilla.org/windows-taskbar;1", &kNS_WIN_TASKBAR_CID },
   { "@mozilla.org/windows-jumplistbuilder;1", &kNS_WIN_JUMPLISTBUILDER_CID },
   { "@mozilla.org/windows-jumplistitem;1", &kNS_WIN_JUMPLISTITEM_CID },
   { "@mozilla.org/windows-jumplistseparator;1", &kNS_WIN_JUMPLISTSEPARATOR_CID },
   { "@mozilla.org/windows-jumplistlink;1", &kNS_WIN_JUMPLISTLINK_CID },
   { "@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID },
 #endif
   { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID },
   { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID },
-#endif
 #ifdef NS_PRINTING
   { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
   { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
   { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
   { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
 #endif
   { NULL }
 };
--- a/widget/src/build/widget.rc
+++ b/widget/src/build/widget.rc
@@ -32,23 +32,17 @@
  * 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 "resource.h"
-#ifdef WINCE
-#include "winuser.h"
-#include "aygshell.h"
-#define DS_CONTEXTHELP 0
-#else
 #include <winresrc.h>
-#endif
 #include <dlgs.h>
 
 IDC_GRAB                CURSOR  DISCARDABLE     "res/grab.cur"
 IDC_GRABBING            CURSOR  DISCARDABLE     "res/grabbing.cur"
 IDC_CELL                CURSOR  DISCARDABLE     "res/cell.cur"
 IDC_COPY                CURSOR  DISCARDABLE     "res/copy.cur"
 IDC_ALIAS               CURSOR  DISCARDABLE     "res/aliasb.cur"
 IDC_ZOOMIN              CURSOR  DISCARDABLE     "res/zoom_in.cur"
--- a/widget/src/windows/Makefile.in
+++ b/widget/src/windows/Makefile.in
@@ -82,38 +82,31 @@ endif
 ifdef NS_PRINTING
 CPPSRCS		+= \
 	nsPrintOptionsWin.cpp \
 	nsPrintSettingsWin.cpp \
 	nsDeviceContextSpecWin.cpp \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH), WINCE)
-CPPSRCS += \
-	nsWindowCE.cpp \
-	nsClipboardCE.cpp \
-	$(NULL)
-else
 CPPSRCS += \
 	KeyboardLayout.cpp \
 	IEnumFE.cpp  \
 	nsDataObj.cpp  \
 	nsDataObjCollection.cpp  \
 	nsNativeDragTarget.cpp  \
 	nsNativeDragSource.cpp  \
 	nsDragService.cpp  \
 	nsClipboard.cpp      \
 	nsImageClipboard.cpp \
 	nsBidiKeyboard.cpp   \
 	$(NULL)
 ifdef NS_ENABLE_TSF
 CPPSRCS		+= nsTextStore.cpp
 endif
-endif
 
 
 DEFINES		+= -D_IMPL_NS_WIDGET -DMOZ_UNICODE 
 
 ifdef MOZ_ENABLE_D3D9_LAYER
 DEFINES		+= -DMOZ_ENABLE_D3D9_LAYER
 endif
 
@@ -133,20 +126,16 @@ LOCAL_INCLUDES	= \
 		-I$(srcdir)/../xpwidgets \
 		-I$(srcdir) \
 		-I$(topsrcdir)/toolkit/xre \
 		-I$(topsrcdir)/xpcom/base \
 		$(NULL)
 
 FORCE_STATIC_LIB = 1
 
-ifdef WINCE
-EXTRA_DSO_LDOPTS += ddraw.lib
-endif
-
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 
 ifdef ENABLE_TESTS
 TOOL_DIRS  += tests
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/widget/src/windows/nsAppShell.cpp
+++ b/widget/src/windows/nsAppShell.cpp
@@ -47,32 +47,16 @@
 
 // For skidmark code
 #include <windows.h> 
 #include <tlhelp32.h> 
 
 const PRUnichar* kAppShellEventId = L"nsAppShell:EventID";
 const PRUnichar* kTaskbarButtonEventId = L"TaskbarButtonCreated";
 
-#ifdef WINCE
-BOOL WaitMessage(VOID)
-{
-  BOOL retval = TRUE;
-  
-  HANDLE hThread = GetCurrentThread();
-  DWORD waitRes = MsgWaitForMultipleObjectsEx(1, &hThread, INFINITE, QS_ALLEVENTS, 0);
-  if((DWORD)-1 == waitRes)
-  {
-    retval = FALSE;
-  }
-  
-  return retval;
-}
-#endif
-
 static UINT sMsgId;
 
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
 static UINT sTaskbarButtonCreatedMsg;
 
 /* static */
 UINT nsAppShell::GetTaskbarButtonCreatedMessage() {
 	return sTaskbarButtonCreatedMsg;
--- a/widget/src/windows/nsDeviceContextSpecWin.cpp
+++ b/widget/src/windows/nsDeviceContextSpecWin.cpp
@@ -33,19 +33,17 @@
  * 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 "nsDeviceContextSpecWin.h"
 #include "prmem.h"
 
-#ifndef WINCE
 #include <winspool.h>
-#endif
 
 #include <tchar.h>
 
 #include "nsAutoPtr.h"
 #include "nsIWidget.h"
 
 #include "nsTArray.h"
 #include "nsIPrintSettingsWin.h"
@@ -127,17 +125,16 @@ typedef struct {
 
 // There are around 40 default print sizes defined by Windows
 const NativePaperSizes kPaperSizes[] = {
   {DMPAPER_LETTER,    8.5,   11.0,  PR_TRUE},
   {DMPAPER_LEGAL,     8.5,   14.0,  PR_TRUE},
   {DMPAPER_A4,        210.0, 297.0, PR_FALSE},
   {DMPAPER_B4,        250.0, 354.0, PR_FALSE}, 
   {DMPAPER_B5,        182.0, 257.0, PR_FALSE},
-#ifndef WINCE
   {DMPAPER_TABLOID,   11.0,  17.0,  PR_TRUE},
   {DMPAPER_LEDGER,    17.0,  11.0,  PR_TRUE},
   {DMPAPER_STATEMENT, 5.5,   8.5,   PR_TRUE},
   {DMPAPER_EXECUTIVE, 7.25,  10.5,  PR_TRUE},
   {DMPAPER_A3,        297.0, 420.0, PR_FALSE},
   {DMPAPER_A5,        148.0, 210.0, PR_FALSE},
   {DMPAPER_CSHEET,    17.0,  22.0,  PR_TRUE},  
   {DMPAPER_DSHEET,    22.0,  34.0,  PR_TRUE},  
@@ -164,17 +161,16 @@ const NativePaperSizes kPaperSizes[] = {
   {DMPAPER_ENV_B5,    176.0, 250.0, PR_FALSE}, 
   {DMPAPER_ENV_B6,    176.0, 125.0, PR_FALSE}, 
   {DMPAPER_ENV_ITALY, 110.0, 230.0, PR_FALSE}, 
   {DMPAPER_ENV_MONARCH,  3.875,  7.5, PR_TRUE},  
   {DMPAPER_ENV_PERSONAL, 3.625,  6.5, PR_TRUE},  
   {DMPAPER_FANFOLD_US,   14.875, 11.0, PR_TRUE},  
   {DMPAPER_FANFOLD_STD_GERMAN, 8.5, 12.0, PR_TRUE},  
   {DMPAPER_FANFOLD_LGL_GERMAN, 8.5, 13.0, PR_TRUE},  
-#endif // WINCE
 };
 const PRInt32 kNumPaperSizes = 41;
 
 //----------------------------------------------------------------------------------
 nsDeviceContextSpecWin::nsDeviceContextSpecWin()
 {
   mDriverName    = nsnull;
   mDeviceName    = nsnull;
@@ -213,19 +209,16 @@ static PRUnichar * GetDefaultPrinterName
   GlobalPrinters::GetInstance()->GetDefaultPrinterName(printerName);
   return ToNewUnicode(printerName);
 }
 
 //----------------------------------------------------------------
 static nsresult 
 EnumerateNativePrinters(DWORD aWhichPrinters, LPWSTR aPrinterName, PRBool& aIsFound, PRBool& aIsFile)
 {
-#ifdef WINCE
-  aIsFound = PR_FALSE;
-#else
   DWORD             dwSizeNeeded = 0;
   DWORD             dwNumItems   = 0;
   LPPRINTER_INFO_2W  lpInfo        = NULL;
 
   // Get buffer size
   if (::EnumPrintersW(aWhichPrinters, NULL, 2, NULL, 0, &dwSizeNeeded,
                       &dwNumItems)) {
     return NS_ERROR_FAILURE;
@@ -247,39 +240,36 @@ EnumerateNativePrinters(DWORD aWhichPrin
     if (wcscmp(lpInfo[i].pPrinterName, aPrinterName) == 0) {
       aIsFound = PR_TRUE;
       aIsFile  = wcscmp(lpInfo[i].pPortName, L"FILE:") == 0;
       break;
     }
   }
 
   free(lpInfo);
-#endif
   return NS_OK;
 }
 
 //----------------------------------------------------------------
 static void 
 CheckForPrintToFileWithName(LPWSTR aPrinterName, PRBool& aIsFile)
 {
   PRBool isFound = PR_FALSE;
   aIsFile = PR_FALSE;
-#ifndef WINCE
   nsresult rv = EnumerateNativePrinters(PRINTER_ENUM_LOCAL, aPrinterName, isFound, aIsFile);
   if (isFound) return;
 
   rv = EnumerateNativePrinters(PRINTER_ENUM_NETWORK, aPrinterName, isFound, aIsFile);
   if (isFound) return;
 
   rv = EnumerateNativePrinters(PRINTER_ENUM_SHARED, aPrinterName, isFound, aIsFile);
   if (isFound) return;
 
   rv = EnumerateNativePrinters(PRINTER_ENUM_REMOTE, aPrinterName, isFound, aIsFile);
   if (isFound) return;
-#endif
 }
 
 static nsresult 
 GetFileNameForPrintSettings(nsIPrintSettings* aPS)
 {
   // for testing
 #ifdef DEBUG_rods
   return NS_OK;
@@ -677,19 +667,16 @@ SetupDevModeFromSettings(LPDEVMODEW aDev
 
 #define DISPLAY_LAST_ERROR 
 
 //----------------------------------------------------------------------------------
 // Setup the object's data member with the selected printer's data
 nsresult
 nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSettings* aPS)
 {
-#ifdef WINCE 
-  return NS_ERROR_NOT_IMPLEMENTED;
-#else
   nsresult rv = NS_ERROR_FAILURE;
 
   if (!GlobalPrinters::GetInstance()->PrintersAreAllocated()) {
     rv = GlobalPrinters::GetInstance()->EnumeratePrinterList();
     if (NS_FAILED(rv)) {
       PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - Couldn't enumerate printers!\n"));
       DISPLAY_LAST_ERROR
     }
@@ -744,17 +731,16 @@ nsDeviceContextSpecWin::GetDataFromPrint
     ::ClosePrinter(hPrinter);
     rv = NS_OK;
   } else {
     rv = NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND;
     PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - Couldn't open printer: [%s]\n", NS_ConvertUTF16toUTF8(aName).get()));
     DISPLAY_LAST_ERROR
   }
   return rv;
-#endif // WINCE
 }
 
 //----------------------------------------------------------------------------------
 // Setup Paper Size options into the DevMode
 // 
 // When using a data member it may be a HGLOCAL or LPDEVMODE
 // if it is a HGLOBAL then we need to "lock" it to get the LPDEVMODE
 // and unlock it when we are done.
@@ -969,17 +955,16 @@ GlobalPrinters::FreeGlobalPrinters()
   }
 }
 
 //----------------------------------------------------------------------------------
 nsresult 
 GlobalPrinters::EnumerateNativePrinters()
 {
   nsresult rv = NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
-#ifndef WINCE
   PR_PL(("-----------------------\n"));
   PR_PL(("EnumerateNativePrinters\n"));
 
   WCHAR szDefaultPrinterName[1024];    
   DWORD status = GetProfileStringW(L"devices", 0, L",",
                                    szDefaultPrinterName,
                                    NS_ARRAY_LENGTH(szDefaultPrinterName));
   if (status > 0) {
@@ -995,26 +980,24 @@ GlobalPrinters::EnumerateNativePrinters(
         prvPtr = sPtr+1;
         count++;
       }
       sPtr++;
     }
     rv = NS_OK;
   }
   PR_PL(("-----------------------\n"));
-#endif
   return rv;
 }
 
 //------------------------------------------------------------------
 // Uses the GetProfileString to get the default printer from the registry
 void 
 GlobalPrinters::GetDefaultPrinterName(nsString& aDefaultPrinterName)
 {
-#ifndef WINCE
   aDefaultPrinterName.Truncate();
   WCHAR szDefaultPrinterName[1024];    
   DWORD status = GetProfileStringW(L"windows", L"device", 0,
                                    szDefaultPrinterName,
                                    NS_ARRAY_LENGTH(szDefaultPrinterName));
   if (status > 0) {
     WCHAR comma = ',';
     LPWSTR sPtr = szDefaultPrinterName;
@@ -1024,19 +1007,16 @@ GlobalPrinters::GetDefaultPrinterName(ns
       *sPtr = 0;
     }
     aDefaultPrinterName = szDefaultPrinterName;
   } else {
     aDefaultPrinterName = EmptyString();
   }
 
   PR_PL(("DEFAULT PRINTER [%s]\n", aDefaultPrinterName.get()));
-#else
-  aDefaultPrinterName = NS_LITERAL_STRING("UNKNOWN");
-#endif
 }
 
 //----------------------------------------------------------------------------------
 // This goes and gets the list of available printers and puts
 // the default printer at the beginning of the list
 nsresult 
 GlobalPrinters::EnumeratePrinterList()
 {
--- a/widget/src/windows/nsFilePicker.cpp
+++ b/widget/src/windows/nsFilePicker.cpp
@@ -52,19 +52,17 @@
 #include "nsIStringBundle.h"
 #include "nsEnumeratorUtils.h"
 #include "nsCRT.h"
 #include <windows.h>
 #include <shlobj.h>
 
 // commdlg.h and cderr.h are needed to build with WIN32_LEAN_AND_MEAN
 #include <commdlg.h>
-#ifndef WINCE
 #include <cderr.h>
-#endif
 
 #include "nsString.h"
 #include "nsToolkit.h"
 
 NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
 
 PRUnichar *nsFilePicker::mLastUsedUnicodeDirectory;
 char nsFilePicker::mLastUsedDirectory[MAX_PATH+1] = { 0 };
@@ -95,30 +93,28 @@ nsFilePicker::~nsFilePicker()
 }
 
 //-------------------------------------------------------------------------
 //
 // Show - Display the file dialog
 //
 //-------------------------------------------------------------------------
 
-#ifndef WINCE_WINDOWS_MOBILE
 int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
 {
   if (uMsg == BFFM_INITIALIZED)
   {
     PRUnichar * filePath = (PRUnichar *) lpData;
     if (filePath)
       ::SendMessageW(hwnd, BFFM_SETSELECTIONW,
                      TRUE /* true because lpData is a path string */,
                      lpData);
   }
   return 0;
 }
-#endif
 
 NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
 {
   NS_ENSURE_ARG_POINTER(aReturnVal);
 
   // suppress blur events
   if (mParentWidget) {
     nsIWidget *tmp = mParentWidget;
@@ -139,18 +135,16 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt1
   // If no display directory, re-use the last one.
   if(initialDir.IsEmpty()) {
     // Allocate copy of last used dir.
     initialDir = mLastUsedUnicodeDirectory;
   }
 
   mUnicodeFile.Truncate();
 
-#ifndef WINCE_WINDOWS_MOBILE
-
   if (mMode == modeGetFolder) {
     PRUnichar dirBuffer[MAX_PATH+1];
     wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
 
     BROWSEINFOW browserInfo;
     browserInfo.hwndOwner      = (HWND)
       (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : 0); 
     browserInfo.pidlRoot       = nsnull;
@@ -178,37 +172,31 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt1
           mUnicodeFile.Assign(fileBuffer);
       }
   
       // free PIDL
       CoTaskMemFree(list);
     }
   }
   else 
-#endif // WINCE_WINDOWS_MOBILE
   {
 
     OPENFILENAMEW ofn;
     memset(&ofn, 0, sizeof(ofn));
     ofn.lStructSize = sizeof(ofn);
     nsString filterBuffer = mFilterList;
                                   
     if (!initialDir.IsEmpty()) {
       ofn.lpstrInitialDir = initialDir.get();
     }
     
     ofn.lpstrTitle   = (LPCWSTR)mTitle.get();
     ofn.lpstrFilter  = (LPCWSTR)filterBuffer.get();
     ofn.nFilterIndex = mSelectedType;
-#ifdef WINCE_WINDOWS_MOBILE
-    // If we're running fullscreen the dialog inherits that, which is bad
-    ofn.hwndOwner    = (HWND) 0;
-#else
     ofn.hwndOwner    = (HWND) (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : 0); 
-#endif
     ofn.lpstrFile    = fileBuffer;
     ofn.nMaxFile     = FILE_BUFFER_SIZE;
 
     ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
 
     if (!mDefaultExtension.IsEmpty()) {
       ofn.lpstrDefExt = mDefaultExtension.get();
     }
@@ -230,19 +218,17 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt1
           //XXX Actually, behavior is sort of weird:
           //    often appends ".html" even if you have an extension
           //    It obeys your extension if you put quotes around name
           ofn.lpstrDefExt = htmExt.get();
         }
       }
     }
 
-#ifndef WINCE
     MOZ_SEH_TRY {
-#endif
       if (mMode == modeOpen) {
         // FILE MUST EXIST!
         ofn.Flags |= OFN_FILEMUSTEXIST;
         result = ::GetOpenFileNameW(&ofn);
       }
       else if (mMode == modeOpenMultiple) {
         ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER;
         result = ::GetOpenFileNameW(&ofn);
@@ -259,46 +245,36 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt1
             StringEndsWith(ext, NS_LITERAL_CSTRING(".pif")) ||
             StringEndsWith(ext, NS_LITERAL_CSTRING(".url")))
           ofn.Flags |= OFN_NODEREFERENCELINKS;
 
         result = ::GetSaveFileNameW(&ofn);
         if (!result) {
           // Error, find out what kind.
           if (::GetLastError() == ERROR_INVALID_PARAMETER 
-#ifndef WINCE
               || ::CommDlgExtendedError() == FNERR_INVALIDFILENAME
-#endif
               ) {
             // probably the default file name is too long or contains illegal characters!
             // Try again, without a starting file name.
             ofn.lpstrFile[0] = 0;
             result = ::GetSaveFileNameW(&ofn);
           }
         }
       } 
-#ifdef WINCE_WINDOWS_MOBILE
-      else if (mMode == modeGetFolder) {
-        ofn.Flags = OFN_PROJECT | OFN_FILEMUSTEXIST;
-        result = ::GetOpenFileNameW(&ofn);
-      }
-#endif
       else {
         NS_ERROR("unsupported mode"); 
       }
-#ifndef WINCE
     }
     MOZ_SEH_EXCEPT(PR_TRUE) {
       MessageBoxW(ofn.hwndOwner,
                   0,
                   L"The filepicker was unexpectedly closed by Windows.",
                   MB_ICONERROR);
       result = PR_FALSE;
     }
-#endif
 
     if (result) {
       // Remember what filter type the user selected
       mSelectedType = (PRInt16)ofn.nFilterIndex;
 
       // Set user-selected location of file or directory
       if (mMode == modeOpenMultiple) {
         
--- a/widget/src/windows/nsIMM32Handler.cpp
+++ b/widget/src/windows/nsIMM32Handler.cpp
@@ -87,20 +87,18 @@ static UINT sWM_MSIME_MOUSE = 0; // mous
 #define IMEMOUSE_WDOWN      0x20    // wheel down
 
 #endif
 
 PRPackedBool nsIMM32Handler::sIsStatusChanged = PR_FALSE;
 PRPackedBool nsIMM32Handler::sIsIME = PR_TRUE;
 PRPackedBool nsIMM32Handler::sIsIMEOpening = PR_FALSE;
 
-#ifndef WINCE
 UINT nsIMM32Handler::sCodePage = 0;
 DWORD nsIMM32Handler::sIMEProperty = 0;
-#endif
 
 /* static */ void
 nsIMM32Handler::EnsureHandlerInstance()
 {
   if (!gIMM32Handler) {
     gIMM32Handler = new nsIMM32Handler();
   }
 }
@@ -192,67 +190,52 @@ nsIMM32Handler::IsDoingKakuteiUndo(HWND 
          charMsg.wParam == VK_BACK && charMsg.lParam == 0x1 &&
          imeStartCompositionMsg.time <= imeCompositionMsg.time &&
          imeCompositionMsg.time <= charMsg.time;
 }
 
 /* static */ PRBool
 nsIMM32Handler::ShouldDrawCompositionStringOurselves()
 {
-#ifdef WINCE
-  // We are not sure we should use native IME behavior...
-  return PR_TRUE;
-#else
   // If current IME has special UI or its composition window should not
   // positioned to caret position, we should now draw composition string
   // ourselves.
   return !(sIMEProperty & IME_PROP_SPECIAL_UI) &&
           (sIMEProperty & IME_PROP_AT_CARET);
-#endif
 }
 
 /* static */ void
 nsIMM32Handler::InitKeyboardLayout(HKL aKeyboardLayout)
 {
-#ifndef WINCE
   WORD langID = LOWORD(aKeyboardLayout);
   ::GetLocaleInfoW(MAKELCID(langID, SORT_DEFAULT),
                    LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
                    (PWSTR)&sCodePage, sizeof(sCodePage) / sizeof(WCHAR));
   sIMEProperty = ::ImmGetProperty(aKeyboardLayout, IGP_PROPERTY);
   sIsIME = ::ImmIsIME(aKeyboardLayout);
   PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
     ("IMM32: InitKeyboardLayout, aKeyboardLayout=%08x, sCodePage=%lu, sIMEProperty=%08x sIsIME=%s\n",
      aKeyboardLayout, sCodePage, sIMEProperty, sIsIME ? "TRUE" : "FALSE"));
-#endif
 }
 
 /* static */ UINT
 nsIMM32Handler::GetKeyboardCodePage()
 {
-#ifdef WINCE
-  return ::GetACP();
-#else
   return sCodePage;
-#endif
 }
 
 /* static */ PRBool
 nsIMM32Handler::CanOptimizeKeyAndIMEMessages(MSG *aNextKeyOrIMEMessage)
 {
-#ifdef WINCE
-  return PR_TRUE;
-#else
   // If IME is opening right now, we shouldn't optimize the key and IME message
   // order because ATOK (Japanese IME of third party) has some problem with the
   // optimization.  When it finishes opening completely, it eats all key
   // messages in the message queue.  And it causes starting composition.  So,
   // we shouldn't eat the key messages before ATOK.
   return !sIsIMEOpening;
-#endif
 }
 
 
 // used for checking the lParam of WM_IME_COMPOSITION
 #define IS_COMPOSING_LPARAM(lParam) \
   ((lParam) & (GCS_COMPSTR | GCS_COMPATTR | GCS_COMPCLAUSE | GCS_CURSORPOS))
 #define IS_COMMITTING_LPARAM(lParam) ((lParam) & GCS_RESULTSTR)
 // Some IMEs (e.g., the standard IME for Korean) don't have caret position,
@@ -1184,49 +1167,44 @@ nsIMM32Handler::HandleComposition(nsWind
   long clauseArrayLength =
     ::ImmGetCompositionStringW(aIMEContext.get(), GCS_COMPCLAUSE, NULL, 0);
   clauseArrayLength /= sizeof(PRUint32);
 
   if (clauseArrayLength > 0) {
     nsresult rv = EnsureClauseArray(clauseArrayLength);
     NS_ENSURE_SUCCESS(rv, PR_FALSE);
 
-#ifndef WINCE
     // Intelligent ABC IME (Simplified Chinese IME, the code page is 936)
     // will crash in ImmGetCompositionStringW for GCS_COMPCLAUSE (bug 424663).
     // See comment 35 of the bug for the detail. Therefore, we should use A
     // API for it, however, we should not kill Unicode support on all IMEs.
     PRBool useA_API = !(sIMEProperty & IME_PROP_UNICODE);
 
     PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
       ("IMM32: HandleComposition, GCS_COMPCLAUSE, useA_API=%s\n",
        useA_API ? "TRUE" : "FALSE"));
-#endif
 
     long clauseArrayLength2 = 
-#ifndef WINCE
       useA_API ?
         ::ImmGetCompositionStringA(aIMEContext.get(), GCS_COMPCLAUSE,
                                    mClauseArray.Elements(),
                                    mClauseArray.Capacity() * sizeof(PRUint32)) :
-#endif
         ::ImmGetCompositionStringW(aIMEContext.get(), GCS_COMPCLAUSE,
                                    mClauseArray.Elements(),
                                    mClauseArray.Capacity() * sizeof(PRUint32));
     clauseArrayLength2 /= sizeof(PRUint32);
 
     if (clauseArrayLength != clauseArrayLength2) {
       PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
         ("IMM32: HandleComposition, GCS_COMPCLAUSE, clauseArrayLength=%ld but clauseArrayLength2=%ld\n",
          clauseArrayLength, clauseArrayLength2));
       if (clauseArrayLength > clauseArrayLength2)
         clauseArrayLength = clauseArrayLength2;
     }
 
-#ifndef WINCE
     if (useA_API) {
       // Convert each values of sIMECompClauseArray. The values mean offset of
       // the clauses in ANSI string. But we need the values in Unicode string.
       nsCAutoString compANSIStr;
       if (ConvertToANSIString(mCompositionString, GetKeyboardCodePage(),
                               compANSIStr)) {
         PRUint32 maxlen = compANSIStr.Length();
         mClauseArray[0] = 0; // first value must be 0
@@ -1234,17 +1212,16 @@ nsIMM32Handler::HandleComposition(nsWind
           PRUint32 len = PR_MIN(mClauseArray[i], maxlen);
           mClauseArray[i] = ::MultiByteToWideChar(GetKeyboardCodePage(), 
                                                   MB_PRECOMPOSED,
                                                   (LPCSTR)compANSIStr.get(),
                                                   len, NULL, 0);
         }
       }
     }
-#endif
   }
   // compClauseArrayLength may be negative. I.e., ImmGetCompositionStringW
   // may return an error code.
   mClauseArray.SetLength(PR_MAX(0, clauseArrayLength));
 
   PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
     ("IMM32: HandleComposition, GCS_COMPCLAUSE, mClauseLength=%ld\n",
      mClauseArray.Length()));
--- a/widget/src/windows/nsIMM32Handler.h
+++ b/widget/src/windows/nsIMM32Handler.h
@@ -52,19 +52,17 @@
 #include "nsString.h"
 #include "nsGUIEvent.h"
 #include "nsTArray.h"
 
 class nsIWidget;
 class nsWindow;
 struct nsIntRect;
 
-#ifndef WINCE
 #define ENABLE_IME_MOUSE_HANDLING 1
-#endif // WINCE
 
 #define NS_WM_IMEFIRST WM_IME_SETCONTEXT
 #define NS_WM_IMELAST  WM_IME_KEYUP
 
 class nsIMEContext
 {
 public:
   nsIMEContext(HWND aWnd) : mWnd(aWnd)
@@ -329,15 +327,13 @@ protected:
   PRPackedBool mIsComposing;
   PRPackedBool mIsComposingOnPlugin;
   PRPackedBool mNativeCaretIsCreated;
 
   static PRPackedBool sIsStatusChanged;
   static PRPackedBool sIsIME;
   static PRPackedBool sIsIMEOpening;
 
-#ifndef WINCE
   static UINT sCodePage;
   static DWORD sIMEProperty;
-#endif // #ifndef WINCE
 };
 
 #endif // nsIMM32Handler_h__
--- a/widget/src/windows/nsIdleServiceWin.cpp
+++ b/widget/src/windows/nsIdleServiceWin.cpp
@@ -41,33 +41,23 @@
 #include "nsIdleServiceWin.h"
 #include <windows.h>
 
 NS_IMPL_ISUPPORTS2(nsIdleServiceWin, nsIIdleService, nsIdleService)
 
 bool
 nsIdleServiceWin::PollIdleTime(PRUint32 *aIdleTime)
 {
-#ifndef WINCE
     LASTINPUTINFO inputInfo;
     inputInfo.cbSize = sizeof(inputInfo);
     if (!::GetLastInputInfo(&inputInfo))
         return false;
 
     *aIdleTime = SAFE_COMPARE_EVEN_WITH_WRAPPING(GetTickCount(), inputInfo.dwTime);
 
     return true;
-#else
-    // On WinCE we don't pull the idle time from the system.
-    return false;
-#endif
 }
 
 bool
 nsIdleServiceWin::UsePollMode()
 {
-#ifndef WINCE
     return true;
-#else
-    // On WinCE we don't pull the idle time from the system.
-    return false;
-#endif
 }
--- a/widget/src/windows/nsLookAndFeel.cpp
+++ b/widget/src/windows/nsLookAndFeel.cpp
@@ -40,18 +40,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsLookAndFeel.h"
 #include "nsXPLookAndFeel.h"
 #include <windows.h>
 #include <shellapi.h>
 #include "nsWindow.h"
 #include "nsStyleConsts.h"
-
-#ifndef WINCE
 #include "nsUXThemeData.h"
 #include "nsUXThemeConstants.h"
 
 typedef UINT (CALLBACK *SHAppBarMessagePtr)(DWORD, PAPPBARDATA);
 SHAppBarMessagePtr gSHAppBarMessage = NULL;
 static HINSTANCE gShell32DLLInst = NULL;
 
 static nsresult GetColorFromTheme(nsUXThemeClass cls,
@@ -64,46 +62,41 @@ static nsresult GetColorFromTheme(nsUXTh
   HRESULT hr = nsUXThemeData::GetThemeColor(cls, aPart, aState, aPropId, &color);
   if (hr == S_OK)
   {
     aColor = COLOREF_2_NSRGB(color);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
-#endif
 
 static PRInt32 GetSystemParam(long flag, PRInt32 def)
 {
     DWORD value; 
     return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
 }
 
 nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
 {
-#ifndef WINCE
   gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
   if (gShell32DLLInst)
   {
       gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst,
                                                              "SHAppBarMessage");
   }
-#endif
 }
 
 nsLookAndFeel::~nsLookAndFeel()
 {
-#ifndef WINCE
    if (gShell32DLLInst)
    {
        FreeLibrary(gShell32DLLInst);
        gShell32DLLInst = NULL;
        gSHAppBarMessage = NULL;
    }
-#endif
 }
 
 nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
 {
   nsresult res = NS_OK;
 
   int idx;
   switch (aID) {
@@ -201,37 +194,33 @@ nsresult nsLookAndFeel::NativeGetColor(c
       idx = COLOR_GRAYTEXT;
       break;
     case eColor_highlight:
     case eColor__moz_html_cellhighlight:
     case eColor__moz_menuhover:
       idx = COLOR_HIGHLIGHT;
       break;
     case eColor__moz_menubarhovertext:
-#ifndef WINCE
       if (!nsUXThemeData::sIsVistaOrLater || !nsUXThemeData::isAppThemed())
       {
         idx = nsUXThemeData::sFlatMenus ?
                 COLOR_HIGHLIGHTTEXT :
                 COLOR_MENUTEXT;
         break;
       }
-#endif
       // Fall through
     case eColor__moz_menuhovertext:
-#ifndef WINCE
       if (nsUXThemeData::IsAppThemed() && nsUXThemeData::sIsVistaOrLater)
       {
         res = ::GetColorFromTheme(eUXMenu,
                                   MENU_POPUPITEM, MPI_HOT, TMT_TEXTCOLOR, aColor);
         if (NS_SUCCEEDED(res))
           return res;
         // fall through to highlight case
       }
-#endif
     case eColor_highlighttext:
     case eColor__moz_html_cellhighlighttext:
       idx = COLOR_HIGHLIGHTTEXT;
       break;
     case eColor_inactiveborder:
       idx = COLOR_INACTIVEBORDER;
       break;
     case eColor_inactivecaption:
@@ -290,57 +279,48 @@ nsresult nsLookAndFeel::NativeGetColor(c
     case eColor__moz_comboboxtext:
       idx = COLOR_WINDOWTEXT;
       break;
     case eColor__moz_dialog:
     case eColor__moz_cellhighlight:
       idx = COLOR_3DFACE;
       break;
     case eColor__moz_win_mediatext:
-#ifndef WINCE
       if (nsUXThemeData::IsAppThemed() && nsUXThemeData::sIsVistaOrLater) {
         res = ::GetColorFromTheme(eUXMediaToolbar,
                                   TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
         if (NS_SUCCEEDED(res))
           return res;
       }
-#endif
       // if we've gotten here just return -moz-dialogtext instead
       idx = COLOR_WINDOWTEXT;
       break;
     case eColor__moz_win_communicationstext:
-#ifndef WINCE
       if (nsUXThemeData::IsAppThemed() && nsUXThemeData::sIsVistaOrLater)
       {
         res = ::GetColorFromTheme(eUXCommunicationsToolbar,
                                   TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
         if (NS_SUCCEEDED(res))
           return res;
       }
-#endif
       // if we've gotten here just return -moz-dialogtext instead
       idx = COLOR_WINDOWTEXT;
       break;
     case eColor__moz_dialogtext:
     case eColor__moz_cellhighlighttext:
       idx = COLOR_WINDOWTEXT;
       break;
     case eColor__moz_dragtargetzone:
       idx = COLOR_HIGHLIGHTTEXT;
       break;
     case eColor__moz_buttondefault:
       idx = COLOR_3DDKSHADOW;
       break;
     case eColor__moz_nativehyperlinktext:
-#ifndef WINCE
       idx = COLOR_HOTLIGHT;
-#else
-      aColor = NS_RGB(0, 0, 0xee);
-      return NS_OK;
-#endif
       break;
     default:
       idx = COLOR_WINDOW;
       break;
     }
 
   DWORD color = ::GetSysColor(idx);
   aColor = COLOREF_2_NSRGB(color);
@@ -368,27 +348,22 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
     case eMetric_SelectTextfieldsOnKeyFocus:
         // Select textfield content when focused by kbd
         // used by nsEventStateManager::sTextfieldSelectModel
         aMetric = 1;
         break;
     case eMetric_SubmenuDelay:
         // This will default to the Windows' default
         // (400ms) on error.
-#ifndef WINCE
         aMetric = GetSystemParam(SPI_GETMENUSHOWDELAY, 400);
-#else
-        aMetric = 400;
-#endif
         break;
     case eMetric_MenusCanOverlapOSBar:
         // we want XUL popups to be able to overlap the task bar.
         aMetric = 1;
         break;
-#ifndef WINCE
     case eMetric_DragThresholdX:
         // The system metric is the number of pixels at which a drag should
         // start.  Our look and feel metric is the number of pixels you can
         // move before starting a drag, so subtract 1.
 
         aMetric = ::GetSystemMetrics(SM_CXDRAG) - 1;
         break;
     case eMetric_DragThresholdY:
@@ -399,17 +374,16 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
         // e.g. normal contrast with large fonts, low contrast, etc.
         // The high contrast flag really means -- use this theme and don't override it.
         HIGHCONTRAST contrastThemeInfo;
         contrastThemeInfo.cbSize = sizeof(contrastThemeInfo);
         ::SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &contrastThemeInfo, 0);
 
         aMetric = ((contrastThemeInfo.dwFlags & HCF_HIGHCONTRASTON) != 0);
         break;
-#endif
     case eMetric_ScrollArrowStyle:
         aMetric = eMetric_ScrollArrowStyleSingle;
         break;
     case eMetric_ScrollSliderStyle:
         aMetric = eMetric_ScrollThumbStyleProportional;
         break;
     case eMetric_TreeOpenDelay:
         aMetric = 1000;
@@ -422,60 +396,43 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
         break;
     case eMetric_TreeScrollDelay:
         aMetric = 100;
         break;
     case eMetric_TreeScrollLinesMax:
         aMetric = 3;
         break;
     case eMetric_WindowsClassic:
-#ifndef WINCE
         aMetric = !nsUXThemeData::IsAppThemed();
-#else
-        aMetric = 0;
-#endif
         break;
     case eMetric_TouchEnabled:
         aMetric = 0;
-#ifndef WINCE
         PRInt32 touchCapabilities;
         touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
         if ((touchCapabilities & NID_READY) && 
            (touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH))) {
             aMetric = 1;
         }
-#elif defined(WINCE_WINDOWS_MOBILE)
-        WCHAR platformType[MAX_PATH];
-        SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(platformType),
-                             platformType, 0);
-        if (!wcscmp(platformType, L"PocketPC"))
-            aMetric = 1;
-#endif
         break;
     case eMetric_WindowsDefaultTheme:
         aMetric = nsUXThemeData::IsDefaultWindowTheme();
         break;
     case eMetric_WindowsThemeIdentifier:
         aMetric = nsUXThemeData::GetNativeThemeId();
         break;
     case eMetric_MacGraphiteTheme:
     case eMetric_MaemoClassic:
         aMetric = 0;
         res = NS_ERROR_NOT_IMPLEMENTED;
         break;
     case eMetric_DWMCompositor:
-#ifndef WINCE
         aMetric = nsUXThemeData::CheckForCompositor();
-#else
-        aMetric = 0;
-#endif
         break;
     case eMetric_AlertNotificationOrigin:
         aMetric = 0;
-#ifndef WINCE
         if (gSHAppBarMessage)
         {
           // Get task bar window handle
           HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL);
 
           if (shellWindow != NULL)
           {
             // Determine position
@@ -503,17 +460,16 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
                   if (::GetWindowLong(shellWindow, GWL_EXSTYLE) &
                         WS_EX_LAYOUTRTL)
                     aMetric |= NS_ALERT_LEFT;
                   break;
               }
             }
           }
         }
-#endif // WINCE
         break;
     case eMetric_IMERawInputUnderlineStyle:
     case eMetric_IMEConvertedTextUnderlineStyle:
         aMetric = NS_STYLE_TEXT_DECORATION_STYLE_DASHED;
         break;
     case eMetric_IMESelectedRawTextUnderlineStyle:
     case eMetric_IMESelectedConvertedTextUnderline:
         aMetric = NS_STYLE_TEXT_DECORATION_STYLE_NONE;
@@ -548,27 +504,23 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
     }
   return res;
 }
 
 /* virtual */
 PRUnichar nsLookAndFeel::GetPasswordCharacter()
 {
 #define UNICODE_BLACK_CIRCLE_CHAR 0x25cf
-#ifdef WINCE
-  return UNICODE_BLACK_CIRCLE_CHAR;
-#else
   static PRUnichar passwordCharacter = 0;
   if (!passwordCharacter) {
     passwordCharacter = '*';
     if (nsUXThemeData::sIsXPOrLater)
       passwordCharacter = UNICODE_BLACK_CIRCLE_CHAR;
   }
   return passwordCharacter;
-#endif
 }
 
 #ifdef NS_DEBUG
 
 NS_IMETHODIMP nsLookAndFeel::GetNavSize(const nsMetricNavWidgetID aWidgetID,
                                         const nsMetricNavFontID   aFontID, 
                                         const PRInt32             aFontSize, 
                                         nsSize &aSize)
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -68,58 +68,16 @@
 #include "gfxWindowsSurface.h"
 #include "gfxWindowsNativeDrawing.h"
 
 #include "nsUXThemeData.h"
 #include "nsUXThemeConstants.h"
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsNativeThemeWin, nsNativeTheme, nsITheme)
 
-#ifdef WINCE
-
-/* These functions might or might not be present; FrameRect probably isn't,
- * but GetViewportOrgEx might be -- so #define them to avoid name collisions.
- */
-
-#define FrameRect moz_FrameRect
-#define GetViewportOrgEx moz_GetViewportOrgEx
-
-static int FrameRect(HDC inDC, CONST RECT *inRect, HBRUSH inBrush)
- {
-   HBRUSH oldBrush = (HBRUSH)SelectObject(inDC, inBrush);
-   RECT myRect = *inRect;
-   InflateRect(&myRect, 1, 1); 
-
-   // The width and height of the border are always one
-   // logical unit.
-
-   // move to top-left, and go clockwise.
-   MoveToEx(inDC, myRect.left, myRect.top, (LPPOINT) NULL);
-   // 1 -> 2
-   LineTo(inDC, myRect.right, myRect.top);
-   // 2 -> 3
-   LineTo(inDC, myRect.right, myRect.bottom);
-   // 3 -> 4
-   LineTo(inDC, myRect.left, myRect.bottom);
-   // 4 -> 1
-   LineTo(inDC, myRect.left, myRect.top);
-
-   SelectObject(inDC, oldBrush);
-   return 1;
-}
-
-static BOOL GetViewportOrgEx(HDC hdc, LPPOINT lpPoint)
-{
-  SetViewportOrgEx(hdc, 0, 0, lpPoint);
-  if (lpPoint->x != 0 || lpPoint->y != 0)
-    SetViewportOrgEx(hdc, lpPoint->x, lpPoint->y, NULL);
-  return TRUE;
-}
-#endif
-
 static inline PRBool IsHTMLContent(nsIFrame *frame)
 {
   nsIContent* content = frame->GetContent();
   return content && content->IsHTML();
 }
 
 static PRInt32 GetTopLevelWindowActiveState(nsIFrame *aFrame)
 {
@@ -1465,17 +1423,16 @@ RENDER_AGAIN:
         HPEN hPen = nsnull;
 
         PRUint8 id = SaveDC(hdc);
 
         ::SelectClipRgn(hdc, NULL);
         ::GetViewportOrgEx(hdc, &vpOrg);
         ::SetBrushOrgEx(hdc, vpOrg.x + widgetRect.left, vpOrg.y + widgetRect.top, NULL);
 
-#ifndef WINCE
         // On vista, choose our own colors and draw an XP style half focus rect
         // for focused checkboxes and a full rect when active.
         if (nsUXThemeData::sIsVistaOrLater && aWidgetType == NS_THEME_CHECKBOX) {
           LOGBRUSH lb;
           lb.lbStyle = BS_SOLID;
           lb.lbColor = RGB(255,255,255);
           lb.lbHatch = 0;
 
@@ -1492,20 +1449,16 @@ RENDER_AGAIN:
           // Draw the lower right corner of the dotted rect.
           ::MoveToEx(hdc, widgetRect.right-1, widgetRect.top, NULL);
           ::LineTo(hdc, widgetRect.right-1, widgetRect.bottom-1);
           ::LineTo(hdc, widgetRect.left, widgetRect.bottom-1);
         } else {
           ::SetTextColor(hdc, 0);
           ::DrawFocusRect(hdc, &widgetRect);
         }
-#else
-        ::SetTextColor(hdc, 0);
-        ::DrawFocusRect(hdc, &widgetRect);
-#endif
         ::RestoreDC(hdc, id);
         if (hPen) {
           ::DeleteObject(hPen);
         }
       }
   }
   else if (aWidgetType == NS_THEME_TOOLBAR && state == 0) {
     // Draw toolbar separator lines above all toolbars except the first one.
@@ -2434,23 +2387,18 @@ nsNativeThemeWin::ClassicGetMinimumWidge
   switch (aWidgetType) {
     case NS_THEME_RADIO:
     case NS_THEME_CHECKBOX:
       (*aResult).width = (*aResult).height = 13;
       break;
     case NS_THEME_MENUCHECKBOX:
     case NS_THEME_MENURADIO:
     case NS_THEME_MENUARROW:
-#ifdef WINCE
-      (*aResult).width =  16;
-      (*aResult).height = 16;
-#else
       (*aResult).width = ::GetSystemMetrics(SM_CXMENUCHECK);
       (*aResult).height = ::GetSystemMetrics(SM_CYMENUCHECK);
-#endif
       break;
     case NS_THEME_SCROLLBAR_BUTTON_UP:
     case NS_THEME_SCROLLBAR_BUTTON_DOWN:
       (*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL);
       (*aResult).height = ::GetSystemMetrics(SM_CYVSCROLL);
       *aIsOverridable = PR_FALSE;
       break;
     case NS_THEME_SCROLLBAR_BUTTON_LEFT:
@@ -2496,60 +2444,44 @@ nsNativeThemeWin::ClassicGetMinimumWidge
     case NS_THEME_PROGRESSBAR:
     case NS_THEME_PROGRESSBAR_VERTICAL:
     case NS_THEME_TAB:
     case NS_THEME_TAB_PANEL:
     case NS_THEME_TAB_PANELS:
       // no minimum widget size
       break;
     case NS_THEME_RESIZER: {     
-#ifndef WINCE
       NONCLIENTMETRICS nc;
       nc.cbSize = sizeof(nc);
       if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nc), &nc, 0))
         (*aResult).width = (*aResult).height = abs(nc.lfStatusFont.lfHeight) + 4;
       else
-#endif
         (*aResult).width = (*aResult).height = 15;
       *aIsOverridable = PR_FALSE;
       break;
     case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
-#ifndef WINCE
       (*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL);
       (*aResult).height = ::GetSystemMetrics(SM_CYVTHUMB);
-#else
-      (*aResult).width = 15;
-      (*aResult).height = 15;
-#endif
       // Without theming, divide the thumb size by two in order to look more
       // native
       if (!GetTheme(aWidgetType))
         (*aResult).height >>= 1;
       *aIsOverridable = PR_FALSE;
       break;
     case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
-#ifndef WINCE
       (*aResult).width = ::GetSystemMetrics(SM_CXHTHUMB);
       (*aResult).height = ::GetSystemMetrics(SM_CYHSCROLL);
-#else
-      (*aResult).width = 15;
-      (*aResult).height = 15;
-#endif
       // Without theming, divide the thumb size by two in order to look more
       // native
       if (!GetTheme(aWidgetType))
         (*aResult).width >>= 1;
       *aIsOverridable = PR_FALSE;
       break;
     case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
-#ifndef WINCE
       (*aResult).width = ::GetSystemMetrics(SM_CXHTHUMB) << 1;
-#else
-      (*aResult).width = 10;
-#endif
       break;
     }
     case NS_THEME_MENUSEPARATOR:
     {
       aResult->width = 0;
       aResult->height = 10;
       break;
     }
@@ -2619,20 +2551,19 @@ nsresult nsNativeThemeWin::ClassicGetThe
       else if (IsCheckedButton(aFrame))
         aState |= DFCS_CHECKED;
       else {
         if (contentState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)) {
           aState |= DFCS_PUSHED;
           const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
           // The down state is flat if the button is focusable
           if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
-#ifndef WINCE
             if (!aFrame->GetContent()->IsHTML())
               aState |= DFCS_FLAT;
-#endif
+
             aFocused = PR_TRUE;
           }
         }
         if (contentState.HasState(NS_EVENT_STATE_FOCUS) ||
             (aState == DFCS_BUTTONPUSH && IsDefaultButton(aFrame))) {
           aFocused = PR_TRUE;
         }
 
@@ -2784,33 +2715,31 @@ nsresult nsNativeThemeWin::ClassicGetThe
 
       nsEventStates eventState = GetContentState(aFrame, aWidgetType);
 
       if (IsDisabled(aFrame, eventState)) {
         aState |= DFCS_INACTIVE;
         return NS_OK;
       }
 
-#ifndef WINCE
       if (isHTML) {
         nsIComboboxControlFrame* ccf = do_QueryFrame(aFrame);
         isOpen = (ccf && ccf->IsDroppedDown());
       }
       else
         isOpen = IsOpenButton(aFrame);
 
       // XXX Button should look active until the mouse is released, but
       //     without making it look active when the popup is clicked.
       if (isOpen && (isHTML || isMenulist))
         return NS_OK;
 
       // Dropdown button active state doesn't need :hover.
       if (eventState.HasState(NS_EVENT_STATE_ACTIVE))
         aState |= DFCS_PUSHED | DFCS_FLAT;
-#endif
 
       return NS_OK;
     }
     case NS_THEME_SCROLLBAR_BUTTON_UP:
     case NS_THEME_SCROLLBAR_BUTTON_DOWN:
     case NS_THEME_SCROLLBAR_BUTTON_LEFT:
     case NS_THEME_SCROLLBAR_BUTTON_RIGHT: {
       nsEventStates contentState = GetContentState(aFrame, aWidgetType);
@@ -2829,20 +2758,18 @@ nsresult nsNativeThemeWin::ClassicGetThe
         case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
           aState = DFCS_SCROLLRIGHT;
           break;
       }
 
       if (IsDisabled(aFrame, contentState))
         aState |= DFCS_INACTIVE;
       else {
-#ifndef WINCE
         if (contentState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
           aState |= DFCS_PUSHED | DFCS_FLAT;
-#endif
       }
 
       return NS_OK;
     }
     case NS_THEME_SPINNER_UP_BUTTON:
     case NS_THEME_SPINNER_DOWN_BUTTON: {
       nsEventStates contentState = GetContentState(aFrame, aWidgetType);
 
@@ -2862,22 +2789,18 @@ nsresult nsNativeThemeWin::ClassicGetThe
         if (contentState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
           aState |= DFCS_PUSHED;
       }
 
       return NS_OK;    
     }
     case NS_THEME_RESIZER:    
       aPart = DFC_SCROLL;
-#ifndef WINCE
       aState = (IsFrameRTL(aFrame)) ?
                DFCS_SCROLLSIZEGRIPRIGHT : DFCS_SCROLLSIZEGRIP;
-#else
-      aState = 0;
-#endif
       return NS_OK;
     case NS_THEME_MENUSEPARATOR:
       aPart = 0;
       aState = 0;
       return NS_OK;
     case NS_THEME_WINDOW_TITLEBAR:
       aPart = mozilla::widget::themeconst::WP_CAPTION;
       aState = GetTopLevelWindowActiveState(aFrame);
@@ -3011,17 +2934,16 @@ static void DrawTab(HDC hdc, const RECT&
   // Tab Diagonal Corners
   if (aDrawLeft)
     ::DrawEdge(hdc, &lightRect, EDGE_RAISED, BF_SOFT | lightFlag);
 
   if (aDrawRight)
     ::DrawEdge(hdc, &shadeRect, EDGE_RAISED, BF_SOFT | shadeFlag);
 }
 
-#ifndef WINCE
 static void DrawMenuImage(HDC hdc, const RECT& rc, PRInt32 aComponent, PRUint32 aColor)
 {
   // This procedure creates a memory bitmap to contain the check mark, draws
   // it into the bitmap (it is a mask image), then composes it onto the menu
   // item in appropriate colors.
   HDC hMemoryDC = ::CreateCompatibleDC(hdc);
   if (hMemoryDC) {
     // XXXjgr We should ideally be caching these, but we wont be notified when
@@ -3058,36 +2980,33 @@ static void DrawMenuImage(HDC hdc, const
         ::SetBkColor(hdc, oldBackCol);
         ::SelectObject(hMemoryDC, hPrevBitmap);
       }
       ::DeleteObject(hMonoBitmap);
     }
     ::DeleteDC(hMemoryDC);
   }
 }
-#endif
 
 void nsNativeThemeWin::DrawCheckedRect(HDC hdc, const RECT& rc, PRInt32 fore, PRInt32 back,
                                        HBRUSH defaultBack)
 {
   static WORD patBits[8] = {
     0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55
   };
         
   HBITMAP patBmp = ::CreateBitmap(8, 8, 1, 1, patBits);
   if (patBmp) {
     HBRUSH brush = (HBRUSH) ::CreatePatternBrush(patBmp);
     if (brush) {        
       COLORREF oldForeColor = ::SetTextColor(hdc, ::GetSysColor(fore));
       COLORREF oldBackColor = ::SetBkColor(hdc, ::GetSysColor(back));
       POINT vpOrg;
 
-#ifndef WINCE
       ::UnrealizeObject(brush);
-#endif
       ::GetViewportOrgEx(hdc, &vpOrg);
       ::SetBrushOrgEx(hdc, vpOrg.x + rc.left, vpOrg.y + rc.top, NULL);
       HBRUSH oldBrush = (HBRUSH) ::SelectObject(hdc, brush);
       ::FillRect(hdc, &rc, brush);
       ::SetTextColor(hdc, oldForeColor);
       ::SetBkColor(hdc, oldBackColor);
       ::SelectObject(hdc, oldBrush);
       ::DeleteObject(brush);          
@@ -3352,17 +3271,16 @@ RENDER_AGAIN:
           }
         } else {
           if ((state & (DFCS_HOT | DFCS_PUSHED)) != 0) {
             ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_HIGHLIGHT+1));
           }
         }
       }
       break;
-#ifndef WINCE
     case NS_THEME_MENUCHECKBOX:
     case NS_THEME_MENURADIO:
       if (!(state & DFCS_CHECKED))
         break; // nothin' to do
     case NS_THEME_MENUARROW: {
       PRUint32 color = COLOR_MENUTEXT;
       if ((state & DFCS_INACTIVE))
         color = COLOR_GRAYTEXT;
@@ -3389,17 +3307,16 @@ RENDER_AGAIN:
       // Our rectangles are 1 pixel high (see border size in menu.css)
       widgetRect.bottom = widgetRect.top+1;
       ::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_3DSHADOW+1));
       widgetRect.top++;
       widgetRect.bottom++;
       ::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_3DHILIGHT+1));
       break;
     }
-#endif
 
     case NS_THEME_WINDOW_TITLEBAR:
     case NS_THEME_WINDOW_TITLEBAR_MAXIMIZED:
     {
       RECT rect = widgetRect;
       PRInt32 offset = GetSystemMetrics(SM_CXFRAME);
       rect.bottom -= 1;
 
--- a/widget/src/windows/nsScreenWin.cpp
+++ b/widget/src/windows/nsScreenWin.cpp
@@ -42,23 +42,16 @@
 //
 #undef WINVER
 #define WINVER 0x0500
 #undef _WIN32_WINNT
 #define _WIN32_WINNT 0x0500
 
 #include "nsScreenWin.h"
 
-#ifdef WINCE
-#ifdef WINCE_WINDOWS_MOBILE
-#include "sipapi.h"
-#endif
-#define GetMonitorInfoW GetMonitorInfo
-#endif
-
 
 nsScreenWin :: nsScreenWin ( void* inScreen )
   : mScreen(inScreen)
 {
 #ifdef DEBUG
   HDC hDCScreen = ::GetDC(nsnull);
   NS_ASSERTION(hDCScreen,"GetDC Failure");
   NS_ASSERTION ( ::GetDeviceCaps(hDCScreen, TECHNOLOGY) == DT_RASDISPLAY, "Not a display screen");
@@ -112,28 +105,16 @@ nsScreenWin :: GetRect(PRInt32 *outLeft,
 
 } // GetRect
 
 
 NS_IMETHODIMP
 nsScreenWin :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
 {
   BOOL success = FALSE;
-#ifdef WINCE_WINDOWS_MOBILE
-  SIPINFO sipInfo;
-  memset(&sipInfo, 0, sizeof(SIPINFO));
-  sipInfo.cbSize = sizeof(SIPINFO);
-  if (SipGetInfo(&sipInfo) && !(sipInfo.fdwFlags & SIPF_OFF)) {
-    *outLeft = sipInfo.rcVisibleDesktop.left;
-    *outTop = sipInfo.rcVisibleDesktop.top;
-    *outWidth = sipInfo.rcVisibleDesktop.right - sipInfo.rcVisibleDesktop.left;
-    *outHeight = sipInfo.rcVisibleDesktop.bottom - sipInfo.rcVisibleDesktop.top;
-    return NS_OK;
-  }
-#endif
 
 #if _MSC_VER >= 1200
   if ( mScreen ) {
     MONITORINFO info;
     info.cbSize = sizeof(MONITORINFO);
     success = ::GetMonitorInfoW( (HMONITOR)mScreen, &info );
     if ( success ) {
       *outLeft = info.rcWork.left;
--- a/widget/src/windows/nsToolkit.cpp
+++ b/widget/src/windows/nsToolkit.cpp
@@ -44,19 +44,17 @@
 #include "prtime.h"
 #include "nsGUIEvent.h"
 #include "nsIServiceManager.h"
 #include "nsComponentManagerUtils.h"
 #include "nsWidgetAtoms.h"
 #include <objbase.h>
 #include <initguid.h>
 
-#ifndef WINCE
 #include "nsUXThemeData.h"
-#endif
 
 // unknwn.h is needed to build with WIN32_LEAN_AND_MEAN
 #include <unknwn.h>
 
 NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit)
 
 //
 // Static thread local storage index of the Toolkit 
@@ -82,19 +80,16 @@ StartAllowingD3D9(nsITimer *aTimer, void
 // Dll entry point. Keep the dll instance
 //
 
 #if defined(__GNUC__)
 // If DllMain gets name mangled, it won't be seen.
 extern "C" {
 #endif
 
-// Windows CE is created when nsToolkit
-// starts up, not when the dll is loaded.
-#ifndef WINCE
 BOOL APIENTRY DllMain(  HINSTANCE hModule, 
                         DWORD reason, 
                         LPVOID lpReserved )
 {
     switch( reason ) {
         case DLL_PROCESS_ATTACH:
             nsToolkit::Startup(hModule);
             break;
@@ -108,17 +103,16 @@ BOOL APIENTRY DllMain(  HINSTANCE hModul
         case DLL_PROCESS_DETACH:
             nsToolkit::Shutdown();
             break;
 
     }
 
     return TRUE;
 }
-#endif //#ifndef WINCE
 
 #if defined(__GNUC__)
 } // extern "C"
 #endif
 
 #endif
 
 //
@@ -161,17 +155,17 @@ void RunPump(void* arg)
 // constructor
 //
 //-------------------------------------------------------------------------
 nsToolkit::nsToolkit()  
 {
     mGuiThread  = NULL;
     mDispatchWnd = 0;
 
-#if defined(MOZ_STATIC_COMPONENT_LIBS) || defined (WINCE)
+#if defined(MOZ_STATIC_COMPONENT_LIBS)
     nsToolkit::Startup(GetModuleHandle(NULL));
 #endif
 
     gMouseTrailer = new MouseTrailer();
 }
 
 
 //-------------------------------------------------------------------------
@@ -191,17 +185,17 @@ nsToolkit::~nsToolkit()
     PR_SetThreadPrivate(gToolkitTLSIndex, nsnull);
 
     if (gMouseTrailer) {
       gMouseTrailer->DestroyTimer();
       delete gMouseTrailer;
       gMouseTrailer = nsnull;
     }
 
-#if defined (MOZ_STATIC_COMPONENT_LIBS) || defined(WINCE)
+#if defined (MOZ_STATIC_COMPONENT_LIBS)
     nsToolkit::Shutdown();
 #endif
 }
 
 void
 nsToolkit::Startup(HMODULE hModule)
 {
     nsToolkit::mDllInstance = hModule;
@@ -227,19 +221,17 @@ nsToolkit::Startup(HMODULE hModule)
     typedef BOOL (*SetProcessDPIAwareFunc)(VOID);
 
     SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)
       GetProcAddress(LoadLibraryW(L"user32.dll"), "SetProcessDPIAware");
 
     if (setDPIAware)
       setDPIAware();
 
-#ifndef WINCE
     nsUXThemeData::Initialize();
-#endif
 }
 
 
 void
 nsToolkit::Shutdown()
 {
     // Crashes on certain XP machines/profiles - see bug 448104 for details
     //nsUXThemeData::Teardown();
@@ -350,31 +342,29 @@ NS_METHOD nsToolkit::Init(PRThread *aThr
 //
 // nsToolkit WindowProc. Used to call methods on the "main GUI thread"...
 //
 //-------------------------------------------------------------------------
 LRESULT CALLBACK nsToolkit::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, 
                                        LPARAM lParam)
 {
     switch (msg) {
-#ifndef WINCE
         case WM_SYSCOLORCHANGE:
         {
           // WM_SYSCOLORCHANGE messages are only dispatched to top
           // level windows but NS_SYSCOLORCHANGE messages must be dispatched
           // to all windows including child windows. We dispatch these messages 
           // from the nsToolkit because if we are running embedded we may not 
           // have a top-level nsIWidget window.
           
           // On WIN32 all windows are automatically invalidated after the 
           // WM_SYSCOLORCHANGE is dispatched so the window is drawn using
           // the current system colors.
           nsWindow::GlobalMsgWindowProc(hWnd, msg, wParam, lParam);
         }
-#endif
     }
 
     return ::DefWindowProcW(hWnd, msg, wParam, lParam);
 }
 
 
 
 //-------------------------------------------------------------------------
@@ -430,26 +420,24 @@ NS_METHOD NS_GetCurrentToolkit(nsIToolki
 PRBool nsToolkit::InitVersionInfo()
 {
   static PRBool isInitialized = PR_FALSE;
 
   if (!isInitialized)
   {
     isInitialized = PR_TRUE;
 
-#ifndef WINCE
     OSVERSIONINFO osversion;
     osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 
     ::GetVersionEx(&osversion);
 
     if (osversion.dwMajorVersion == 5)  { 
       nsToolkit::mIsWinXP = (osversion.dwMinorVersion == 1);
     }
-#endif
   }
 
   return PR_TRUE;
 }
 
 //-------------------------------------------------------------------------
 //
 //
@@ -553,20 +541,18 @@ void MouseTrailer::TimerProc(nsITimer* a
 
   if (mtrailer->mMouseTrailerWindow && ::IsWindow(mtrailer->mMouseTrailerWindow)) {
     POINT mp;
     DWORD pos = ::GetMessagePos();
     mp.x = GET_X_LPARAM(pos);
     mp.y = GET_Y_LPARAM(pos);
     HWND mouseWnd = ::WindowFromPoint(mp);
     if (mtrailer->mMouseTrailerWindow != mouseWnd) {
-#ifndef WINCE
       // Notify someone that a mouse exit happened.
       PostMessage(mtrailer->mMouseTrailerWindow, WM_MOUSELEAVE, 0, 0);
-#endif
 
       // we are out of this window, destroy timer
       mtrailer->DestroyTimer();
       mtrailer->mMouseTrailerWindow = nsnull;
     }
   } else {
     mtrailer->DestroyTimer();
     mtrailer->mMouseTrailerWindow = nsnull;
--- a/widget/src/windows/nsWinGesture.cpp
+++ b/widget/src/windows/nsWinGesture.cpp
@@ -81,19 +81,16 @@ nsWinGesture::nsWinGesture() :
   (void)InitLibrary();
   mPixelScrollOverflow = 0;
 }
 
 /* Load and shutdown */
 
 PRBool nsWinGesture::InitLibrary()
 {
-#ifdef WINCE
-  return PR_FALSE;
-#else
   if (getGestureInfo) {
     return PR_TRUE;
   } else if (sLibraryHandle) {
     return PR_FALSE;
   }
 
   sLibraryHandle = ::LoadLibraryW(kGestureLibraryName);
   HMODULE hTheme = nsUXThemeData::GetThemeDLL();
@@ -151,17 +148,16 @@ PRBool nsWinGesture::InitLibrary()
       PRBool flag;
       if (NS_SUCCEEDED(prefBranch->GetBoolPref("gestures.enable_single_finger_input", &flag))
           && flag)
         gEnableSingleFingerPanEvents = PR_TRUE;
     }
   }
 
   return PR_TRUE;
-#endif
 }
 
 #define GCOUNT 5
 
 PRBool nsWinGesture::SetWinGestureSupport(HWND hWnd, nsGestureNotifyEvent::ePanDirection aDirection)
 {
   if (!getGestureInfo)
     return PR_FALSE;
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -84,18 +84,16 @@
  * become unmanageable.
  *
  * Related source:
  *
  *  nsWindowDefs.h     - Definitions, macros, structs, enums
  *                       and general setup.
  *  nsWindowDbg.h/.cpp - Debug related code and directives.
  *  nsWindowGfx.h/.cpp - Graphics and painting.
- *  nsWindowCE.h/.cpp  - WINCE specific code that can be
- *                       split out from nsWindow.
  *
  */
 
 /**************************************************************
  **************************************************************
  **
  ** BLOCK: Includes
  **
@@ -154,49 +152,38 @@
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsString.h"
 #include "mozilla/Services.h"
 #include "nsNativeThemeWin.h"
 #include "nsWindowsDllInterceptor.h"
 #include "nsIWindowMediator.h"
 #include "nsIServiceManager.h"
-
-#if defined(WINCE)
-#include "nsWindowCE.h"
-#endif
-
-#if defined(WINCE_WINDOWS_MOBILE)
-#define KILL_PRIORITY_ID 2444
-#endif
-
 #include "nsWindowGfx.h"
 #include "gfxWindowsPlatform.h"
 #include "Layers.h"
-#ifndef WINCE
+
 #ifdef MOZ_ENABLE_D3D9_LAYER
 #include "LayerManagerD3D9.h"
 #endif
+
 #ifdef MOZ_ENABLE_D3D10_LAYER
 #include "LayerManagerD3D10.h"
 #endif
+
 #include "LayerManagerOGL.h"
 #include "nsIGfxInfo.h"
-#endif
 #include "BasicLayers.h"
-
-#if !defined(WINCE)
 #include "nsUXThemeConstants.h"
 #include "KeyboardLayout.h"
 #include "nsNativeDragTarget.h"
 #include <mmsystem.h> // needed for WIN32_LEAN_AND_MEAN
 #include <zmouse.h>
 #include <pbt.h>
 #include <richedit.h>
-#endif // !defined(WINCE)
 
 #if defined(ACCESSIBILITY)
 #include "oleidl.h"
 #include <winuser.h>
 #include "nsIAccessibleDocument.h"
 #if !defined(WINABLEAPI)
 #include <winable.h>
 #endif // !defined(WINABLEAPI)
@@ -215,22 +202,16 @@
 #endif // defined(MOZ_SPLASHSCREEN)
 
 // Windowless plugin support
 #include "npapi.h"
 
 #include "nsWindowDefs.h"
 
 #include "mozilla/FunctionTimer.h"
-
-#ifdef WINCE_WINDOWS_MOBILE
-#include "nsGfxCIID.h"
-#endif
-
-#include "mozilla/FunctionTimer.h"
 #include "nsCrashOnException.h"
 #include "nsIXULRuntime.h"
 
 using namespace mozilla::widget;
 using namespace mozilla::layers;
 
 /**************************************************************
  **************************************************************
@@ -324,33 +305,18 @@ MSG             nsWindow::sRedirectedKey
  **************************************************************/
 
 static const char *sScreenManagerContractID       = "@mozilla.org/gfx/screenmanager;1";
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* gWindowsLog                      = nsnull;
 #endif
 
-#ifndef WINCE
 // Kbd layout. Used throughout character processing.
 static KeyboardLayout gKbdLayout;
-#endif
-
-#ifdef WINCE_WINDOWS_MOBILE
-// HTC Navigation Wheel Event
-// This is the defined value for Gesture Mode
-const int WM_HTCNAV = 0x0400 + 200;
-
-typedef int (__stdcall * HTCApiNavOpen)(HANDLE, int);
-typedef int (__stdcall * HTCApiNavSetMode)(HANDLE, unsigned int);
-
-HTCApiNavOpen    gHTCApiNavOpen = nsnull;
-HTCApiNavSetMode gHTCApiNavSetMode = nsnull;
-static PRBool    gCheckForHTCApi = PR_FALSE;
-#endif
 
 // Global user preference for disabling native theme. Used
 // in NativeWindowTheme.
 PRBool          gDisableNativeTheme               = PR_FALSE;
 
 // Global used in Show window enumerations.
 static PRBool   gWindowsVisible                   = PR_FALSE;
 
@@ -442,36 +408,30 @@ nsWindow::nsWindow() : nsBaseWidget()
 
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
   mTaskbarPreview = nsnull;
   mHasTaskbarIconBeenCreated = PR_FALSE;
 #endif
 
   // Global initialization
   if (!sInstanceCount) {
-#if !defined(WINCE)
     gKbdLayout.LoadLayout(::GetKeyboardLayout(0));
-#endif
 
     // Init IME handler
     nsIMM32Handler::Initialize();
 
 #ifdef NS_ENABLE_TSF
     nsTextStore::Initialize();
 #endif
 
-#if !defined(WINCE)
     if (SUCCEEDED(::OleInitialize(NULL)))
       sIsOleInitialized = TRUE;
     NS_ASSERTION(sIsOleInitialized, "***** OLE is not initialized!\n");
-#endif
-
-#if !defined(WINCE)
+
     InitInputWorkaroundPrefDefaults();
-#endif
 
     // Init titlebar button info for custom frames.
     nsUXThemeData::InitTitlebarInfo();
     // Init theme data
     nsUXThemeData::UpdateNativeThemeInfo();
 
     ForgetRedirectedKeyDownMessage();
   } // !sInstanceCount
@@ -494,59 +454,44 @@ nsWindow::~nsWindow()
 
   sInstanceCount--;
 
   // Global shutdown
   if (sInstanceCount == 0) {
 #ifdef NS_ENABLE_TSF
     nsTextStore::Terminate();
 #endif
-
-#if !defined(WINCE)
     NS_IF_RELEASE(sCursorImgContainer);
     if (sIsOleInitialized) {
       ::OleFlushClipboard();
       ::OleUninitialize();
       sIsOleInitialized = FALSE;
     }
     // delete any of the IME structures that we allocated
     nsIMM32Handler::Terminate();
-#endif // !defined(WINCE)
-  }
-
-#if !defined(WINCE)
+  }
+
   NS_IF_RELEASE(mNativeDragTarget);
-#endif // !defined(WINCE)
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
 
 /**************************************************************
  *
  * SECTION: nsIWidget::Create, nsIWidget::Destroy
  *
  * Creating and destroying windows for this widget.
  *
  **************************************************************/
 
 // Allow Derived classes to modify the height that is passed
-// when the window is created or resized. Also add extra height
-// if needed (on Windows CE)
+// when the window is created or resized.
 PRInt32 nsWindow::GetHeight(PRInt32 aProposedHeight)
 {
-  PRInt32 extra = 0;
-
-  #if defined(WINCE) && !defined(WINCE_WINDOWS_MOBILE)
-  DWORD style = WindowStyle();
-  if ((style & WS_SYSMENU) && (style & WS_POPUP)) {
-    extra = GetSystemMetrics(SM_CYCAPTION);
-  }
-  #endif
-
-  return aProposedHeight + extra;
+  return aProposedHeight;
 }
 
 // Create the proper widget
 nsresult
 nsWindow::Create(nsIWidget *aParent,
                  nsNativeWidget aNativeParent,
                  const nsIntRect &aRect,
                  EVENT_CALLBACK aHandleEventFunction,
@@ -719,20 +664,16 @@ nsWindow::Create(nsIWidget *aParent,
           sSwitchKeyboardLayout = temp;
 
         if (NS_SUCCEEDED(prefBranch->GetBoolPref("mozilla.widget.disable-native-theme",
                                                  &temp)))
           gDisableNativeTheme = temp;
       }
     }
   }
-#if defined(WINCE_HAVE_SOFTKB)
-  if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel )
-     nsWindowCE::CreateSoftKeyMenuBar(mWnd);
-#endif
 
   return NS_OK;
 }
 
 // Close this nsWindow
 NS_METHOD nsWindow::Destroy()
 {
   // WM_DESTROY has already fired, we're done.
@@ -847,17 +788,16 @@ void nsWindow::GetWindowPopupClass(nsStr
  *
  * SECTION: Window styles utilities
  *
  * Return the proper windows styles and extended styles.
  *
  **************************************************************/
 
 // Return nsWindow styles
-#if !defined(WINCE) // implemented in nsWindowCE.cpp
 DWORD nsWindow::WindowStyle()
 {
   DWORD style;
 
   switch (mWindowType) {
     case eWindowType_plugin:
     case eWindowType_child:
       style = WS_OVERLAPPED;
@@ -926,37 +866,32 @@ DWORD nsWindow::WindowStyle()
         style |= WS_SYSMENU;
       }
     }
   }
 
   VERIFY_WINDOW_STYLE(style);
   return style;
 }
-#endif // !defined(WINCE)
 
 // Return nsWindow extended styles
 DWORD nsWindow::WindowExStyle()
 {
   switch (mWindowType)
   {
     case eWindowType_plugin:
     case eWindowType_child:
       return 0;
 
     case eWindowType_dialog:
       return WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME;
 
     case eWindowType_popup:
     {
-      DWORD extendedStyle =
-#if defined(WINCE) && !defined(WINCE_WINDOWS_MOBILE)
-        WS_EX_NOACTIVATE |
-#endif
-        WS_EX_TOOLWINDOW;
+      DWORD extendedStyle = WS_EX_TOOLWINDOW;
       if (mPopupLevel == ePopupLevelTop)
         extendedStyle |= WS_EX_TOPMOST;
       return extendedStyle;
     }
     default:
       NS_ERROR("unknown border style");
       // fall through
 
@@ -1139,25 +1074,22 @@ nsWindow* nsWindow::GetParentWindow(PRBo
     return nsnull;
 
 
   // aIncludeOwner set to true implies walking the parent chain to retrieve the
   // root owner. aIncludeOwner set to false implies the search will stop at the
   // true parent (default).
   nsWindow* widget = nsnull;
   if (mWnd) {
-#ifdef WINCE
-    HWND parent = ::GetParent(mWnd);
-#else
     HWND parent = nsnull;
     if (aIncludeOwner)
       parent = ::GetParent(mWnd);
     else
       parent = ::GetAncestor(mWnd, GA_PARENT);
-#endif
+
     if (parent) {
       widget = GetNSWindowPtr(parent);
       if (widget) {
         // If the widget is in the process of being destroyed then
         // do NOT return it
         if (widget->mInDtor) {
           widget = nsnull;
         }
@@ -1274,44 +1206,27 @@ NS_METHOD nsWindow::Show(PRBool bState)
 
   if (mWnd) {
     if (bState) {
       if (!wasVisible && mWindowType == eWindowType_toplevel) {
         // speed up the initial paint after show for
         // top level windows:
         syncInvalidate = PR_TRUE;
         switch (mSizeMode) {
-#ifdef WINCE
-          case nsSizeMode_Fullscreen:
-            ::SetForegroundWindow(mWnd);
-            ::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
-            MakeFullScreen(TRUE);
-            break;
-
-          case nsSizeMode_Maximized :
-            ::SetForegroundWindow(mWnd);
-            ::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
-            break;
-          // use default for nsSizeMode_Minimized on Windows CE
-#else
           case nsSizeMode_Fullscreen:
             ::ShowWindow(mWnd, SW_SHOW);
             break;
           case nsSizeMode_Maximized :
             ::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
             break;
           case nsSizeMode_Minimized :
             ::ShowWindow(mWnd, SW_SHOWMINIMIZED);
             break;
-#endif
           default:
             if (CanTakeFocus()) {
-#ifdef WINCE
-              ::SetForegroundWindow(mWnd);
-#endif
               ::ShowWindow(mWnd, SW_SHOWNORMAL);
             } else {
               // Place the window behind the foreground window
               // (as long as it is not topmost)
               HWND wndAfter = ::GetForegroundWindow();
               if (!wndAfter)
                 wndAfter = HWND_BOTTOM;
               else if (GetWindowLongPtrW(wndAfter, GWL_EXSTYLE) & WS_EX_TOPMOST)
@@ -1323,41 +1238,35 @@ NS_METHOD nsWindow::Show(PRBool bState)
             break;
         }
       } else {
         DWORD flags = SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW;
         if (wasVisible)
           flags |= SWP_NOZORDER;
 
         if (mWindowType == eWindowType_popup) {
-#ifndef WINCE
           // ensure popups are the topmost of the TOPMOST
           // layer. Remember not to set the SWP_NOZORDER
           // flag as that might allow the taskbar to overlap
-          // the popup.  However on windows ce, we need to
-          // activate the popup or clicks will not be sent.
+          // the popup.
           flags |= SWP_NOACTIVATE;
-#endif
           HWND owner = ::GetWindow(mWnd, GW_OWNER);
           ::SetWindowPos(mWnd, owner ? 0 : HWND_TOPMOST, 0, 0, 0, 0, flags);
         } else {
-#ifndef WINCE
           if (mWindowType == eWindowType_dialog && !CanTakeFocus())
             flags |= SWP_NOACTIVATE;
-#endif
+
           ::SetWindowPos(mWnd, HWND_TOP, 0, 0, 0, 0, flags);
         }
       }
 
-#ifndef WINCE
       if (!wasVisible && (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog)) {
         // when a toplevel window or dialog is shown, initialize the UI state
         ::SendMessageW(mWnd, WM_CHANGEUISTATE, MAKEWPARAM(UIS_INITIALIZE, UISF_HIDEFOCUS | UISF_HIDEACCEL), 0);
       }
-#endif
     } else {
       if (mWindowType != eWindowType_dialog) {
         ::ShowWindow(mWnd, SW_HIDE);
       } else {
         ::SetWindowPos(mWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
                        SWP_NOZORDER | SWP_NOACTIVATE);
       }
     }
@@ -1394,28 +1303,25 @@ NS_METHOD nsWindow::IsVisible(PRBool & b
  * window clipping regions for window transparency.
  *
  **************************************************************/
 
 // XP and Vista visual styles sometimes require window clipping regions to be applied for proper
 // transparency. These routines are called on size and move operations.
 void nsWindow::ClearThemeRegion()
 {
-#ifndef WINCE
   if (nsUXThemeData::sIsVistaOrLater && !HasGlass() &&
       (mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
        (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
     SetWindowRgn(mWnd, NULL, false);
   }
-#endif
 }
 
 void nsWindow::SetThemeRegion()
 {
-#ifndef WINCE
   // Popup types that have a visual styles region applied (bug 376408). This can be expanded
   // for other window types as needed. The regions are applied generically to the base window
   // so default constants are used for part and state. At some point we might need part and
   // state values from nsNativeThemeWin's GetThemePartAndState, but currently windows that
   // change shape based on state haven't come up.
   if (nsUXThemeData::sIsVistaOrLater && !HasGlass() &&
       (mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
        (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
@@ -1425,61 +1331,54 @@ void nsWindow::SetThemeRegion()
     HDC dc = ::GetDC(mWnd);
     nsUXThemeData::getThemeBackgroundRegion(nsUXThemeData::GetTheme(eUXTooltip), dc, TTP_STANDARD, TS_NORMAL, &rect, &hRgn);
     if (hRgn) {
       if (!SetWindowRgn(mWnd, hRgn, false)) // do not delete or alter hRgn if accepted.
         DeleteObject(hRgn);
     }
     ::ReleaseDC(mWnd, dc);
   }
-#endif
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::RegisterTouchWindow,
  * nsIWidget::UnregisterTouchWindow, and helper functions
  *
  * Used to register the native window to receive touch events
  *
  **************************************************************/
 
 NS_METHOD nsWindow::RegisterTouchWindow() {
   mTouchWindow = PR_TRUE;
-#ifndef WINCE
   mGesture.RegisterTouchWindow(mWnd);
   ::EnumChildWindows(mWnd, nsWindow::RegisterTouchForDescendants, 0);
-#endif
   return NS_OK;
 }
 
 NS_METHOD nsWindow::UnregisterTouchWindow() {
   mTouchWindow = PR_FALSE;
-#ifndef WINCE
   mGesture.UnregisterTouchWindow(mWnd);
   ::EnumChildWindows(mWnd, nsWindow::UnregisterTouchForDescendants, 0);
-#endif
   return NS_OK;
 }
 
-#ifndef WINCE
 BOOL CALLBACK nsWindow::RegisterTouchForDescendants(HWND aWnd, LPARAM aMsg) {
   nsWindow* win = GetNSWindowPtr(aWnd);
   if (win)
     win->mGesture.RegisterTouchWindow(aWnd);
   return TRUE;
 }
 
 BOOL CALLBACK nsWindow::UnregisterTouchForDescendants(HWND aWnd, LPARAM aMsg) {
   nsWindow* win = GetNSWindowPtr(aWnd);
   if (win)
     win->mGesture.UnregisterTouchWindow(aWnd);
   return TRUE;
 }
-#endif
 
 /**************************************************************
  *
  * SECTION: nsIWidget::Move, nsIWidget::Resize,
  * nsIWidget::Size, nsIWidget::BeginResizeDrag
  *
  * Repositioning and sizing a window.
  *
@@ -1564,21 +1463,19 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidt
 
   // Set cached value for lightweight and printing
   mBounds.width  = aWidth;
   mBounds.height = aHeight;
 
   if (mWnd) {
     UINT  flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE;
 
-#ifndef WINCE
     if (!aRepaint) {
       flags |= SWP_NOREDRAW;
     }
-#endif
 
     ClearThemeRegion();
     VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
     SetThemeRegion();
   }
 
   if (aRepaint)
     Invalidate(PR_FALSE);
@@ -1605,21 +1502,19 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, P
   // Set cached value for lightweight and printing
   mBounds.x      = aX;
   mBounds.y      = aY;
   mBounds.width  = aWidth;
   mBounds.height = aHeight;
 
   if (mWnd) {
     UINT  flags = SWP_NOZORDER | SWP_NOACTIVATE;
-#ifndef WINCE
     if (!aRepaint) {
       flags |= SWP_NOREDRAW;
     }
-#endif
 
     ClearThemeRegion();
     VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
     SetThemeRegion();
   }
 
   if (aRepaint)
     Invalidate(PR_FALSE);
@@ -1646,17 +1541,16 @@ NS_METHOD nsWindow::ResizeClient(PRInt32
     GetScreenBounds(bounds);
     aX += bounds.x;
     aY += bounds.y;
     return Resize(aX, aY, aWidth, aHeight, aRepaint);
   }
   return Resize(aWidth, aHeight, aRepaint);
 }
 
-#if !defined(WINCE)
 NS_IMETHODIMP
 nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
 {
   NS_ENSURE_ARG_POINTER(aEvent);
 
   if (aEvent->eventStructType != NS_MOUSE_EVENT) {
     // you can only begin a resize drag with a mouse event
     return NS_ERROR_INVALID_ARG;
@@ -1703,17 +1597,17 @@ nsWindow::BeginResizeDrag(nsGUIEvent* aE
   HWND toplevelWnd = GetTopLevelHWND(mWnd, PR_TRUE);
 
   // tell Windows to start the resize
   ::PostMessage(toplevelWnd, WM_SYSCOMMAND, syscommand,
                 POINTTOPOINTS(aEvent->refPoint));
 
   return NS_OK;
 }
-#endif
+
 /**************************************************************
  *
  * SECTION: Window Z-order and state.
  *
  * nsIWidget::PlaceBehind, nsIWidget::SetSizeMode,
  * nsIWidget::ConstrainPosition
  *
  * Z-order, positioning, restore, minimize, and maximize.
@@ -1745,17 +1639,16 @@ NS_METHOD nsWindow::PlaceBehind(nsTopLev
     flags |= SWP_NOACTIVATE;
   }
 
   ::SetWindowPos(mWnd, behind, 0, 0, 0, 0, flags);
   return NS_OK;
 }
 
 // Maximize, minimize or restore the window.
-#if !defined(WINCE) // implemented in nsWindowCE.cpp
 NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) {
 
   nsresult rv;
 
   // Let's not try and do anything if we're already in that state.
   // (This is needed to prevent problems when calling window.minimize(), which
   // calls us directly, and then the OS triggers another call to us.)
   if (aMode == mSizeMode)
@@ -1791,17 +1684,16 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRIn
     ::ShowWindow(mWnd, mode);
     // we dispatch an activate event here to ensure that the right child window
     // is focused
     if (mode == SW_RESTORE || mode == SW_MAXIMIZE)
       DispatchFocusToTopLevelWindow(NS_ACTIVATE);
   }
   return rv;
 }
-#endif // !defined(WINCE)
 
 // Constrain a potential move to fit onscreen
 NS_METHOD nsWindow::ConstrainPosition(PRBool aAllowSlop,
                                       PRInt32 *aX, PRInt32 *aY)
 {
   if (!mIsTopWidgetWindow) // only a problem for top-level windows
     return NS_OK;
 
@@ -1897,23 +1789,17 @@ NS_METHOD nsWindow::Enable(PRBool bState
   }
   return NS_OK;
 }
 
 // Return the current enable state
 NS_METHOD nsWindow::IsEnabled(PRBool *aState)
 {
   NS_ENSURE_ARG_POINTER(aState);
-
-#ifndef WINCE
   *aState = !mWnd || (::IsWindowEnabled(mWnd) && ::IsWindowEnabled(::GetAncestor(mWnd, GA_ROOT)));
-#else
-  *aState = !mWnd || (::IsWindowEnabled(mWnd) && ::IsWindowEnabled(mWnd));
-#endif
-
   return NS_OK;
 }
 
 
 /**************************************************************
  *
  * SECTION: nsIWidget::SetFocus
  *
@@ -2229,17 +2115,16 @@ nsWindow::UpdateNonClientMargins(PRInt32
   else if (mNonClientMargins.right > 0)
     mNonClientOffset.right = mHorResizeMargin - mNonClientMargins.right;
 
   if (!mNonClientMargins.bottom)
     mNonClientOffset.bottom = mVertResizeMargin;
   else if (mNonClientMargins.bottom > 0)
     mNonClientOffset.bottom = mVertResizeMargin - mNonClientMargins.bottom;
 
-#ifndef WINCE
   if (aSizeMode == nsSizeMode_Maximized) {
     // Address an issue with auto-hide taskbars which fall behind the window.
     // Ensure a 1 pixel margin at the bottom of the monitor so that unhiding
     // the taskbar works properly.
     MONITORINFO info = {sizeof(MONITORINFO)};
     if (::GetMonitorInfo(::MonitorFromWindow(mWnd, MONITOR_DEFAULTTOPRIMARY),
                          &info)) {
       RECT r;
@@ -2253,17 +2138,16 @@ nsWindow::UpdateNonClientMargins(PRInt32
         if (r.top <= info.rcMonitor.top &&
             r.left <= info.rcMonitor.left && 
             r.right >= info.rcMonitor.right &&
             r.bottom >= info.rcMonitor.bottom)
           mNonClientOffset.bottom -= r.bottom - info.rcMonitor.bottom + 1;
       }
     }
   }
-#endif
 
   if (aReflowWindow) {
     // Force a reflow of content based on the new client
     // dimensions.
     ResetLayout();
   }
 
   return PR_TRUE;
@@ -2371,21 +2255,19 @@ nsWindow::ExcludeNonClientFromPaintRegio
 NS_METHOD nsWindow::SetBackgroundColor(const nscolor &aColor)
 {
   nsBaseWidget::SetBackgroundColor(aColor);
 
   if (mBrush)
     ::DeleteObject(mBrush);
 
   mBrush = ::CreateSolidBrush(NSRGB_2_COLOREF(mBackground));
-#ifndef WINCE
   if (mWnd != NULL) {
     ::SetClassLongPtrW(mWnd, GCLP_HBRBACKGROUND, (LONG_PTR)mBrush);
   }
-#endif
   return NS_OK;
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::SetCursor
  *
  * SetCursor and related utilities for manging cursor state.
@@ -2844,57 +2726,16 @@ NS_METHOD nsWindow::Invalidate(const nsI
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::MakeFullScreen(PRBool aFullScreen)
 {
-#if WINCE_WINDOWS_MOBILE
-  RECT rc;
-  if (aFullScreen) {
-    SetForegroundWindow(mWnd);
-    if (nsWindowCE::sMenuBarShown) {
-      SIPINFO sipInfo;
-      memset(&sipInfo, 0, sizeof(SIPINFO));
-      sipInfo.cbSize = sizeof(SIPINFO);
-      if (SipGetInfo(&sipInfo))
-        SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), 
-                sipInfo.rcVisibleDesktop.bottom);
-      else
-        SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), 
-                GetSystemMetrics(SM_CYSCREEN));
-      RECT menuBarRect;
-      if (GetWindowRect(nsWindowCE::sSoftKeyMenuBarHandle, &menuBarRect) && 
-          menuBarRect.top < rc.bottom)
-        rc.bottom = menuBarRect.top;
-      SHFullScreen(mWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_SHOWSIPBUTTON);
-    } else {
-      
-      SHFullScreen(mWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
-      SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
-    }
-  }
-  else {
-    SHFullScreen(mWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON);
-    SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE);
-  }
-
-  if (aFullScreen)
-    mSizeMode = nsSizeMode_Fullscreen;
-
-  // nsBaseWidget hides the chrome and resizes the window, replicate that here
-  HideWindowChrome(aFullScreen);
-  Resize(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, PR_TRUE);
-
-  return NS_OK;
-
-#else
-
   mFullscreenMode = aFullScreen;
   if (aFullScreen) {
     if (mSizeMode == nsSizeMode_Fullscreen)
       return NS_OK;
     mOldSizeMode = mSizeMode;
     SetSizeMode(nsSizeMode_Fullscreen);
   } else {
     SetSizeMode(mOldSizeMode);
@@ -2918,17 +2759,16 @@ nsWindow::MakeFullScreen(PRBool aFullScr
 
   // Let the dom know via web shell window
   nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
   event.mSizeMode = mSizeMode;
   InitEvent(event);
   DispatchWindowEvent(&event);
 
   return rv;
-#endif
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::Update
  *
  * Force a synchronous repaint of the window.
  *
@@ -3047,17 +2887,16 @@ NS_METHOD nsWindow::SetTitle(const nsASt
  * SECTION: nsIWidget::SetIcon
  *
  * Set the main windows icon.
  *
  **************************************************************/
 
 NS_METHOD nsWindow::SetIcon(const nsAString& aIconSpec) 
 {
-#ifndef WINCE
   // Assume the given string is a local identifier for an icon file.
 
   nsCOMPtr<nsILocalFile> iconFile;
   ResolveIconName(aIconSpec, NS_LITERAL_STRING(".ico"),
                   getter_AddRefs(iconFile));
   if (!iconFile)
     return NS_OK; // not an error if icon is not found
 
@@ -3098,17 +2937,16 @@ NS_METHOD nsWindow::SetIcon(const nsAStr
       ::DestroyIcon(icon);
   }
 #ifdef DEBUG_SetIcon
   else {
     NS_LossyConvertUTF16toASCII cPath(iconPath);
     printf( "\nSmall icon load error; icon=%s, rc=0x%08X\n\n", cPath.get(), ::GetLastError() );
   }
 #endif
-#endif // WINCE
   return NS_OK;
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::WidgetToScreenOffset
  *
  * Return this widget's origin in screen coordinates.
@@ -3143,17 +2981,16 @@ nsIntSize nsWindow::ClientToWindowSize(c
 /**************************************************************
  *
  * SECTION: nsIWidget::EnableDragDrop
  *
  * Enables/Disables drag and drop of files on this widget.
  *
  **************************************************************/
 
-#if !defined(WINCE) // implemented in nsWindowCE.cpp
 NS_METHOD nsWindow::EnableDragDrop(PRBool aEnable)
 {
   NS_ASSERTION(mWnd, "nsWindow::EnableDragDrop() called after Destroy()");
 
   nsresult rv = NS_ERROR_FAILURE;
   if (aEnable) {
     if (nsnull == mNativeDragTarget) {
        mNativeDragTarget = new nsNativeDragTarget(this);
@@ -3173,17 +3010,16 @@ NS_METHOD nsWindow::EnableDragDrop(PRBoo
         rv = NS_OK;
       }
       mNativeDragTarget->DragCancel();
       NS_RELEASE(mNativeDragTarget);
     }
   }
   return rv;
 }
-#endif
 
 /**************************************************************
  *
  * SECTION: nsIWidget::CaptureMouse
  *
  * Enables/Disables system mouse capture.
  *
  **************************************************************/
@@ -3229,33 +3065,26 @@ NS_IMETHODIMP nsWindow::CaptureRollupEve
     sRollupConsumeEvent = aConsumeRollupEvent;
     NS_IF_RELEASE(sRollupWidget);
     NS_IF_RELEASE(sMenuRollup);
     sRollupListener = aListener;
     sMenuRollup = aMenuRollup;
     NS_IF_ADDREF(aMenuRollup);
     sRollupWidget = this;
     NS_ADDREF(this);
-
-#ifndef WINCE
     if (!sMsgFilterHook && !sCallProcHook && !sCallMouseHook) {
       RegisterSpecialDropdownHooks();
     }
     sProcessHook = PR_TRUE;
-#endif
-    
   } else {
     sRollupListener = nsnull;
     NS_IF_RELEASE(sMenuRollup);
     NS_IF_RELEASE(sRollupWidget);
-    
-#ifndef WINCE
     sProcessHook = PR_FALSE;
     UnregisterSpecialDropdownHooks();
-#endif
   }
 
   return NS_OK;
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::GetAttention
@@ -3263,17 +3092,16 @@ NS_IMETHODIMP nsWindow::CaptureRollupEve
  * Bring this window to the user's attention.
  *
  **************************************************************/
 
 // Draw user's attention to this window until it comes to foreground.
 NS_IMETHODIMP
 nsWindow::GetAttention(PRInt32 aCycleCount)
 {
-#ifndef WINCE
   // Got window?
   if (!mWnd)
     return NS_ERROR_NOT_INITIALIZED;
 
   // Don't flash if the flash count is 0 or if the
   // top level window is already active.
   HWND fgWnd = ::GetForegroundWindow();
   if (aCycleCount == 0 || fgWnd == GetTopLevelHWND(mWnd))
@@ -3289,32 +3117,30 @@ nsWindow::GetAttention(PRInt32 aCycleCou
     return NS_OK;
 
   DWORD defaultCycleCount = 0;
   ::SystemParametersInfo(SPI_GETFOREGROUNDFLASHCOUNT, 0, &defaultCycleCount, 0);
 
   FLASHWINFO flashInfo = { sizeof(FLASHWINFO), flashWnd,
     FLASHW_ALL, aCycleCount > 0 ? aCycleCount : defaultCycleCount, 0 };
   ::FlashWindowEx(&flashInfo);
-#endif
+
   return NS_OK;
 }
 
 void nsWindow::StopFlashing()
 {
-#ifndef WINCE
   HWND flashWnd = mWnd;
   while (HWND ownerWnd = ::GetWindow(flashWnd, GW_OWNER)) {
     flashWnd = ownerWnd;
   }
 
   FLASHWINFO flashInfo = { sizeof(FLASHWINFO), flashWnd,
     FLASHW_STOP, 0, 0 };
   ::FlashWindowEx(&flashInfo);
-#endif
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::HasPendingInputEvent
  *
  * Ask whether there user input events pending.  All input events are
  * included, including those not targeted at this nsIwidget instance.
@@ -3326,25 +3152,21 @@ nsWindow::HasPendingInputEvent()
 {
   // If there is pending input or the user is currently
   // moving the window then return true.
   // Note: When the user is moving the window WIN32 spins
   // a separate event loop and input events are not
   // reported to the application.
   if (HIWORD(GetQueueStatus(QS_INPUT)))
     return PR_TRUE;
-#ifdef WINCE
-  return PR_FALSE;
-#else
   GUITHREADINFO guiInfo;
   guiInfo.cbSize = sizeof(GUITHREADINFO);
   if (!GetGUIThreadInfo(GetCurrentThreadId(), &guiInfo))
     return PR_FALSE;
   return GUI_INMOVESIZE == (guiInfo.flags & GUI_INMOVESIZE);
-#endif
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::GetLayerManager
  *
  * Get the layer manager associated with this widget.
  *
@@ -3394,17 +3216,16 @@ GetLayerManagerPrefs(LayerManagerPrefs* 
 
 mozilla::layers::LayerManager*
 nsWindow::GetLayerManager(LayerManagerPersistence aPersistence, bool* aAllowRetaining)
 {
   if (aAllowRetaining) {
     *aAllowRetaining = true;
   }
 
-#ifndef WINCE
 #ifdef MOZ_ENABLE_D3D10_LAYER
   if (mLayerManager) {
     if (mLayerManager->GetBackendType() ==
         mozilla::layers::LayerManager::LAYERS_D3D10)
     {
       mozilla::layers::LayerManagerD3D10 *layerManagerD3D10 =
         static_cast<mozilla::layers::LayerManagerD3D10*>(mLayerManager.get());
       if (layerManagerD3D10->device() !=
@@ -3480,17 +3301,16 @@ nsWindow::GetLayerManager(LayerManagerPe
         }
       }
     }
 
     // Fall back to software if we couldn't use any hardware backends.
     if (!mLayerManager)
       mLayerManager = CreateBasicLayerManager();
   }
-#endif
 
   return mLayerManager;
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::GetThebesSurface
  *
@@ -3536,19 +3356,16 @@ gfxASurface *nsWindow::GetThebesSurface(
  *
  * Called after the dialog is loaded and it has a default button.
  *
  **************************************************************/
  
 NS_IMETHODIMP
 nsWindow::OnDefaultButtonLoaded(const nsIntRect &aButtonRect)
 {
-#ifdef WINCE
-  return NS_ERROR_NOT_IMPLEMENTED;
-#else
   if (aButtonRect.IsEmpty())
     return NS_OK;
 
   // Don't snap when we are not active.
   HWND activeWnd = ::GetActiveWindow();
   if (activeWnd != ::GetForegroundWindow() ||
       GetTopLevelHWND(mWnd, PR_TRUE) != GetTopLevelHWND(activeWnd, PR_TRUE)) {
     return NS_OK;
@@ -3585,17 +3402,16 @@ nsWindow::OnDefaultButtonLoaded(const ns
     return NS_OK;
   }
 
   if (!::SetCursorPos(centerOfButton.x, centerOfButton.y)) {
     NS_ERROR("SetCursorPos failed");
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
-#endif
 }
 
 NS_IMETHODIMP
 nsWindow::OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta,
                                          PRBool aIsHorizontal,
                                          PRInt32 &aOverriddenDelta)
 {
   // The default vertical and horizontal scrolling speed is 3, this is defined
@@ -3716,22 +3532,17 @@ void nsWindow::InitEvent(nsGUIEvent& eve
     }
   }
   else {  
     // use the point override if provided
     event.refPoint.x = aPoint->x;
     event.refPoint.y = aPoint->y;
   }
 
-#ifndef WINCE
   event.time = ::GetMessageTime();
-#else
-  event.time = PR_Now() / 1000;
-#endif
-
   mLastPoint = event.refPoint;
 }
 
 /**************************************************************
  *
  * SECTION: Moz event dispatch helpers
  *
  * Helpers for dispatching different types of moz events.
@@ -3951,21 +3762,17 @@ void nsWindow::DispatchPendingEvents()
   if (::GetQueueStatus(QS_PAINT)) {
     // Find the top level window.
     HWND topWnd = GetTopLevelHWND(mWnd);
 
     // Dispatch pending paints for topWnd and all its descendant windows.
     // Note: EnumChildWindows enumerates all descendant windows not just
     // the children (but not the window itself).
     nsWindow::DispatchStarvedPaints(topWnd, 0);
-#if !defined(WINCE)
     ::EnumChildWindows(topWnd, nsWindow::DispatchStarvedPaints, 0);
-#else
-    nsWindowCE::EnumChildWindows(topWnd, nsWindow::DispatchStarvedPaints, NULL);
-#endif
   }
 }
 
 // Deal with plugin events
 PRBool nsWindow::DispatchPluginEvent(const MSG &aMsg)
 {
   if (!PluginHasFocus())
     return PR_FALSE;
@@ -4089,21 +3896,17 @@ PRBool nsWindow::DispatchMouseEvent(PRUi
       break;
     default:
       eventButton = 0;
       break;
   }
 
   // Doubleclicks are used to set the click count, then changed to mousedowns
   // We're going to time double-clicks from mouse *up* to next mouse *down*
-#ifndef WINCE
   LONG curMsgTime = ::GetMessageTime();
-#else
-  LONG curMsgTime = PR_Now() / 1000;
-#endif
 
   if (aEventType == NS_MOUSE_DOUBLECLICK) {
     event.message = NS_MOUSE_BUTTON_DOWN;
     event.button = aButton;
     sLastClickCount = 2;
   }
   else if (aEventType == NS_MOUSE_BUTTON_UP) {
     // remember when this happened for the next mouse down
@@ -4755,17 +4558,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
       nsUXThemeData::CheckForCompositor() &&
       nsUXThemeData::dwmDwmDefWindowProcPtr(mWnd, msg, wParam, lParam, &dwmHitResult)) {
     *aRetValue = dwmHitResult;
     return PR_TRUE;
   }
 #endif // MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 
   switch (msg) {
-#ifndef WINCE
     // WM_QUERYENDSESSION must be handled by all windows.
     // Otherwise Windows thinks the window can just be killed at will.
     case WM_QUERYENDSESSION:
       if (sCanQuit == TRI_UNKNOWN)
       {
         // Ask if it's ok to quit, and store the answer until we
         // get WM_ENDSESSION signaling the round is complete.
         nsCOMPtr<nsIObserverService> obsServ =
@@ -4777,21 +4579,18 @@ PRBool nsWindow::ProcessMessage(UINT msg
 
         PRBool abortQuit;
         cancelQuit->GetData(&abortQuit);
         sCanQuit = abortQuit ? TRI_FALSE : TRI_TRUE;
       }
       *aRetValue = sCanQuit ? TRUE : FALSE;
       result = PR_TRUE;
       break;
-#endif
-
-#ifndef WINCE
+
     case WM_ENDSESSION:
-#endif
     case MOZ_WM_APP_QUIT:
       if (msg == MOZ_WM_APP_QUIT || (wParam == TRUE && sCanQuit == TRI_TRUE))
       {
         // Let's fake a shutdown sequence without actually closing windows etc.
         // to avoid Windows killing us in the middle. A proper shutdown would
         // require having a chance to pump some messages. Unfortunately
         // Windows won't let us do that. Bug 212316.
         nsCOMPtr<nsIObserverService> obsServ =
@@ -4805,21 +4604,19 @@ PRBool nsWindow::ProcessMessage(UINT msg
         obsServ->NotifyObservers(nsnull, "profile-before-change", context.get());
         // Then a controlled but very quick exit.
         _exit(0);
       }
       sCanQuit = TRI_UNKNOWN;
       result = PR_TRUE;
       break;
 
-#ifndef WINCE
     case WM_DISPLAYCHANGE:
       DispatchStandardEvent(NS_DISPLAYCHANGED);
       break;
-#endif
 
     case WM_SYSCOLORCHANGE:
       // Note: This is sent for child windows as well as top-level windows.
       // The Win32 toolkit normally only sends these events to top-level windows.
       // But we cycle through all of the childwindows and send it to them as well
       // so all presentations get notified properly.
       // See nsWindow::GlobalMsgWindowProc.
       DispatchStandardEvent(NS_SYSCOLORCHANGED);
@@ -5021,17 +4818,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
                                     msg, (WPARAM)paintRgn, lParam);
       if (paintRgn != (HRGN)wParam)
         DeleteObject(paintRgn);
       *aRetValue = res;
       result = PR_TRUE;
     }
     break;
 
-#ifndef WINCE
     case WM_POWERBROADCAST:
       // only hidden window handle this
       // to prevent duplicate notification
       if (mWindowType == eWindowType_invisible) {
         switch (wParam)
         {
           case PBT_APMSUSPEND:
             PostSleepWakeNotification("sleep_notification");
@@ -5039,17 +4835,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
           case PBT_APMRESUMEAUTOMATIC:
           case PBT_APMRESUMECRITICAL:
           case PBT_APMRESUMESUSPEND:
             PostSleepWakeNotification("wake_notification");
             break;
         }
       }
       break;
-#endif
 
     case WM_MOVE: // Window moved
     {
       RECT rect;
       ::GetWindowRect(mWnd, &rect);
       result = OnMove(rect.left, rect.top);
     }
     break;
@@ -5065,21 +4860,19 @@ PRBool nsWindow::ProcessMessage(UINT msg
       result = PR_TRUE;
       break;
 
     case WM_PAINT:
       *aRetValue = (int) OnPaint(NULL, 0);
       result = PR_TRUE;
       break;
 
-#ifndef WINCE
     case WM_PRINTCLIENT:
       result = OnPaint((HDC) wParam, 0);
       break;
-#endif
 
     case WM_HOTKEY:
       result = OnHotKey(wParam, lParam);
       break;
 
     case WM_SYSCHAR:
     case WM_CHAR:
     {
@@ -5114,21 +4907,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
       if (!AutoErase((HDC)wParam)) {
         *aRetValue = 1;
         result = PR_TRUE;
       }
       break;
 
     case WM_MOUSEMOVE:
     {
-#ifdef WINCE_WINDOWS_MOBILE
-      // Reset the kill timer so that we can continue at this
-      // priority
-      SetTimer(mWnd, KILL_PRIORITY_ID, 2000 /* 2seconds */, NULL);
-#endif
       mMousePresent = PR_TRUE;
 
       // Suppress dispatch of pending events
       // when mouse moves are generated by widget
       // creation instead of user input.
       LPARAM lParamScreen = lParamToScreen(lParam);
       POINT mp;
       mp.x      = GET_X_LPARAM(lParamScreen);
@@ -5148,49 +4936,32 @@ PRBool nsWindow::ProcessMessage(UINT msg
 
     case WM_NCMOUSEMOVE:
       // If we receive a mouse move event on non-client chrome, make sure and
       // send an NS_MOUSE_EXIT event as well.
       if (mMousePresent && !sIsInMouseCapture)
         SendMessage(mWnd, WM_MOUSELEAVE, 0, 0);
     break;
 
-#ifdef WINCE_WINDOWS_MOBILE
-    case WM_TIMER:
-      SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
-      KillTimer(mWnd, KILL_PRIORITY_ID);
-      break;
-#endif
-
     case WM_LBUTTONDOWN:
     {
-#ifdef WINCE_WINDOWS_MOBILE
-      SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
-      SetTimer(mWnd, KILL_PRIORITY_ID, 2000 /* 2 seconds */, NULL);
-#endif
       result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam, lParam,
                                   PR_FALSE, nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
     }
     break;
 
     case WM_LBUTTONUP:
     {
       result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, wParam, lParam,
                                   PR_FALSE, nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
-
-#ifdef WINCE_WINDOWS_MOBILE
-      SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
-      KillTimer(mWnd, KILL_PRIORITY_ID);
-#endif
     }
     break;
 
-#ifndef WINCE
     case WM_MOUSELEAVE:
     {
       if (!mMousePresent)
         break;
       mMousePresent = PR_FALSE;
 
       // We need to check mouse button states and put them in for
       // wParam.
@@ -5199,17 +4970,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
         | (GetKeyState(VK_RBUTTON) ? MK_RBUTTON : 0);
       // Synthesize an event position because we don't get one from
       // WM_MOUSELEAVE.
       LPARAM pos = lParamToClient(::GetMessagePos());
       DispatchMouseEvent(NS_MOUSE_EXIT, mouseState, pos, PR_FALSE,
                          nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
     }
     break;
-#endif
 
     case WM_CONTEXTMENU:
     {
       // if the context menu is brought up from the keyboard, |lParam|
       // will be -1.
       LPARAM pos;
       PRBool contextMenukey = PR_FALSE;
       if (lParam == -1)
@@ -5358,74 +5128,42 @@ PRBool nsWindow::ProcessMessage(UINT msg
     // the focus system about this until the WM_SETFOCUS or WM_KILLFOCUS
     // events are fired. Instead, set either the sJustGotActivate or
     // gJustGotDeativate flags and fire the NS_ACTIVATE or NS_DEACTIVATE
     // events once the focus events arrive.
     case WM_ACTIVATE:
       if (mEventCallback) {
         PRInt32 fActive = LOWORD(wParam);
 
-#if defined(WINCE_HAVE_SOFTKB)
-        if (mIsTopWidgetWindow && sSoftKeyboardState)
-          nsWindowCE::ToggleSoftKB(mWnd, fActive);
-        if (nsWindowCE::sShowSIPButton == TRI_FALSE && WA_INACTIVE != fActive) {
-          HWND hWndSIPB = FindWindowW(L"MS_SIPBUTTON", NULL ); 
-          if (hWndSIPB)
-            ShowWindow(hWndSIPB, SW_HIDE);
-        }
-
-#endif
-
         if (WA_INACTIVE == fActive) {
           // when minimizing a window, the deactivation and focus events will
           // be fired in the reverse order. Instead, just dispatch
           // NS_DEACTIVATE right away.
           if (HIWORD(wParam))
             result = DispatchFocusToTopLevelWindow(NS_DEACTIVATE);
           else
             sJustGotDeactivate = PR_TRUE;
-#ifndef WINCE
+
           if (mIsTopWidgetWindow)
             mLastKeyboardLayout = gKbdLayout.GetLayout();
-#endif
 
         } else {
           StopFlashing();
 
           sJustGotActivate = PR_TRUE;
           nsMouseEvent event(PR_TRUE, NS_MOUSE_ACTIVATE, this,
                              nsMouseEvent::eReal);
           InitEvent(event);
           DispatchWindowEvent(&event);
-#ifndef WINCE
           if (sSwitchKeyboardLayout && mLastKeyboardLayout)
             ActivateKeyboardLayout(mLastKeyboardLayout, 0);
-#endif
         }
       }
-#ifdef WINCE_WINDOWS_MOBILE
-      if (!gCheckForHTCApi && gHTCApiNavOpen == nsnull) {
-        gCheckForHTCApi = PR_TRUE;
-
-        HINSTANCE library = LoadLibrary(L"HTCAPI.dll"); 
-        gHTCApiNavOpen    = (HTCApiNavOpen)    GetProcAddress(library, "HTCNavOpen"); 
-        gHTCApiNavSetMode = (HTCApiNavSetMode) GetProcAddress(library ,"HTCNavSetMode"); 
-      }
-      
-      if (gHTCApiNavOpen != nsnull) {
-        gHTCApiNavOpen(mWnd, 1 /* undocumented value */);
-
-        if (gHTCApiNavSetMode != nsnull)
-          gHTCApiNavSetMode ( mWnd, 4);
-        // 4 is Gesture Mode. This will generate WM_HTCNAV events to the window
-      }
-#endif
       break;
       
-#ifndef WINCE
     case WM_MOUSEACTIVATE:
       if (mWindowType == eWindowType_popup) {
         // a popup with a parent owner should not be activated when clicked
         // but should still allow the mouse event to be fired, so the return
         // value is set to MA_NOACTIVATE. But if the owner isn't the frontmost
         // window, just use default processing so that the window is activated.
         HWND owner = ::GetWindow(mWnd, GW_OWNER);
         if (owner && owner == ::GetForegroundWindow()) {
@@ -5436,17 +5174,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
       break;
 
     case WM_WINDOWPOSCHANGING:
     {
       LPWINDOWPOS info = (LPWINDOWPOS) lParam;
       OnWindowPosChanging(info);
     }
     break;
-#endif
 
     case WM_SETFOCUS:
       // If previous focused window isn't ours, it must have received the
       // redirected message.  So, we should forget it.
       if (!IsOurProcessWindow(HWND(wParam))) {
         ForgetRedirectedKeyDownMessage();
       }
       if (sJustGotActivate) {
@@ -5454,83 +5191,44 @@ PRBool nsWindow::ProcessMessage(UINT msg
       }
 
 #ifdef ACCESSIBILITY
       if (nsWindow::sIsAccessibilityOn) {
         // Create it for the first time so that it can start firing events
         nsAccessible *rootAccessible = GetRootAccessible();
       }
 #endif
-
-#if defined(WINCE_HAVE_SOFTKB)
-      {
-        // On Windows CE, we have a window that overlaps
-        // the ISP button.  In this case, we should always
-        // try to hide it when we are activated
-      
-        nsIMEContext IMEContext(mWnd);
-        // Open the IME 
-        ImmSetOpenStatus(IMEContext.get(), TRUE);
-      }
-#endif
       break;
 
     case WM_KILLFOCUS:
-#if defined(WINCE_HAVE_SOFTKB)
-      {
-        nsIMEContext IMEContext(mWnd);
-        ImmSetOpenStatus(IMEContext.get(), FALSE);
-      }
-#endif
       if (sJustGotDeactivate) {
         result = DispatchFocusToTopLevelWindow(NS_DEACTIVATE);
       }
       break;
 
     case WM_WINDOWPOSCHANGED:
     {
       WINDOWPOS *wp = (LPWINDOWPOS)lParam;
       OnWindowPosChanged(wp, result);
     }
     break;
 
     case WM_SETTINGCHANGE:
-#if !defined (WINCE_WINDOWS_MOBILE)
       getWheelInfo = PR_TRUE;
-#else
-      switch (wParam) {
-        case SPI_SETSIPINFO:
-        case SPI_SETCURRENTIM:
-          nsWindowCE::OnSoftKbSettingsChange(mWnd);
-          break;
-        case SETTINGCHANGE_RESET:
-          if (mWindowType == eWindowType_invisible) {
-            // The OS sees to get confused and think that the invisable window
-            // is in the foreground after an orientation change. By actually
-            // setting it to the foreground and hiding it, we set it strait.
-            // See bug 514007 for details.
-            SetForegroundWindow(mWnd);
-            ShowWindow(mWnd, SW_HIDE);
-          } 
-          break;
-      }
-#endif
       OnSettingsChange(wParam, lParam);
       break;
 
-#ifndef WINCE
     case WM_INPUTLANGCHANGEREQUEST:
       *aRetValue = TRUE;
       result = PR_FALSE;
       break;
 
     case WM_INPUTLANGCHANGE:
       result = OnInputLangChange((HKL)lParam);
       break;
-#endif // WINCE
 
     case WM_DESTROYCLIPBOARD:
     {
       nsIClipboard* clipboard;
       nsresult rv = CallGetService(kCClipboardCID, &clipboard);
       if(NS_SUCCEEDED(rv)) {
         clipboard->EmptyClipboard(nsIClipboard::kGlobalClipboard);
         NS_RELEASE(clipboard);
@@ -5552,17 +5250,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
             msaaAccessible->Release(); // release extra addref
             result = PR_TRUE;  // We handled the WM_GETOBJECT message
           }
         }
       }
     }
 #endif
 
-#ifndef WINCE
     case WM_SYSCOMMAND:
     {
       WPARAM filteredWParam = (wParam &0xFFF0);
       // prevent Windows from trimming the working set. bug 76831
       if (!sTrimOnMinimize && filteredWParam == SC_MINIMIZE) {
         ::ShowWindow(mWnd, SW_SHOWMINIMIZED);
         result = PR_TRUE;
       }
@@ -5573,40 +5270,31 @@ PRBool nsWindow::ProcessMessage(UINT msg
           mSizeMode == nsSizeMode_Fullscreen) {
         DisplaySystemMenu(mWnd, mSizeMode, mIsRTL,
                           MOZ_SYSCONTEXT_X_POS,
                           MOZ_SYSCONTEXT_Y_POS);
         result = PR_TRUE;
       }
     }
     break;
-#endif
-
-
-#ifdef WINCE
-  case WM_HIBERNATE:        
-    nsMemory::HeapMinimize(PR_TRUE);
-    break;
-#endif
 
   case WM_MOUSEWHEEL:
   case WM_MOUSEHWHEEL:
     {
       // If OnMouseWheel returns true, the event was forwarded directly to another
       // mozilla window message handler (ProcessMessage). In this case the return
       // value of the forwarded event is in 'result' which we should return immediately.
       // If OnMouseWheel returns false, OnMouseWheel processed the event internally.
       // 'result' and 'aRetValue' will be set based on what we did with the event, so
       // we should fall through.
       if (OnMouseWheel(msg, wParam, lParam, getWheelInfo, result, aRetValue))
         return result;
     }
     break;
 
-#ifndef WINCE
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   case WM_DWMCOMPOSITIONCHANGED:
     // First, update the compositor state to latest one. All other methods
     // should use same state as here for consistency painting.
     nsUXThemeData::CheckForCompositor(PR_TRUE);
 
     UpdateNonClientMargins();
     RemovePropW(mWnd, kManageWindowInfoProperty);
@@ -5676,17 +5364,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
         DispatchEvent(&gestureNotifyEvent, status);
         mDisplayPanFeedback = gestureNotifyEvent.displayPanFeedback;
         if (!mTouchWindow)
           mGesture.SetWinGestureSupport(mWnd, gestureNotifyEvent.panDirection);
       }
       result = PR_FALSE; //should always bubble to DefWindowProc
     }
     break;
-#endif // !defined(WINCE)
 
     case WM_CLEAR:
     {
       nsContentCommandEvent command(PR_TRUE, NS_CONTENT_COMMAND_DELETE, this);
       DispatchWindowEvent(&command);
       result = PR_TRUE;
     }
     break;
@@ -5710,17 +5397,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
     case WM_PASTE:
     {
       nsContentCommandEvent command(PR_TRUE, NS_CONTENT_COMMAND_PASTE, this);
       DispatchWindowEvent(&command);
       result = PR_TRUE;
     }
     break;
 
-#ifndef WINCE
     case EM_UNDO:
     {
       nsContentCommandEvent command(PR_TRUE, NS_CONTENT_COMMAND_UNDO, this);
       DispatchWindowEvent(&command);
       *aRetValue = (LRESULT)(command.mSucceeded && command.mIsEnabled);
       result = PR_TRUE;
     }
     break;
@@ -5762,33 +5448,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
     {
       nsContentCommandEvent command(PR_TRUE, NS_CONTENT_COMMAND_REDO,
                                     this, PR_TRUE);
       DispatchWindowEvent(&command);
       *aRetValue = (LRESULT)(command.mSucceeded && command.mIsEnabled);
       result = PR_TRUE;
     }
     break;
-#endif
-
-#ifdef WINCE_WINDOWS_MOBILE
-   //HTC NAVIGATION WHEEL EVENT
-   case WM_HTCNAV:
-   {
-     int distance = wParam & 0x000000FF;
-     if ( (wParam & 0x000000100) != 0) // Counter Clockwise
-       distance *= -1;
-     if (OnMouseWheel(WM_MOUSEWHEEL, MAKEWPARAM(0, distance), 
-                      MAKELPARAM(GetSystemMetrics(SM_CXSCREEN) / 2, 
-                                 GetSystemMetrics(SM_CYSCREEN) / 2), 
-                      getWheelInfo, result, aRetValue))
-        return result;
-   }
-   break;
-#endif
 
     default:
     {
 #ifdef NS_ENABLE_TSF
       if (msg == WM_USER_TSF_TEXTCHANGE) {
         nsTextStore::OnTextChangeMsg();
       }
 #endif //NS_ENABLE_TSF
@@ -5847,21 +5516,17 @@ BOOL CALLBACK nsWindow::BroadcastMsgToCh
 // Enumerate all top level windows specifying that the children of each
 // top level window should be enumerated. Do *not* send the message to
 // each top level window since it is assumed that the toolkit will send
 // aMsg to them directly.
 BOOL CALLBACK nsWindow::BroadcastMsg(HWND aTopWindow, LPARAM aMsg)
 {
   // Iterate each of aTopWindows child windows sending the aMsg
   // to each of them.
-#if !defined(WINCE)
   ::EnumChildWindows(aTopWindow, nsWindow::BroadcastMsgToChildren, aMsg);
-#else
-  nsWindowCE::EnumChildWindows(aTopWindow, nsWindow::BroadcastMsgToChildren, aMsg);
-#endif
   return TRUE;
 }
 
 // This method is called from nsToolkit::WindowProc to forward global
 // messages which need to be dispatched to all child windows.
 void nsWindow::GlobalMsgWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   switch (msg) {
@@ -5870,19 +5535,17 @@ void nsWindow::GlobalMsgWindowProc(HWND 
       // WM_SYSCOLORCHANGE is only sent to top-level windows, but the
       // cross platform API requires that NS_SYSCOLORCHANGE message be sent to
       // all child windows as well. When running in an embedded application
       // we may not receive a WM_SYSCOLORCHANGE message because the top
       // level window is owned by the embeddor.
       // System color changes are posted to top-level windows only.
       // The NS_SYSCOLORCHANGE must be dispatched to all child
       // windows as well.
-#if !defined(WINCE)
      ::EnumThreadWindows(GetCurrentThreadId(), nsWindow::BroadcastMsg, msg);
-#endif
     break;
   }
 }
 
 /**************************************************************
  *
  * SECTION: Event processing helpers
  *
@@ -5986,25 +5649,23 @@ nsWindow::ClientMarginHitTestPoint(PRInt
       // to possibly override a resizer border.
       testResult = HTCLIENT;
     }
   }
 
   return testResult;
 }
 
-#ifndef WINCE
 void nsWindow::PostSleepWakeNotification(const char* aNotification)
 {
   nsCOMPtr<nsIObserverService> observerService =
     mozilla::services::GetObserverService();
   if (observerService)
     observerService->NotifyObservers(nsnull, aNotification, nsnull);
 }
-#endif
 
 // RemoveNextCharMessage() should be called by WM_KEYDOWN or WM_SYSKEYDOWM
 // message handler.  If there is no WM_(SYS)CHAR message for it, this
 // method does nothing.
 // NOTE: WM_(SYS)CHAR message is posted by TranslateMessage() API which is
 // called in message loop.  So, WM_(SYS)KEYDOWN message should have
 // WM_(SYS)CHAR message in the queue if the keydown event causes character
 // input.
@@ -6108,17 +5769,16 @@ LRESULT nsWindow::ProcessKeyDownMessage(
     nsIMM32Handler::NotifyEndStatusChange();
   } else if (!nsIMM32Handler::IsComposingOn(this)) {
     result = OnKeyDown(aMsg, modKeyState, aEventDispatched, nsnull);
     // OnKeyDown cleaned up the redirected message information itself, so,
     // we should do nothing.
     forgetRedirectedMessage.mCancel = PR_TRUE;
   }
 
-#ifndef WINCE
   if (aMsg.wParam == VK_MENU ||
       (aMsg.wParam == VK_F10 && !modKeyState.mIsShiftDown)) {
     // We need to let Windows handle this keypress,
     // by returning PR_FALSE, if there's a native menu
     // bar somewhere in our containing window hierarchy.
     // Otherwise we handle the keypress and don't pass
     // it on to Windows, by returning PR_TRUE.
     PRBool hasNativeMenu = PR_FALSE;
@@ -6127,29 +5787,27 @@ LRESULT nsWindow::ProcessKeyDownMessage(
       if (::GetMenu(hWnd)) {
         hasNativeMenu = PR_TRUE;
         break;
       }
       hWnd = ::GetParent(hWnd);
     }
     result = !hasNativeMenu;
   }
-#endif
 
   return result;
 }
 
 nsresult
 nsWindow::SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
                                    PRInt32 aNativeKeyCode,
                                    PRUint32 aModifierFlags,
                                    const nsAString& aCharacters,
                                    const nsAString& aUnmodifiedCharacters)
 {
-#ifndef WINCE  //Win CE doesn't support many of the calls used in this method, perhaps theres another way
   nsPrintfCString layoutName("%08x", aNativeKeyboardLayout);
   HKL loadedLayout = LoadKeyboardLayoutA(layoutName.get(), KLF_NOTELLSHELL);
   if (loadedLayout == NULL)
     return NS_ERROR_NOT_AVAILABLE;
 
   // Setup clean key state and load desired layout
   BYTE originalKbdState[256];
   ::GetKeyboardState(originalKbdState);
@@ -6201,67 +5859,55 @@ nsWindow::SynthesizeNativeKeyEvent(PRInt
   }
 
   // Restore old key state and layout
   ::SetKeyboardState(originalKbdState);
   gKbdLayout.LoadLayout(oldLayout);
 
   UnloadKeyboardLayout(loadedLayout);
   return NS_OK;
-#else  //XXX: is there another way to do this?
-  return NS_ERROR_NOT_IMPLEMENTED;
-#endif
 }
 
 nsresult
 nsWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
                                      PRUint32 aNativeMessage,
                                      PRUint32 aModifierFlags)
 {
-#ifndef WINCE // I don't think WINCE supports SendInput
   RECT r;
   ::GetWindowRect(mWnd, &r);
   ::SetCursorPos(r.left + aPoint.x, r.top + aPoint.y);
 
   INPUT input;
   memset(&input, 0, sizeof(input));
 
   input.type = INPUT_MOUSE;
   input.mi.dwFlags = aNativeMessage;
   ::SendInput(1, &input, sizeof(INPUT));
 
   return NS_OK;
-#else
-  return NS_ERROR_NOT_IMPLEMENTED;
-#endif
 }
 
 /**************************************************************
  *
  * SECTION: OnXXX message handlers
  *
  * For message handlers that need to be broken out or
  * implemented in specific platform code.
  *
  **************************************************************/
 
 BOOL nsWindow::OnInputLangChange(HKL aHKL)
 {
 #ifdef KE_DEBUG
   printf("OnInputLanguageChange\n");
 #endif
-
-#ifndef WINCE
   gKbdLayout.LoadLayout(aHKL);
-#endif
-
   return PR_FALSE;   // always pass to child window
 }
 
-#if !defined(WINCE) // implemented in nsWindowCE.cpp
 void nsWindow::OnWindowPosChanged(WINDOWPOS *wp, PRBool& result)
 {
   if (wp == nsnull)
     return;
 
 #ifdef WINSTATE_DEBUG_OUTPUT
   if (mWnd == GetTopLevelHWND(mWnd))
     printf("*** OnWindowPosChanged: [  top] ");
@@ -6449,19 +6095,17 @@ void nsWindow::ActivateOtherWindowHelper
                  SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
   if (hwndBelow)
     ::SetForegroundWindow(hwndBelow);
 
   // Play the minimize sound while we're here, since that is also
   // forgotten when we use SW_SHOWMINIMIZED.
   ::PlaySoundW(L"Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC);
 }
-#endif // !defined(WINCE)
-
-#if !defined(WINCE)
+
 void nsWindow::OnWindowPosChanging(LPWINDOWPOS& info)
 {
   // Update non-client margins if the frame size is changing, and let the
   // browser know we are changing size modes, so alternative css can kick in.
   // If we're going into fullscreen mode, ignore this, since it'll reset
   // margins to normal mode. 
   if ((info->flags & SWP_FRAMECHANGED && !(info->flags & SWP_NOSIZE)) &&
       mSizeMode != nsSizeMode_Fullscreen) {
@@ -6521,17 +6165,16 @@ void nsWindow::OnWindowPosChanging(LPWIN
       }
     }
     NS_IF_RELEASE(event.mActualBelow);
   }
   // prevent rude external programs from making hidden window visible
   if (mWindowType == eWindowType_invisible)
     info->flags &= ~SWP_SHOWWINDOW;
 }
-#endif
 
 void nsWindow::UserActivity()
 {
   // Check if we have the idle service, if not we try to get it.
   if (!mIdleService) {
     mIdleService = do_GetService("@mozilla.org/widget/idleservice;1");
   }
 
@@ -6576,17 +6219,16 @@ PRBool nsWindow::OnTouch(WPARAM wParam, 
 
   delete [] pInputs;
   mGesture.CloseTouchInputHandle((HTOUCHINPUT)lParam);
   return PR_TRUE;
 }
 #endif
 
 // Gesture event processing. Handles WM_GESTURE events.
-#if !defined(WINCE)
 PRBool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
 {
   // Treatment for pan events which translate into scroll events:
   if (mGesture.IsPanEvent(lParam)) {
     nsMouseScrollEvent event(PR_TRUE, NS_MOUSE_PIXEL_SCROLL, this);
 
     if ( !mGesture.ProcessPanMessage(mWnd, wParam, lParam) )
       return PR_FALSE; // ignore
@@ -6648,30 +6290,28 @@ PRBool nsWindow::OnGesture(WPARAM wParam
     return PR_FALSE; // Ignored, fall through
   }
 
   // Only close this if we process and return true.
   mGesture.CloseGestureInfoHandle((HGESTUREINFO)lParam);
 
   return PR_TRUE; // Handled
 }
-#endif // !defined(WINCE)
-
-#if !defined(WINCE)
+
 PRUint16 nsWindow::GetMouseInputSource()
 {
   PRUint16 inputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_MOUSE;
   LPARAM lParamExtraInfo = ::GetMessageExtraInfo();
   if ((lParamExtraInfo & TABLET_INK_SIGNATURE) == TABLET_INK_CHECK) {
     inputSource = (lParamExtraInfo & TABLET_INK_TOUCH) ?
                   PRUint16(nsIDOMNSMouseEvent::MOZ_SOURCE_TOUCH) : nsIDOMNSMouseEvent::MOZ_SOURCE_PEN;
   }
   return inputSource;
 }
-#endif
+
 /*
  * OnMouseWheel - mouse wheel event processing. This was originally embedded
  * within the message case block. If returning true result should be returned
  * immediately (no more processing).
  */
 PRBool nsWindow::OnMouseWheel(UINT msg, WPARAM wParam, LPARAM lParam, PRBool& getWheelInfo, PRBool& result, LRESULT *aRetValue)
 {
   // Handle both flavors of mouse wheel events.
@@ -6815,24 +6455,21 @@ StringCaseInsensitiveEquals(const PRUnic
     return PR_FALSE;
 
   nsCaseInsensitiveStringComparator comp;
   return comp(aChars1, aChars2, aNumChars1, aNumChars2) == 0;
 }
 
 UINT nsWindow::MapFromNativeToDOM(UINT aNativeKeyCode)
 {
-#ifndef WINCE
   switch (aNativeKeyCode) {
     case VK_OEM_1:     return NS_VK_SEMICOLON;     // 0xBA, For the US standard keyboard, the ';:' key
     case VK_OEM_PLUS:  return NS_VK_ADD;           // 0xBB, For any country/region, the '+' key
     case VK_OEM_MINUS: return NS_VK_SUBTRACT;      // 0xBD, For any country/region, the '-' key
   }
-#endif
-
   return aNativeKeyCode;
 }
 
 /* static */
 PRBool nsWindow::IsRedirectedKeyDownMessage(const MSG &aMsg)
 {
   return (aMsg.message == WM_KEYDOWN || aMsg.message == WM_SYSKEYDOWN) &&
          (sRedirectedKeyDown.message == aMsg.message &&
@@ -6880,20 +6517,17 @@ nsWindow::PerformElantechSwipeGestureHac
  */
 LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
                             nsModifierKeyState &aModKeyState,
                             PRBool *aEventDispatched,
                             nsFakeCharMessage* aFakeCharMessage)
 {
   UINT virtualKeyCode =
     aMsg.wParam != VK_PROCESSKEY ? aMsg.wParam : ::ImmGetVirtualKey(mWnd);
-
-#ifndef WINCE
   gKbdLayout.OnKeyDown(virtualKeyCode);
-#endif
 
   if (sUseElantechGestureHacks) {
     PerformElantechSwipeGestureHack(virtualKeyCode, aModKeyState);
   }
 
   // Use only DOMKeyCode for XP processing.
   // Use virtualKeyCode for gKbdLayout and native processing.
   UINT DOMKeyCode = nsIMM32Handler::IsComposingOn(this) ?
@@ -6983,21 +6617,17 @@ LRESULT nsWindow::OnKeyDown(const MSG &a
   PRUint32 extraFlags = (noDefault ? NS_EVENT_FLAG_NO_DEFAULT : 0);
   MSG msg;
   BOOL gotMsg = aFakeCharMessage ||
     ::PeekMessageW(&msg, mWnd, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD);
   // Enter and backspace are always handled here to avoid for example the
   // confusion between ctrl-enter and ctrl-J.
   if (DOMKeyCode == NS_VK_RETURN || DOMKeyCode == NS_VK_BACK ||
       ((aModKeyState.mIsControlDown || aModKeyState.mIsAltDown)
-#ifdef WINCE
-       ))
-#else
        && !gKbdLayout.IsDeadKey() && KeyboardLayout::IsPrintableCharKey(virtualKeyCode)))
-#endif
   {
     // Remove a possible WM_CHAR or WM_SYSCHAR messages from the message queue.
     // They can be more than one because of:
     //  * Dead-keys not pairing with base character
     //  * Some keyboard layouts may map up to 4 characters to the single key
     PRBool anyCharMessagesRemoved = PR_FALSE;
 
     if (aFakeCharMessage) {
@@ -7053,17 +6683,16 @@ LRESULT nsWindow::OnKeyDown(const MSG &a
 
     BOOL result = OnChar(msg, aModKeyState, nsnull, extraFlags);
     // If a syschar keypress wasn't processed, Windows may want to
     // handle it to activate a native menu.
     if (!result && msg.message == WM_SYSCHAR)
       ::DefWindowProcW(mWnd, msg.message, msg.wParam, msg.lParam);
     return result;
   }
-#ifndef WINCE
   else if (!aModKeyState.mIsControlDown && !aModKeyState.mIsAltDown &&
              (KeyboardLayout::IsPrintableCharKey(virtualKeyCode) ||
               KeyboardLayout::IsNumpadKey(virtualKeyCode)))
   {
     // If this is simple KeyDown event but next message is not WM_CHAR,
     // this event may not input text, so we should ignore this event.
     // See bug 314130.
     return PluginHasFocus() && noDefault;
@@ -7222,27 +6851,16 @@ LRESULT nsWindow::OnKeyDown(const MSG &a
 
       DispatchKeyEvent(NS_KEY_PRESS, uniChar, &altArray,
                        keyCode, nsnull, aModKeyState, extraFlags);
     }
   } else {
     DispatchKeyEvent(NS_KEY_PRESS, 0, nsnull, DOMKeyCode, nsnull, aModKeyState,
                      extraFlags);
   }
-#else
-  {
-    UINT unichar = ::MapVirtualKey(virtualKeyCode, MAPVK_VK_TO_CHAR);
-    // Check for dead characters or no mapping
-    if (unichar & 0x80) {
-      return noDefault;
-    }
-    DispatchKeyEvent(NS_KEY_PRESS, unichar, nsnull, DOMKeyCode, nsnull, aModKeyState,
-                     extraFlags);
-  }
-#endif
 
   return noDefault;
 }
 
 // OnKeyUp
 LRESULT nsWindow::OnKeyUp(const MSG &aMsg,
                           nsModifierKeyState &aModKeyState,
                           PRBool *aEventDispatched)
@@ -7396,22 +7014,16 @@ nsWindow::ConfigureChildren(const nsTArr
   // XXXroc we could use BeginDeferWindowPos/DeferWindowPos/EndDeferWindowPos
   // here, if that helps in some situations. So far I haven't seen a
   // need.
   for (PRUint32 i = 0; i < aConfigurations.Length(); ++i) {
     const Configuration& configuration = aConfigurations[i];
     nsWindow* w = static_cast<nsWindow*>(configuration.mChild);
     NS_ASSERTION(w->GetParent() == this,
                  "Configured widget is not a child");
-#ifdef WINCE
-    // MSDN says we should do on WinCE this before moving or resizing the window
-    // See http://msdn.microsoft.com/en-us/library/aa930600.aspx
-    // We put the region back just below, anyway.
-    ::SetWindowRgn(w->mWnd, NULL, TRUE);
-#endif
     nsresult rv = w->SetWindowClipRegion(configuration.mClipRegion, PR_TRUE);
     NS_ENSURE_SUCCESS(rv, rv);
     nsIntRect bounds;
     w->GetBounds(bounds);
     if (bounds.Size() != configuration.mBounds.Size()) {
       w->Resize(configuration.mBounds.x, configuration.mBounds.y,
                 configuration.mBounds.width, configuration.mBounds.height,
                 PR_TRUE);
@@ -7609,25 +7221,18 @@ void nsWindow::OnDestroy()
     SetCursor(eCursor_standard);
 
 #ifdef MOZ_XUL
   // Reset transparency
   if (eTransparencyTransparent == mTransparencyMode)
     SetupTranslucentWindowMemoryBitmap(eTransparencyOpaque);
 #endif
 
-#if defined(WINCE_HAVE_SOFTKB)
-  // Revert the changes made for the software keyboard settings
-  nsWindowCE::ResetSoftKB(mWnd);
-#endif
-
-#if !defined(WINCE)
   // Finalize panning feedback to possibly restore window displacement
   mGesture.PanFeedbackFinalize(mWnd, PR_TRUE);
-#endif
 
   // Clear the main HWND.
   mWnd = NULL;
 }
 
 // OnMove
 PRBool nsWindow::OnMove(PRInt32 aX, PRInt32 aY)
 {
@@ -7673,22 +7278,20 @@ PRBool nsWindow::OnResize(nsIntRect &aWi
 #endif
 
     return DispatchWindowEvent(&event);
   }
 
   return PR_FALSE;
 }
 
-#if !defined(WINCE) // implemented in nsWindowCE.cpp
 PRBool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam)
 {
   return PR_TRUE;
 }
-#endif // !defined(WINCE)
 
 void nsWindow::OnSettingsChange(WPARAM wParam, LPARAM lParam)
 {
   if (mWindowType == eWindowType_dialog ||
       mWindowType == eWindowType_toplevel )
     nsWindowGfx::OnSettingsChangeGfx(wParam);
 }
 
@@ -8233,21 +7836,16 @@ NS_IMETHODIMP nsWindow::SetInputMode(con
 #endif 
   if (nsIMM32Handler::IsComposing()) {
     ResetInputState();
   }
   mIMEContext = aContext;
   PRBool enable = (status == nsIWidget::IME_STATUS_ENABLED ||
                    status == nsIWidget::IME_STATUS_PLUGIN);
 
-#if defined(WINCE_HAVE_SOFTKB)
-  sSoftKeyboardState = (status != nsIWidget::IME_STATUS_DISABLED);
-  nsWindowCE::ToggleSoftKB(mWnd, sSoftKeyboardState);
-#endif
-
   if (!enable != !mOldIMC)
     return NS_OK;
   mOldIMC = ::ImmAssociateContext(mWnd, enable ? mOldIMC : NULL);
   NS_ASSERTION(!enable || !mOldIMC, "Another IMC was associated");
 
   return NS_OK;
 }
 
@@ -8438,18 +8036,16 @@ void nsWindow::ResizeTranslucentWindow(P
       new gfxWindowsSurface(gfxIntSize(aNewWidth, aNewHeight), gfxASurface::ImageFormatARGB32);
     mTransparentSurface = newSurface;
     mMemoryDC = newSurface->GetDC();
   }
 }
 
 void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode)
 {
-#ifndef WINCE
-
   if (aMode == mTransparencyMode)
     return;
 
   // stop on dialogs and popups!
   HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
   nsWindow* parent = GetNSWindowPtr(hWnd);
 
   if (!parent)
@@ -8493,32 +8089,30 @@ void nsWindow::SetWindowTranslucencyInne
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   if (HasGlass())
     memset(&mGlassMargins, 0, sizeof mGlassMargins);
 #endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   mTransparencyMode = aMode;
 
   SetupTranslucentWindowMemoryBitmap(aMode);
   UpdateGlass();
-#endif // #ifndef WINCE
 }
 
 void nsWindow::SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode)
 {
   if (eTransparencyTransparent == aMode) {
     ResizeTranslucentWindow(mBounds.width, mBounds.height, PR_TRUE);
   } else {
     mTransparentSurface = nsnull;
     mMemoryDC = NULL;
   }
 }
 
 nsresult nsWindow::UpdateTranslucentWindow()
 {
-#ifndef WINCE
   if (mBounds.IsEmpty())
     return NS_OK;
 
   ::GdiFlush();
 
   BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
   SIZE winSize = { mBounds.width, mBounds.height };
   POINT srcPos = { 0, 0 };
@@ -8543,34 +8137,32 @@ nsresult nsWindow::UpdateTranslucentWind
     nsIntRect r(0, 0, 0, 0);
     static_cast<gfxD2DSurface*>(mTransparentSurface.get())->ReleaseDC(&r);
   }
 #endif
 
   if (!updateSuccesful) {
     return NS_ERROR_FAILURE;
   }
-#endif
 
   return NS_OK;
 }
 
 #endif //MOZ_XUL
 
 /**************************************************************
  **************************************************************
  **
  ** BLOCK: Popup rollup hooks
  **
  ** Deals with CaptureRollup on popup windows.
  **
  **************************************************************
  **************************************************************/
 
-#ifndef WINCE
 // Schedules a timer for a window, so we can rollup after processing the hook event
 void nsWindow::ScheduleHookTimer(HWND aWnd, UINT aMsgId)
 {
   // In some cases multiple hooks may be scheduled
   // so ignore any other requests once one timer is scheduled
   if (sHookTimerId == 0) {
     // Remember the window handle and the message ID to be used later
     sRollupMsgId = aMsgId;
@@ -8769,17 +8361,16 @@ VOID CALLBACK nsWindow::HookTimerForPopu
     // sRollupListener and sRollupWidget are not NULL
     LRESULT popupHandlingResult;
     nsAutoRollup autoRollup;
     DealWithPopups(sRollupMsgWnd, sRollupMsgId, 0, 0, &popupHandlingResult);
     sRollupMsgId = 0;
     sRollupMsgWnd = NULL;
   }
 }
-#endif // WinCE
 
 BOOL CALLBACK nsWindow::ClearResourcesCallback(HWND aWnd, LPARAM aMsg)
 {
     nsWindow *window = nsWindow::GetNSWindowPtr(aWnd);
     if (window) {
         window->ClearCachedResources();
     }  
     return TRUE;
@@ -8804,27 +8395,19 @@ static PRBool IsDifferentThreadWindow(HW
   return ::GetCurrentThreadId() != ::GetWindowThreadProcessId(aWnd, NULL);
 }
 
 PRBool
 nsWindow::EventIsInsideWindow(UINT Msg, nsWindow* aWindow)
 {
   RECT r;
 
-#ifndef WINCE
   if (Msg == WM_ACTIVATEAPP)
     // don't care about activation/deactivation
     return PR_FALSE;
-#else
-  if (Msg == WM_ACTIVATE)
-    // but on Windows CE we do care about
-    // activation/deactivation because there doesn't exist
-    // cancelable Mouse Activation events
-    return PR_TRUE;
-#endif
 
   ::GetWindowRect(aWindow->mWnd, &r);
   DWORD pos = ::GetMessagePos();
   POINT mp;
   mp.x = GET_X_LPARAM(pos);
   mp.y = GET_Y_LPARAM(pos);
 
   // was the event inside this window?
@@ -8834,29 +8417,25 @@ nsWindow::EventIsInsideWindow(UINT Msg, 
 // Handle events that may cause a popup (combobox, XPMenu, etc) to need to rollup.
 BOOL
 nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult)
 {
   if (sRollupListener && sRollupWidget && ::IsWindowVisible(inWnd)) {
 
     if (inMsg == WM_LBUTTONDOWN || inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN ||
         inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL || inMsg == WM_ACTIVATE ||
-        (inMsg == WM_KILLFOCUS && IsDifferentThreadWindow((HWND)inWParam))
-#ifndef WINCE
-        ||
+        (inMsg == WM_KILLFOCUS && IsDifferentThreadWindow((HWND)inWParam)) ||
         inMsg == WM_NCRBUTTONDOWN ||
         inMsg == WM_MOVING ||
         inMsg == WM_SIZING ||
         inMsg == WM_NCLBUTTONDOWN ||
         inMsg == WM_NCMBUTTONDOWN ||
         inMsg == WM_MOUSEACTIVATE ||
         inMsg == WM_ACTIVATEAPP ||
-        inMsg == WM_MENUSELECT
-#endif
-        )
+        inMsg == WM_MENUSELECT)
     {
       // Rollup if the event is outside the popup.
       PRBool rollup = !nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)sRollupWidget);
 
       if (rollup && (inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL))
       {
         sRollupListener->ShouldRollupOnMouseWheelEvent(&rollup);
         *outResult = PR_TRUE;
@@ -8883,17 +8462,16 @@ nsWindow::DealWithPopups(HWND inWnd, UIN
                 popupsToRollup = sameTypeCount;
               }
               break;
             }
           } // foreach parent menu widget
         } // if rollup listener knows about menus
       }
 
-#ifndef WINCE
       if (inMsg == WM_MOUSEACTIVATE && popupsToRollup == PR_UINT32_MAX) {
         // Prevent the click inside the popup from causing a change in window
         // activation. Since the popup is shown non-activated, we need to eat
         // any requests to activate the window while it is displayed. Windows
         // will automatically activate the popup on the mousedown otherwise.
         if (!rollup) {
           *outResult = MA_NOACTIVATE;
           return TRUE;
@@ -8910,19 +8488,17 @@ nsWindow::DealWithPopups(HWND inWnd, UIN
             {
               *outResult = MA_NOACTIVATE;
               return true;
             }
           }
         }
       }
       // if we've still determined that we should still rollup everything, do it.
-      else
-#endif
-      if ( rollup ) {
+      else if (rollup) {
         // sRollupConsumeEvent may be modified by
         // nsIRollupListener::Rollup.
         PRBool consumeRollupEvent = sRollupConsumeEvent;
         // only need to deal with the last rollup for left mouse down events.
         sRollupListener->Rollup(popupsToRollup, inMsg == WM_LBUTTONDOWN ? &mLastRollup : nsnull);
 
         // Tell hook to stop processing messages
         sProcessHook = PR_FALSE;
@@ -8932,40 +8508,35 @@ nsWindow::DealWithPopups(HWND inWnd, UIN
         // return TRUE tells Windows that the event is consumed,
         // false allows the event to be dispatched
         //
         // So if we are NOT supposed to be consuming events, let it go through
         if (consumeRollupEvent && inMsg != WM_RBUTTONDOWN) {
           *outResult = MA_ACTIVATE;
 
           // However, don't activate panels
-#ifndef WINCE
           if (inMsg == WM_MOUSEACTIVATE) {
             nsWindow* activateWindow = GetNSWindowPtr(inWnd);
             if (activateWindow) {
               nsWindowType wintype;
               activateWindow->GetWindowType(wintype);
               if (wintype == eWindowType_popup && activateWindow->PopupType() == ePopupTypePanel) {
                 *outResult = MA_NOACTIVATE;
               }
             }
           }
-#endif
-
           return TRUE;
         }
-#ifndef WINCE
         // if we are only rolling up some popups, don't activate and don't let
         // the event go through. This prevents clicks menus higher in the
         // chain from opening when a context menu is open
         if (popupsToRollup != PR_UINT32_MAX && inMsg == WM_MOUSEACTIVATE) {
           *outResult = MA_NOACTIVATEANDEAT;
           return TRUE;
         }
-#endif
       }
     } // if event that might trigger a popup to rollup
   } // if rollup listeners registered
 
   return FALSE;
 }
 
 /**************************************************************
@@ -8984,33 +8555,29 @@ nsModifierKeyState::nsModifierKeyState()
   mIsShiftDown   = IS_VK_DOWN(NS_VK_SHIFT);
   mIsControlDown = IS_VK_DOWN(NS_VK_CONTROL);
   mIsAltDown     = IS_VK_DOWN(NS_VK_ALT);
 }
 
 
 PRInt32 nsWindow::GetWindowsVersion()
 {
-#ifdef WINCE
-  return 0x500;
-#else
   static PRInt32 version = 0;
   static PRBool didCheck = PR_FALSE;
 
   if (!didCheck)
   {
     didCheck = PR_TRUE;
     OSVERSIONINFOEX osInfo;
     osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
     // This cast is safe and supposed to be here, don't worry
     ::GetVersionEx((OSVERSIONINFO*)&osInfo);
     version = (osInfo.dwMajorVersion & 0xff) << 8 | (osInfo.dwMinorVersion & 0xff);
   }
   return version;
-#endif
 }
 
 // Note that the result of GetTopLevelWindow method can be different from the
 // result of GetTopLevelHWND method.  The result can be non-floating window.
 // Because our top level window may be contained in another window which is
 // not managed by us.
 nsWindow* nsWindow::GetTopLevelWindow(PRBool aStopOnDialogOrPopup)
 {
@@ -9055,28 +8622,16 @@ HWND nsWindow::GetTopLevelHWND(HWND aWnd
 
       VERIFY_WINDOW_STYLE(style);
 
       if (!(style & WS_CHILD)) // first top-level window
         break;
     }
 
     upWnd = ::GetParent(curWnd); // Parent or owner (if has no parent)
-
-#ifdef WINCE
-    // For dialog windows, we want just the parent, not the owner.
-    // For other/popup windows, we want to find the first owner/parent
-    // that's a dialog and/or has an owner.
-    if (upWnd && ::GetWindow(curWnd, GW_OWNER) == upWnd) {
-      DWORD_PTR style = ::GetWindowLongPtrW(curWnd, GWL_STYLE);
-      if ((style & WS_DLGFRAME) != 0)
-        break;
-    }
-#endif
-
     curWnd = upWnd;
   }
 
   return topWnd;
 }
 
 static BOOL CALLBACK gEnumWindowsProc(HWND hwnd, LPARAM lParam)
 {
@@ -9162,17 +8717,16 @@ PRBool nsWindow::GetInputWorkaroundPref(
 }
 
 PRBool nsWindow::UseTrackPointHack()
 {
   return GetInputWorkaroundPref("ui.trackpoint_hack.enabled",
                                 sDefaultTrackPointHack);
 }
 
-#if !defined(WINCE)
 static PRBool
 HasRegistryKey(HKEY aRoot, PRUnichar* aName)
 {
   HKEY key;
   LONG result = ::RegOpenKeyExW(aRoot, aName, 0, KEY_READ, &key);
   if (result != ERROR_SUCCESS)
     return PR_FALSE;
   ::RegCloseKey(key);
@@ -9276,17 +8830,16 @@ void nsWindow::InitInputWorkaroundPrefDe
               IsObsoleteSynapticsDriver()) {
     sDefaultTrackPointHack = PR_TRUE;
   }
 
   sUseElantechGestureHacks =
     GetInputWorkaroundPref("ui.elantech_gesture_hacks.enabled",
                            IsObsoleteElantechDriver());
 }
-#endif // #if !defined(WINCE)
 
 LPARAM nsWindow::lParamToScreen(LPARAM lParam)
 {
   POINT pt;
   pt.x = GET_X_LPARAM(lParam);
   pt.y = GET_Y_LPARAM(lParam);
   ::ClientToScreen(mWnd, &pt);
   return MAKELPARAM(pt.x, pt.y);
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -60,35 +60,28 @@
 #include "gfxWindowsSurface.h"
 #include "nsWindowDbg.h"
 #include "cairo.h"
 #include "nsITimer.h"
 #ifdef CAIRO_HAS_D2D_SURFACE
 #include "gfxD2DSurface.h"
 #endif
 
-#if !defined(WINCE)
 #include "nsWinGesture.h"
-#endif
-
-#if defined(WINCE)
-#include "nsWindowCE.h"
-#endif
 
 #include "WindowHook.h"
 #include "TaskbarWindowPreview.h"
 
 #ifdef ACCESSIBILITY
 #include "OLEACC.H"
 #include "nsAccessible.h"
 #endif
 
-#if !defined(WINCE)
 #include "nsUXThemeData.h"
-#endif // !defined(WINCE)
+
 /**
  * Forward class definitions
  */
 
 class nsNativeDragTarget;
 class nsIRollupListener;
 class nsIFile;
 class imgIContainer;
@@ -128,19 +121,17 @@ public:
   virtual float           GetDPI();
   NS_IMETHOD              Show(PRBool bState);
   NS_IMETHOD              IsVisible(PRBool & aState);
   NS_IMETHOD              ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY);
   NS_IMETHOD              Move(PRInt32 aX, PRInt32 aY);
   NS_IMETHOD              Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
   NS_IMETHOD              Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
   NS_IMETHOD              ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
-#if !defined(WINCE)
   NS_IMETHOD              BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
-#endif
   NS_IMETHOD              PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, PRBool aActivate);
   NS_IMETHOD              SetSizeMode(PRInt32 aMode);
   NS_IMETHOD              Enable(PRBool aState);
   NS_IMETHOD              IsEnabled(PRBool *aState);
   NS_IMETHOD              SetFocus(PRBool aRaise);
   NS_IMETHOD              GetBounds(nsIntRect &aRect);
   NS_IMETHOD              GetScreenBounds(nsIntRect &aRect);
   NS_IMETHOD              GetClientBounds(nsIntRect &aRect);
@@ -296,20 +287,18 @@ protected:
    * Callbacks
    */
   static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
   static LRESULT CALLBACK WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
 
   static BOOL CALLBACK    BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg);
   static BOOL CALLBACK    BroadcastMsg(HWND aTopWindow, LPARAM aMsg);
   static BOOL CALLBACK    DispatchStarvedPaints(HWND aTopWindow, LPARAM aMsg);
-#if !defined(WINCE)
   static BOOL CALLBACK    RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
   static BOOL CALLBACK    UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
-#endif
   static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam);
   static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam);
   static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam);
   static VOID    CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime );
   static BOOL    CALLBACK ClearResourcesCallback(HWND aChild, LPARAM aParam);
   static BOOL    CALLBACK EnumAllChildWindProc(HWND aWnd, LPARAM aParam);
   static BOOL    CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam);
   static void             AllowD3D9Callback(nsWindow *aWindow);
@@ -325,19 +314,17 @@ protected:
   LPARAM                  lParamToClient(LPARAM lParam);
   virtual void            SubclassWindow(BOOL bState);
   PRBool                  CanTakeFocus();
   PRBool                  UpdateNonClientMargins(PRInt32 aSizeMode = -1, PRBool aReflowWindow = PR_TRUE);
   void                    UpdateGetWindowInfoCaptionStatus(PRBool aActiveCaption);
   void                    ResetLayout();
   void                    InvalidateNonClientRegion();
   HRGN                    ExcludeNonClientFromPaintRegion(HRGN aRegion);
-#if !defined(WINCE)
   static void             InitInputWorkaroundPrefDefaults();
-#endif
   static PRBool           GetInputWorkaroundPref(const char* aPrefName, PRBool aValueIfAutomatic);
   static PRBool           UseTrackPointHack();
   static void             PerformElantechSwipeGestureHack(UINT& aVirtualKeyCode, nsModifierKeyState& aModKeyState);
   static void             GetMainWindowClass(nsAString& aClass);
   PRBool                  HasGlass() const {
     return mTransparencyMode == eTransparencyGlass ||
            mTransparencyMode == eTransparencyBorderlessGlass;
   }
@@ -423,19 +410,17 @@ protected:
   PRBool                  OnHotKey(WPARAM wParam, LPARAM lParam);
   BOOL                    OnInputLangChange(HKL aHKL);
   void                    OnSettingsChange(WPARAM wParam, LPARAM lParam);
   PRBool                  OnPaint(HDC aDC, PRUint32 aNestingLevel);
   void                    OnWindowPosChanged(WINDOWPOS *wp, PRBool& aResult);
   PRBool                  OnMouseWheel(UINT msg, WPARAM wParam, LPARAM lParam, 
                                        PRBool& result, PRBool& getWheelInfo,
                                        LRESULT *aRetValue);
-#if !defined(WINCE)
   void                    OnWindowPosChanging(LPWINDOWPOS& info);
-#endif // !defined(WINCE)
 
   /**
    * Function that registers when the user has been active (used for detecting
    * when the user is idle).
    */
   void                    UserActivity();
 
   PRInt32                 GetHeight(PRInt32 aProposedHeight);
@@ -485,20 +470,18 @@ protected:
   UINT                    MapFromNativeToDOM(UINT aNativeKeyCode);
   void                    StopFlashing();
   static PRBool           IsTopLevelMouseExit(HWND aWnd);
   static void             SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray, PRUint32 aModifiers);
   nsresult                SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
                                               PRBool aIntersectWithExisting);
   nsIntRegion             GetRegionToPaint(PRBool aForceFullRepaint, 
                                            PAINTSTRUCT ps, HDC aDC);
-#if !defined(WINCE)
   static void             ActivateOtherWindowHelper(HWND aWnd);
   static PRUint16         GetMouseInputSource();
-#endif
 #ifdef ACCESSIBILITY
   static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
 #endif // ACCESSIBILITY
   void                    ClearCachedResources();
 
   nsPopupType PopupType() { return mPopupType; }
 
 protected:
@@ -609,32 +592,26 @@ protected:
   nsTransparencyMode    mTransparencyMode;
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   nsIntRegion           mPossiblyTransparentRegion;
   MARGINS               mGlassMargins;
 #endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 #endif // MOZ_XUL
 
   // Win7 Gesture processing and management
-#if !defined(WINCE)
   nsWinGesture          mGesture;
-#endif // !defined(WINCE)
 
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
   // Weak ref to the nsITaskbarWindowPreview associated with this window
   nsWeakPtr             mTaskbarPreview;
   // True if the taskbar (possibly through the tab preview) tells us that the
   // icon has been created on the taskbar.
   PRBool                mHasTaskbarIconBeenCreated;
 #endif
 
-#if defined(WINCE_HAVE_SOFTKB)
-  static PRBool         sSoftKeyboardState;
-#endif // defined(WINCE_HAVE_SOFTKB)
-
 #ifdef ACCESSIBILITY
   static BOOL           sIsAccessibilityOn;
   static HINSTANCE      sAccLib;
   static LPFNLRESULTFROMOBJECT sLresultFromObject;
 #endif // ACCESSIBILITY
 
   // sRedirectedKeyDown is WM_KEYDOWN message or WM_SYSKEYDOWN message which
   // was reirected to SendInput() API by OnKeyDown().
--- a/widget/src/windows/nsWindowDefs.h
+++ b/widget/src/windows/nsWindowDefs.h
@@ -164,34 +164,21 @@
   /*
    *#define GET_DEVICE_LPARAM(lParam)         ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK))
    *#define GET_MOUSEORKEY_LPARAM             GET_DEVICE_LPARAM
    *#define GET_FLAGS_LPARAM(lParam)          (LOWORD(lParam))
    *#define GET_KEYSTATE_LPARAM(lParam)       GET_FLAGS_LPARAM(lParam)
    */
 #endif // #ifndef APPCOMMAND_BROWSER_BACKWARD
 
-#if defined(WINCE)
-#ifndef RDW_NOINTERNALPAINT
-#define RDW_NOINTERNALPAINT     0
-#endif
-#ifndef ERROR
-#define ERROR 0
-#endif
-#endif // defined(WINCE)
-
 //Tablet PC Mouse Input Source
-#if !defined(WINCE)
 #define TABLET_INK_SIGNATURE 0xFFFFFF00
 #define TABLET_INK_CHECK     0xFF515700
 #define TABLET_INK_TOUCH     0x00000080
 #define MOUSE_INPUT_SOURCE() GetMouseInputSource()
-#else
-#define MOUSE_INPUT_SOURCE() nsIDOMNSMouseEvent::MOZ_SOURCE_MOUSE
-#endif
 
 /**************************************************************
  *
  * SECTION: enums
  * 
  **************************************************************/
 
 // nsWindow::sCanQuit
--- a/widget/src/windows/nsWindowGfx.cpp
+++ b/widget/src/windows/nsWindowGfx.cpp
@@ -71,20 +71,18 @@ using mozilla::plugins::PluginInstancePa
 #include "BasicLayers.h"
 #ifdef MOZ_ENABLE_D3D9_LAYER
 #include "LayerManagerD3D9.h"
 #endif
 #ifdef MOZ_ENABLE_D3D10_LAYER
 #include "LayerManagerD3D10.h"
 #endif
 
-#ifndef WINCE
 #include "nsUXThemeData.h"
 #include "nsUXThemeConstants.h"
-#endif
 
 extern "C" {
 #include "pixman.h"
 }
 
 using namespace mozilla::layers;
 
 /**************************************************************
@@ -159,63 +157,42 @@ nsWindowGfx::ConvertHRGNToRegion(HRGN aR
  **
  ** Paint related nsWindow methods.
  **
  **************************************************************
  **************************************************************/
 
 void nsWindowGfx::OnSettingsChangeGfx(WPARAM wParam)
 {
-#if defined(WINCE_WINDOWS_MOBILE)
-  if (wParam == SETTINGCHANGE_RESET) {
-    if (glpDDSecondary) {
-      glpDDSecondary->Release();
-      glpDDSecondary = NULL;
-    }
-
-    if(glpDD)
-      glpDD->RestoreAllSurfaces();
-  }
-#endif
+  // Previously contained only an ifdef WINCE_WINDOWS_MOBILE
+  // TODO: Remove this and adjust references
 }
 
 // GetRegionToPaint returns the invalidated region that needs to be painted
-// it's abstracted out because Windows XP/Vista/7 handles this for us, but
-// we need to keep track of it our selves for Windows CE and Windows Mobile
-
 nsIntRegion nsWindow::GetRegionToPaint(PRBool aForceFullRepaint,
                                        PAINTSTRUCT ps, HDC aDC)
 {
   if (aForceFullRepaint) {
     RECT paintRect;
     ::GetClientRect(mWnd, &paintRect);
     return nsIntRegion(nsWindowGfx::ToIntRect(paintRect));
   }
 
-#if defined(WINCE_WINDOWS_MOBILE) || !defined(WINCE)
   HRGN paintRgn = ::CreateRectRgn(0, 0, 0, 0);
   if (paintRgn != NULL) {
-# ifdef WINCE
-    int result = GetUpdateRgn(mWnd, paintRgn, FALSE);
-# else
     int result = GetRandomRgn(aDC, paintRgn, SYSRGN);
-# endif
     if (result == 1) {
       POINT pt = {0,0};
       ::MapWindowPoints(NULL, mWnd, &pt, 1);
       ::OffsetRgn(paintRgn, pt.x, pt.y);
     }
     nsIntRegion rgn(nsWindowGfx::ConvertHRGNToRegion(paintRgn));
     ::DeleteObject(paintRgn);
-# ifdef WINCE
-    if (!rgn.IsEmpty())
-# endif
-      return rgn;
+    return rgn;
   }
-#endif
   return nsIntRegion(nsWindowGfx::ToIntRect(ps.rcPaint));
 }
 
 #define WORDSSIZE(x) ((x).width * (x).height)
 static PRBool
 EnsureSharedSurfaceSize(gfxIntSize size)
 {
   gfxIntSize screenSize;
@@ -427,25 +404,22 @@ PRBool nsWindow::OnPaint(HDC aDC, PRUint
                  (r = iter.Next()) != nsnull;) {
               thebesContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height), PR_TRUE);
             }
             thebesContext->Clip();
             thebesContext->SetOperator(gfxContext::OPERATOR_CLEAR);
             thebesContext->Paint();
             thebesContext->SetOperator(gfxContext::OPERATOR_OVER);
           }
-#ifdef WINCE
-          thebesContext->SetFlag(gfxContext::FLAG_SIMPLIFY_OPERATORS);
-#endif
 
           // don't need to double buffer with anything but GDI
           BasicLayerManager::BufferMode doubleBuffering =
             BasicLayerManager::BUFFER_NONE;
           if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI)) {
-# if defined(MOZ_XUL) && !defined(WINCE)
+#ifdef MOZ_XUL
             switch (mTransparencyMode) {
               case eTransparencyGlass:
               case eTransparencyBorderlessGlass:
               default:
                 // If we're not doing translucency, then double buffer
                 doubleBuffering = BasicLayerManager::BUFFER_BUFFERED;
                 break;
               case eTransparencyTransparent:
@@ -622,32 +596,32 @@ PRBool nsWindow::OnPaint(HDC aDC, PRUint
   }
 
   if (!aDC) {
     ::EndPaint(mWnd, &ps);
   }
 
   mPaintDC = nsnull;
 
-#if defined(WIDGET_DEBUG_OUTPUT) && !defined(WINCE)
+#if defined(WIDGET_DEBUG_OUTPUT)
   if (debug_WantPaintFlashing())
   {
     // Only flash paint events which have not ignored the paint message.
     // Those that ignore the paint message aren't painting anything so there
     // is only the overhead of the dispatching the paint event.
     if (nsEventStatus_eIgnore != eventStatus) {
       ::InvertRgn(debugPaintFlashDC, debugPaintFlashRegion);
       PR_Sleep(PR_MillisecondsToInterval(30));
       ::InvertRgn(debugPaintFlashDC, debugPaintFlashRegion);
       PR_Sleep(PR_MillisecondsToInterval(30));
     }
     ::ReleaseDC(mWnd, debugPaintFlashDC);
     ::DeleteObject(debugPaintFlashRegion);
   }
-#endif // WIDGET_DEBUG_OUTPUT && !WINCE
+#endif // WIDGET_DEBUG_OUTPUT
 
   mPainting = PR_FALSE;
 
   nsPaintEvent didPaintEvent(PR_TRUE, NS_DID_PAINT, this);
   DispatchWindowEvent(&didPaintEvent);
 
   if (aNestingLevel == 0 && ::GetUpdateRect(mWnd, NULL, PR_FALSE)) {
     OnPaint(aDC, 1);
@@ -730,29 +704,25 @@ PRUint8* nsWindowGfx::Data32BitTo1Bit(PR
     }
   }
 
   return outData;
 }
 
 PRBool nsWindowGfx::IsCursorTranslucencySupported()
 {
-#ifdef WINCE
-  return PR_FALSE;
-#else
   static PRBool didCheck = PR_FALSE;
   static PRBool isSupported = PR_FALSE;
   if (!didCheck) {
     didCheck = PR_TRUE;
     // Cursor translucency is supported on Windows XP and newer
     isSupported = nsWindow::GetWindowsVersion() >= 0x501;
   }
 
   return isSupported;
-#endif
 }
 
 /**
  * Convert the given image data to a HBITMAP. If the requested depth is
  * 32 bit and the OS supports translucency, a bitmap with an alpha channel
  * will be returned.
  *
  * @param aImageData The image data to convert. Must use the format accepted
@@ -765,17 +735,16 @@ PRBool nsWindowGfx::IsCursorTranslucency
  *         DeleteObject when done with the bitmap.
  *         On failure, NULL will be returned.
  */
 HBITMAP nsWindowGfx::DataToBitmap(PRUint8* aImageData,
                                   PRUint32 aWidth,
                                   PRUint32 aHeight,
                                   PRUint32 aDepth)
 {
-#ifndef WINCE
   HDC dc = ::GetDC(NULL);
 
   if (aDepth == 32 && IsCursorTranslucencySupported()) {
     // Alpha channel. We need the new header.
     BITMAPV4HEADER head = { 0 };
     head.bV4Size = sizeof(head);
     head.bV4Width = aWidth;
     head.bV4Height = aHeight;
@@ -826,12 +795,9 @@ HBITMAP nsWindowGfx::DataToBitmap(PRUint
 
     bi.bmiColors[0] = white;
     bi.bmiColors[1] = black;
   }
 
   HBITMAP bmp = ::CreateDIBitmap(dc, &head, CBM_INIT, aImageData, &bi, DIB_RGB_COLORS);
   ::ReleaseDC(NULL, dc);
   return bmp;
-#else
-  return nsnull;
-#endif
 }
--- a/widget/src/xpwidgets/nsClipboardPrivacyHandler.cpp
+++ b/widget/src/xpwidgets/nsClipboardPrivacyHandler.cpp
@@ -43,17 +43,17 @@
 #include "nsIClipboard.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsLiteralString.h"
 #include "nsNetCID.h"
 #include "nsXPCOM.h"
 #include "mozilla/Services.h"
 
-#if defined(XP_WIN) && !defined(WINCE)
+#if defined(XP_WIN)
 #include <ole2.h>
 #endif
 
 #define NS_MOZ_DATA_FROM_PRIVATEBROWSING "application/x-moz-private-browsing"
 
 NS_IMPL_ISUPPORTS2(nsClipboardPrivacyHandler, nsIObserver, nsISupportsWeakReference)
 
 nsresult
@@ -105,17 +105,17 @@ nsClipboardPrivacyHandler::Observe(nsISu
 
     const char * flavors[] = { NS_MOZ_DATA_FROM_PRIVATEBROWSING };
     PRBool haveFlavors;
     rv = clipboard->HasDataMatchingFlavors(flavors,
                                            NS_ARRAY_LENGTH(flavors),
                                            nsIClipboard::kGlobalClipboard,
                                            &haveFlavors);
     if (NS_SUCCEEDED(rv) && haveFlavors) {
-#if defined(XP_WIN) && !defined(WINCE)
+#if defined(XP_WIN)
       // Workaround for bug 518412.  On Windows 7 x64, there is a bug
       // in handling clipboard data without any formats between
       // 32-bit/64-bit boundaries, which could lead Explorer to crash.
       // We work around the problem by clearing the clipboard using
       // the usual Win32 API.
       NS_ENSURE_TRUE(SUCCEEDED(::OleSetClipboard(NULL)), NS_ERROR_FAILURE);
 #else
       // Empty the native clipboard by copying an empty transferable
--- a/widget/tests/Makefile.in
+++ b/widget/tests/Makefile.in
@@ -107,29 +107,27 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
                standalone_native_menu_window.xul \
                test_bug586713.xul \
                bug586713_window.xul \
                test_key_event_counts.xul \
                $(NULL)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
-ifneq ($(OS_ARCH), WINCE)
 _CHROME_FILES  += taskbar_previews.xul \
 		window_state_windows.xul \
 		taskbar_progress.xul \
 		test_chrome_context_menus_win.xul \
 		test_plugin_input_event.html \
 		chrome_context_menus_win.xul \
 		$(NULL)
 
 _TEST_FILES +=	test_bug565392.html \
 		$(NULL)
 endif
-endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 _TEST_FILES += 	plugin_scroll_invalidation.html \
 		test_plugin_scroll_invalidation.html \
 		$(NULL)
 endif
 
 ifdef _TEST_FILES