add osx-disable-event-loop

This commit is contained in:
David Rose 2007-10-01 17:34:53 +00:00
parent 3000263819
commit fcb83a251e
3 changed files with 23 additions and 12 deletions

View File

@ -41,6 +41,13 @@ ConfigVariableBool show_resize_box
"window would completely hide any resize control drawn by the "
"OS. Set this variable false to allow this control to be hidden."));
ConfigVariableBool osx_disable_event_loop
("osx-disable-event-loop", false,
PRC_DESC("Set this true to disable the window event loop for the Panda "
"windows. This makes sense only in a publish environment where "
"the window event loop is already handled by another part of the "
"app."));
////////////////////////////////////////////////////////////////////
// Function: init_libosxdisplay
// Description: Initializes the library. This must be called at

View File

@ -26,5 +26,6 @@ NotifyCategoryDecl( osxdisplay , EXPCL_PANDAGL, EXPTP_PANDAGL);
extern EXPCL_PANDAGL void init_libosxdisplay();
extern ConfigVariableBool show_resize_box;
extern ConfigVariableBool osx_disable_event_loop;
#endif /* __CONFIG_OSXDISPLAY_H__ */

View File

@ -1157,21 +1157,24 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
void osxGraphicsWindow::process_events()
{
GraphicsWindow::process_events();
EventRef theEvent;
EventTargetRef theTarget;
theTarget = GetEventDispatcherTarget();
if (!_properties.has_parent_window())
if (!osx_disable_event_loop) {
EventRef theEvent;
EventTargetRef theTarget;
theTarget = GetEventDispatcherTarget();
if (!_properties.has_parent_window())
{
// while (ReceiveNextEvent(0, NULL,kEventDurationForever,true, &theEvent)== noErr)
while (ReceiveNextEvent(0, NULL,kEventDurationNoWait,true, &theEvent)== noErr)
{
// cerr << "--------------------------------------------Dispatch Event " << pass++ << "\n";
SendEventToEventTarget (theEvent, theTarget);
ReleaseEvent(theEvent);
// cerr << "------------------------------------Done Dispatch \n";
}
// while (ReceiveNextEvent(0, NULL,kEventDurationForever,true, &theEvent)== noErr)
while (ReceiveNextEvent(0, NULL,kEventDurationNoWait,true, &theEvent)== noErr)
{
// cerr << "--------------------------------------------Dispatch Event " << pass++ << "\n";
SendEventToEventTarget (theEvent, theTarget);
ReleaseEvent(theEvent);
// cerr << "------------------------------------Done Dispatch \n";
}
}
}
};
// handle display config changes meaing we need to update the GL context via the resize function and check for windwo dimension changes