mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-08 16:03:21 +00:00
bug 508210 - Gap between fennec window and soft keyboard r=vlad
This commit is contained in:
parent
8e3080a124
commit
7c60af6847
@ -5606,12 +5606,6 @@ PRBool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam)
|
||||
|
||||
void nsWindow::OnSettingsChange(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#if defined(WINCE_WINDOWS_MOBILE)
|
||||
if (wParam == SPI_SETSIPINFO) {
|
||||
nsWindowCE::NotifySoftKbObservers();
|
||||
}
|
||||
#endif
|
||||
|
||||
nsWindowGfx::OnSettingsChangeGfx(wParam);
|
||||
}
|
||||
|
||||
|
@ -78,23 +78,26 @@ TriStateBool nsWindowCE::sShowSIPButton = TRI_UNKNOWN;
|
||||
**************************************************************/
|
||||
|
||||
#ifdef WINCE_HAVE_SOFTKB
|
||||
void nsWindowCE::NotifySoftKbObservers()
|
||||
void nsWindowCE::NotifySoftKbObservers(LPRECT visRect)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (observerService) {
|
||||
if (!visRect) {
|
||||
SIPINFO sipInfo;
|
||||
wchar_t rectBuf[256];
|
||||
memset(&sipInfo, 0, sizeof(SIPINFO));
|
||||
sipInfo.cbSize = sizeof(SIPINFO);
|
||||
if (SipGetInfo(&sipInfo)) {
|
||||
_snwprintf(rectBuf, 256, L"{\"left\": %d, \"top\": %d,"
|
||||
L" \"right\": %d, \"bottom\": %d}",
|
||||
sipInfo.rcVisibleDesktop.left,
|
||||
sipInfo.rcVisibleDesktop.top,
|
||||
sipInfo.rcVisibleDesktop.right,
|
||||
sipInfo.rcVisibleDesktop.bottom);
|
||||
observerService->NotifyObservers(nsnull, "softkb-change", rectBuf);
|
||||
}
|
||||
if (SipGetInfo(&sipInfo))
|
||||
visRect = &(sipInfo.rcVisibleDesktop);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (observerService) {
|
||||
wchar_t rectBuf[256];
|
||||
_snwprintf(rectBuf, 256, L"{\"left\": %d, \"top\": %d,"
|
||||
L" \"right\": %d, \"bottom\": %d}",
|
||||
visRect->left, visRect->top, visRect->right, visRect->bottom);
|
||||
observerService->NotifyObservers(nsnull, "softkb-change", rectBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,10 +134,28 @@ void nsWindowCE::ToggleSoftKB(PRBool show)
|
||||
GetWindowRect(hWndSIP, &sipRect);
|
||||
int sipH = sipRect.bottom - sipRect.top;
|
||||
int sipW = sipRect.right - sipRect.left;
|
||||
MoveWindow(hWndSIP, (sX - sipW)/2, sY - sipH, sX, sY, TRUE);
|
||||
}
|
||||
|
||||
NotifySoftKbObservers();
|
||||
sipRect.left = (sX - sipW)/2;
|
||||
sipRect.top = sY - sipH;
|
||||
sipRect.bottom = sY;
|
||||
sipRect.right = sipRect.left + sipW;
|
||||
MoveWindow(hWndSIP, (sX - sipW)/2, sY - sipH, sipW, sipH, TRUE);
|
||||
SIPINFO sipInfo;
|
||||
RECT visRect;
|
||||
visRect.top = 0;
|
||||
visRect.left = 0;
|
||||
visRect.bottom = show ? sipRect.top : sY;
|
||||
visRect.right = sX;
|
||||
sipInfo.cbSize = sizeof(SIPINFO);
|
||||
sipInfo.fdwFlags = SIPF_DOCKED | SIPF_LOCKED | (show ? SIPF_ON : SIPF_OFF);
|
||||
sipInfo.rcSipRect = sipRect;
|
||||
sipInfo.rcVisibleDesktop = visRect;
|
||||
sipInfo.dwImDataSize = 0;
|
||||
sipInfo.pvImData = NULL;
|
||||
SipSetInfo(&sipInfo);
|
||||
NotifySoftKbObservers(&visRect);
|
||||
} else {
|
||||
NotifySoftKbObservers();
|
||||
}
|
||||
}
|
||||
|
||||
void nsWindowCE::CreateSoftKeyMenuBar(HWND wnd)
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
#if defined(WINCE_HAVE_SOFTKB)
|
||||
static void ToggleSoftKB(PRBool show);
|
||||
static void CreateSoftKeyMenuBar(HWND wnd);
|
||||
static void NotifySoftKbObservers();
|
||||
static void NotifySoftKbObservers(LPRECT = NULL);
|
||||
static TriStateBool sShowSIPButton;
|
||||
#endif
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user