OS X Carbon GUI
Positng this question here for lack of a better place to put it.
Here is the code I'm messing with:
And I compile it with:
int main(int ArgC, char **ArgV)
rPos.top = 200;
rPos.left = 300;
rPos.bottom = 400;
rPos.right = 500;
//Create the window
CreateNewWindow(kDocumentWindowClass, kWindowStandardDocumentAttributes |
kWindowStandardHandlerAttribute, &rPos, &Handle);
//Show the window
//Remove the winow
The code does create a window. Te problem is the window won't respond to anything.
gcc OSXGUI.c -framework Carbon
According to the API docs, the call to RunApplicationEventLoop() is supposed to install the default event handler to the window. That default handler is supposed to handle the basic requests; maximize, minimize, resize, and move. Except its not doing that. The window will maximize and minimize, but not move or resize.
Am I compiling it wrong (It seems to want to be a console app as opposed to a GUI app)? Or is there some other issue with my code?
My guess is the event loop that is created is for the thread rather than the application, since if I install my own event handler it never recieves anything. But I just don't know, and the documentation Apple has doesn't cover windows that aren't made from NIB's very well.
Well even if its creating an event loop for the thread that shouldn't matter. I replaced the call to RunApplicationEventLoop() with my own event loop:
and the loop was given events for the window. I didn't see any events for move or size requests though.
WaitNextEvent(everyEvent, &Event, (unsigned int)-1, NULL);
printf("Got an event!\n");