зеркало из https://github.com/mozilla/gecko-dev.git
bug 481914 - dialogs shouldn't be larger than available screen space. Send notification and adjust avail screen size for soft keyboard r=dougt, sr=vlad
This commit is contained in:
Родитель
c71b7fc5e0
Коммит
2cfbb51fda
|
@ -48,6 +48,9 @@
|
|||
#include "nsScreenWin.h"
|
||||
|
||||
#ifdef WINCE
|
||||
#ifdef WINCE_WINDOWS_MOBILE
|
||||
#include "sipapi.h"
|
||||
#endif
|
||||
#define GetMonitorInfoW GetMonitorInfo
|
||||
#endif
|
||||
|
||||
|
@ -114,6 +117,19 @@ NS_IMETHODIMP
|
|||
nsScreenWin :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
#ifdef WINCE_WINDOWS_MOBILE
|
||||
SIPINFO sipInfo;
|
||||
memset(&sipInfo, 0, sizeof(SIPINFO));
|
||||
sipInfo.cbSize = sizeof(SIPINFO);
|
||||
if (SipGetInfo(&sipInfo) && !(sipInfo.fdwFlags & SIPF_OFF)) {
|
||||
*outLeft = sipInfo.rcVisibleDesktop.left;
|
||||
*outTop = sipInfo.rcVisibleDesktop.top;
|
||||
*outWidth = sipInfo.rcVisibleDesktop.right - sipInfo.rcVisibleDesktop.left;
|
||||
*outHeight = sipInfo.rcVisibleDesktop.bottom - sipInfo.rcVisibleDesktop.top;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _MSC_VER >= 1200
|
||||
if ( mScreen ) {
|
||||
MONITORINFO info;
|
||||
|
|
|
@ -208,6 +208,25 @@ static gfxIntSize gSharedSurfaceSize;
|
|||
static PRBool gSoftKeyMenuBar = PR_FALSE;
|
||||
static PRBool gSoftKeyboardState = PR_FALSE;
|
||||
|
||||
static void NotifySoftKbObservers() {
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (observerService) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ToggleSoftKB(PRBool show)
|
||||
{
|
||||
HWND hWndSIP = FindWindowW(L"SipWndClass", NULL );
|
||||
|
@ -218,7 +237,8 @@ static void ToggleSoftKB(PRBool show)
|
|||
if (hWndSIP)
|
||||
ShowWindow(hWndSIP, show ? SW_SHOW: SW_HIDE);
|
||||
|
||||
SHSipPreference(NULL, show ? SIP_UP: SIP_DOWN);
|
||||
SipShowIM(show ? SIPF_ON : SIPF_OFF);
|
||||
NotifySoftKbObservers();
|
||||
}
|
||||
|
||||
static void CreateSoftKeyMenuBar(HWND wnd)
|
||||
|
@ -4829,6 +4849,10 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
|
||||
case WM_SETTINGCHANGE:
|
||||
getWheelInfo = PR_TRUE;
|
||||
#ifdef WINCE_WINDOWS_MOBILE
|
||||
if (wParam == SPI_SETSIPINFO)
|
||||
NotifySoftKbObservers();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
|
|
Загрузка…
Ссылка в новой задаче