Trickey Input Problem

Moderator
Posts: 613
Joined: 2004.09
Post: #1
Ok I have had a few people look over my code, have completely rewrote it once, and have changed and commented out everything i can think of.

My problem is apparently not limited to carbon events but also to, GetKeys and Cocoa Events. All events are accepted in window mode, when switched into full screen all events except keyboard events are accepted. I simply get a system beep when any key is pressed. It appears as if they OS is blocking all keys.

I have attempted to bring the app to front which is successful, and I have watched for the app going into hiding from launch. The app itself remains frontmost. I belive I have narrowed this down to my fullscreen content losing the abilty to take input possibly because its not frontmost with the app?

Is there a way to make my fullscreen context frontmost? Or is this not related to my problem? Could my problem be based around my cocoa interface?

Thanks in advance as always guys.

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #2
Sorry, it's a little late for me and I might not be reading your post right (had a few too many beers). Seems like maybe you might not be abusing the system as you should in fullscreen with Cocoa. Just loop and don't let the system have any space when in fullscreen. I like to do something like this:
Code:
- (void)updateFrame
{
    NSEvent *event;
    
    // must continually pick up events while in full screen
    while ([view isFullScreen])
    {
        while ((event = [[NSApplication sharedApplication]
           nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast]
           inMode:NSEventTrackingRunLoopMode dequeue:YES])
           != NULL)
           {
               [self handleEventsWhileInFullScreen:event];
           }
        [view drawFrame];
    }
    
    // otherwise draw normally
    [view drawFrame];

...

- (void)handleEventsWhileInFullScreen:(NSEvent *)event
{
    unichar unicodeKey;
    
    if ([event type] == NSKeyDown)
    {
        unicodeKey = [[event charactersIgnoringModifiers] characterAtIndex:0];
        ...
Also, I hate to sound like a parrot but - "Don't use GetKeys() anymore. RaaaAWWK!"
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #3
I am using Carbon Events for my loop, GetKeys was merely a test to see if i could get any kind of key input it was not my prefered first, second, or even third method of input.

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Post Reply