1
Window / Detecting keypresses on Mac OSX Catalina
« on: January 12, 2023, 03:27:40 pm »
I'm having issues with detecting certain keypresses when building on Mac OSX Catalina. The system seems to think that the application wants to be able to monitor input while in the background, which isn't even true.
According to another post I found on this forum (quoted below), it's caused by using IsKeyPressed, and the solution is to use events. But that's not possible – I'm trying to do is handle modified mouse clicks (eg, Alt+Click) and scroll wheel (eg, Ctrl+Wheel). The MouseButtonEvent does not have a modifier key field, so the only option is to manually check for the modifier. The same applies to the scroll event.
I know for certain that other apps can handle modified mouse clicks and scroll wheel without needing to register for input monitoring in System Preferences, so why is it that there's no way to do this in SFML? If IsKeyPressed does not work, what other options are there? Perhaps the Mac implementation of IsKeyPressed is incorrect.
EDIT: Based on the contents of the framework package, I appear to be using version 2.5.1.
According to another post I found on this forum (quoted below), it's caused by using IsKeyPressed, and the solution is to use events. But that's not possible – I'm trying to do is handle modified mouse clicks (eg, Alt+Click) and scroll wheel (eg, Ctrl+Wheel). The MouseButtonEvent does not have a modifier key field, so the only option is to manually check for the modifier. The same applies to the scroll event.
I know for certain that other apps can handle modified mouse clicks and scroll wheel without needing to register for input monitoring in System Preferences, so why is it that there's no way to do this in SFML? If IsKeyPressed does not work, what other options are there? Perhaps the Mac implementation of IsKeyPressed is incorrect.
If you actually use events and not real-time input (sf::Keyboard::IsKeyPressed), then things should work fine.
For real-time input you will have to grant the app input monitoring privileges as far as I know, that's one of the major changes in Catalina for all applications.
There are ways to disable some stuff for developers, but as I am not a macOS user, I don't really know and would need to research myself.
EDIT: Based on the contents of the framework package, I appear to be using version 2.5.1.