windows widget fixups for windows mobile. bug 418658, r=ere, a=beltzner

This commit is contained in:
dougt@meer.net 2008-02-21 12:57:22 -08:00
Родитель 0d7753ff58
Коммит 716544dbae
4 изменённых файлов: 18 добавлений и 96 удалений

Просмотреть файл

@ -1798,7 +1798,7 @@ HRESULT nsDataObj::GetFileDescriptor_IStreamA(FORMATETC& aFE, STGMEDIUM& aSTG)
HGLOBAL fileGroupDescHandle = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE,sizeof(FILEGROUPDESCRIPTORW));
NS_ENSURE_TRUE(fileGroupDescHandle, E_OUTOFMEMORY);
LPFILEGROUPDESCRIPTORA fileGroupDescA = reinterpret_cast<LPFILEGROUPDESCRIPTORA>(::GlobalLock(fileGroupDescHandle));
LPFILEGROUPDESCRIPTORA fileGroupDescA = reinterpret_cast<LPFILEGROUPDESCRIPTORA>(GlobalLock(fileGroupDescHandle));
if (!fileGroupDescA) {
::GlobalFree(fileGroupDescHandle);
return E_OUTOFMEMORY;
@ -1825,7 +1825,7 @@ HRESULT nsDataObj::GetFileDescriptor_IStreamA(FORMATETC& aFE, STGMEDIUM& aSTG)
fileGroupDescA->cItems = 1;
fileGroupDescA->fgd[0].dwFlags = FD_PROGRESSUI;
::GlobalUnlock( fileGroupDescHandle );
GlobalUnlock( fileGroupDescHandle );
aSTG.hGlobal = fileGroupDescHandle;
aSTG.tymed = TYMED_HGLOBAL;
@ -1837,7 +1837,7 @@ HRESULT nsDataObj::GetFileDescriptor_IStreamW(FORMATETC& aFE, STGMEDIUM& aSTG)
HGLOBAL fileGroupDescHandle = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE,sizeof(FILEGROUPDESCRIPTORW));
NS_ENSURE_TRUE(fileGroupDescHandle, E_OUTOFMEMORY);
LPFILEGROUPDESCRIPTORW fileGroupDescW = reinterpret_cast<LPFILEGROUPDESCRIPTORW>(::GlobalLock(fileGroupDescHandle));
LPFILEGROUPDESCRIPTORW fileGroupDescW = reinterpret_cast<LPFILEGROUPDESCRIPTORW>(GlobalLock(fileGroupDescHandle));
if (!fileGroupDescW) {
::GlobalFree(fileGroupDescHandle);
return E_OUTOFMEMORY;
@ -1860,7 +1860,7 @@ HRESULT nsDataObj::GetFileDescriptor_IStreamW(FORMATETC& aFE, STGMEDIUM& aSTG)
fileGroupDescW->cItems = 1;
fileGroupDescW->fgd[0].dwFlags = FD_PROGRESSUI;
::GlobalUnlock(fileGroupDescHandle);
GlobalUnlock(fileGroupDescHandle);
aSTG.hGlobal = fileGroupDescHandle;
aSTG.tymed = TYMED_HGLOBAL;

Просмотреть файл

@ -42,9 +42,11 @@
#include "nsIDragSession.h"
#include <ole2.h>
#include <shlobj.h>
#ifndef WINCE
#ifndef IDropTargetHelper
#include <shobjidl.h> // Vista drag image interfaces
#endif
#endif // WINCE
class nsIDragService;
class nsIWidget;
@ -114,8 +116,9 @@ protected:
nsIDragService * mDragService;
// Drag target helper
#ifndef WINCE
IDropTargetHelper * mDropTargetHelper;
#endif
};
#endif // _nsNativeDragTarget_h_

Просмотреть файл

@ -1924,8 +1924,13 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI
case NS_THEME_MENUCHECKBOX:
case NS_THEME_MENURADIO:
case NS_THEME_MENUARROW:
#ifdef WINCE
(*aResult).width = 16;
(*aResult).height = 16;
#endif
(*aResult).width = ::GetSystemMetrics(SM_CXMENUCHECK);
(*aResult).height = ::GetSystemMetrics(SM_CYMENUCHECK);
#endif
break;
case NS_THEME_SCROLLBAR_BUTTON_UP:
case NS_THEME_SCROLLBAR_BUTTON_DOWN:

Просмотреть файл

