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];
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]]) {
140 ((QuartzView *)base).fParentView = nil;
141 }
else if ([base isKindOfClass : [
QuartzWindow class]]) {
142 QuartzWindow *qw = (QuartzWindow *)base;
144 [qw.fContentView removeFromSuperview];
145 qw.contentView = nil;
149 [qw.fMainWindow removeChildWindow : qw];
166 bool contextInserted =
false;
169 contextInserted =
true;
171 }
catch (
const std::exception &) {
228 assert(drawableIter !=
fDrawables.end() &&
"ReplaceDrawable, can not replace non existing drawable");
229 drawableIter->second.Reset(nsObj);
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::const_iterator const_drawable_iterator
NSObject< X11Drawable > * GetDrawable(Drawable_t drawableD) const
void DeleteGLContext(Handle_t contextID)
Namespace for new ROOT classes and functions.
Util::NSStrongReference< QuartzWindow > fFakeGLWindow
Drawable_t fCurrentDrawableID
Window_t GetRootWindowID() const
ctx2handle_map fGLContextToHandle
QuartzView * fContentView
void ReplaceDrawable(Drawable_t drawableID, NSObject *nsObj)
NSOpenGLContext * GetGLContextForHandle(Handle_t contextID)
Drawable_t RegisterDrawable(NSObject *nsObj)
void SetFakeGLWindow(QuartzWindow *fakeWin)
Handle_t fFreeGLContextID
DerivedType * Get() const
void DeleteDrawable(Drawable_t drawableID)
handle2ctx_map fHandleToGLContext
std::vector< Drawable_t > fFreeDrawableIDs
Handle_t RegisterGLContext(NSOpenGLContext *glContext)
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > > fDrawables
QuartzWindow * GetFakeGLWindow()
QuartzWindow * fMainWindow
NSObject< X11Window > * GetWindow(Window_t windowID) const
void Reset(NSObject *object)
Handle_t GetHandleForGLContext(NSOpenGLContext *glContext)
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::iterator drawable_iterator
bool IsRootWindow(Window_t windowID) const