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]]) {
139 [(QuartzView *)base removeFromSuperview];
140 ((QuartzView *)base).fParentView = nil;
141 }
else if ([base isKindOfClass : [
QuartzWindow class]]) {
142 QuartzWindow *qw = (QuartzWindow *)base;
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);
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::const_iterator const_drawable_iterator
void DeleteGLContext(Handle_t contextID)
Namespace for new ROOT classes and functions.
Window_t GetRootWindowID() const
Util::NSStrongReference< QuartzWindow > fFakeGLWindow
Drawable_t fCurrentDrawableID
ctx2handle_map fGLContextToHandle
void ReplaceDrawable(Drawable_t drawableID, NSObject *nsObj)
NSObject< X11Window > * GetWindow(Window_t windowID) const
bool IsRootWindow(Window_t windowID) const
NSOpenGLContext * GetGLContextForHandle(Handle_t contextID)
Drawable_t RegisterDrawable(NSObject *nsObj)
void SetFakeGLWindow(QuartzWindow *fakeWin)
Handle_t fFreeGLContextID
void DeleteDrawable(Drawable_t drawableID)
handle2ctx_map fHandleToGLContext
std::vector< Drawable_t > fFreeDrawableIDs
Handle_t RegisterGLContext(NSOpenGLContext *glContext)
NSObject< X11Drawable > * GetDrawable(Drawable_t drawableD) const
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > > fDrawables
DerivedType * Get() const
QuartzWindow * GetFakeGLWindow()
QuartzWindow * fMainWindow
void Reset(NSObject *object)
Handle_t GetHandleForGLContext(NSOpenGLContext *glContext)
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::iterator drawable_iterator
QuartzView * fContentView