diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 25ddb3ea9ee..03784e6820a 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -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) diff --git a/widget/src/windows/nsWindowCE.cpp b/widget/src/windows/nsWindowCE.cpp index f2cf81fbc0a..ab4b30c03d8 100644 --- a/widget/src/windows/nsWindowCE.cpp +++ b/widget/src/windows/nsWindowCE.cpp @@ -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; @@ -91,7 +91,23 @@ void nsWindowCE::NotifySoftKbObservers(LPRECT visRect) else 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 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; } diff --git a/widget/src/windows/nsWindowCE.h b/widget/src/windows/nsWindowCE.h index 5cfd43d9448..6c6200ac20c 100644 --- a/widget/src/windows/nsWindowCE.h +++ b/widget/src/windows/nsWindowCE.h @@ -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();