If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Widget focus code requires WM_ACTIVATE for WM_*FOCUS messages to work properly

RESOLVED FIXED

Status

()

Core
Widget: Win32
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: robarnold, Assigned: Neil Deakin)

Tracking

Trunk
x86
Windows NT
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

2.86 KB, patch
Ere Maijala (slow)
: review+
Details | Diff | Splinter Review
(Reporter)

Description

8 years ago
When a browser window is minimized, a call to ShowWindow(hWnd, SW_RESTORE) should properly restore focus. What seems to happen is that there's an extra WM_SETFOCUS/WM_KILLFOCUS message pair that moves focus from the child window (which had focus before the minimize) to the top level window. Because there is no WM_ACTIVATE that precedes this pair of messages, the event is suppressed so the focus manager does not restore focus to the child window.

This occurs when restoring a minimized window programatically via the Windows 7 taskbar preview. An external application could attempt to do the same and we'd see the same result. Switching to another window and back again fixes the issue.
(Assignee)

Comment 1

8 years ago
Created attachment 391086 [details] [diff] [review]
patch

Seems that ShowWindow(mWnd, SW_RESTORE) isn't quite the same as the user restoring. The latter sends an extra WM_SETFOCUS. Instead, this patch fires an extra NS_ACTIVATE after restoring or maximizing. The focus manager will call SetFocus or the right child widget but do nothing more as the window is already active.

The test changes don't actually test this bug, but are just an extra check to ensure everything is still focused as it should in case something else breaks.
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
Attachment #391086 - Flags: review?(emaijala)

Updated

8 years ago
Attachment #391086 - Flags: review?(emaijala) → review+
(Assignee)

Comment 2

8 years ago
http://hg.mozilla.org/mozilla-central/rev/47be4ba8c62b
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.