@ -183,7 +183,6 @@ static const char kMozHeapDumpMessageString[] = "MOZ_HeapDump";
#ifndef ULW_ALPHA
#define ULW_ALPHA 0x00000002
extern "C"
WINUSERAPI
BOOL WINAPI UpdateLayeredWindow(HWND hWnd, HDC hdcDst, POINT *pptDst,
@ -197,78 +196,6 @@ BOOL WINAPI UpdateLayeredWindow(HWND hWnd, HDC hdcDst, POINT *pptDst,
#ifdef WINCE
static PRBool gSoftKeyMenuBar = PR_FALSE;
static PRBool gOverrideHWKeys = PR_TRUE;
typedef BOOL (__stdcall *UnregisterFunc1Proc)( UINT, UINT );
static UnregisterFunc1Proc gProcUnregisterFunc = NULL;
static HINSTANCE gCoreDll = NULL;
UINT gHardwareKeys[][2] =
{
{ 0xc1, MOD_WIN },
{ 0xc2, MOD_WIN },
{ 0xc3, MOD_WIN },
{ 0xc4, MOD_WIN },
{ 0xc5, MOD_WIN },
{ 0xc6, MOD_WIN },
{ 0x72, 0 },// Answer - 0x72 Modifier - 0
{ 0x73, 0 },// Hangup - 0x73 Modifier - 0
{ 0x74, 0 },//
{ 0x75, 0 },// Volume Up - 0x75 Modifier - 0
{ 0x76, 0 },// Volume Down - 0x76 Modifier - 0
{ 0, 0 },
};
static void MapHardwareButtons(HWND window)
{
if (!window)
return;
// handle hardware buttons so that they broadcast into our
// application. the following code is based on an article
// on the Pocket PC Developer Network:
//
// http://www.pocketpcdn.com/articles/handle_hardware_keys.html
if (gOverrideHWKeys)
{
if (!gProcUnregisterFunc)
{
gCoreDll = LoadLibrary(_T("coredll.dll")); // leak
if (gCoreDll)
gProcUnregisterFunc = (UnregisterFunc1Proc)GetProcAddress( gCoreDll, _T("UnregisterFunc1"));
}
if (gProcUnregisterFunc)
{
for (int i=0; gHardwareKeys[i][0]; i++)
{
UINT mod = gHardwareKeys[i][1];
UINT kc = gHardwareKeys[i][0];
gProcUnregisterFunc(mod, kc);
RegisterHotKey(window, kc, mod, kc);
}
}
}
}
static void UnmapHardwareButtons()
{
if (!gProcUnregisterFunc)
return;
for (int i=0; gHardwareKeys[i][0]; i++)
{
UINT mod = gHardwareKeys[i][1];
UINT kc = gHardwareKeys[i][0];
gProcUnregisterFunc(mod, kc);
}
}
void CreateSoftKeyMenuBar(HWND wnd)
{
if (!wnd)
@ -779,25 +706,16 @@ nsWindow::nsWindow() : nsBaseWidget()
mIsTopWidgetWindow = PR_FALSE;
mLastKeyboardLayout = 0;
#ifndef WINCE
if (!sInstanceCount && SUCCEEDED(::OleInitialize(NULL))) {
sIsOleInitialized = TRUE;
}
NS_ASSERTION(sIsOleInitialized, "***** OLE is not initialized!\n");
sInstanceCount++;
#ifdef WINCE
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
nsCOMPtr<nsIPrefBranch> prefBranch;
prefs->GetBranch(0, getter_AddRefs(prefBranch));
if (prefBranch)
{
prefBranch->GetBoolPref("config.wince.overrideHWKeys", &gOverrideHWKeys);
}
}
#endif
}
}
HKL nsWindow::gKeyboardLayout = 0;
@ -836,6 +754,7 @@ nsWindow::~nsWindow()
SetCursor(eCursor_standard);
}
#ifndef WINCE
//
// delete any of the IME structures that we allocated
//
@ -858,6 +777,7 @@ nsWindow::~nsWindow()
sIsOleInitialized = FALSE;
}
}
#endif
NS_IF_RELEASE(mNativeDragTarget);
@ -1452,7 +1372,6 @@ nsWindow::StandardWindowCreate(nsIWidget *aParent,
if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel )
CreateSoftKeyMenuBar(mWnd);
MapHardwareButtons(mWnd);
#endif
return NS_OK;
@ -2226,11 +2145,6 @@ NS_METHOD nsWindow::SetFocus(PRBool aRaise)
if (::IsIconic(toplevelWnd))
::ShowWindow(toplevelWnd, SW_RESTORE);
::SetFocus(mWnd);
#ifdef WINCE
MapHardwareButtons(mWnd);
#endif
}
return NS_OK;
}