diff --git a/panda/src/osxdisplay/config_osxdisplay.cxx b/panda/src/osxdisplay/config_osxdisplay.cxx index 65f02a8af0..4574334dd7 100644 --- a/panda/src/osxdisplay/config_osxdisplay.cxx +++ b/panda/src/osxdisplay/config_osxdisplay.cxx @@ -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 diff --git a/panda/src/osxdisplay/config_osxdisplay.h b/panda/src/osxdisplay/config_osxdisplay.h index 3a1ea8e3c2..9337dee0ee 100644 --- a/panda/src/osxdisplay/config_osxdisplay.h +++ b/panda/src/osxdisplay/config_osxdisplay.h @@ -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__ */ diff --git a/panda/src/osxdisplay/osxGraphicsWindow.mm b/panda/src/osxdisplay/osxGraphicsWindow.mm index c066f3016a..9af9d57ead 100644 --- a/panda/src/osxdisplay/osxGraphicsWindow.mm +++ b/panda/src/osxdisplay/osxGraphicsWindow.mm @@ -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