winemac.drv: add fullscreen mode support for Mac OS X 10.7+

Ken Thomases ken at codeweavers.com
Sun May 12 15:12:14 CDT 2013


Hi Kevin,

I'm bringing this back to wine-devel.  Please CC the list unless you intend to take things private, in which case please say so.

On May 10, 2013, at 6:48 PM, Kevin Eaves wrote:

> I should have made everything clear, sorry.  It was for personal use, so it's pretty nasty, but works great.  The only real problem is with user32.  Everything else is easy to clean up and get working with Wine properly without any issues.  Just wanted to show that.

Sure, that's what I figured.


> On May 9, 2013, at 9:56 PM, Ken Thomases wrote:
> 
>>> The fullscreen button appears if a main window is resizable.
>> 
>> We may want to narrow this down a bit.  For example, the common file dialogs are resizable, but probably shouldn't be full-screen-enabled.  Perhaps no owned window should be.
> 
> Only windows in the windows cycle should be fullscreen enabled.  If the window can be manually moved to its own space, then it should be able to go fullscreen.  No dialogs are enabled.  These follow the main window to spaces.  If in Cocoa fullscreen, the new window automatically opens fullscreen in its own space.  Everything works just like Mac applications with this setting.

Ah, I failed to notice before that the use of NSWindowCollectionBehaviorFullScreenPrimary was only in the same code path as NSWindowCollectionBehaviorParticipatesInCycle.  Yes, that makes sense.

>> From cocoa_window.m.diff:
>> 
>>> +#import <Cocoa/Cocoa.h>
>> 
>> 
>> Was that actually needed?  cocoa_window.h already imports <AppKit/AppKit.h>.
>> 
>> ...
>> 
>>> +        if (style & NSResizableWindowMask)
>>> +            [[self standardWindowButton:NSWindowZoomButton] setEnabled:!self.disabled];
> 
> These should have not been included in the diff.  It's unrelated to Cocoa fullscreen, however, the zoom button is currently bugged.  It is not disabled when the window is disabled.  To reproduce the problem: launch regedit, open the import window, and click the zoom button on the main window.  I sent a patch for it.

I'm not seeing that problem happen here.  Mind you, I'm currently testing on 10.6.  I'll have to run some tests on 10.7+ tomorrow.

I find it improbable that removing NSResizableWindowMask from the style doesn't disable the zoom button.  That style is the only thing which enables the zoom button to begin with.  In other words, in a normal Mac app, one would not need to disable the zoom button separately.


>>> -        if (captured || fullscreen)
>>> +        if (captured || (fullscreen && !(normalStyleMask & NSResizableWindowMask)))
>> 
>> You're trying to distinguish between a window that was full-screened at the instigation of the Windows program versus one which has been full-screened by Cocoa, right?  Hmm.  I think we need a better technique to determine that.  I agree that it's not likely the Windows program would make its window full-screen while still allowing it to be resized but it feels wrong to assume that.
>> 
>> Also, I think we can entirely avoid setting the window level for windows that have been Cocoa full-screened.  Setting the window level is mostly about relationship to other windows, but a Cocoa full-screen window should be on a space by itself, shouldn't it?
>> 
>>> +            else if ([self styleMask] & NSFullScreenWindowMask)
>>> +                level = NSMainMenuWindowLevel + 2;
>> 
>> I'm not following why Cocoa full-screened windows should be at +2 vs. +1.
> 
> The window levels are automatically adjusted and the menu is in a hover state.  We need to prevent the menu from being hidden, and hide the menu if the Windows program goes fullscreen while in Cocoa fullscreen (+1 doesn't cut it).

I'm going to have to do some testing to understand this, too.  NSMainMenuWindowLevel should be in the same level as the menu (meaning could be above or below due to normal window ordering operations).  NSMainMenuWindowLevel + 1 should always be above the menu, regardless.  NSMainMenuWindowLevel + 2 should not be necessary.  But maybe something weird is going on.

Also, if the Windows program changes a window from resizable to non-resizable, then we should probably pull the window out of Cocoa fullscreen.  The Windows program _may_ have intended to make the window full-screen but we can't know that.  It may simply be changing the window style for some other purpose, and that may make it no longer a candidate for Cocoa full-screen mode.


>>> +    - (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
>>> +    {
>>> +        return NSMakeSize(proposedSize.width, proposedSize.height);
>>> +    }
>> 
>> Is this actually needed?  I assume that's the default behavior when the delegate method is absent.  (Also, if it is necessary, it can just return proposedSize without making a new size struct.)
> 
> This little gem will resize ANY window — non-resizable, disabled, a dialog box...  Add this and poof!!  There is no reason to ever disable Cocoa fullscreen.  Mac applications don't so neither should Wine.

I disagree.  Windows programs that are not expecting their window to resize (because they haven't made them resizable) can misbehave badly if the window does resize.  Just because that didn't happen in your testing doesn't mean it won't.

As you mentioned in your original email, Cocoa full-screen is roughly akin to window resizing.  So, it should be disabled if/when the window is made non-resizable.

> I haven't tested this enough with non-resizable windows, but it is possible to resize any window.

I don't follow this.  It is possible to resize any window even non-resizable ones?  To what are you referring?  Possible how?  Do you mean specifically just with this full-screen patch?

> I use this feature to resize a few non-resizable game windows.  Maybe add a registry key to allow non-resizable windows to go fullscreen.

Perhaps.

Cheers,
Ken




More information about the wine-devel mailing list