Full Screen Key Capture Issues
So over the last few months ive been toying off and on with this code and I cant quite get it to work. Ive narrowed it down a whole bunch but I was hoping for a little guidance since this is my first time really working with OpenGL.
The problem is that my event captures all keys in the window mode just fine. But as soon as I try and go fullscreen it rejects all key input. What I mean by that is any key input I do while in fullscreen I get a system beep.
I checked the code with printf() and it installed the event handler just fine in both modes. In the windowed mode I get an event occured printf, but in full screen it dosnt even call my event handler.
If I call a CGDisplayRelease() and bring up my menu I can capture key strokes while I have a menu bar pulled down but if I dont have a menu bar selected I still get a system beep.
I hope this is enough info, If anyone wants to take a look at my full source let me know I would be happy to email it to you.
Thanks in advance for the help, and thanks for your time
The problem is that my event captures all keys in the window mode just fine. But as soon as I try and go fullscreen it rejects all key input. What I mean by that is any key input I do while in fullscreen I get a system beep.
I checked the code with printf() and it installed the event handler just fine in both modes. In the windowed mode I get an event occured printf, but in full screen it dosnt even call my event handler.
If I call a CGDisplayRelease() and bring up my menu I can capture key strokes while I have a menu bar pulled down but if I dont have a menu bar selected I still get a system beep.
Code:
void InitMyEventHandler(void)
{
EventTypeSpec events[3] = {
kEventClassKeyboard, kEventRawKeyDown,
kEventClassKeyboard, kEventRawKeyUp,
kEventClassKeyboard, kEventRawKeyModifiersChanged,
};
/************************/
/* CREATE EVENT HANDLER */
/************************/
gMyEventHandlerUPP = NewEventHandlerUPP(MyEventHandler);
InstallEventHandler(GetApplicationEventTarget(), gMyEventHandlerUPP, 3, events, nil, &gMyEventHandlerRef);
//InstallEventHandler(GetUserFocusEventTarget(), gMyEventHandlerUPP, 3, events, nil, &gMyEventHandlerRef);
NSLog(@"Loaded");
}I hope this is enough info, If anyone wants to take a look at my full source let me know I would be happy to email it to you.
Thanks in advance for the help, and thanks for your time
I couldn't find anything wrong with the code you posted. I wrote an article on reading the keyboard with Carbon events. You can find the article using the link in my signature. The article includes a small sample program that reads key presses in fullscreen mode.
I figured out what my issue was, I was missing a RunApplicationMainLoop(); in my switch to full screen code. Thanks for the help Mark, your article lead me down the right path.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Full Screen OpenGL Crashes | Blacktiger | 13 | 6,533 |
Feb 19, 2009 02:39 PM Last Post: backslash |
|
| OpenGL full screen mode leaves garbage on screen when exiting app | Malarkey | 5 | 4,458 |
Nov 19, 2008 12:51 PM Last Post: Malarkey |
|
| Changing resolution while already in full-screen mode? | Malarkey | 1 | 2,259 |
Jun 10, 2008 07:49 PM Last Post: AnotherJake |
|
| Full Screen Switching | Blacktiger | 3 | 3,009 |
Feb 9, 2008 03:05 PM Last Post: Blacktiger |
|
| Dealing with Battery Low Warning During Full Screen | AnotherJake | 8 | 5,221 |
Feb 8, 2008 12:26 PM Last Post: OneSadCookie |
|

