Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VenturaSaver2Cpx: the Ventura Screensaver and Mouse Events bug #1267

Open
xmddmx opened this issue Oct 3, 2022 · 5 comments
Open

VenturaSaver2Cpx: the Ventura Screensaver and Mouse Events bug #1267

xmddmx opened this issue Oct 3, 2022 · 5 comments

Comments

@xmddmx
Copy link

xmddmx commented Oct 3, 2022

Let's take this as given: macOS screensavers should, optionally, be programmed to let users interact with keyboard or mouse while the screensaver is running. I believe "Mowing Man" was one of the first to do this?

What about recent versions of macOS?

  • in macOS High Sierra, Apple removed the ability for a screensaver to launch a helper app which could display content by creating a new window at level 2002 or higher. The helper app, being a regular macOS app, had full keyboad / mouse permissions, and was easy to test & debug. This macOS change broke a lot of code (iScreensaver, SETI @ home...) We reworked our apps to deal with it.
  • in macOS Mojave, Apple added a bunch of new restrictions on keyboard and mouse usage, but we figured out ways to get around almost all of them them.
  • in macOS Catalina, Apple blocked screensavers from using any keyboard events, and made using Mouse events difficult (especially with 2+ monitor systems). We could not figure out how to enable keyboard events, but we did figure out a workaround to handle mouse events on 2+ screens
  • in macOS Ventura, Apple again changed things. There still appears to be no way to get keyboard events to a running screensaver. In addition, techniques used in Catallina to receive mouseEvents are stymied.
  • (through beta 9) In a Ventura .saver, even if you try to capture mouse events, once the mouse has moved 200 pixels (in either X or Y direction) the screensaver exits.
  • it appears that the event or responsder order is different in Ventura: In a Monterey screensaver, you can use NSEvent addLocalMonitorForEvents to capture an event, forward it to your NSView, and then return nil (to prevent the parent Screen Saver app from seeing it). In Ventura something has changed - my best guess is that the ScreenSaverEngine reads the mouseMoved event before sending it to the .saver process. So there's no way to block events by returning 'nil' (although this may only apply to .mouseMoved events, see below)

In any case, I propose we call this the VenturaSaver2Cpx bug to have a nice search keyword. I don't think it's worth registering a new domain name 😄

There seemed to be no way around this.

Until now.

I belive I have found a workaround for the VenturaSaver2Cpx bug.

The workaround is ugly - basically, you have to trap the mouse cursor, figure out how far it's moving, and if it moves more than 200px, move it back, all the while maintaining a "simulated" cursor position that you forward on to your NSViews.

When you do this, you can have a screensaver which shows an onscreen display (OSD) also called a Heads Up Display (HUD) which allows a user to interact with a running screensaver using mouse or trackpad move / click events.

Would that be of interest to Aerial users?

@xmddmx
Copy link
Author

xmddmx commented Oct 6, 2022

Update: I feel like my workaround is pretty solid on Ventura, allowing you to mouse over the entire screen. However, it only works on 1 monitor - I've not found a way to mouse from one screen to nother w/o causing the screensaver to exit.

@glouel
Copy link
Collaborator

glouel commented Oct 8, 2022

Hey @xmddmx

Apologies for not answering earlier, it was a horribly busy week here at work.

Your description of the history of this is super accurate as far as I can tell.

And yes yes yes, your workaround looks super interesting. Having any gesture to go to next video (or maybe even back to previous) is something I'm definitely interested in, so please tell me more. Is it possible to do something with mouse clicks btw ?

In any case, thanks for letting me know about this and yup, definitely interested if I didn't say that enough ;)

@xmddmx
Copy link
Author

xmddmx commented Oct 8, 2022

@glouel I've got a proof-of-concept project based on ScreenSaverMinimal, but I don't think it's really ready for public consumption yet. Is there a way I could send you the XCode project privately for you to hack on ?

@glouel
Copy link
Collaborator

glouel commented Oct 8, 2022

Sure thing, send me an email at guillaume @ louel . fr (without the spaces)

@xmddmx
Copy link
Author

xmddmx commented Oct 8, 2022

done! happy to collaborate here or direct via email. once stuff is working a little better I think it should be public...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants