From 3e0bcd1533150e24c71e0c333ae5f96491d2d0e9 Mon Sep 17 00:00:00 2001 From: "shanjian%netscape.com" Date: Tue, 13 Aug 2002 23:43:01 +0000 Subject: [PATCH] #57332 Quick typing erases a converting text Let all ime/key message have the same priority. p=shotaro kamio, r=shanjian, sr=kin git-svn-id: svn://10.0.0.236/trunk@127213 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsAppShell.cpp | 24 ++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/mozilla/widget/src/windows/nsAppShell.cpp b/mozilla/widget/src/windows/nsAppShell.cpp index 9c39929c09d..23a43f0a685 100644 --- a/mozilla/widget/src/windows/nsAppShell.cpp +++ b/mozilla/widget/src/windows/nsAppShell.cpp @@ -91,6 +91,28 @@ NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener) #include "nsITimerManager.h" +BOOL PeekKeyAndIMEMessage(LPMSG msg, HWND hwnd) +{ + MSG msg1, msg2, *lpMsg; + BOOL b1, b2; + b1 = ::PeekMessage(&msg1, NULL, WM_KEYFIRST, WM_IME_KEYLAST, PM_NOREMOVE); + b2 = ::PeekMessage(&msg2, NULL, WM_IME_SETCONTEXT, WM_IME_KEYUP, PM_NOREMOVE); + if (b1 || b2) { + if (b1 && b2) { + if (msg1.time < msg2.time) + lpMsg = &msg1; + else + lpMsg = &msg2; + } else if (b1) + lpMsg = &msg1; + else + lpMsg = &msg2; + return ::PeekMessage(msg, hwnd, lpMsg->message, lpMsg->message, PM_REMOVE); + } + + return false; +} + NS_METHOD nsAppShell::Run(void) { @@ -109,7 +131,7 @@ NS_METHOD nsAppShell::Run(void) do { // Give priority to system messages (in particular keyboard, mouse, // timer, and paint messages). - if (::PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || + if (PeekKeyAndIMEMessage(&msg, NULL) || ::PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {