Facepunch / garrysmod-requests

Feature requests for Garry's Mod
84 stars 24 forks source link

Treat OS X Fullscreen Mode as Native Window #702

Open Jake3231 opened 8 years ago

Jake3231 commented 8 years ago

I love Gmod on my Mac, but among the little things I would change about it, is its ability to play nice with OS X's fullscreen app system. I think that Gmod should be launched as a fullscreen window on OS X, rather than the generic Steam style app that lock the computer into the app. It would be great if you could swipe with three fingers between desktops, with Gmod being one of them. This would also allow notification center and its notifications to appear onto of the game. I hope that the Mac users out there will understand my idea on this!

robotboy655 commented 8 years ago

-window -noborder ?

Jake3231 commented 8 years ago

What I mean is that when you launch the game in fullscreen, it is not a window, as recognized by OS X. It seems to take over the screen and disappear when you use any method to leave the app. Most Mac apps that run in fullscreen run as a fullscreen Window. If you take Safari fullscreen it has full support of the Mac's software features and virtual desktop system. I just think that Gmod should run in a traditional OS X window rather than the alternative.

Bo98 commented 8 years ago

In other words: A request to use the native OS full screen rather than the makeshift one the Source engine.

None of the other Source engine games uses this as of yet (not sure about Dota 2: Reborn?).

Jake3231 commented 8 years ago

That is a much better way to put it. I don't know if Source will block this, but I'm sure that it's not impossible. I make OS X apps myself, but I use Xcode. I know that it's a bit harder not using the traditional and verified Apple method of developing Mac apps.

Bo98 commented 8 years ago

The game does use the Cocoa framework very low down (ValveCocoaMain function in launcher.dylib) though it tries to go somewhat platform-agnostic as soon as possible. Since window management is likely one of the things that is as low down as ValveCocoaMain is probably is possible but whether it will work without side effects is another matter.

Jake3231 commented 8 years ago

That is a good point. I know that this is easier said than done, but I would have to push for someone to at least try to do this, because worst case scenario is that it wouldn't work and we'd retain the same system that we've been using. I just think that if someone could figure this out without any serious side effects, it would really improve the experience for Mac users.

Jake3231 commented 8 years ago

Just for clarification on what you said, Source Engine forces apps to use its makeshift method? Is it possible to tell the program to run that makeshift view inside of a native window? If apps aren't forced to use Source's method, then I'd imagine that the change wouldn't be too bad.

Bo98 commented 8 years ago

The Source Engine already does display in a window - when you are not in fullscreen. The "makeshift" method I was talking about is exclusively what they use for fullscreen now. I'm not sure exactly what method they do it but that's irrelevant as the change suggested would be to use the aforementioned window all the time and take advantage of the OS fullscreen feature on that window (by adding the NSWindowCollectionBehaviorFullScreenPrimary flag through -[NSWindow setCollectionBehavior:] and calling -[NSWindow toggleFullScreen:nil] as required).

Jake3231 commented 8 years ago

I think you're right. Do you think it is possible to make Gmod use OS X's window and fullscreen features?

Bo98 commented 8 years ago

Possible? Yes.

Willox did indicate plans to replace the Cocoa implementation with SDL which might happen to have proper fullscreen support there out of the box but I haven't tested that.

Jake3231 commented 8 years ago

I hate to ask this, but could you, or someone, test the SDL implementation? I just think that Mac users would really appreciate being able to use OS X's full screen features. I also wonder, would this implimentation improve performance by any chance? It looks like this comment from Willox also mentions some benefits of SDL..

Jake3231 commented 7 years ago

Just curious, what's the status of SDL right now? Is there still a chance of implementing it? As Willox said in the previously mentioned comment, there seem to be quite a few benefits to SDL right now — especially for Linux and macOS.

Jake3231 commented 7 years ago

Please excuse my lack of knowledge, but how would I test this myself? I should ask, what is the exact file that runs to initialize the game's first window? I may try to mess around with the code there.