From c8c84059089c9af1acd9dd4aa0321e1f7ae1e826 Mon Sep 17 00:00:00 2001 From: "dougt%meer.net" Date: Wed, 23 Feb 2005 07:07:51 +0000 Subject: [PATCH] bug 281948. WinCE changes to GFX and Widget. r=ere, sr=darin --- gfx/src/windows/Makefile.in | 8 +- gfx/src/windows/nsDeviceContextSpecWin.cpp | 29 +++- gfx/src/windows/nsDeviceContextWin.cpp | 6 + gfx/src/windows/nsFontMetricsWin.cpp | 17 ++- gfx/src/windows/nsGfxFactoryWin.cpp | 35 +++-- gfx/src/windows/nsImageWin.cpp | 2 + gfx/src/windows/nsNativeThemeWin.cpp | 40 ++++-- gfx/src/windows/nsRenderingContextWin.cpp | 34 ++++- widget/src/build/Makefile.in | 7 +- widget/src/build/nsWinWidgetFactory.cpp | 58 ++++---- widget/src/windows/Makefile.in | 21 +-- widget/src/windows/nsImageClipboard.h | 4 + widget/src/windows/nsLookAndFeel.cpp | 10 +- widget/src/windows/nsToolkit.cpp | 60 +++++--- widget/src/windows/nsToolkit.h | 5 +- widget/src/windows/nsWindow.cpp | 154 ++++++++++++++++----- widget/src/windows/nsWindow.h | 36 +++++ widget/src/windows/nsWindowAPI.h | 3 + 18 files changed, 401 insertions(+), 128 deletions(-) diff --git a/gfx/src/windows/Makefile.in b/gfx/src/windows/Makefile.in index fa4140e2489..7ea1c74e84f 100644 --- a/gfx/src/windows/Makefile.in +++ b/gfx/src/windows/Makefile.in @@ -80,13 +80,17 @@ CPPSRCS = \ nsDeviceContextSpecFactoryW.cpp \ nsScreenWin.cpp \ nsScreenManagerWin.cpp \ - nsPrintOptionsWin.cpp \ - nsPrintSettingsWin.cpp \ nsGfxFactoryWin.cpp \ nsNativeThemeWin.cpp \ nsUnicodeRange.cpp \ $(NULL) +ifneq ($(OS_ARCH), WINCE) +CPPSRCS += nsPrintOptionsWin.cpp \ + nsPrintSettingsWin.cpp \ + $(NULL) +endif + EXPORTS = nsIRenderingContextWin.h nsIDrawingSurfaceWin.h EXTRA_DSO_LIBS = gkgfx mozutil_s gfxshared_s diff --git a/gfx/src/windows/nsDeviceContextSpecWin.cpp b/gfx/src/windows/nsDeviceContextSpecWin.cpp index 381060fb291..747f9fd57c0 100644 --- a/gfx/src/windows/nsDeviceContextSpecWin.cpp +++ b/gfx/src/windows/nsDeviceContextSpecWin.cpp @@ -123,6 +123,9 @@ 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}, @@ -134,8 +137,6 @@ const NativePaperSizes kPaperSizes[] = { {DMPAPER_ESHEET, 34.0, 44.0, PR_TRUE}, {DMPAPER_LETTERSMALL, 8.5, 11.0, PR_TRUE}, {DMPAPER_A4SMALL, 210.0, 297.0, PR_FALSE}, - {DMPAPER_B4, 250.0, 354.0, PR_FALSE}, - {DMPAPER_B5, 182.0, 257.0, PR_FALSE}, {DMPAPER_FOLIO, 8.5, 13.0, PR_TRUE}, {DMPAPER_QUARTO, 215.0, 275.0, PR_FALSE}, {DMPAPER_10X14, 10.0, 14.0, PR_TRUE}, @@ -161,6 +162,7 @@ const NativePaperSizes kPaperSizes[] = { {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; @@ -213,6 +215,9 @@ static PRUnichar * GetDefaultPrinterNameFromGlobalPrinters() static nsresult EnumerateNativePrinters(DWORD aWhichPrinters, LPTSTR aPrinterName, PRBool& aIsFound, PRBool& aIsFile) { +#ifdef WINCE + aIsFound = PR_FALSE; +#else DWORD dwSizeNeeded = 0; DWORD dwNumItems = 0; LPPRINTER_INFO_2 lpInfo = NULL; @@ -243,6 +248,7 @@ EnumerateNativePrinters(DWORD aWhichPrinters, LPTSTR aPrinterName, PRBool& aIsFo } ::HeapFree(GetProcessHeap (), 0, lpInfo); +#endif return NS_OK; } @@ -252,6 +258,7 @@ CheckForPrintToFileWithName(LPTSTR aPrinterName, PRBool& aIsFile) { PRBool isFound = PR_FALSE; aIsFile = PR_FALSE; +#ifndef WINCE nsresult rv = EnumerateNativePrinters(PRINTER_ENUM_LOCAL, aPrinterName, isFound, aIsFile); if (isFound) return; @@ -263,7 +270,7 @@ CheckForPrintToFileWithName(LPTSTR aPrinterName, PRBool& aIsFile) rv = EnumerateNativePrinters(PRINTER_ENUM_REMOTE, aPrinterName, isFound, aIsFile); if (isFound) return; - +#endif } static nsresult @@ -650,6 +657,9 @@ static void DisplayLastError() 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()) { @@ -714,6 +724,7 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett DISPLAY_LAST_ERROR } return rv; +#endif // WINCE } //---------------------------------------------------------------------------------- @@ -932,6 +943,9 @@ nsPrinterEnumeratorWin::EnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult // Display the AdvancedDocumentProperties for the selected Printer NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPrinterName, nsIPrintSettings* aPrintSettings) { +#ifdef WINCE + return NS_ERROR_NOT_IMPLEMENTED; +#else nsresult rv = NS_ERROR_FAILURE; HANDLE hPrinter = NULL; BOOL status = ::OpenPrinter(NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aPrinterName).get()), &hPrinter, NULL); @@ -1004,6 +1018,7 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri } return rv; +#endif //WINCE } //---------------------------------------------------------------------------------- @@ -1040,7 +1055,7 @@ nsresult GlobalPrinters::EnumerateNativePrinters() { nsresult rv = NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE; - +#ifndef WINCE PR_PL(("-----------------------\n")); PR_PL(("EnumerateNativePrinters\n")); @@ -1064,7 +1079,7 @@ GlobalPrinters::EnumerateNativePrinters() rv = NS_OK; } PR_PL(("-----------------------\n")); - +#endif return rv; } @@ -1073,6 +1088,7 @@ GlobalPrinters::EnumerateNativePrinters() void GlobalPrinters::GetDefaultPrinterName(LPTSTR& aDefaultPrinterName) { +#ifndef WINCE aDefaultPrinterName = nsnull; TCHAR szDefaultPrinterName[1024]; DWORD status = GetProfileString("windows", "device", 0, szDefaultPrinterName, sizeof(szDefaultPrinterName)/sizeof(TCHAR)); @@ -1090,6 +1106,9 @@ GlobalPrinters::GetDefaultPrinterName(LPTSTR& aDefaultPrinterName) } PR_PL(("DEFAULT PRINTER [%s]\n", aDefaultPrinterName)); +#else + aDefaultPrinterName = "UNKNOWN"; +#endif } //---------------------------------------------------------------------------------- diff --git a/gfx/src/windows/nsDeviceContextWin.cpp b/gfx/src/windows/nsDeviceContextWin.cpp index 8a168ff569c..35e0f7a15f3 100644 --- a/gfx/src/windows/nsDeviceContextWin.cpp +++ b/gfx/src/windows/nsDeviceContextWin.cpp @@ -410,6 +410,9 @@ nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLo nsresult nsDeviceContextWin :: GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsFont* aFont) const { +#ifdef WINCE + return NS_ERROR_NOT_IMPLEMENTED; +#else NONCLIENTMETRICS ncm; HGDIOBJ hGDI; @@ -498,6 +501,7 @@ nsresult nsDeviceContextWin :: GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsF aFont->systemFont = PR_TRUE; return CopyLogFontToNSFont(&aHDC, ptrLogFont, aFont); +#endif } NS_IMETHODIMP nsDeviceContextWin :: GetSystemFont(nsSystemFontID anID, nsFont *aFont) const @@ -607,12 +611,14 @@ NS_IMETHODIMP nsDeviceContextWin::GetPaletteInfo(nsPaletteInfo& aPaletteInfo) aPaletteInfo.sizePalette = mPaletteInfo.sizePalette; aPaletteInfo.numReserved = mPaletteInfo.numReserved; +#ifndef WINCE if (NULL == mPaletteInfo.palette) { HWND hwnd = (HWND)mWidget; HDC hdc = ::GetDC(hwnd); mPaletteInfo.palette = ::CreateHalftonePalette(hdc); ::ReleaseDC(hwnd, hdc); } +#endif aPaletteInfo.palette = mPaletteInfo.palette; diff --git a/gfx/src/windows/nsFontMetricsWin.cpp b/gfx/src/windows/nsFontMetricsWin.cpp index 655a507d29b..0a6910032c2 100644 --- a/gfx/src/windows/nsFontMetricsWin.cpp +++ b/gfx/src/windows/nsFontMetricsWin.cpp @@ -515,7 +515,11 @@ nsFontMetricsWin::FillLogFont(LOGFONT* logFont, PRInt32 aWeight, (mFont.decorations & NS_FONT_DECORATION_LINE_THROUGH) ? TRUE : FALSE; logFont->lfCharSet = mIsUserDefined ? ANSI_CHARSET : DEFAULT_CHARSET; +#ifndef WINCE logFont->lfOutPrecision = OUT_TT_PRECIS; +#else + logFont->lfOutPrecision = OUT_DEFAULT_PRECIS; +#endif logFont->lfClipPrecision = CLIP_TURNOFF_FONTASSOCIATION; logFont->lfQuality = DEFAULT_QUALITY; logFont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; @@ -2317,7 +2321,6 @@ nsFontMetricsWin::CreateFontHandle(HDC aDC, const nsString& aName, LOGFONT* aLog PRInt32 weight = GetFontWeight(mFont.weight, weightTable); FillLogFont(aLogFont, weight); - /* * XXX we are losing info by converting from Unicode to system code page * but we don't really have a choice since CreateFontIndirectW is @@ -2458,9 +2461,11 @@ enumProc(const LOGFONT* logFont, const TEXTMETRIC* metrics, } // copy Unicode subrange bitfield (128bit) if it's a truetype font. +#ifndef WINCE if (fontType & hasFontSig) { memcpy(font->signature.fsUsb, ((NEWTEXTMETRICEX*)metrics)->ntmFontSig.fsUsb, 16); } +#endif return 1; } } @@ -2487,9 +2492,12 @@ enumProc(const LOGFONT* logFont, const TEXTMETRIC* metrics, if (fontType & hasFontSig) { font->flags |= NS_GLOBALFONT_TRUETYPE; +#ifndef WINCE // copy Unicode subrange bitfield (128 bits = 16 bytes) memcpy(font->signature.fsUsb, ((NEWTEXTMETRICEX*)metrics)->ntmFontSig.fsUsb, 16); +#endif } + if (logFont->lfCharSet == SYMBOL_CHARSET) { font->flags |= NS_GLOBALFONT_SYMBOL; } @@ -2667,6 +2675,10 @@ nsFontMetricsWin::FindSubstituteFont(HDC aDC, PRUint32 c) for (i = 0; i < count; ++i) { nsAutoString name; nsFontWin* font = (nsFontWin*)mLoadedFonts[i]; + + if (!font->mFont) + continue; + HFONT oldFont = (HFONT)::SelectObject(aDC, font->mFont); eGetNameError res = GetNAME(aDC, &name); ::SelectObject(aDC, oldFont); @@ -2716,7 +2728,6 @@ nsFontMetricsWin::FindSubstituteFont(HDC aDC, PRUint32 c) } } } - // We are running out of resources if we reach here... Try a stock font NS_ASSERTION(::GetMapMode(aDC) == MM_TEXT, "mapping mode needs to be MM_TEXT"); nsFontWin* font = LoadSubstituteFont(aDC, EmptyString()); @@ -5023,7 +5034,6 @@ nsFontMetricsWinA::FindLocalFont(HDC aDC, PRUint32 aChar) return subset; } } - return nsnull; } @@ -5040,7 +5050,6 @@ nsFontMetricsWinA::LoadGenericFont(HDC aDC, PRUint32 aChar, const nsString& aNam if (font && font->HasGlyph(aChar)) { return font->FindSubset(aDC, (PRUnichar)aChar, this); } - return nsnull; } diff --git a/gfx/src/windows/nsGfxFactoryWin.cpp b/gfx/src/windows/nsGfxFactoryWin.cpp index 708065b5b7a..f0527731337 100644 --- a/gfx/src/windows/nsGfxFactoryWin.cpp +++ b/gfx/src/windows/nsGfxFactoryWin.cpp @@ -67,15 +67,18 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDrawingSurfaceWin) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecFactoryWin) //NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableRegion) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsWin) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorWin) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerWin) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin) NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeWin) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(gfxImageFrame) +#ifndef WINCE +NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsWin) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) +#endif + PRBool UseAFunctions() { @@ -199,11 +202,6 @@ static const nsModuleComponentInfo components[] = "@mozilla.org/gfx/region;1", nsScriptableRegionConstructor }, - { "nsPrintOptionsWin", - NS_PRINTSETTINGSSERVICE_CID, - "@mozilla.org/gfx/printsettings-service;1", - nsPrintOptionsWinConstructor }, - { "nsFontEnumeratorWin", NS_FONT_ENUMERATOR_CID, "@mozilla.org/gfx/fontenumerator;1", @@ -218,11 +216,7 @@ static const nsModuleComponentInfo components[] = NS_SCREENMANAGER_CID, "@mozilla.org/gfx/screenmanager;1", nsScreenManagerWinConstructor }, - { "Win Printer Enumerator", - NS_PRINTER_ENUMERATOR_CID, - // "@mozilla.org/gfx/printer_enumerator/win;1", - "@mozilla.org/gfx/printerenumerator;1", - nsPrinterEnumeratorWinConstructor }, + { "Native Theme Renderer", NS_THEMERENDERER_CID, "@mozilla.org/chrome/chrome-native-theme;1", @@ -232,10 +226,25 @@ static const nsModuleComponentInfo components[] = GFX_IMAGEFRAME_CID, "@mozilla.org/gfx/image/frame;2", gfxImageFrameConstructor, }, + +#ifndef WINCE + { "nsPrintOptionsWin", + NS_PRINTSETTINGSSERVICE_CID, + "@mozilla.org/gfx/printsettings-service;1", + nsPrintOptionsWinConstructor }, + + { "Win Printer Enumerator", + NS_PRINTER_ENUMERATOR_CID, + // "@mozilla.org/gfx/printer_enumerator/win;1", + "@mozilla.org/gfx/printerenumerator;1", + nsPrinterEnumeratorWinConstructor }, + { "Print Session", NS_PRINTSESSION_CID, "@mozilla.org/gfx/printsession;1", nsPrintSessionConstructor } +#endif + }; NS_IMPL_NSGETMODULE(nsGfxModule, components) diff --git a/gfx/src/windows/nsImageWin.cpp b/gfx/src/windows/nsImageWin.cpp index 866001e581a..1c5d2bf64dd 100644 --- a/gfx/src/windows/nsImageWin.cpp +++ b/gfx/src/windows/nsImageWin.cpp @@ -1022,7 +1022,9 @@ nsImageWin::ProgressiveDoubleBlit(nsIDeviceContext *aContext, nsPaletteInfo palInfo; aContext->GetPaletteInfo(palInfo); if (palInfo.isPaletteDevice && palInfo.palette) { +#ifndef WINCE ::SetStretchBltMode(imgDC, HALFTONE); +#endif ::SelectPalette(imgDC, (HPALETTE)palInfo.palette, TRUE); ::RealizePalette(imgDC); } diff --git a/gfx/src/windows/nsNativeThemeWin.cpp b/gfx/src/windows/nsNativeThemeWin.cpp index 6a5d2cb58fe..152ef9f41df 100644 --- a/gfx/src/windows/nsNativeThemeWin.cpp +++ b/gfx/src/windows/nsNativeThemeWin.cpp @@ -1116,16 +1116,6 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI (*aResult).height = ::GetSystemMetrics(SM_CYHSCROLL); *aIsOverridable = PR_FALSE; break; - case NS_THEME_SCROLLBAR_THUMB_VERTICAL: - (*aResult).width = ::GetSystemMetrics(SM_CYVTHUMB); - (*aResult).height = (*aResult).width >> 1; - *aIsOverridable = PR_FALSE; - break; - case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL: - (*aResult).height = ::GetSystemMetrics(SM_CXHTHUMB); - (*aResult).width = (*aResult).height >> 1; - *aIsOverridable = PR_FALSE; - break; case NS_THEME_SCROLLBAR_TRACK_VERTICAL: // XXX HACK We should be able to have a minimum height for the scrollbar // track. However, this causes problems when uncollapsing a scrollbar @@ -1133,9 +1123,6 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI // (*aResult).height = ::GetSystemMetrics(SM_CYVTHUMB) << 1; break; - case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: - (*aResult).width = ::GetSystemMetrics(SM_CXHTHUMB) << 1; - break; case NS_THEME_DROPDOWN_BUTTON: (*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL); break; @@ -1160,6 +1147,7 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI case NS_THEME_TAB_PANELS: // no minimum widget size break; +#ifndef WINCE case NS_THEME_RESIZER: { NONCLIENTMETRICS nc; nc.cbSize = sizeof(nc); @@ -1168,7 +1156,21 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI else (*aResult).width = (*aResult).height = 15; break; + case NS_THEME_SCROLLBAR_THUMB_VERTICAL: + (*aResult).width = ::GetSystemMetrics(SM_CYVTHUMB); + (*aResult).height = (*aResult).width >> 1; + *aIsOverridable = PR_FALSE; + break; + case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL: + (*aResult).height = ::GetSystemMetrics(SM_CXHTHUMB); + (*aResult).width = (*aResult).height >> 1; + *aIsOverridable = PR_FALSE; + break; + case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: + (*aResult).width = ::GetSystemMetrics(SM_CXHTHUMB) << 1; + break; } +#endif default: return NS_ERROR_FAILURE; } @@ -1196,8 +1198,10 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 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()->IsContentOfType(nsIContent::eHTML)) aState |= DFCS_FLAT; +#endif aFocused = PR_TRUE; } } @@ -1294,8 +1298,10 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 aState |= DFCS_INACTIVE; else { PRInt32 eventState = GetContentState(aFrame, aWidgetType); +#ifndef WINCE if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE) - aState |= DFCS_PUSHED | DFCS_FLAT; + aState |= DFCS_PUSHED | DFCS_FLAT; +#endif } return NS_OK; @@ -1326,8 +1332,10 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 aState |= DFCS_INACTIVE; else { contentState = GetContentState(aFrame, aWidgetType); +#ifndef WINCE if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE) aState |= DFCS_PUSHED | DFCS_FLAT; +#endif } return NS_OK; @@ -1356,10 +1364,12 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 return NS_OK; } +#ifndef WINCE case NS_THEME_RESIZER: aPart = DFC_SCROLL; aState = DFCS_SCROLLSIZEGRIP; return NS_OK; +#endif } return NS_ERROR_FAILURE; } @@ -1609,7 +1619,9 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground(nsIRenderingContext* aCon oldForeColor = ::SetTextColor(hdc, ::GetSysColor(COLOR_3DHILIGHT)); oldBackColor = ::SetBkColor(hdc, color3D); +#ifndef WINCE ::UnrealizeObject(brush); +#endif ::SetBrushOrgEx(hdc, widgetRect.left, widgetRect.top, NULL); oldBrush = (HBRUSH) ::SelectObject(hdc, brush); diff --git a/gfx/src/windows/nsRenderingContextWin.cpp b/gfx/src/windows/nsRenderingContextWin.cpp index a56566da7a2..70b9cabc5c9 100644 --- a/gfx/src/windows/nsRenderingContextWin.cpp +++ b/gfx/src/windows/nsRenderingContextWin.cpp @@ -195,6 +195,7 @@ nsRenderingContextWin :: nsRenderingContextWin() // Windows 95 or earlier: assume it's not Bidi gBidiInfo = DONT_INIT; } +#ifndef WINCE else if (os.dwMajorVersion >= 4) { // Windows 98 or later UINT cp = ::GetACP(); @@ -205,6 +206,7 @@ nsRenderingContextWin :: nsRenderingContextWin() gBidiInfo = GCP_REORDER; } } +#endif } } @@ -433,15 +435,19 @@ nsresult nsRenderingContextWin :: SetupDC(HDC aOldDC, HDC aNewDC) ::SetTextColor(aNewDC, PALETTERGB_COLORREF(mColor)); mCurrTextColor = mCurrentColor; ::SetBkMode(aNewDC, TRANSPARENT); +#ifndef WINCE ::SetPolyFillMode(aNewDC, WINDING); +#endif // Temporary fix for bug 135226 until we do better decode-time // dithering and paletized storage of images. nsPaletteInfo palInfo; mContext->GetPaletteInfo(palInfo); +#ifndef WINCE if (palInfo.isPaletteDevice) ::SetStretchBltMode(aNewDC, HALFTONE); else ::SetStretchBltMode(aNewDC, COLORONCOLOR); +#endif ::SetTextAlign(aNewDC, TA_BASELINE); @@ -533,7 +539,9 @@ NS_IMETHODIMP nsRenderingContextWin :: LockDrawingSurface(PRInt32 aX, PRInt32 aY if(palInfo.isPaletteDevice && palInfo.palette){ ::SelectPalette(mDC,(HPALETTE)palInfo.palette,PR_TRUE); ::RealizePalette(mDC); +#ifndef WINCE ::UpdateColors(mDC); +#endif } } @@ -559,8 +567,10 @@ NS_IMETHODIMP nsRenderingContextWin :: UnlockDrawingSurface(void) mCurrTextColor = mCurrentColor; ::SetBkMode(mDC, TRANSPARENT); +#ifndef WINCE ::SetPolyFillMode(mDC, WINDING); ::SetStretchBltMode(mDC, COLORONCOLOR); +#endif mOrigSolidBrush = (HBRUSH)::SelectObject(mDC, mCurrBrush); mOrigFont = (HFONT)::SelectObject(mDC, mCurrFont); @@ -629,7 +639,9 @@ nsRenderingContextWin :: GetHints(PRUint32& aResult) { PRUint32 result = 0; +#ifndef WINCE result |= NS_RENDERING_HINT_FAST_MEASURE; +#endif if (gIsWIN95) result |= NS_RENDERING_HINT_FAST_8BIT_TEXT; @@ -637,10 +649,12 @@ nsRenderingContextWin :: GetHints(PRUint32& aResult) if (NOT_SETUP == gBidiInfo) { InitBidiInfo(); } +#ifndef WINCE if (GCP_REORDER == (gBidiInfo & GCP_REORDER) ) result |= NS_RENDERING_HINT_BIDI_REORDERING; if (GCP_GLYPHSHAPE == (gBidiInfo & GCP_GLYPHSHAPE) ) result |= NS_RENDERING_HINT_ARABIC_SHAPING; +#endif aResult = result; @@ -1347,7 +1361,9 @@ NS_IMETHODIMP nsRenderingContextWin :: DrawArc(nscoord aX, nscoord aY, nscoord a ey = (PRInt32)(cy - distance * sin(anglerad)); // this just makes it consitent, on windows 95 arc will always draw CC, nt this sets direction +#ifndef WINCE ::SetArcDirection(mDC, AD_COUNTERCLOCKWISE); +#endif ::Arc(mDC, aX, aY, aX + aWidth, aY + aHeight, sx, sy, ex, ey); @@ -1388,8 +1404,9 @@ NS_IMETHODIMP nsRenderingContextWin :: FillArc(nscoord aX, nscoord aY, nscoord a // this just makes it consistent, on windows 95 arc will always draw CC, // on NT this sets direction +#ifndef WINCE ::SetArcDirection(mDC, AD_COUNTERCLOCKWISE); - +#endif ::Pie(mDC, aX, aY, aX + aWidth, aY + aHeight, sx, sy, ex, ey); return NS_OK; @@ -2438,7 +2455,9 @@ NS_IMETHODIMP nsRenderingContextWin :: CopyOffScreenBits(nsIDrawingSurface* aSrc // road until I can get all this figured out.. and completed correctly. // Opened bug #153367 to take care of this palette issue. //::RealizePalette(destdc); +#ifndef WINCE ::UpdateColors(mDC); +#endif } if (aCopyFlags & NS_COPYBITS_XFORM_SOURCE_VALUES) @@ -2678,7 +2697,14 @@ HPEN nsRenderingContextWin :: SetupDottedPen(void) { if ((mCurrentColor != mCurrPenColor) || (NULL == mCurrPen) || (mCurrPen != mStates->mDottedPen)) { - HPEN tpen = ::CreatePen(PS_DOT, 0, PALETTERGB_COLORREF(mColor)); + HPEN tpen = ::CreatePen( +#ifndef WINCE + PS_DOT, +#else + PS_DASH, +#endif + 0, PALETTERGB_COLORREF(mColor)); + ::SelectObject(mDC, tpen); @@ -2834,6 +2860,7 @@ nsRenderingContextWin::ReleaseBackbuffer(void) { NS_IMETHODIMP nsRenderingContextWin::SetRightToLeftText(PRBool aIsRTL) { +#ifndef WINCE // Only call SetTextAlign if the new value is different from the // current value if (aIsRTL != mRightToLeftText) { @@ -2848,6 +2875,7 @@ nsRenderingContextWin::SetRightToLeftText(PRBool aIsRTL) } mRightToLeftText = aIsRTL; +#endif return NS_OK; } @@ -2858,6 +2886,7 @@ nsRenderingContextWin::SetRightToLeftText(PRBool aIsRTL) void nsRenderingContextWin::InitBidiInfo() { +#ifndef WINCE if (NOT_SETUP == gBidiInfo) { gBidiInfo = DONT_INIT; @@ -2900,6 +2929,7 @@ nsRenderingContextWin::InitBidiInfo() } } } +#endif //WINCE } diff --git a/widget/src/build/Makefile.in b/widget/src/build/Makefile.in index dd06f861b0f..fabc71ba209 100644 --- a/widget/src/build/Makefile.in +++ b/widget/src/build/Makefile.in @@ -72,8 +72,11 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../windows \ $(NULL) -OS_LIBS += $(call EXPAND_LIBNAME, comctl32 comdlg32 uuid ole32 \ - shell32 oleaut32 gdi32 imm32 ) +OS_LIBS += $(call EXPAND_LIBNAME, uuid ole32 oleaut32 ) + +ifneq ($(OS_ARCH), WINCE) +OS_LIBS += $(call EXPAND_LIBNAME, comctl32 comdlg32 shell32 gdi32 imm32 ) +endif SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)widget_windows.$(LIB_SUFFIX) \ diff --git a/widget/src/build/nsWinWidgetFactory.cpp b/widget/src/build/nsWinWidgetFactory.cpp index 420511b5ada..30107644609 100644 --- a/widget/src/build/nsWinWidgetFactory.cpp +++ b/widget/src/build/nsWinWidgetFactory.cpp @@ -64,17 +64,21 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow) + +#ifndef WINCE NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel) NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard) +#endif + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) static const nsModuleComponentInfo components[] = { @@ -86,36 +90,16 @@ static const nsModuleComponentInfo components[] = NS_CHILD_CID, "@mozilla.org/widgets/child_window/win;1", ChildWindowConstructor }, +#ifndef WINCE { "File Picker", NS_FILEPICKER_CID, "@mozilla.org/filepicker;1", nsFilePickerConstructor }, - { "AppShell", - NS_APPSHELL_CID, - "@mozilla.org/widget/appshell/win;1", - nsAppShellConstructor }, - { "Toolkit", - NS_TOOLKIT_CID, - "@mozilla.org/widget/toolkit/win;1", - nsToolkitConstructor }, - { "Look And Feel", - NS_LOOKANDFEEL_CID, - "@mozilla.org/widget/lookandfeel;1", - nsLookAndFeelConstructor }, { "Sound", NS_SOUND_CID, // "@mozilla.org/widget/sound/win;1" "@mozilla.org/sound;1", nsSoundConstructor }, - { "Transferable", - NS_TRANSFERABLE_CID, - // "@mozilla.org/widget/transferable/win;1", - "@mozilla.org/widget/transferable;1", - nsTransferableConstructor }, - { "HTML Format Converter", - NS_HTMLFORMATCONVERTER_CID, - "@mozilla.org/widget/htmlformatconverter;1", - nsHTMLFormatConverterConstructor }, { "Clipboard", NS_CLIPBOARD_CID, // "@mozilla.org/widget/clipboard/win;1", @@ -134,6 +118,28 @@ static const nsModuleComponentInfo components[] = NS_BIDIKEYBOARD_CID, "@mozilla.org/widget/bidikeyboard;1", nsBidiKeyboardConstructor }, +#endif + { "AppShell", + NS_APPSHELL_CID, + "@mozilla.org/widget/appshell/win;1", + nsAppShellConstructor }, + { "Toolkit", + NS_TOOLKIT_CID, + "@mozilla.org/widget/toolkit/win;1", + nsToolkitConstructor }, + { "Look And Feel", + NS_LOOKANDFEEL_CID, + "@mozilla.org/widget/lookandfeel;1", + nsLookAndFeelConstructor }, + { "Transferable", + NS_TRANSFERABLE_CID, + // "@mozilla.org/widget/transferable/win;1", + "@mozilla.org/widget/transferable;1", + nsTransferableConstructor }, + { "HTML Format Converter", + NS_HTMLFORMATCONVERTER_CID, + "@mozilla.org/widget/htmlformatconverter;1", + nsHTMLFormatConverterConstructor }, }; diff --git a/widget/src/windows/Makefile.in b/widget/src/windows/Makefile.in index f07f3374a1b..baad5429dec 100644 --- a/widget/src/windows/Makefile.in +++ b/widget/src/windows/Makefile.in @@ -69,22 +69,27 @@ REQUIRES = xpcom \ $(NULL) CPPSRCS = \ - nsNativeDragTarget.cpp \ - nsNativeDragSource.cpp \ - nsDragService.cpp \ L_Ienumfe.cpp \ - nsDataObj.cpp \ - nsDataObjCollection.cpp \ - nsClipboard.cpp \ nsWindow.cpp \ - nsFilePicker.cpp \ nsAppShell.cpp \ nsLookAndFeel.cpp \ nsToolkit.cpp \ - nsSound.cpp \ + $(NULL) + +ifneq ($(OS_ARCH), WINCE) +CPPSRCS += \ + nsDataObj.cpp \ + nsDataObjCollection.cpp \ + nsClipboard.cpp \ + nsNativeDragTarget.cpp \ + nsNativeDragSource.cpp \ + nsDragService.cpp \ nsImageClipboard.cpp \ nsBidiKeyboard.cpp \ + nsFilePicker.cpp \ + nsSound.cpp \ $(NULL) +endif DEFINES += -D_IMPL_NS_WIDGET -DMOZ_AIMM -DMOZ_UNICODE diff --git a/widget/src/windows/nsImageClipboard.h b/widget/src/windows/nsImageClipboard.h index 825c48234a0..c806fad43ba 100644 --- a/widget/src/windows/nsImageClipboard.h +++ b/widget/src/windows/nsImageClipboard.h @@ -37,6 +37,8 @@ * * ***** END LICENSE BLOCK ***** */ +#ifndef WINCE + /* Things To Do 11/8/00 Check image metrics, can we support them? Do we need to? @@ -105,3 +107,5 @@ private: BITMAPV4HEADER* mHeader; }; // nsImageFromClipboard + +#endif //WINCE diff --git a/widget/src/windows/nsLookAndFeel.cpp b/widget/src/windows/nsLookAndFeel.cpp index 62c66d8d08b..9d7edf14200 100644 --- a/widget/src/windows/nsLookAndFeel.cpp +++ b/widget/src/windows/nsLookAndFeel.cpp @@ -223,12 +223,14 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_WindowTitleHeight: aMetric = ::GetSystemMetrics(SM_CYCAPTION); break; +#ifndef WINCE case eMetric_WindowBorderWidth: aMetric = ::GetSystemMetrics(SM_CXFRAME); break; case eMetric_WindowBorderHeight: aMetric = ::GetSystemMetrics(SM_CYFRAME); break; +#endif case eMetric_Widget3DBorder: aMetric = ::GetSystemMetrics(SM_CXEDGE); break; @@ -300,6 +302,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) sSubmenuDelay = 300; +#ifndef WINCE result = ::RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &key); @@ -320,6 +323,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) } } } +#endif } aMetric = sSubmenuDelay; } @@ -331,6 +335,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_DragFullWindow: { static PRInt32 sDragFullWindow = -1; +#ifndef WINCE if (sDragFullWindow == -1) { HKEY key; char value[100]; @@ -355,11 +360,13 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) sDragFullWindow = str.ToInteger(&errorCode); } } - } + } +#endif aMetric = sDragFullWindow ? 1 : 0; } 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 @@ -385,6 +392,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) aMetric = 0; } break; +#endif case eMetric_ScrollArrowStyle: aMetric = eMetric_ScrollArrowStyleSingle; break; diff --git a/widget/src/windows/nsToolkit.cpp b/widget/src/windows/nsToolkit.cpp index 2f813ceed81..796076e1e24 100644 --- a/widget/src/windows/nsToolkit.cpp +++ b/widget/src/windows/nsToolkit.cpp @@ -91,11 +91,13 @@ DEFINE_GUID(IID_IActiveIMMMessagePumpOwner, IActiveIMMApp* nsToolkit::gAIMMApp = NULL; PRInt32 nsToolkit::gAIMMCount = 0; +#ifndef WINCE nsWindow *MouseTrailer::mCaptureWindow = NULL; nsWindow *MouseTrailer::mHoldMouse = NULL; MouseTrailer *MouseTrailer::theMouseTrailer = NULL; PRBool MouseTrailer::gIgnoreNextCycle(PR_FALSE); PRBool MouseTrailer::mIsInCaptureMode(PR_FALSE); +#endif #if !defined(MOZ_STATIC_COMPONENT_LIBS) && !defined(MOZ_ENABLE_LIBXUL) // @@ -107,6 +109,7 @@ PRBool MouseTrailer::mIsInCaptureMode(PR_FALSE); extern "C" { #endif +#ifndef WINCE BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD reason, LPVOID lpReserved ) @@ -130,6 +133,7 @@ BOOL APIENTRY DllMain( HINSTANCE hModule, return TRUE; } +#endif //wince #if defined(__GNUC__) } // extern "C" @@ -149,6 +153,7 @@ struct ThreadInitInfo { /* Detect when the user is moving a top-level window */ +#ifndef WINCE LRESULT CALLBACK DetectWindowMove(int code, WPARAM wParam, LPARAM lParam) { /* This msg filter is required to determine when the user has @@ -171,9 +176,9 @@ LRESULT CALLBACK DetectWindowMove(int code, WPARAM wParam, LPARAM lParam) PL_FavorPerformanceHint(PR_TRUE, 0); } } - return CallNextHookEx(nsMsgFilterHook, code, wParam, lParam); } +#endif // WINCE @@ -441,6 +446,7 @@ BOOL WINAPI nsUnregisterClass(LPCWSTR aClassW, HINSTANCE aInst) return FALSE; } +#ifndef WINCE BOOL WINAPI nsSHGetPathFromIDList(LPCITEMIDLIST aIdList, LPWSTR aPathW) { char pathA[MAX_PATH+1]; @@ -485,6 +491,7 @@ LPITEMIDLIST WINAPI nsSHBrowseForFolder(LPBROWSEINFOW aBiW) } return itemIdList; } +#endif HMODULE nsToolkit::mShell32Module = NULL; NS_DefWindowProc nsToolkit::mDefWindowProc = DefWindowProcA; @@ -501,8 +508,11 @@ NS_GetClassName nsToolkit::mGetClassName = nsGetClassName; NS_CreateWindowEx nsToolkit::mCreateWindowEx = nsCreateWindowEx; NS_RegisterClass nsToolkit::mRegisterClass = nsRegisterClass; NS_UnregisterClass nsToolkit::mUnregisterClass = nsUnregisterClass; + +#ifndef WINCE NS_SHGetPathFromIDList nsToolkit::mSHGetPathFromIDList = nsSHGetPathFromIDList; NS_SHBrowseForFolder nsToolkit::mSHBrowseForFolder = nsSHBrowseForFolder; +#endif void RunPump(void* arg) { @@ -510,8 +520,10 @@ void RunPump(void* arg) ::PR_EnterMonitor(info->monitor); // Start Active Input Method Manager on this thread +#ifndef WINCE if(nsToolkit::gAIMMApp) nsToolkit::gAIMMApp->Activate(TRUE); +#endif // do registration and creation in this thread info->toolkit->CreateInternalWindow(PR_GetCurrentThread()); @@ -541,6 +553,7 @@ nsToolkit::nsToolkit() mGuiThread = NULL; mDispatchWnd = 0; +#ifndef WINCE // // Initialize COM since create Active Input Method Manager object // @@ -551,8 +564,9 @@ nsToolkit::nsToolkit() ::CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER, IID_IActiveIMMApp, (void**) &nsToolkit::gAIMMApp); nsToolkit::gAIMMCount++; +#endif -#ifdef MOZ_STATIC_COMPONENT_LIBS +#if defined(MOZ_STATIC_COMPONENT_LIBS) || defined (WINCE) nsToolkit::Startup(GetModuleHandle(NULL)); #endif } @@ -567,6 +581,7 @@ nsToolkit::~nsToolkit() { NS_PRECONDITION(::IsWindow(mDispatchWnd), "Invalid window handle"); +#ifndef WINCE nsToolkit::gAIMMCount--; if (!nsToolkit::gAIMMCount) { @@ -577,6 +592,7 @@ nsToolkit::~nsToolkit() } ::CoUninitialize(); } +#endif // Destroy the Dispatch Window ::DestroyWindow(mDispatchWnd); @@ -590,12 +606,14 @@ nsToolkit::~nsToolkit() // Unhook the filter used to determine when // the user is moving a top-level window. +#ifndef WINCE if (nsMsgFilterHook != NULL) { UnhookWindowsHookEx(nsMsgFilterHook); nsMsgFilterHook = NULL; } +#endif -#ifdef MOZ_STATIC_COMPONENT_LIBS +#if defined (MOZ_STATIC_COMPONENT_LIBS) || defined(WINCE) nsToolkit::Shutdown(); #endif } @@ -604,6 +622,7 @@ nsToolkit::~nsToolkit() void nsToolkit::Startup(HMODULE hModule) { +#ifndef WINCE // // Set flag of nsToolkit::mUseImeApiW due to using Unicode API. // @@ -625,7 +644,9 @@ nsToolkit::Startup(HMODULE hModule) } nsToolkit::mIsNT = (osversion.dwPlatformId == VER_PLATFORM_WIN32_NT); - if (nsToolkit::mIsNT) { + if (nsToolkit::mIsNT) +#endif + { // For Windows 9x base OS nsFoo is already pointing to A functions // However on NT base OS we should point them to respective W functions nsToolkit::mDefWindowProc = DefWindowProcW; @@ -644,6 +665,7 @@ nsToolkit::Startup(HMODULE hModule) nsToolkit::mUnregisterClass = UnregisterClassW; // Explicit call of SHxxxW in Win95 makes moz fails to run (170969) // we use GetProcAddress() to hide +#ifndef WINCE nsToolkit::mShell32Module = ::LoadLibrary("Shell32.dll"); if (nsToolkit::mShell32Module) { nsToolkit::mSHGetPathFromIDList = (NS_SHGetPathFromIDList)GetProcAddress(nsToolkit::mShell32Module, "SHGetPathFromIDListW"); @@ -663,6 +685,7 @@ nsToolkit::Startup(HMODULE hModule) nsToolkit::mW2KXP_CP936 = PR_TRUE; } } +#endif } nsToolkit::mDllInstance = hModule; @@ -726,15 +749,16 @@ void nsToolkit::CreateInternalWindow(PRThread *aThread) // // create the internal window // + mDispatchWnd = ::CreateWindow("nsToolkitClass", - "NetscapeDispatchWnd", - WS_DISABLED, - -50, -50, - 10, 10, - NULL, - NULL, - nsToolkit::mDllInstance, - NULL); + "NetscapeDispatchWnd", + WS_DISABLED, + -50, -50, + 10, 10, + NULL, + NULL, + nsToolkit::mDllInstance, + NULL); VERIFY(mDispatchWnd); } @@ -785,20 +809,24 @@ NS_METHOD nsToolkit::Init(PRThread *aThread) // If no thread is provided create one if (NULL != aThread) { // Start Active Input Method Manager on this thread +#ifndef WINCE if(nsToolkit::gAIMMApp) nsToolkit::gAIMMApp->Activate(TRUE); +#endif CreateInternalWindow(aThread); } else { // create a thread where the message pump will run CreateUIThread(); } +#ifndef WINCE // Hook window move messages so the toolkit can report when // the user is moving a top-level window. if (nsMsgFilterHook == NULL) { nsMsgFilterHook = SetWindowsHookEx(WH_CALLWNDPROC, DetectWindowMove, NULL, GetCurrentThreadId()); } +#endif return NS_OK; } @@ -839,12 +867,13 @@ LRESULT CALLBACK nsToolkit::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, } +#ifndef WINCE if(nsToolkit::gAIMMApp) { LRESULT lResult; if (nsToolkit::gAIMMApp->OnDefWindowProc(hWnd, msg, wParam, lParam, &lResult) == S_OK) return lResult; } - +#endif return nsToolkit::mDefWindowProc(hWnd, msg, wParam, lParam); } @@ -899,7 +928,7 @@ NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult) return rv; } - +#ifndef WINCE //------------------------------------------------------------------------- // // @@ -909,7 +938,6 @@ MouseTrailer * MouseTrailer::GetMouseTrailer(DWORD aThreadID) { MouseTrailer::theMouseTrailer = new MouseTrailer(); } return MouseTrailer::theMouseTrailer; - } //------------------------------------------------------------------------- @@ -1045,5 +1073,5 @@ void CALLBACK MouseTrailer::TimerProc(HWND hWnd, UINT msg, UINT event, DWORD tim } } - +#endif diff --git a/widget/src/windows/nsToolkit.h b/widget/src/windows/nsToolkit.h index d2c4b899463..ab12c4a9faa 100644 --- a/widget/src/windows/nsToolkit.h +++ b/widget/src/windows/nsToolkit.h @@ -131,7 +131,9 @@ public: static NS_RegisterClass mRegisterClass; static NS_UnregisterClass mUnregisterClass; static NS_SHGetPathFromIDList mSHGetPathFromIDList; +#ifndef WINCE static NS_SHBrowseForFolder mSHBrowseForFolder; +#endif }; #define WM_CALLMETHOD (WM_USER+1) @@ -151,6 +153,7 @@ class nsWindow; * mouse pointer to see if it is within the outer most window. */ +#ifndef WINCE class MouseTrailer { public: @@ -202,6 +205,6 @@ private: //@} }; - +#endif // WINCE #endif // TOOLKIT_H diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 8aa4e9925e6..74a3d8866db 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -191,6 +191,7 @@ static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID); static const char *sScreenManagerContractID = "@mozilla.org/gfx/screenmanager;1"; +#ifndef WINCE //////////////////////////////////////////////////// // Manager for Registering and unregistering OLE // This is needed for drag & drop & Clipboard support @@ -225,6 +226,7 @@ OleRegisterMgr::~OleRegisterMgr() #endif ::OleUninitialize(); } +#endif //////////////////////////////////////////////////// // nsWindow Class static variable definitions @@ -655,8 +657,11 @@ public: TimerInfo *info = FindInfo(timerWindow); if (info) { // make sure it's unflashed and kill the timer + +#ifndef WINCE if (info->hasFlashed) ::FlashWindow(info->flashWindow, FALSE); +#endif ::KillTimer(info->timerWindow, info->timerID); RemoveTimer(info); delete info; @@ -861,7 +866,9 @@ nsWindow::nsWindow() : nsBaseWidget() nsWindow::uWM_MSIME_MOUSE = ::RegisterWindowMessage(RWM_MOUSE); // Heap dump +#ifndef WINCE nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessage(kMozHeapDumpMessageString); +#endif } mNativeDragTarget = nsnull; @@ -870,7 +877,7 @@ nsWindow::nsWindow() : nsBaseWidget() sInstanceCount++; -#ifndef __MINGW32__ +#if !defined (__MINGW32__) && !defined(WINCE) if (!nsWindow::uMSH_MOUSEWHEEL) nsWindow::uMSH_MOUSEWHEEL = RegisterWindowMessage(MSH_MOUSEWHEEL); #endif @@ -893,10 +900,12 @@ nsWindow::~nsWindow() gCurrentWindow = nsnull; } +#ifndef WINCE MouseTrailer * mouseTrailer = MouseTrailer::GetMouseTrailer(0); if (mouseTrailer->GetMouseTrailerWindow() == this) { mouseTrailer->DestroyTimer(); } +#endif // If the widget was released without calling Destroy() then the native // window still exists, and we need to destroy it @@ -929,10 +938,14 @@ nsWindow::~nsWindow() NS_METHOD nsWindow::CaptureMouse(PRBool aCapture) { if (aCapture) { +#ifndef WINCE MouseTrailer::SetCaptureWindow(this); +#endif ::SetCapture(mWnd); } else { +#ifndef WINCE MouseTrailer::SetCaptureWindow(NULL); +#endif ::ReleaseCapture(); } mIsInMouseCapture = aCapture; @@ -1192,17 +1205,20 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, gRollupWidget = this; NS_ADDREF(this); +#ifndef WINCE + if (!gMsgFilterHook && !gCallProcHook && !gCallMouseHook) { RegisterSpecialDropdownHooks(); } gProcessHook = PR_TRUE; - + } else { NS_IF_RELEASE(gRollupListener); NS_IF_RELEASE(gRollupWidget); - + gProcessHook = PR_FALSE; UnregisterSpecialDropdownHooks(); +#endif } return NS_OK; @@ -1227,28 +1243,21 @@ nsWindow::EventIsInsideWindow(UINT Msg, nsWindow* aWindow) return (PRBool) PtInRect(&r, mp); } -static LPCTSTR GetNSWindowPropName() { - static ATOM atom = 0; - - // this is threadsafe, even without locking; - // even if there's a race, GlobalAddAtom("MozillansIWidgetPtr") - // will just return the same value - if (!atom) { - atom = ::GlobalAddAtom("MozillansIWidgetPtr"); - } - return MAKEINTATOM(atom); +static char* sPropName = "MozillansIWidgetPtr"; +static char* GetNSWindowPropName() { + return sPropName; } nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd) { - return (nsWindow *) ::GetProp(aWnd, GetNSWindowPropName()); + return (nsWindow *) ::GetPropA(aWnd, GetNSWindowPropName()); } BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr) { if (ptr == NULL) { - ::RemoveProp(aWnd, GetNSWindowPropName()); + ::RemovePropA(aWnd, GetNSWindowPropName()); return TRUE; } else { - return ::SetProp(aWnd, GetNSWindowPropName(), (HANDLE)ptr); + return ::SetPropA(aWnd, GetNSWindowPropName(), (HANDLE)ptr); } } @@ -1262,15 +1271,23 @@ nsWindow :: DealWithPopups ( HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inL { if ( gRollupListener && gRollupWidget) { - if (inMsg == WM_ACTIVATE || inMsg == WM_NCLBUTTONDOWN || inMsg == WM_LBUTTONDOWN || - inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN || - inMsg == WM_NCMBUTTONDOWN || inMsg == WM_NCRBUTTONDOWN || inMsg == WM_MOUSEACTIVATE || - inMsg == WM_MOUSEWHEEL || inMsg == uMSH_MOUSEWHEEL || inMsg == WM_ACTIVATEAPP || - inMsg == WM_MENUSELECT || inMsg == WM_MOVING || inMsg == WM_SIZING || - // Non-toplevel windows normally don't get WM_GETMINMAXINFO. - // Therefore if a non-toplevel window gets this message, we should ignore it. + if (inMsg == WM_ACTIVATE || inMsg == WM_LBUTTONDOWN || + inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN || + inMsg == WM_MOUSEWHEEL || inMsg == uMSH_MOUSEWHEEL +#ifndef WINCE + || + inMsg == WM_NCRBUTTONDOWN || + inMsg == WM_MOVING || + inMsg == WM_SIZING || + inMsg == WM_GETMINMAXINFO || + inMsg == WM_NCLBUTTONDOWN || + inMsg == WM_NCMBUTTONDOWN || + inMsg == WM_MOUSEACTIVATE || + inMsg == WM_ACTIVATEAPP || + inMsg == WM_MENUSELECT || (inMsg == WM_GETMINMAXINFO && !::GetParent(inWnd)) - ) +#endif + ) { // Rollup if the event is outside the popup. PRBool rollup = !nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)gRollupWidget); @@ -1307,6 +1324,7 @@ nsWindow :: DealWithPopups ( HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inL } // if rollup listener knows about menus } +#ifndef WINCE if (inMsg == WM_MOUSEACTIVATE) { // Prevent the click inside the popup from causing a change in window // activation. Since the popup is shown non-activated, we need to eat @@ -1332,9 +1350,10 @@ nsWindow :: DealWithPopups ( HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inL } } } - // if we've still determined that we should still rollup everything, do it. - else if ( rollup ) { + else +#endif + if ( rollup ) { gRollupListener->Rollup(); // Tell hook to stop processing messages @@ -1549,6 +1568,7 @@ nsWindow::StandardWindowCreate(nsIWidget *aParent, (DLGPROC)DummyDialogProc, NULL); } else { + mWnd = nsToolkit::mCreateWindowEx(extendedStyle, aInitData && aInitData->mDropShadow ? WindowPopupClassW() : WindowClassW(), @@ -1801,8 +1821,10 @@ NS_METHOD nsWindow::Show(PRBool bState) case nsSizeMode_Maximized : mode = SW_SHOWMAXIMIZED; break; +#ifndef WINCE case nsSizeMode_Minimized : mode = SW_SHOWMINIMIZED; +#endif break; default : mode = SW_SHOWNORMAL; @@ -1887,9 +1909,11 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) { case nsSizeMode_Maximized : mode = SW_MAXIMIZE; break; +#ifndef WINCE case nsSizeMode_Minimized : mode = gTrimOnMinimize ? SW_MINIMIZE : SW_SHOWMINIMIZED; break; +#endif default : mode = SW_RESTORE; } @@ -2126,9 +2150,11 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) } UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE; +#ifndef WINCE if (!aRepaint) { flags |= SWP_NOREDRAW; } +#endif if (NULL != deferrer) { VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer, @@ -2178,10 +2204,11 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeig } UINT flags = SWP_NOZORDER | SWP_NOACTIVATE; +#ifndef WINCE if (!aRepaint) { flags |= SWP_NOREDRAW; } - +#endif if (NULL != deferrer) { VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer, mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags)); @@ -2364,9 +2391,11 @@ NS_METHOD nsWindow::SetBackgroundColor(const nscolor &aColor) ::DeleteObject(mBrush); mBrush = ::CreateSolidBrush(NSRGB_2_COLOREF(mBackground)); +#ifndef WINCE if (mWnd != NULL) { SetClassLong(mWnd, GCL_HBRBACKGROUND, (LONG)mBrush); } +#endif return NS_OK; } @@ -2955,7 +2984,7 @@ void nsWindow::SetUpForPaint(HDC aHDC) NS_METHOD nsWindow::EnableDragDrop(PRBool aEnable) { nsresult rv = NS_ERROR_FAILURE; - +#ifndef WINCE if (aEnable) { if (nsnull == mNativeDragTarget) { mNativeDragTarget = new nsNativeDragTarget(this); @@ -2977,7 +3006,7 @@ NS_METHOD nsWindow::EnableDragDrop(PRBool aEnable) NS_RELEASE(mNativeDragTarget); } } - +#endif return rv; } @@ -3695,7 +3724,9 @@ void PrintEvent(UINT msg, PRBool aShowAllEvents, PRBool aShowMouseMoves) // Static helper functions for heap dumping static nsresult HeapDump(const char *filename, const char *heading) { - +#ifdef WINCE + return NS_ERROR_NOT_IMPLEMENTED; +#else // Make sure heapwalk() is available typedef BOOL WINAPI HeapWalkProc(HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry); typedef DWORD WINAPI GetProcessHeapsProc(DWORD NumberOfHeaps, PHANDLE ProcessHeaps); @@ -3757,6 +3788,7 @@ static nsresult HeapDump(const char *filename, const char *heading) PR_Close(prfd); return NS_OK; +#endif } // Recursively dispatch synchronous paints for nsIWidget @@ -3847,9 +3879,11 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } 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. @@ -3946,10 +3980,12 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result = OnPaint(); break; +#ifndef WINCE case WM_PRINTCLIENT: result = OnPaint((HDC) wParam); break; - +#endif + case WM_SYSCHAR: case WM_CHAR: { @@ -4034,7 +4070,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } else result = PR_FALSE; - +#ifndef WINCE if (wParam == VK_MENU || (wParam == VK_F10 && !mIsShiftDown)) { // We need to let Windows handle this keypress, // by returning PR_FALSE, if there's a native menu @@ -4052,6 +4088,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } result = !hasNativeMenu; } +#endif DispatchPendingEvents(); break; @@ -4229,6 +4266,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT PRBool result = DispatchWindowEvent(&event); NS_RELEASE(event.widget); +#ifndef WINCE if (event.acceptActivation) *aRetValue = MA_ACTIVATE; else @@ -4236,10 +4274,12 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT if (gSwitchKeyboardLayout && mLastKeyboardLayout) ActivateKeyboardLayout(mLastKeyboardLayout, 0); +#endif } } break; +#ifndef WINCE case WM_MOUSEACTIVATE: { // This seems to be the only way we're @@ -4262,6 +4302,8 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } break; +#endif + case WM_SETFOCUS: result = DispatchFocus(NS_GOTFOCUS, isMozWindowTakingFocus); if (gJustGotActivate) { @@ -4292,6 +4334,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result = DispatchFocus(NS_LOSTFOCUS, isMozWindowTakingFocus); break; +#ifndef WINCE case WM_WINDOWPOSCHANGED: { #ifdef MOZ_XUL @@ -4415,6 +4458,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } } break; +#endif case WM_SETTINGCHANGE: getWheelInfo = PR_TRUE; @@ -4450,6 +4494,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result = PR_TRUE; break; +#ifndef WINCE case WM_INPUTLANGCHANGEREQUEST: *aRetValue = TRUE; result = PR_FALSE; @@ -4458,6 +4503,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT case WM_INPUTLANGCHANGE: result = OnInputLangChange((HKL)lParam, aRetValue); break; +#endif case WM_IME_STARTCOMPOSITION: result = OnIMEStartComposition(); @@ -4494,6 +4540,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result = OnIMESetContext(wParam, lParam); break; +#ifndef WINCE case WM_DROPFILES: { #if 0 @@ -4519,6 +4566,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT #endif } break; +#endif case WM_DESTROYCLIPBOARD: { @@ -4558,6 +4606,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } #endif +#ifndef WINCE case WM_SYSCOMMAND: // prevent Windows from trimming the working set. bug 76831 if (!gTrimOnMinimize && wParam == SC_MINIMIZE) { @@ -4565,10 +4614,12 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result = PR_TRUE; } break; +#endif default: { // Handle both flavors of mouse wheel events. +#ifndef WINCE if ((msg == WM_MOUSEWHEEL) || (msg == uMSH_MOUSEWHEEL)) { static int iDeltaPerLine; static ULONG ulScrollLines; @@ -4749,6 +4800,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT HeapDump("c:\\heapdump.txt", "whatever"); result = PR_TRUE; } +#endif // WINCE } break; @@ -4784,7 +4836,11 @@ LPCWSTR nsWindow::WindowClassW() wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = nsToolkit::mDllInstance; +#ifdef WINCE + wc.hIcon = NULL; +#else wc.hIcon = ::LoadIconW(::GetModuleHandle(NULL), MAKEINTRESOURCEW(IDI_APPLICATION)); +#endif wc.hCursor = NULL; wc.hbrBackground = mBrush; wc.lpszMenuName = NULL; @@ -4844,7 +4900,11 @@ LPCWSTR nsWindow::WindowPopupClassW() wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = nsToolkit::mDllInstance; +#ifdef WINCE + wc.hIcon = NULL; +#else wc.hIcon = ::LoadIconW(::GetModuleHandle(NULL), MAKEINTRESOURCEW(IDI_APPLICATION)); +#endif wc.hCursor = NULL; wc.hbrBackground = mBrush; wc.lpszMenuName = NULL; @@ -4862,7 +4922,7 @@ LPCWSTR nsWindow::WindowPopupClassW() return className; } -LPCTSTR nsWindow::WindowClass() +LPCSTR nsWindow::WindowClass() { // Call into the wide version to make sure things get // registered properly. @@ -4886,7 +4946,7 @@ LPCTSTR nsWindow::WindowClass() return kClassNameGeneral; } -LPCTSTR nsWindow::WindowPopupClass() +LPCSTR nsWindow::WindowPopupClass() { // Call into the wide version to make sure things get // registered properly. @@ -4904,6 +4964,9 @@ LPCTSTR nsWindow::WindowPopupClass() //------------------------------------------------------------------------- DWORD nsWindow::WindowStyle() { +#ifdef WINCE + return WS_CHILD; +#else DWORD style; switch (mWindowType) { @@ -4971,6 +5034,7 @@ DWORD nsWindow::WindowStyle() } return style; +#endif } @@ -5435,9 +5499,11 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, nsPoint* // So we use "WindowFromPoint" to find what window we are over and // set that window into the mouse trailer timer. if (!mIsInMouseCapture) { +#ifndef WINCE MouseTrailer * mouseTrailer = MouseTrailer::GetMouseTrailer(0); MouseTrailer::SetMouseTrailerWindow(this); mouseTrailer->CreateTimer(); +#endif } else { POINT mp; DWORD pos = ::GetMessagePos(); @@ -5466,9 +5532,11 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, nsPoint* } // only set the window into the mouse trailer if we have a good window if (nsnull != someWindow) { +#ifndef WINCE MouseTrailer * mouseTrailer = MouseTrailer::GetMouseTrailer(0); MouseTrailer::SetMouseTrailerWindow(someWindow); mouseTrailer->CreateTimer(); +#endif } } @@ -5480,7 +5548,9 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, nsPoint* if (rect.Contains(event.point.x, event.point.y)) { if (gCurrentWindow == NULL || gCurrentWindow != this) { if ((nsnull != gCurrentWindow) && (!gCurrentWindow->mIsDestroying)) { +#ifndef WINCE MouseTrailer::IgnoreNextCycle(); +#endif gCurrentWindow->DispatchMouseEvent(NS_MOUSE_EXIT, wParam, gCurrentWindow->GetLastPoint()); } gCurrentWindow = this; @@ -5710,6 +5780,10 @@ NS_METHOD nsWindow::SetIcon(const nsAString& aIconSpec) // XXX this should use MZLU (see bug 239279) ::SetLastError(0); +#ifdef WINCE +#define LR_LOADFROMFILE 0 +#endif + HICON bigIcon = (HICON)::LoadImageW(NULL, (LPCWSTR)iconPath.get(), IMAGE_ICON, @@ -6946,7 +7020,9 @@ static VOID CALLBACK nsGetAttentionTimerFunc(HWND hwnd, UINT uMsg, UINT idEvent, if (maxFlashCount > 0) { // We have a max flash count, if we haven't met it yet, flash again. if (flashCount < maxFlashCount) { +#ifndef WINCE ::FlashWindow(flashwnd, TRUE); +#endif gAttentionTimerMonitor->IncrementFlashCount(hwnd); } else @@ -6954,7 +7030,9 @@ static VOID CALLBACK nsGetAttentionTimerFunc(HWND hwnd, UINT uMsg, UINT idEvent, } else { // The caller didn't specify a flash count. +#ifndef WINCE ::FlashWindow(flashwnd, TRUE); +#endif } gAttentionTimerMonitor->SetFlashed(hwnd); @@ -7049,6 +7127,9 @@ MSGFEventMsgInfo gMSGFEvents[] = { #endif + +#ifndef WINCE + //------------------------------------------------------------------------- // Schedules a timer for a window, so we can rollup after processing the hook event void nsWindow::ScheduleHookTimer(HWND aWnd, UINT aMsgId) @@ -7069,6 +7150,7 @@ void nsWindow::ScheduleHookTimer(HWND aWnd, UINT aMsgId) //------------------------------------------------------------------------- // Process Menu messages // Rollup when when is clicked + LRESULT CALLBACK nsWindow::MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam) { #ifdef DISPLAY_NOISY_MSGF_MSG @@ -7146,6 +7228,7 @@ LRESULT CALLBACK nsWindow::MozSpecialWndProc(int code, WPARAM wParam, LPARAM lPa //------------------------------------------------------------------------- // Register the special "hooks" for dropdown processing + void nsWindow::RegisterSpecialDropdownHooks() { NS_ASSERTION(!gMsgFilterHook, "gMsgFilterHook must be NULL!"); @@ -7191,6 +7274,7 @@ void nsWindow::RegisterSpecialDropdownHooks() //------------------------------------------------------------------------- // Unhook special message hooks for dropdowns + void nsWindow::UnregisterSpecialDropdownHooks() { DISPLAY_NMM_PRT("***************** De-installing Msg Hooks ***************\n"); @@ -7220,6 +7304,7 @@ void nsWindow::UnregisterSpecialDropdownHooks() } } + //------------------------------------------------------------------------- // This timer is designed to only fire one time at most each time a "hook" function // is used to rollup the dropdown @@ -7247,6 +7332,7 @@ VOID CALLBACK nsWindow::HookTimerForPopups(HWND hwnd, UINT uMsg, UINT idEvent, D gRollupMsgWnd = NULL; } } +#endif // WinCE #ifdef ACCESSIBILITY diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index a1493739917..bad7fcae5eb 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -120,6 +120,7 @@ public: } nsIMM(const char* aModuleName="IMM32.DLL") { +#ifndef WINCE mInstance=::LoadLibrary(aModuleName); NS_ASSERTION(mInstance!=NULL, "nsIMM.LoadLibrary failed."); @@ -158,6 +159,36 @@ public: mSetOpenStatus=(mInstance) ? (SetOpenStatusPtr)GetProcAddress(mInstance,"ImmSetOpenStatus") : 0; NS_ASSERTION(mSetOpenStatus!=NULL, "nsIMM.ImmSetOpenStatus failed."); +#elif WINCE_EMULATOR + mInstance=NULL; + mGetCompositionStringA=NULL; + mGetCompositionStringW=NULL; + mGetContext=NULL; + mReleaseContext=NULL; + mNotifyIME=NULL; + mSetCandiateWindow=NULL; + mGetCompositionWindow=NULL; + mSetCompositionWindow=NULL; + mGetProperty=NULL; + mGetDefaultIMEWnd=NULL; + mGetOpenStatus=NULL; + mSetOpenStatus=NULL; +#else // WinCE + mInstance=NULL; + + mGetCompositionStringA=NULL; + mGetCompositionStringW=(GetCompStrPtr)ImmGetCompositionStringW; + mGetContext=(GetContextPtr)ImmGetContext; + mReleaseContext=(RelContextPtr)ImmReleaseContext; + mNotifyIME=(NotifyIMEPtr)ImmNotifyIME; + mSetCandiateWindow=(SetCandWindowPtr)ImmSetCandidateWindow; + mGetCompositionWindow=(GetCompWindowPtr)ImmGetCompositionWindow; + mSetCompositionWindow=(SetCompWindowPtr)ImmSetCompositionWindow; + mGetProperty=(GetPropertyPtr)ImmGetProperty; + mGetDefaultIMEWnd=(GetDefaultIMEWndPtr)ImmGetDefaultIMEWnd; + mGetOpenStatus=(GetOpenStatusPtr)ImmGetOpenStatus; + mSetOpenStatus=(SetOpenStatusPtr)ImmSetOpenStatus; +#endif } ~nsIMM() { @@ -396,6 +427,9 @@ public: PRBool BlurEventsSuppressed(); protected: + +#ifndef WINCE + // special callback hook methods for pop ups static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam); @@ -406,6 +440,8 @@ protected: static void RegisterSpecialDropdownHooks(); static void UnregisterSpecialDropdownHooks(); +#endif + static BOOL DealWithPopups (HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult); static PRBool EventIsInsideWindow(UINT Msg, nsWindow* aWindow); diff --git a/widget/src/windows/nsWindowAPI.h b/widget/src/windows/nsWindowAPI.h index 893644afab5..1ebb2faf65c 100644 --- a/widget/src/windows/nsWindowAPI.h +++ b/widget/src/windows/nsWindowAPI.h @@ -58,7 +58,10 @@ typedef HWND (WINAPI *NS_CreateWindowEx) typedef ATOM (WINAPI *NS_RegisterClass) (CONST WNDCLASSW *); typedef BOOL (WINAPI *NS_UnregisterClass) (LPCWSTR, HINSTANCE); typedef BOOL (WINAPI *NS_SHGetPathFromIDList) (LPCITEMIDLIST, LPWSTR); + +#ifndef WINCE typedef LPITEMIDLIST (WINAPI *NS_SHBrowseForFolder) (LPBROWSEINFOW); +#endif // Avoid including windowsx.h to prevent macro pollution #ifndef GET_X_LPARAM