12#define DEBUG_ROOT_COCOA
16#ifdef DEBUG_ROOT_COCOA
23#include <OpenGL/OpenGL.h>
24#include <Cocoa/Cocoa.h>
38 : fCurrentDrawableID(GetRootWindowID() + 1),
45 [NSApplication sharedApplication];
84 assert(
fDrawables.find(newID) ==
fDrawables.end() &&
"RegisterDrawable, id for new drawable is still in use");
95#ifdef DEBUG_ROOT_COCOA
97 NSLog(
@"Fatal error: requested non-existing drawable %lu", drawableID);
101 NSLog(
@"This drawable was deleted already");
103 NSLog(
@"This drawable not found among allocated/deleted drawables");
107 assert(drawableIter !=
fDrawables.end() &&
"GetDrawable, non-existing drawable requested");
108 return drawableIter->second.Get();
115#ifdef DEBUG_ROOT_COCOA
117 NSLog(
@"Fatal error: requested non-existing drawable %lu", windowID);
121 NSLog(
@"This window was deleted already");
123 NSLog(
@"This window not found among allocated/deleted drawables");
127 assert(winIter !=
fDrawables.end() &&
"GetWindow, non-existing window requested");
128 return (NSObject<X11Window> *)winIter->second.Get();
135 assert(drawableIter !=
fDrawables.end() &&
"DeleteDrawable, non existing drawableID");
137 NSObject<X11Drawable> *
const base = drawableIter->second.Get();
138 if ([base isKindOfClass : [
QuartzView class]]) {
141 }
else if ([base isKindOfClass : [
QuartzWindow class]]) {
145 qw.contentView = nil;
166 bool contextInserted =
false;
169 contextInserted =
true;
171 }
catch (
const std::exception &) {
188 assert(c2hIt !=
fGLContextToHandle.end() &&
"DeleteGLContext, inconsistent context map");
228 assert(drawableIter !=
fDrawables.end() &&
"ReplaceDrawable, can not replace non existing drawable");
229 drawableIter->second.Reset(nsObj);
void SetFakeGLWindow(QuartzWindow *fakeWin)
Drawable_t RegisterDrawable(NSObject *nsObj)
handle2ctx_map fHandleToGLContext
void DeleteDrawable(Drawable_t drawableID)
Window_t GetRootWindowID() const
Handle_t GetHandleForGLContext(NSOpenGLContext *glContext)
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::iterator drawable_iterator
Util::NSStrongReference< QuartzWindow > fFakeGLWindow
NSObject< X11Drawable > * GetDrawable(Drawable_t drawableD) const
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::const_iterator const_drawable_iterator
ctx2handle_map fGLContextToHandle
void DeleteGLContext(Handle_t contextID)
std::vector< Drawable_t > fFreeDrawableIDs
Handle_t fFreeGLContextID
Handle_t RegisterGLContext(NSOpenGLContext *glContext)
NSObject< X11Window > * GetWindow(Window_t windowID) const
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > > fDrawables
void ReplaceDrawable(Drawable_t drawableID, NSObject *nsObj)
QuartzWindow * GetFakeGLWindow()
Drawable_t fCurrentDrawableID
NSOpenGLContext * GetGLContextForHandle(Handle_t contextID)
bool IsRootWindow(Window_t windowID) const
void Reset(NSObject *object)
DerivedType * Get() const
QuartzView * fContentView
QuartzWindow * fMainWindow
EvaluateInfo init(std::vector< RooRealProxy > parameters, std::vector< ArrayWrapper * > wrappers, std::vector< double * > arrays, size_t begin, size_t batchSize)