winemac: Disable the zoom button for windows that are disabled.

Ken Thomases ken at codeweavers.com
Tue May 14 04:06:25 CDT 2013


I have submitted an alternative patch to fix this issue.  It ended up being more involved.

First, on considering exactly how disabling a window should interact with its resizability features, I decided that disabling should not remove NSResizableWindowMask from the style mask.

Consider a window whose style mask is just NSTitledWindowMask | NSResizableWindowMask – that is, it's not closable or minimizable.  If disabling it removed NSResizableWindowMask, then it would have no bits for the window buttons in the mask.  So, the window would not display any buttons.  That's not the correct behavior.  Disabling should leave all the same buttons visible, it's just that they should be, well, disabled.

Similarly for the resize indicator (a.k.a. grow box).  The Mac driver currently hides it, but I may make that an option in the future.  Anyway, if the window is resizable and the resize indicator is showing, then disabling it should not hide it, just make it unresponsive to clicks and drags.  (That's how a Mac-native app behaves when a resizable window is behind a modal dialog, for example.)

So, to disable the zoom button, I just access it directly and disable it as you did in your patches.  However, we also need to disable the resize cursors at the window edges.  So, I set the minimum and maximum sizes of the window to match the current size.  (The resize cursors themselves don't show for non-main windows, but such windows can still be resized by Command-dragging their edges.  That  would work with regedit when its Import dialog is open had I not set the min and max sizes, which would be bad.)


I encountered some difficulties in implementing the above strategy, however.  Basically, -[NSWindow setStyleMask:] is pretty broken on 10.7+.  It works properly on 10.6.

This isn't related to disabling windows so much as to the Windows program changing the style such that the window changes its resizability.

It turns out that adding or removing NSResizableWindowMask when neither of the other two buttons are present in the style mask does _not_ show or hide the buttons like it should.  So, if you start with just NSTitledWindowMask and add NSResizableWindowMask, the window still shows no buttons.  And if you start with NSTitledWindowMask | NSResizableWindowMask and remove NSResizableWindowMask, then the window does not hide the buttons.

The workaround is to also toggle NSClosableWindowMask temporarily in that operation.  That seems to force Cocoa to refresh its notion of whether the buttons should show or not.

-Ken




More information about the wine-devel mailing list