bug 479444 - text fields are hidden by the software keyboard r=blassey

This commit is contained in:
Alex Pakhotin 2009-12-21 16:50:31 -08:00
Родитель 7612ac579b
Коммит 64dbe7ec42
3 изменённых файлов: 26 добавлений и 10 удалений

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

@ -4206,7 +4206,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
#if defined(WINCE_HAVE_SOFTKB)
if (mIsTopWidgetWindow && sSoftKeyboardState)
nsWindowCE::ToggleSoftKB(fActive);
nsWindowCE::ToggleSoftKB(mWnd, fActive);
if (nsWindowCE::sShowSIPButton != TRI_TRUE && WA_INACTIVE != fActive) {
HWND hWndSIPB = FindWindowW(L"MS_SIPBUTTON", NULL );
if (hWndSIPB)
@ -4348,7 +4348,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
case SPI_SIPMOVE:
case SPI_SETSIPINFO:
case SPI_SETCURRENTIM:
nsWindowCE::NotifySoftKbObservers();
nsWindowCE::NotifySoftKbObservers(mWnd);
break;
case SETTINGCHANGE_RESET:
if (mWindowType == eWindowType_invisible) {
@ -6268,7 +6268,7 @@ NS_IMETHODIMP nsWindow::SetIMEEnabled(PRUint32 aState)
#if defined(WINCE_HAVE_SOFTKB)
sSoftKeyboardState = (aState != nsIWidget::IME_STATUS_DISABLED);
nsWindowCE::ToggleSoftKB(sSoftKeyboardState);
nsWindowCE::ToggleSoftKB(mWnd, sSoftKeyboardState);
#endif
if (!enable != !mOldIMC)

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

@ -80,7 +80,7 @@ TriStateBool nsWindowCE::sHardKBPresence = TRI_UNKNOWN;
**************************************************************/
#ifdef WINCE_HAVE_SOFTKB
void nsWindowCE::NotifySoftKbObservers(LPRECT visRect)
void nsWindowCE::NotifySoftKbObservers(HWND wnd, LPRECT visRect)
{
if (!visRect) {
SIPINFO sipInfo;
@ -92,6 +92,22 @@ void nsWindowCE::NotifySoftKbObservers(LPRECT visRect)
return;
}
if (wnd) {
HWND wndMain = nsWindow::GetTopLevelHWND(wnd);
RECT winRect;
::GetWindowRect(wndMain, &winRect);
if (winRect.bottom != visRect->bottom) {
if (winRect.bottom < visRect->bottom && sShowSIPButton != TRI_TRUE) {
// Soft keyboard has been hidden, have to hide the SIP button as well
HWND hWndSIPB = FindWindowW(L"MS_SIPBUTTON", NULL );
if (hWndSIPB)
ShowWindow(hWndSIPB, SW_HIDE);
}
winRect.bottom = visRect->bottom;
MoveWindow(wndMain, winRect.left, winRect.top, winRect.right - winRect.left, winRect.bottom - winRect.top, TRUE);
}
}
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
@ -103,7 +119,7 @@ void nsWindowCE::NotifySoftKbObservers(LPRECT visRect)
}
}
void nsWindowCE::ToggleSoftKB(PRBool show)
void nsWindowCE::ToggleSoftKB(HWND wnd, PRBool show)
{
if (sHardKBPresence == TRI_UNKNOWN)
CheckKeyboardStatus();
@ -165,9 +181,9 @@ void nsWindowCE::ToggleSoftKB(PRBool show)
sipInfo.dwImDataSize = 0;
sipInfo.pvImData = NULL;
SipSetInfo(&sipInfo);
NotifySoftKbObservers(&visRect);
NotifySoftKbObservers(wnd, &visRect);
} else {
NotifySoftKbObservers();
NotifySoftKbObservers(wnd);
}
sSIPInTransition = PR_FALSE;
}

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

@ -84,9 +84,9 @@ public:
static BOOL EnumChildWindows(HWND inParent, WNDENUMPROC inFunc, LPARAM inParam);
#if defined(WINCE_HAVE_SOFTKB)
static void ToggleSoftKB(PRBool show);
static void ToggleSoftKB(HWND wnd, PRBool show);
static void CreateSoftKeyMenuBar(HWND wnd);
static void NotifySoftKbObservers(LPRECT = NULL);
static void NotifySoftKbObservers(HWND wnd, LPRECT = NULL);
static PRBool sSIPInTransition;
static TriStateBool sShowSIPButton;
static void CheckKeyboardStatus();