winex11.drv: Post a WM_SYSCOMMAND SC_CLOSE when the Window Manager asks to close a window (try 2)

Paul Chitescu paulc at voip.null.ro
Wed Jun 16 03:06:15 CDT 2010


Changelog:
	winex11.drv: Post a WM_SYSCOMMAND SC_CLOSE when the Window Manager asks to 
close a window

Bug fix for: http://bugs.winehq.org/show_bug.cgi?id=22941

Rationale:

The Alt-F4 approach fails because:
- some applications interpret Alt-F4 for something else
- some other shift or control keys may be down
- doesn't work when the focus is in a listbox

The emulation of "click in close box" or "double click in sysmenu" fails 
because:
- another menu may be already open
- internals of wine's peek_message fail to deliver messages in order when an 
application peeks or gets messages with a range filter (Mozilla peeks at 
WM_MOUSEFIRST - WM_MOUSELAST so WM_NCLBUTTONDOWN is retrieved after 
WM_LBUTTONUP)
- applications deal with the sysmenu themselves and break timings (Mozilla 
again)

The WM_SYSCOMMAND approach looks the cleaner because:
- it's the expected final result of the other two methods
- doesn't depend on the current keys or mouse state
- works in all programs I've tested ;-)

Probably none of the solutions is perfect but this is definitely less hackish.

Tested in:
- Word Viewer 97
- Microsoft Word, Excel, Powerpoint Viewer 2003
- Microsoft Word, Excel (ribbon interface), Powerpoint Viewer 2007
- Mozilla Firefox 3.6.3
- Internet Explorer 6
- Yahoo Messenger 9
- pretty much everything I have installed

Changes from previous patch: just claim a mnemonic was used to close the 
window, don't pass the mouse coordinates. In Windows only clicking on the [X] 
button causes lParam to be non-zero.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winex11_syscommand_close2.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100616/9da37d83/attachment.bin>


More information about the wine-patches mailing list