winemac: When programmatically focusing a window, don't generate WINDOW_LOST_FOCUS event for previously focused window.

Ken Thomases ken at codeweavers.com
Wed Sep 25 15:10:57 CDT 2013


That event can confuse things if the program switches focus from A to B and
then back to A and then processes events.  It will get an event saying that
A lost focus in Cocoa, check that A does indeed have current focus in Wine,
and so switch focus away from it (to the desktop window).  (It then gets an
event that B lost focus, but that does nothing at that point.)

The code already tracked when it programmatically focused a window and
ignored the resulting notifications from Cocoa, but that state was only
tracked for the window being focused.  The window losing focus couldn't tell
that it was losing it because of a programmatic change, so it generated the
WINDOW_LOST_FOCUS event.

The fix is to share that tracking state across all windows.  The state
indicates which window is being focused.  Most checks now compare that against
self to retain the existing semantics of only ignoring receipt of focus for
the window being intentionally focused.  The check in -windowDidResignKey:,
though, just checks that it's non-nil so that it ignores loss of focus no
matter which window is being focused.
---
dlls/winemac.drv/cocoa_window.h |    1 -
dlls/winemac.drv/cocoa_window.m |   14 ++++++++------
2 files changed, 8 insertions(+), 7 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-winemac-When-programmatically-focusing-a-window-don-.patch
Type: text/x-patch
Size: 2366 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130925/68282ee0/attachment.bin>


More information about the wine-patches mailing list