Bug 297683. ensure that there is only one softkey menubar since having more results in a window minimization when an dialog is opened. remove config.wince.useOKBtn pref. it isn't used any longer. r=veditz wince only

This commit is contained in:
dougt%meer.net 2006-04-17 17:42:20 +00:00
Родитель 3feb14d512
Коммит bb9d035a5b
2 изменённых файлов: 30 добавлений и 132 удалений

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

@ -197,7 +197,6 @@ BOOL WINAPI UpdateLayeredWindow(HWND hWnd, HDC hdcDst, POINT *pptDst,
#ifdef WINCE
static PRBool gSoftKeyMenuBar = PR_FALSE;
static PRBool gUseOkayButton = PR_FALSE;
static PRBool gOverrideHWKeys = PR_TRUE;
typedef BOOL (__stdcall *UnregisterFunc1Proc)( UINT, UINT );
@ -270,10 +269,15 @@ static void UnmapHardwareButtons()
}
}
HWND CreateSoftKeyMenuBar(HWND wnd)
void CreateSoftKeyMenuBar(HWND wnd)
{
if (!wnd)
return nsnull;
return;
static HWND gSoftKeyMenuBar = nsnull;
if (gSoftKeyMenuBar != nsnull)
return;
SHMENUBARINFO mbi;
ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
@ -288,7 +292,7 @@ HWND CreateSoftKeyMenuBar(HWND wnd)
mbi.hInstRes = GetModuleHandle(NULL);
if (!SHCreateMenuBar(&mbi))
return nsnull;
return;
SetWindowPos(mbi.hwndMB, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE);
@ -305,7 +309,7 @@ HWND CreateSoftKeyMenuBar(HWND wnd)
MAKELPARAM (SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
SHMBOF_NODEFAULT | SHMBOF_NOTIFY));
return mbi.hwndMB;
gSoftKeyMenuBar = mbi.hwndMB;
}
#endif
@ -840,12 +844,9 @@ nsWindow::nsWindow() : nsBaseWidget()
prefs->GetBranch(0, getter_AddRefs(prefBranch));
if (prefBranch)
{
prefBranch->GetBoolPref("config.wince.useOKBtn", &gUseOkayButton);
prefBranch->GetBoolPref("config.wince.overrideHWKeys", &gOverrideHWKeys);
}
}
mSoftKeyMenuBar = nsnull;
#endif
}
@ -1497,10 +1498,11 @@ nsWindow::StandardWindowCreate(nsIWidget *aParent,
}
}
#ifdef WINCE
if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel )
mSoftKeyMenuBar = CreateSoftKeyMenuBar(mWnd);
MapHardwareButtons(mWnd);
if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel )
CreateSoftKeyMenuBar(mWnd);
MapHardwareButtons(mWnd);
#endif
return NS_OK;
@ -4100,13 +4102,6 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
result = DispatchWindowEvent(&event);
NS_RELEASE(event.widget);
}
#ifdef WINCE
else if (gUseOkayButton && LOWORD(wParam) == IDOK)
{
PostMessage(mWnd, WM_CLOSE, 0, 0);
PostMessage(mWnd, WM_DESTROY, 0, 0);
}
#endif
}
break;
@ -4319,83 +4314,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
break;
#endif
#ifdef WINCE
// This needs to move into nsIDOMKeyEvent.idl && nsGUIEvent.h
case WM_HOTKEY:
{
// SmartPhones has a one or two menu buttons at the
// bottom of the screen. They are dispatched via a
// menu resource, rather then a hotkey. To make
// this look consistent, we have mapped this menu to
// fire hotkey events. See
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win_ce/html/pwc_TheBackButtonandOtherInterestingButtons.asp
if (VK_TSOFT1 == HIWORD(lParam) && (0 != (MOD_KEYUP & LOWORD(lParam))))
{
keybd_event(VK_F23, 0, 0, 0);
keybd_event(VK_F23, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
}
if (VK_TSOFT2 == HIWORD(lParam) && (0 != (MOD_KEYUP & LOWORD(lParam))))
{
keybd_event(VK_F24, 0, 0, 0);
keybd_event(VK_F24, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
}
if (VK_TBACK == HIWORD(lParam) && (0 != (MOD_KEYUP & LOWORD(lParam))))
{
keybd_event(VK_BACK, 0, 0, 0);
keybd_event(VK_BACK, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
}
switch (wParam)
{
case VK_APP1:
keybd_event(VK_F1, 0, 0, 0);
keybd_event(VK_F1, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
case VK_APP2:
keybd_event(VK_F2, 0, 0, 0);
keybd_event(VK_F2, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
case VK_APP3:
keybd_event(VK_F3, 0, 0, 0);
keybd_event(VK_F3, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
case VK_APP4:
keybd_event(VK_F4, 0, 0, 0);
keybd_event(VK_F4, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
case VK_APP5:
keybd_event(VK_F5, 0, 0, 0);
keybd_event(VK_F5, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
case VK_APP6:
keybd_event(VK_F6, 0, 0, 0);
keybd_event(VK_F6, 0, KEYEVENTF_KEYUP, 0);
result = 0;
break;
}
}
break;
#endif
case WM_SYSCHAR:
case WM_SYSCHAR:
case WM_CHAR:
{
#ifdef KE_DEBUG
@ -5106,6 +5025,12 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
break;
#endif
#ifdef WINCE
case WM_HIBERNATE:
nsMemory::HeapMinimize(PR_TRUE);
break;
#endif
default:
{
// Handle both flavors of mouse wheel events.
@ -5278,14 +5203,15 @@ LPCWSTR nsWindow::WindowClassW()
WNDCLASSW wc;
// wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = nsWindow::DefaultWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = nsToolkit::mDllInstance;
#ifdef WINCE
wc.style = 0;
wc.hIcon = NULL;
#else
wc.style = CS_DBLCLKS;
// XXX : we don't need LoadIconW for now (see bug 171349, comment 181)
wc.hIcon = ::LoadIcon(::GetModuleHandle(NULL), IDI_APPLICATION);
#endif
@ -5341,7 +5267,13 @@ LPCWSTR nsWindow::WindowPopupClassW()
if (!nsWindow::sIsPopupClassRegistered) {
WNDCLASSW wc;
wc.style = CS_DBLCLKS | CS_XP_DROPSHADOW;
#ifndef WINCE
wc.style = CS_DBLCLKS | CS_XP_DROPSHADOW;
#else
wc.style = 0;
#endif
wc.lpfnWndProc = nsWindow::DefaultWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
@ -5509,35 +5441,6 @@ DWORD nsWindow::WindowStyle()
//-------------------------------------------------------------------------
DWORD nsWindow::WindowExStyle()
{
#ifdef WINCE
switch (mWindowType)
{
case eWindowType_child:
return 0;
case eWindowType_dialog:
return WS_EX_WINDOWEDGE | WS_EX_CAPTIONOKBTN;
case eWindowType_popup:
return WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
default:
NS_ASSERTION(0, "unknown border style");
// fall through
case eWindowType_toplevel:
case eWindowType_invisible:
{
if (gUseOkayButton)
return WS_EX_WINDOWEDGE | WS_EX_CAPTIONOKBTN;
return WS_EX_WINDOWEDGE;
}
}
#else
switch (mWindowType)
{
case eWindowType_child:
@ -5557,7 +5460,6 @@ DWORD nsWindow::WindowExStyle()
case eWindowType_invisible:
return WS_EX_WINDOWEDGE;
}
#endif
}

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

@ -445,10 +445,6 @@ protected:
// Drag & Drop
nsNativeDragTarget * mNativeDragTarget;
#ifdef WINCE
HWND mSoftKeyMenuBar;
#endif
// Enumeration of the methods which are accessible on the "main GUI thread"
// via the CallMethod(...) mechanism...
// see nsSwitchToUIThread