Closed Bug 227243 Opened 23 years ago Closed 17 years ago

windows/nsWindow should check WMP_NOACTIVATE when handling WM_WINDOWPOSCHANGED to prevent extra DispatchFocus

Categories

(Core :: XUL, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: phnixwxz1, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Build Identifier: Newest nsWindow.cpp windows/nsWindow should check WMP_NOACTIVATE flag before DispatchFocus when handling WM_WINDOWPOSCHANGED. 4244 if (wp->flags & SWP_FRAMECHANGED && ::IsWindowVisible(mWnd)) { ...... 4269 else if (pl.showCmd == SW_SHOWNORMAL){ 4270 // Make sure we're active 4271 result = DispatchFocus(NS_GOTFOCUS, PR_TRUE); 4272 result = DispatchFocus(NS_ACTIVATE, PR_TRUE); 4273 } The extra DispatchFocus's may cause incorrect or loss of onFocus events. For example, when an unfocused and inactivated window is SetWindowRgn'ed, WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED is sent with SWP_FRAMECHANGED flag, then the above code will dispatch NS_GOTFOCUS and NS_ACTIVATE, which will cause onFocus DOM event incorrectly triggered, while the real window is still unfocused and inactivated. When the window is actually focused and activated, the expected onFocus event is not trigger. Reproducible: Always Steps to Reproduce:
danm?
Assignee: jag → danm-moz
Status: UNCONFIRMED → NEW
Ever confirmed: true
Okeydoke. Can you supply a patch and Mozilla testcase? I assume we're talking specifically about making just this one change: Index: widget/src/windows/nsWindow.cpp =================================================================== RCS file: /cvsroot/mozilla/widget/src/windows/nsWindow.cpp,v retrieving revision 3.488 diff -u -r3.488 nsWindow.cpp --- widget/src/windows/nsWindow.cpp 14 Nov 2003 21:58:08 -0000 3.488 +++ widget/src/windows/nsWindow.cpp 7 Dec 2003 23:56:55 -0000 @@ -4267,5 +4267,6 @@ gJustGotDeactivate = PR_FALSE; result = DispatchFocus(NS_DEACTIVATE, isMozWindowTakingFocus); - } else if (pl.showCmd == SW_SHOWNORMAL){ + } else if (pl.showCmd == SW_SHOWNORMAL && + !(wp->flags & SWP_NOACTIVATE)) { // Make sure we're active result = DispatchFocus(NS_GOTFOCUS, PR_TRUE); It sounds fine but I haven't been able to script a scenario that this either helps or hinders.
Assignee: danm.moz → nobody
No longer relevant
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.