Spaces and CTRL

Issue #78 resolved
Anonymous created an issue


Just got the new updated version of Boxer, and the fact that you can get out of the game, without quitting is nice, but can some response keys, like CTRL be kept only in the game. Since many old dos games needs CTRL for fireing, and using the arrow keys, Spaces activates.


Comments (10)

  1. Alun Bestor repo owner

    Hi Glenn, this issue has been raised recently in the Boxer blog comments so I'll paraphrase a bit from there:

    When OS X Spaces is turned on, it defaults to using the Ctrl+Arrow key combos to switch between spaces. This naturally interferes with DOS programs that use Ctrl and the arrow keys, causing unwanted space switching.

    Unfortunately, OS X handles this keyboard shortcut first before any application gets to it. The keypresses never actually reach Boxer in fact, and there's no way for Boxer to intercept the shortcut before OS X handles it.

    While it is technically possible for Boxer to disable the Spaces shortcuts while Boxer is running, in practice this approach works very poorly: it requires Boxer to disable Spaces altogether, and to kill and restart the OS X Dock. This is quite visible and intrusive, and can occasionally cause Finder to crash. In short, this solution was too disruptive and unreliable, and not appropriate for a well-behaved Mac application.

    Another workaround I explored was to make Boxer automatically assigned to all Spaces: that way, the space switching would still occur but Boxer would be there waiting on whichever Space you switched to. In practice though, this too worked very poorly: there was a noticeable delay while switching, the keypress that triggered the switch would never reach DOS anyway, and the Boxer window would lose focus when switching Spaces (which resulted in the mouse unlocking from the window.) In short, this solution was no better than the original problem.

    Currently, it appears there's nothing Boxer can do to solve this problem itself. The solution is to disable these keyboard shortcuts in the Exposé & Spaces Preferences pane, or to remap them to a different key modifier like Cmd+arrow keys (which is not used in Boxer.)

  2. Alun Bestor repo owner
    • changed status to open

    Actually, having received additional feedback from another user, I now realise that you're probably referring to the Spaces shortcuts now taking effect even in full screen. This is a regression that needs to be addressed.

    To wit: in the latest 1.0beta2 version (2011-01-23), full screen mode was changed to no longer capture the display. This allows users to access the menu, bring up other windows and switch to other applications while in full screen. Unfortunately, this also tells OS X that it's OK to enable all the Space-switching shortcuts, which are normally suppressed while an application has taken over the display.

    I will try to find a solution to this so that while the mouse is locked (which it normally is in full screen), then Boxer tells OS X that no application-switching or space-switching is possible. When you unlock the mouse to access the menu bar or other windows, or when you exit full screen mode altogether, then Boxer should return to a normal application mode and space-switching shortcuts should function again.

    That will probably have the side-effect that application-switching shortcuts like Cmd-Tab will not work in full screen while the mouse is locked. But since what people normally want to do in full screen is play their damn game rather than switch willy-nilly from one application to another, then I think this is a reasonable compromise.

  3. Alun Bestor repo owner

    Progress report: I've now tried having Boxer switch to a 'kiosk'-style application mode which prevents switching to other applications or spaces, and indeed this does stop the spaces shortcuts from taking effect.

    However, it doesn't prevent the space shortcuts from being *caught*: OS X still eats the keypresses, which means DOS still never sees them, and this frequently results in the Ctrl and/or arrow keys getting 'stuck' down. This is worse than the behaviour it was trying to fix.

    It seems the only viable solution for suppressing the shortcuts properly is for Boxer to go back to a display-capturing approach. However, this may prevent all the friendly full screen behaviour I was hoping to achieve with these latest changes.

  4. Anonymous


    Thanks for the try, i will just have to get use to some other keys either in the game or for Spaces


  5. Alun Bestor repo owner

    So with the sterling assistance of Hyperspaces developer Tony Arnold, I was actually able to get a much better approach working: ironically, one of the earlier ones that I'd tried but failed to get working, and assumed was not possible.

    If you have your Spaces arrow-key shortcuts set to a modifier which may conflict with DOS (Ctrl+arrowkeys, Opt+arrowkeys or Shift+arrowkeys) then while a DOS window is focused, Boxer will override the Spaces shortcut to be Ctrl+Cmd+arrowkeys (or Opt+Cmd+arrowkeys etc.). It will restore the old shortcut when you close the window or move focus to another window.

    This prevents Spaces from interfering with Boxer's normal operation in both windowed and fullscreen mode, while still allowing you to switch spaces if you really want to.

    This change will appear in the next Boxer update, once I've tested it out on OS X 10.5.

  6. Alun Bestor repo owner

    One wrinkle: the override doesn't work on 10.5 because the System Events Applescript API for changing the hotkeys was silently broken until 10.6. Thus, the fix is disabled for 10.5.

    I'm leaving this issue resolved however, because the majority of Boxer users are already on 10.6, and 10.5 users have the simple recourse of changing the shortcut themselves.

  7. Alun Bestor repo owner
    • changed status to open
    • marked as bug
    • changed component to Input
    • changed version to 1.0
    • changed milestone to 1.1

    Unfortunately OS X 10.7 Lion has removed the API that Boxer used to override these shortcuts, meaning the approach will no longer work. I'm reopening this bug until I come up with an alternative solution for preventing Ctrl+arrowkey interference.

  8. Alun Bestor repo owner

    This problem is now fixed in development code and will appear in Boxer 1.2, due for release the first week of November.

    The solution suppresses hotkeys assigned to F1-F12, along with arrow-key hotkeys - whether they're triggered with Ctrl, Shift, Alt or any other modifier combination. All such keypresses are passed straight to DOS when a program is running, without going through OS X's global hotkey handling.

    This relies on the user having "Enable access for assistive devices" turned on in the OS X Universal Access preferences, but this is fairly common - and if the user has it disabled, they'll be prompted to turn it on.

  9. Bernard Helyer

    This doesn't work for me in 10.10. I can't find 'enable access for assistive devices', but it's my understanding this is now per-app, and have selected Boxer as shown here:

    Screen Shot 2014-11-30 at 5.24.37 pm.png

    The preference dialog stops asking me to turn assistive on, but ctrl and an arrow key still move spaces, full screen and windowed.

    EDIT: Nevermind, you have to restart Boxer, it seems.

  10. Log in to comment