зеркало из https://github.com/mozilla/gecko-dev.git
bug 63243, sr=roc+moz
But this codes is back out from bug 55256 So It will re-check in this codes with bug 63243's better fix
This commit is contained in:
Родитель
db54b37df4
Коммит
b7a8b45ee6
|
@ -92,16 +92,19 @@ NS_METHOD nsAppShell::Run(void)
|
|||
do {
|
||||
// Give priority to system messages (in particular keyboard, mouse,
|
||||
// timer, and paint messages).
|
||||
if (nsToolkit::nsPeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) ||
|
||||
nsToolkit::nsPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) ||
|
||||
nsToolkit::nsPeekMessage(&msg, NULL, 0, WM_USER-1, PM_REMOVE) ||
|
||||
nsToolkit::nsPeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
if (::PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) ||
|
||||
::PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) ||
|
||||
::PeekMessage(&msg, NULL, 0, WM_USER-1, PM_REMOVE) ||
|
||||
::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
|
||||
keepGoing = (msg.message != WM_QUIT);
|
||||
|
||||
if (keepGoing != 0) {
|
||||
//#ifdef MOZ_AIMM // not need?
|
||||
// if (!nsToolkit::gAIMMMsgPumpOwner || (nsToolkit::gAIMMMsgPumpOwner->OnTranslateMessage(&msg) != S_OK))
|
||||
//#endif
|
||||
TranslateMessage(&msg);
|
||||
nsToolkit::nsDispatchMessage(&msg);
|
||||
::DispatchMessage(&msg);
|
||||
if (mDispatchListener)
|
||||
mDispatchListener->AfterDispatch();
|
||||
}
|
||||
|
@ -112,7 +115,7 @@ NS_METHOD nsAppShell::Run(void)
|
|||
do {
|
||||
queue->FireNextReadyTimer(NS_PRIORITY_LOWEST);
|
||||
} while (queue->HasReadyTimers(NS_PRIORITY_LOWEST) &&
|
||||
!::nsToolkit::nsPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE));
|
||||
!::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE));
|
||||
|
||||
} else {
|
||||
if (!gKeepGoing) {
|
||||
|
@ -155,10 +158,10 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
|
|||
do {
|
||||
// Give priority to system messages (in particular keyboard, mouse,
|
||||
// timer, and paint messages).
|
||||
if (nsToolkit::nsPeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) ||
|
||||
nsToolkit::nsPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) ||
|
||||
nsToolkit::nsPeekMessage(&msg, NULL, 0, WM_USER-1, PM_REMOVE) ||
|
||||
nsToolkit::nsPeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
if (::PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) ||
|
||||
::PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) ||
|
||||
::PeekMessage(&msg, NULL, 0, WM_USER-1, PM_REMOVE) ||
|
||||
::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
|
||||
gotMessage = true;
|
||||
|
||||
|
@ -168,7 +171,7 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
|
|||
do {
|
||||
queue->FireNextReadyTimer(NS_PRIORITY_LOWEST);
|
||||
} while (queue->HasReadyTimers(NS_PRIORITY_LOWEST) &&
|
||||
!nsToolkit::nsPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE));
|
||||
!::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE));
|
||||
|
||||
} else {
|
||||
// Block and wait for any posted application message
|
||||
|
@ -182,6 +185,9 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
|
|||
printf("-> %d", msg.message);
|
||||
#endif
|
||||
|
||||
//#ifdef MOZ_AIMM // not need?
|
||||
// if (!nsToolkit::gAIMMMsgPumpOwner || (nsToolkit::gAIMMMsgPumpOwner->OnTranslateMessage(&msg) != S_OK))
|
||||
//#endif
|
||||
TranslateMessage(&msg);
|
||||
aEvent = &msg;
|
||||
aRealEvent = PR_TRUE;
|
||||
|
@ -190,7 +196,7 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
|
|||
|
||||
nsresult nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent)
|
||||
{
|
||||
nsToolkit::nsDispatchMessage((MSG *)aEvent);
|
||||
DispatchMessage((MSG *)aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,16 +61,6 @@ BOOL APIENTRY DllMain( HINSTANCE hModule,
|
|||
{
|
||||
switch( reason ) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
//
|
||||
// Set flag of nsToolkit::mIsNT due to using Unicode API.
|
||||
//
|
||||
|
||||
OSVERSIONINFO osversion;
|
||||
::ZeroMemory(&osversion, sizeof(OSVERSIONINFO));
|
||||
osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
::GetVersionEx(&osversion);
|
||||
nsToolkit::mIsNT = (osversion.dwPlatformId == VER_PLATFORM_WIN32_NT) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
nsToolkit::mDllInstance = hModule;
|
||||
|
||||
//
|
||||
|
@ -89,7 +79,17 @@ BOOL APIENTRY DllMain( HINSTANCE hModule,
|
|||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = "nsToolkitClass";
|
||||
|
||||
VERIFY(nsToolkit::nsRegisterClass(&wc));
|
||||
VERIFY(::RegisterClass(&wc));
|
||||
|
||||
//
|
||||
// Set flag of nsToolkit::mIsNT due to using Unicode API.
|
||||
//
|
||||
|
||||
OSVERSIONINFO osversion;
|
||||
::ZeroMemory(&osversion, sizeof(OSVERSIONINFO));
|
||||
osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
::GetVersionEx(&osversion);
|
||||
nsToolkit::mIsNT = (osversion.dwPlatformId == VER_PLATFORM_WIN32_NT) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
break;
|
||||
|
||||
|
@ -100,8 +100,8 @@ BOOL APIENTRY DllMain( HINSTANCE hModule,
|
|||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
//VERIFY(nsToolkit::nsUnregisterClass("nsToolkitClass", nsToolkit::mDllInstance));
|
||||
nsToolkit::nsUnregisterClass("nsToolkitClass", nsToolkit::mDllInstance);
|
||||
//VERIFY(::UnregisterClass("nsToolkitClass", nsToolkit::mDllInstance));
|
||||
::UnregisterClass("nsToolkitClass", nsToolkit::mDllInstance);
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -143,9 +143,9 @@ void RunPump(void* arg)
|
|||
|
||||
// Process messages
|
||||
MSG msg;
|
||||
while (nsToolkit::nsGetMessage(&msg, NULL, 0, 0)) {
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
nsToolkit::nsDispatchMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ void nsToolkit::CreateInternalWindow(PRThread *aThread)
|
|||
//
|
||||
// create the internal window
|
||||
//
|
||||
mDispatchWnd = nsToolkit::nsCreateWindow("nsToolkitClass",
|
||||
mDispatchWnd = ::CreateWindow("nsToolkitClass",
|
||||
"NetscapeDispatchWnd",
|
||||
WS_DISABLED,
|
||||
-50, -50,
|
||||
|
@ -316,7 +316,7 @@ LRESULT CALLBACK nsToolkit::WindowProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
return lResult;
|
||||
}
|
||||
#endif
|
||||
return nsToolkit::nsDefWindowProc(hWnd, msg, wParam, lParam);
|
||||
return ::DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
|
@ -371,187 +371,6 @@ NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult)
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Wrapper API of CreateWindowEx() for Unicode Window class support
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
HWND nsToolkit::nsCreateWindowEx(DWORD dwExStyle,
|
||||
LPCSTR lpClassName,
|
||||
LPCSTR lpWindowName,
|
||||
DWORD dwStyle,
|
||||
int x, int y,
|
||||
int nWidth, int nHeight,
|
||||
HWND hWndParent,
|
||||
HMENU hMenu,
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
if (!nsToolkit::mIsNT)
|
||||
{
|
||||
// Windows 95/98/Me do not support Unicode API of CreateWindow.
|
||||
|
||||
return ::CreateWindowExA(dwExStyle,
|
||||
lpClassName,
|
||||
lpWindowName,
|
||||
dwStyle,
|
||||
x, y,
|
||||
nWidth, nHeight,
|
||||
hWndParent,
|
||||
hMenu,
|
||||
hInstance,
|
||||
lpParam);
|
||||
}
|
||||
|
||||
HWND hWnd;
|
||||
int len;
|
||||
int needLen;
|
||||
LPWSTR lpClassStr = nsnull;
|
||||
LPWSTR lpWindowStr = nsnull;
|
||||
|
||||
if (lpClassName)
|
||||
{
|
||||
len = lstrlenA(lpClassName) + 1;
|
||||
needLen = ::MultiByteToWideChar(CP_ACP, 0, lpClassName, len, NULL, 0);
|
||||
if (needLen != 0)
|
||||
{
|
||||
lpClassStr = new WCHAR[needLen];
|
||||
::MultiByteToWideChar(CP_ACP, 0, lpClassName, len, lpClassStr, needLen);
|
||||
}
|
||||
}
|
||||
|
||||
if (lpWindowName)
|
||||
{
|
||||
len = lstrlenA(lpWindowName) + 1;
|
||||
needLen = ::MultiByteToWideChar(CP_ACP, 0, lpWindowName, len, NULL, 0);
|
||||
if (needLen != 0)
|
||||
{
|
||||
lpWindowStr = new WCHAR[needLen];
|
||||
::MultiByteToWideChar(CP_ACP, 0, lpWindowName, len, lpWindowStr, needLen);
|
||||
}
|
||||
}
|
||||
|
||||
hWnd = ::CreateWindowExW(dwExStyle,
|
||||
lpClassStr,
|
||||
lpWindowStr,
|
||||
dwStyle,
|
||||
x, y,
|
||||
nWidth, nHeight,
|
||||
hWndParent,
|
||||
hMenu,
|
||||
hInstance,
|
||||
lpParam);
|
||||
|
||||
if (lpClassStr)
|
||||
delete lpClassStr;
|
||||
|
||||
if (lpWindowStr)
|
||||
delete lpWindowStr;
|
||||
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Wrapper API of RegisterClass() for Unicode Window class support
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
ATOM nsToolkit::nsRegisterClass(CONST WNDCLASS *lpWndClass)
|
||||
{
|
||||
if (!nsToolkit::mIsNT)
|
||||
{
|
||||
// Windows 95/98/Me do not support Unicode API of ResigterClass.
|
||||
|
||||
return ::RegisterClassA(lpWndClass);
|
||||
}
|
||||
|
||||
WNDCLASSW wc;
|
||||
int len;
|
||||
int needLen;
|
||||
ATOM ret;
|
||||
|
||||
wc.style = lpWndClass->style;
|
||||
wc.lpfnWndProc = lpWndClass->lpfnWndProc;
|
||||
wc.cbClsExtra = lpWndClass->cbClsExtra;
|
||||
wc.cbWndExtra = lpWndClass->cbWndExtra;
|
||||
wc.hInstance = lpWndClass->hInstance;
|
||||
wc.hIcon = lpWndClass->hIcon;
|
||||
wc.hCursor = lpWndClass->hCursor;
|
||||
wc.hbrBackground = lpWndClass->hbrBackground;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = NULL;
|
||||
|
||||
if (lpWndClass->lpszMenuName)
|
||||
{
|
||||
len = lstrlenA(lpWndClass->lpszMenuName) + 1;
|
||||
needLen = ::MultiByteToWideChar(CP_ACP, 0, lpWndClass->lpszMenuName, len, NULL, 0);
|
||||
if (needLen != 0)
|
||||
{
|
||||
wc.lpszMenuName = new WCHAR[needLen];
|
||||
::MultiByteToWideChar(CP_ACP, 0, lpWndClass->lpszMenuName, len, (LPWSTR) wc.lpszMenuName, needLen);
|
||||
}
|
||||
}
|
||||
|
||||
if (lpWndClass->lpszClassName)
|
||||
{
|
||||
len = lstrlenA(lpWndClass->lpszClassName) + 1;
|
||||
needLen = ::MultiByteToWideChar(CP_ACP, 0, lpWndClass->lpszClassName, len, NULL, 0);
|
||||
if (needLen != 0)
|
||||
{
|
||||
wc.lpszClassName = new WCHAR[needLen];
|
||||
::MultiByteToWideChar(CP_ACP, 0, lpWndClass->lpszClassName, len, (LPWSTR) wc.lpszClassName, needLen);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ::RegisterClassW(&wc);
|
||||
|
||||
if (wc.lpszMenuName)
|
||||
delete [] (LPWSTR) wc.lpszMenuName;
|
||||
|
||||
if (wc.lpszClassName)
|
||||
delete [] (LPWSTR) wc.lpszClassName;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Wrapper API of UnregisterClass() for Unicode Window class support
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
BOOL nsToolkit::nsUnregisterClass(LPCSTR lpClassName, HINSTANCE hInstance)
|
||||
{
|
||||
if (!nsToolkit::mIsNT)
|
||||
{
|
||||
// Windows 95/98/Me do not support Unicode API of UnResigterClass.
|
||||
|
||||
return ::UnregisterClassA(lpClassName, hInstance);
|
||||
}
|
||||
|
||||
LPWSTR lpClassUnicode;
|
||||
int len;
|
||||
int needLen;
|
||||
BOOL ret;
|
||||
|
||||
if (lpClassName)
|
||||
{
|
||||
len = lstrlenA(lpClassName) + 1;
|
||||
needLen = ::MultiByteToWideChar(CP_ACP, 0, lpClassName, len, NULL, 0);
|
||||
if (needLen)
|
||||
{
|
||||
lpClassUnicode = new WCHAR[needLen];
|
||||
::MultiByteToWideChar(CP_ACP, 0, lpClassName, len, lpClassUnicode, needLen);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ::UnregisterClassW(lpClassUnicode, hInstance);
|
||||
|
||||
if (lpClassUnicode)
|
||||
delete [] lpClassUnicode;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -81,75 +81,6 @@ public:
|
|||
static IActiveIMMApp *gAIMMApp;
|
||||
static PRInt32 gAIMMCount;
|
||||
#endif
|
||||
|
||||
public:
|
||||
// wrapper API for Unicode window support
|
||||
|
||||
static BOOL nsPeekMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin,
|
||||
UINT wMsgFilterMax, UINT wRemoveMsg)
|
||||
{
|
||||
return nsToolkit::mIsNT ?
|
||||
::PeekMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg) :
|
||||
::PeekMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
|
||||
}
|
||||
|
||||
static BOOL nsGetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin,
|
||||
UINT wMsgFilterMax)
|
||||
{
|
||||
return nsToolkit::mIsNT ?
|
||||
::GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax) :
|
||||
::GetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
||||
}
|
||||
|
||||
static LRESULT nsDispatchMessage(CONST MSG *lpmsg)
|
||||
{
|
||||
return nsToolkit::mIsNT ?
|
||||
::DispatchMessageW(lpmsg) :
|
||||
::DispatchMessage(lpmsg);
|
||||
}
|
||||
|
||||
static LRESULT nsDefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return nsToolkit::mIsNT ?
|
||||
::DefWindowProcW(hWnd, Msg, wParam, lParam) :
|
||||
::DefWindowProc(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
static LONG nsGetWindowLong(HWND hWnd, int nIndex)
|
||||
{
|
||||
return nsToolkit::mIsNT ?
|
||||
::GetWindowLongW(hWnd, nIndex) :
|
||||
::GetWindowLong(hWnd, nIndex);
|
||||
}
|
||||
|
||||
static LONG nsSetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
{
|
||||
return nsToolkit::mIsNT ?
|
||||
::SetWindowLongW(hWnd, nIndex, dwNewLong) :
|
||||
::SetWindowLong(hWnd, nIndex, dwNewLong);
|
||||
}
|
||||
|
||||
static HWND nsCreateWindow(LPCSTR lpClassName,
|
||||
LPCSTR lpWindowName, DWORD dwStyle,
|
||||
int x, int y, int nWidth, int nHeight,
|
||||
HWND hWndParent, HMENU hMenu,
|
||||
HINSTANCE hInstance, LPVOID lpParam)
|
||||
{
|
||||
return nsCreateWindowEx(WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
|
||||
lpClassName, lpWindowName, dwStyle,
|
||||
x, y, nWidth, nHeight,
|
||||
hWndParent, hMenu, hInstance, lpParam);
|
||||
}
|
||||
|
||||
static HWND nsCreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName,
|
||||
LPCSTR lpWindowName, DWORD dwStyle,
|
||||
int x, int y, int nWidth, int nHeight,
|
||||
HWND hWndParent, HMENU hMenu,
|
||||
HINSTANCE hInstance, LPVOID lpParam);
|
||||
|
||||
static ATOM nsRegisterClass(CONST WNDCLASS *lpWndClass);
|
||||
static BOOL nsUnregisterClass(LPCSTR lpClassName, HINSTANCE hInstance);
|
||||
|
||||
};
|
||||
|
||||
#define WM_CALLMETHOD (WM_USER+1)
|
||||
|
|
|
@ -296,10 +296,10 @@ extern HINSTANCE g_hinst;
|
|||
hIMC = theIMM.GetContext(hWnd); \
|
||||
}
|
||||
|
||||
#define NS_IMM_GETCONVERSIONSTATUS(hIMC, lpfdwConversion, lpfdwSentence, bRet) \
|
||||
#define NS_IMM_GETCONVERSIONSTATUS(hIMC, lpfdwConversion, lpfdwSentence) \
|
||||
{ \
|
||||
nsIMM &theIMM = nsIMM::LoadModule(); \
|
||||
bRet = theIMM.GetConversionStatus(hIMC, (lpfdwConversion), (lpfdwSentence)); \
|
||||
theIMM.GetConversionStatus(hIMC, (lpfdwConversion), (lpfdwSentence)); \
|
||||
}
|
||||
|
||||
#define NS_IMM_RELEASECONTEXT(hWnd, hIMC) \
|
||||
|
@ -308,10 +308,10 @@ extern HINSTANCE g_hinst;
|
|||
theIMM.ReleaseContext(hWnd, hIMC); \
|
||||
}
|
||||
|
||||
#define NS_IMM_NOTIFYIME(hIMC, dwAction, dwIndex, dwValue, bRtn) \
|
||||
#define NS_IMM_NOTIFYIME(hIMC, dwAction, dwIndex, dwValue) \
|
||||
{ \
|
||||
nsIMM &theIMM = nsIMM::LoadModule(); \
|
||||
bRtn = theIMM.NotifyIME(hIMC, dwAction, dwIndex, dwValue); \
|
||||
theIMM.NotifyIME(hIMC, dwAction, dwIndex, dwValue); \
|
||||
}
|
||||
|
||||
#define NS_IMM_SETCANDIDATEWINDOW(hIMC, candForm) \
|
||||
|
@ -320,10 +320,10 @@ extern HINSTANCE g_hinst;
|
|||
theIMM.SetCandidateWindow(hIMC, candForm); \
|
||||
}
|
||||
|
||||
#define NS_IMM_SETCONVERSIONSTATUS(hIMC, lpfdwConversion, lpfdwSentence, bRet) \
|
||||
#define NS_IMM_SETCONVERSIONSTATUS(hIMC, lpfdwConversion, lpfdwSentence) \
|
||||
{ \
|
||||
nsIMM &theIMM = nsIMM::LoadModule(); \
|
||||
bRet = theIMM.SetConversionStatus(hIMC, (lpfdwConversion), (lpfdwSentence)); \
|
||||
theIMM.SetConversionStatus(hIMC, (lpfdwConversion), (lpfdwSentence)); \
|
||||
}
|
||||
|
||||
#endif /* MOZ_AIMM */
|
||||
|
@ -919,7 +919,7 @@ LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
|
|||
// why we are hitting this assert
|
||||
if (nsnull == someWindow) {
|
||||
NS_ASSERTION(someWindow, "someWindow is null, cannot call any CallWindowProc");
|
||||
return nsToolkit::nsDefWindowProc(hWnd, msg, wParam, lParam);
|
||||
return ::DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
// hold on to the window for the life of this method, in case it gets
|
||||
|
@ -966,7 +966,7 @@ LRESULT CALLBACK nsWindow::DefaultWindowProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
if (nsToolkit::gAIMMApp->OnDefWindowProc(hWnd, msg, wParam, lParam, &lResult) == S_OK)
|
||||
return lResult;
|
||||
}
|
||||
return nsToolkit::nsDefWindowProc(hWnd, msg, wParam, lParam);
|
||||
return ::DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1088,7 +1088,7 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent,
|
|||
(DLGPROC)DummyDialogProc,
|
||||
NULL);
|
||||
} else {
|
||||
mWnd = nsToolkit::nsCreateWindowEx(extendedStyle,
|
||||
mWnd = ::CreateWindowEx(extendedStyle,
|
||||
WindowClass(),
|
||||
"",
|
||||
style,
|
||||
|
@ -2444,35 +2444,6 @@ BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte
|
|||
}
|
||||
|
||||
|
||||
BOOL nsWindow::OnUniChar( UINT uniCharCode, UINT virtualKeyCode)
|
||||
{
|
||||
if(mIsControlDown && (virtualKeyCode <= 0x1A)) // Ctrl+A Ctrl+Z, see Programming Windows 3.1 page 110 for details
|
||||
{
|
||||
// need to account for shift here. bug 16486
|
||||
if ( mIsShiftDown )
|
||||
uniCharCode = virtualKeyCode - 1 + 'A' ;
|
||||
else
|
||||
uniCharCode = virtualKeyCode - 1 + 'a' ;
|
||||
virtualKeyCode = 0;
|
||||
}
|
||||
else
|
||||
{ // 0x20 - SPACE, 0x3D - EQUALS
|
||||
if(virtualKeyCode < 0x20 || (virtualKeyCode == 0x3D && mIsControlDown))
|
||||
{
|
||||
uniCharCode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
virtualKeyCode = 0;
|
||||
mIsShiftDown = PR_FALSE;
|
||||
}
|
||||
}
|
||||
return DispatchKeyEvent(NS_KEY_PRESS, uniCharCode, virtualKeyCode);
|
||||
|
||||
//return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void nsWindow::ConstrainZLevel(HWND *aAfter) {
|
||||
|
||||
nsZLevelEvent event;
|
||||
|
@ -2887,15 +2858,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
result = OnChar(ch,ch==0x0d ? VK_RETURN : VK_BACK,true);
|
||||
break;
|
||||
}
|
||||
|
||||
// If Mozilla run on Windows NT / 2000, it uses Unicode window class due to #55256.
|
||||
// So wParam is Unicode.
|
||||
if(nsToolkit::mIsNT)
|
||||
{
|
||||
char_result = wParam;
|
||||
result = OnUniChar(char_result,ch);
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
char_result = ch;
|
||||
result = OnChar(char_result,ch,false);
|
||||
|
@ -3445,7 +3408,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
break;
|
||||
}
|
||||
|
||||
LONG proc = nsToolkit::nsGetWindowLong(destWnd, GWL_WNDPROC);
|
||||
LONG proc = ::GetWindowLong(destWnd, GWL_WNDPROC);
|
||||
if (proc != (LONG)&nsWindow::WindowProc) {
|
||||
// Some other app
|
||||
break;
|
||||
|
@ -3534,7 +3497,7 @@ LPCTSTR nsWindow::WindowClass()
|
|||
#ifdef MOZ_AIMM
|
||||
wc.lpfnWndProc = nsWindow::DefaultWindowProc;
|
||||
#else
|
||||
wc.lpfnWndProc = nsToolkit::nsDefWindowProc;
|
||||
wc.lpfnWndProc = ::DefWindowProc;
|
||||
#endif
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
|
@ -3545,7 +3508,7 @@ LPCTSTR nsWindow::WindowClass()
|
|||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = className;
|
||||
|
||||
nsWindow::sIsRegistered = nsToolkit::nsRegisterClass(&wc);
|
||||
nsWindow::sIsRegistered = ::RegisterClass(&wc);
|
||||
#ifdef MOZ_AIMM
|
||||
// Call FilterClientWindows method since it enables ActiveIME on CJK Windows
|
||||
if(nsToolkit::gAIMMApp)
|
||||
|
@ -3673,14 +3636,14 @@ void nsWindow::SubclassWindow(BOOL bState)
|
|||
|
||||
if (bState) {
|
||||
// change the nsWindow proc
|
||||
mPrevWndProc = (WNDPROC)nsToolkit::nsSetWindowLong(mWnd, GWL_WNDPROC,
|
||||
mPrevWndProc = (WNDPROC)::SetWindowLong(mWnd, GWL_WNDPROC,
|
||||
(LONG)nsWindow::WindowProc);
|
||||
NS_ASSERTION(mPrevWndProc, "Null standard window procedure");
|
||||
// connect the this pointer to the nsWindow handle
|
||||
SetNSWindowPtr(mWnd, this);
|
||||
}
|
||||
else {
|
||||
nsToolkit::nsSetWindowLong(mWnd, GWL_WNDPROC, (LONG)mPrevWndProc);
|
||||
::SetWindowLong(mWnd, GWL_WNDPROC, (LONG)mPrevWndProc);
|
||||
SetNSWindowPtr(mWnd, NULL);
|
||||
mPrevWndProc = NULL;
|
||||
}
|
||||
|
@ -4243,12 +4206,6 @@ static char* GetACPString(const nsString& aStr)
|
|||
|
||||
NS_METHOD nsWindow::SetTitle(const nsString& aTitle)
|
||||
{
|
||||
if(nsToolkit::mIsNT) {
|
||||
// Windows NT / 2000 use Unicode API due to bug #55256
|
||||
::SendMessageW(mWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)aTitle.GetUnicode());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
char* title = GetACPString(aTitle);
|
||||
if (title) {
|
||||
::SendMessage(mWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCTSTR)title);
|
||||
|
|
|
@ -322,7 +322,6 @@ protected:
|
|||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
BOOL OnChar(UINT mbcsCharCode, UINT virtualKeyCode, bool isMultibyte);
|
||||
BOOL OnUniChar( UINT uniCharCode, UINT virtualKeyCode);
|
||||
|
||||
BOOL OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode);
|
||||
BOOL OnKeyUp( UINT aVirtualKeyCode, UINT aScanCode);
|
||||
|
|
Загрузка…
Ссылка в новой задаче