b=477727; windows widget nsWindow WinCE/Windows Mobile separation fixes; r=dougt

This commit is contained in:
Vladimir Vukicevic 2009-02-12 18:26:02 -08:00
parent d81d3dca11
commit c02b509b7b

View File

@ -78,9 +78,20 @@
#include "gfxImageSurface.h"
#ifdef WINCE
#include "aygshell.h"
#include "imm.h"
#define PAINT_USE_IMAGE_SURFACE
#ifdef WINCE_WINDOWS_MOBILE
#define WINCE_HAVE_SOFTKB
#include "tpcshell.h"
#else
#undef WINCE_HAVE_SOFTKB
#include "winuserm.h"
#endif
#else
#include "nsUXThemeData.h"
@ -150,13 +161,16 @@
#include "prprf.h"
#include "prmem.h"
#ifdef NS_ENABLE_TSF
#include "nsTextStore.h"
#endif //NS_ENABLE_TSF
/*
* WinCE helpers
*/
#ifdef WINCE
#ifdef WINCE_HAVE_SOFTKB
static PRBool gSoftKeyMenuBar = PR_FALSE;
static void CreateSoftKeyMenuBar(HWND wnd)
@ -201,6 +215,7 @@ static void CreateSoftKeyMenuBar(HWND wnd)
gSoftKeyMenuBar = mbi.hwndMB;
}
#endif //defined(WINCE_HAVE_SOFTKB)
#define IDI_APPLICATION MAKEINTRESOURCE(32512)
@ -251,7 +266,7 @@ inline BOOL EnumThreadWindows(DWORD inThreadID, WNDENUMPROC inFunc, LPARAM inPar
return FALSE;
}
#endif
#endif //defined(WINCE)
@ -1402,7 +1417,7 @@ nsWindow::StandardWindowCreate(nsIWidget *aParent,
}
}
}
#ifdef WINCE
#if defined(WINCE) && defined(WINCE_HAVE_SOFTKB)
if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel )
CreateSoftKeyMenuBar(mWnd);
#endif
@ -4732,11 +4747,9 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
if (WA_INACTIVE == fActive) {
gJustGotDeactivate = PR_TRUE;
if (mIsTopWidgetWindow)
#ifndef WINCE
if (mIsTopWidgetWindow)
mLastKeyboardLayout = gKbdLayout.GetLayout();
#else
;
#endif
} else {
gJustGotActivate = PR_TRUE;
@ -4806,7 +4819,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
}
#endif
#ifdef WINCE
#if defined(WINCE) && 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
@ -4834,7 +4847,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
break;
case WM_KILLFOCUS:
#ifdef WINCE
#if defined(WINCE) && defined(WINCE_HAVE_SOFTKB)
{
// Get current input context
HIMC hC = ImmGetContext(mWnd);
@ -5350,7 +5363,6 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
#endif
}
//*aRetValue = result;
if (mWnd) {
return result;
@ -6063,8 +6075,7 @@ PRBool nsWindow::OnPaint(HDC aDC)
(PRInt32) mWnd);
#endif // NS_DEBUG
#ifndef WINCE
#ifdef MOZ_XUL
#if defined(MOZ_XUL) && !defined(PAINT_USE_IMAGE_SURFACE)
nsRefPtr<gfxASurface> targetSurface;
if (eTransparencyTransparent == mTransparencyMode) {
if (mTransparentSurface == nsnull)
@ -6073,24 +6084,25 @@ PRBool nsWindow::OnPaint(HDC aDC)
} else {
targetSurface = new gfxWindowsSurface(hDC);
}
#else
nsRefPtr<gfxASurface> targetSurface = new gfxWindowsSurface(hDC);
#endif
#else
nsRefPtr<gfxImageSurface> targetSurface = new gfxImageSurface(gfxIntSize(ps.rcPaint.right - ps.rcPaint.left,
ps.rcPaint.bottom - ps.rcPaint.top),
#elif defined(PAINT_USE_IMAGE_SURFACE)
gfxIntSize surfaceSize(ps.rcPaint.right - ps.rcPaint.left,
ps.rcPaint.bottom - ps.rcPaint.top);
nsRefPtr<gfxImageSurface> targetSurface = new gfxImageSurface(surfaceSize,
gfxASurface::ImageFormatRGB24);
if (targetSurface && !targetSurface->CairoStatus()) {
targetSurface->SetDeviceOffset(gfxPoint(-ps.rcPaint.left, -ps.rcPaint.top));
}
#else
nsRefPtr<gfxASurface> targetSurface = new gfxWindowsSurface(hDC);
#endif
nsRefPtr<gfxContext> thebesContext = new gfxContext(targetSurface);
thebesContext->SetFlag(gfxContext::FLAG_DESTINED_FOR_SCREEN);
#ifndef WINCE
#if defined(MOZ_XUL)
// don't need to double buffer with PAINT_USE_IMAGE_SURFACE;
// it's implicitly double buffered
#if !defined(PAINT_USE_IMAGE_SURFACE)
# if defined(MOZ_XUL)
if (eTransparencyGlass == mTransparencyMode && nsUXThemeData::sHaveCompositor) {
thebesContext->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
} else if (eTransparencyTransparent == mTransparencyMode) {
@ -6103,11 +6115,11 @@ PRBool nsWindow::OnPaint(HDC aDC)
// If we're not doing translucency, then double buffer
thebesContext->PushGroup(gfxASurface::CONTENT_COLOR);
}
#else
# else
// If we're not doing translucency, then double buffer
thebesContext->PushGroup(gfxASurface::CONTENT_COLOR);
# endif
#endif
#endif /* ifndef WINCE */
nsCOMPtr<nsIRenderingContext> rc;
nsresult rv = mContext->CreateRenderingContextInstance (*getter_AddRefs(rc));
@ -6132,24 +6144,37 @@ PRBool nsWindow::OnPaint(HDC aDC)
// bitmap. Now it can be read from memory bitmap to apply alpha channel and after
// that displayed on the screen.
UpdateTranslucentWindow();
} else if (result) {
#ifndef WINCE
} else
#endif
if (result) {
#ifndef PAINT_USE_IMAGE_SURFACE
// Only update if DispatchWindowEvent returned TRUE; otherwise, nothing handled
// this, and we'll just end up painting with black.
thebesContext->PopGroupToSource();
thebesContext->SetOperator(gfxContext::OPERATOR_SOURCE);
thebesContext->Paint();
#else
nsRefPtr<gfxASurface> winSurface = new gfxWindowsSurface(hDC);
nsRefPtr<gfxContext> winCtx = new gfxContext(winSurface);
// Just blit this directly
BITMAPINFOHEADER bi;
memset(&bi, 0, sizeof(BITMAPINFOHEADER));
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = surfaceSize.width;
bi.biHeight = - surfaceSize.height;
bi.biPlanes = 1;
bi.biBitCount = 32;
bi.biCompression = BI_RGB;
winCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
winCtx->SetSource(targetSurface);
winCtx->Paint();
StretchDIBits(hDC,
ps.rcPaint.left, ps.rcPaint.top,
surfaceSize.width, surfaceSize.height,
0, 0,
surfaceSize.width, surfaceSize.height,
targetSurface->Data(),
(BITMAPINFO*) &bi,
DIB_RGB_COLORS,
SRCCOPY);
#endif
}
#endif
}
}
@ -6937,7 +6962,7 @@ nsWindow::GetTextRangeList(PRUint32* aListLength,
// iterate over the attributes
int lastOffset = 0;
for (int i = 0; i < *aListLength; i++) {
for (unsigned int i = 0; i < *aListLength; i++) {
long current = sIMECompClauseArray[i + 1];
NS_ASSERTION(current <= maxlen, "wrong offset");
if(current > maxlen)