How to know when my app loses and gains the focus with carbon

Discussion in 'Mac Programming' started by MACaveli7, Feb 22, 2011.

  1. MACaveli7 macrumors newbie

    Joined:
    Oct 15, 2010
    #1
    Howdy folks, I can't seem to locate the event for my application losing and gaining the focus, my app is full screen so I assume that is why the kEventClassWindows events will not work.

    There is a kEventAppFrontSwitched in the kEventClassApplication events, but from the sounds of it this will tell me when the front application loses focus not my particular application.

    Any help with this will be mucho appreciated.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    How about kEventAppActivated/kEventAppDeactivated?
     
  3. MACaveli7 thread starter macrumors newbie

    Joined:
    Oct 15, 2010
  4. MACaveli7 thread starter macrumors newbie

    Joined:
    Oct 15, 2010
    #4
    kEventAppActivated/kEventAppDeactivated seems to only work when the user clicks out of or on the screen, so is not useful in full screen.
     
  5. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #5
    So do you mean if the user performs a keyboard command, such as command-tab, to switch apps, that event isn't called?
     
  6. MACaveli7 thread starter macrumors newbie

    Joined:
    Oct 15, 2010
    #6
    It might be, but I need to know when something such as an overlay appears that takes the focus away from the app.
     
  7. mif macrumors regular

    Joined:
    Feb 16, 2010
    Location:
    home
    #7
    One of these might work (from CarbonEvents.h).

    kEventAppFocusNextFloatingWindow?

    /*--------------------------------------------------------------------------------------*/
    /* Application Events */
    /*--------------------------------------------------------------------------------------*/

    /*
    kEventClassApplication quick reference:

    kEventAppActivated = 1,
    kEventAppDeactivated = 2,
    kEventAppQuit = 3,
    kEventAppLaunchNotification = 4,
    kEventAppLaunched = 5,
    kEventAppTerminated = 6,
    kEventAppFrontSwitched = 7,

    kEventAppFocusMenuBar = 8,
    kEventAppFocusNextDocumentWindow = 9,
    kEventAppFocusNextFloatingWindow = 10,
    kEventAppFocusToolbar = 11,
    kEventAppFocusDrawer = 12,

    kEventAppGetDockTileMenu = 20,
    kEventAppUpdateDockTile = 21,

    kEventAppIsEventInInstantMouser = 104,

    kEventAppHidden = 107,
    kEventAppShown = 108,
    kEventAppSystemUIModeChanged = 109,
    kEventAppAvailableWindowBoundsChanged = 110,
    kEventAppActiveWindowChanged = 111
    */
     

Share This Page