зеркало из 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:
Родитель
44f605a1fa
Коммит
9901470cb2
|
@ -48,6 +48,9 @@
|
||||||
#include "nsScreenWin.h"
|
#include "nsScreenWin.h"
|
||||||
|
|
||||||
#ifdef WINCE
|
#ifdef WINCE
|
||||||
|
#ifdef WINCE_WINDOWS_MOBILE
|
||||||
|
#include "sipapi.h"
|
||||||
|
#endif
|
||||||
#define GetMonitorInfoW GetMonitorInfo
|
#define GetMonitorInfoW GetMonitorInfo
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -114,6 +117,19 @@ NS_IMETHODIMP
|
||||||
nsScreenWin :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
|
nsScreenWin :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
|
||||||
{
|
{
|
||||||
BOOL success = FALSE;
|
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 _MSC_VER >= 1200
|
||||||
if ( mScreen ) {
|
if ( mScreen ) {
|
||||||
MONITORINFO info;
|
MONITORINFO info;
|
||||||
|
|
|
@ -208,6 +208,25 @@ static gfxIntSize gSharedSurfaceSize;
|
||||||
static PRBool gSoftKeyMenuBar = PR_FALSE;
|
static PRBool gSoftKeyMenuBar = PR_FALSE;
|
||||||
static PRBool gSoftKeyboardState = 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)
|
static void ToggleSoftKB(PRBool show)
|
||||||
{
|
{
|
||||||
HWND hWndSIP = FindWindowW(L"SipWndClass", NULL );
|
HWND hWndSIP = FindWindowW(L"SipWndClass", NULL );
|
||||||
|
@ -218,7 +237,8 @@ static void ToggleSoftKB(PRBool show)
|
||||||
if (hWndSIP)
|
if (hWndSIP)
|
||||||
ShowWindow(hWndSIP, show ? SW_SHOW: SW_HIDE);
|
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)
|
static void CreateSoftKeyMenuBar(HWND wnd)
|
||||||
|
@ -4829,6 +4849,10 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
||||||
|
|
||||||
case WM_SETTINGCHANGE:
|
case WM_SETTINGCHANGE:
|
||||||
getWheelInfo = PR_TRUE;
|
getWheelInfo = PR_TRUE;
|
||||||
|
#ifdef WINCE_WINDOWS_MOBILE
|
||||||
|
if (wParam == SPI_SETSIPINFO)
|
||||||
|
NotifySoftKbObservers();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PALETTECHANGED:
|
case WM_PALETTECHANGED:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче