Re: Disabling Hot Corners
Re: Disabling Hot Corners
- Subject: Re: Disabling Hot Corners
- From: Seth Willits <email@hidden>
- Date: Tue, 23 Jul 2013 13:19:16 -0700
On Jul 23, 2013, at 12:00 PM, Seth Willits wrote:
> TLDR:
>
> - Capture the mouse and use mouse event deltas to avoid hitting any hot corners.
>
> - If the game is not full screen, when the in-game cursor becomes visible, stop capturing the mouse and use the normal mouse events. Hide the Mac cursor when it is within the bounds of the game window, but when it moves outside of the window hide the game cursor and show the Mac cursor.
>
> - When capturing the mouse, always make sure to programmatically move it to the center of the game window otherwise you can have the mouse be locked outside of the window and click events will go to background apps.
>
>
> See:
> CGWarpMouseCursorPosition/CGDisplayMoveCursorToPoint, CGAssociateMouseAndMouseCursorPosition, NSEvent's delta properties
I should follow this up with a few clarifications since a good game developer friend of mine asked a good question. His argument boiled down to "you're doing this wrong" and should be using Apple's (relatively) new built-in full screen window API and not trying to replicate Windows behavior.
On 10.7 Apple introduced an official way (beyond CGDisplayCapture) to create full screen windows, in which the window becomes a new Space. Users can swipe between spaces, and can also Cmd-Tab between apps even when in one of these spaces.
1) I initially assumed pre-10.7 compatibility was required (given that this is SDL2), but there are also other reasons why the standard full screen behavior can't really be used:
2) When a window is made full screen on its own Space, you still have the potential for the mouse to hit hot corners. There is no combination of API entry point and options I can find which will allow the user to Cmd-Tab between applications, hide the menu bar and Dock, and disable hot corners as well. There are options combinations that will disallow hotcorners, but then the user can't Cmd-Tab. So you're hosed.
3) It's not possible for a background application to display a window above the game which—as I understand it—is exactly what Steam does. (Which I assume is of considerable importance to you give your employer. (On 10.7 it actually is possible, but this behavior is gone in later versions. Presumably it was a bug.) So in order to continue having Steam display windows on top of a game, the game itself can't use OS X's new full screen behavior.
If #1 and #3 are not concerns, then you could use OS X's new full screen behavior, however you still would need to capture the mouse to avoid hot corners.
I think there's little benefit to actually using the new behavior, so the most compatible thing to do is not use it, capture the mouse and use deltas to avoid the corners.
Also: file a radars to request being able to disable hot corners.
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden