Modifier keys

Using GLFW
  • Nobody/Anonymous

    On Mac OS X, the command key doesn't trigger an event. Thankfully, I was able to fix this by adding a only few lines to GLFW's source. My problem now is that both the left-side and right-side modifier keys cause GLFW to trigger events for left-side modifiers.

    My game really needs to be able to differentiate between the modifiers on each side of the keyboard, but GLFW doesn't seem to support that on Mac OS X.

    Would it be possible to add support for this in a future release?

    • Camilla Löwy

      Camilla Löwy - 2006-02-05

      Well, there are no constants for command keys in GLFW. They could be added, of course, or the keys could be mapped to existing constants. Sounds like a useful addition. I'll see if it can be added (I'm only the OS X developer).

      It would be great if you could email me a patch with your changes, as a reference.

    • Nobody/Anonymous

      I uploaded the diff file to my site:

      • Camilla Löwy

        Camilla Löwy - 2006-02-07

        That's great! Thank you very much :)

    • Nobody/Anonymous

      [I'm the same person who started the thread]

      Simply add this line to the _glfwHandleMacModifierChange function:
      _glfwTestModifier( cmdKey, GLFW_KEY_LCMD );
      and add a GLFW_KEY_LCMD constant to glfw.h

      Carbon provides only a "cmdKey" constant, no constant for the right-side version like it has for the other mods.

      This little utility may help (somehow) - it can show codes for any modifier key:

      The problem with right mod keys registering as left mod keys (both left and right shift keys trigger LSHIFT, for example) might just be a problem with Carbon or my OS, because it is clear that your code is written properly in _glfwHandleMacModifierChange.

    • Nobody/Anonymous

      [I'm the same person who started the thread]

      I've modified the GLFW code to use Apple's HID Utilities library to get individual modifier key states.

      With the modifications, user must now link against IOKit,
      CoreFoundation, and HIDUtilities to compile their GLFW programs.

      HID Utilities must be downloaded separately from Apple:

      You may decide not to use my additions, but I'm sure you'd be interested in seeing them. Unfortunately, I haven't a clue how to do a patch thingy, so what do you suggest?

      • Camilla Löwy

        Camilla Löwy - 2006-02-06

        I'm going to add a dependency to the HID Manager for joystick support, but I'd really rather not depend on code outside the regular OS and Developer Tools. I'd still be interested in your code, since I'll have to duplicate parts of the HID Utilities functionality anyway.

        If your copy of GLFW comes from CVS, then you can produce a suitable diff with `cvs duff -u`. Otherwise, download a fresh copy of the sources and do `diff -ru clean-glfw-dir your-glfw-dir`.

        Thank you for working on this. It may be the thing to finally get me to add HID support to GLFW. Please don't hesitate to bug me via email :)


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks