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");
96 NSLog(
@"Fatal error: requested drawable %lu is not found among currently valid drawables.", drawableID);
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");
128 assert(winIter !=
fDrawables.end() &&
"GetWindow, non-existing window requested");
136 assert(drawableIter !=
fDrawables.end() &&
"DeleteDrawable, non existing drawableID");
139 if ([base isKindOfClass : [
QuartzView class]]) {
142 }
else if ([base isKindOfClass : [
QuartzWindow class]]) {
146 qw.contentView = nil;
167 bool contextInserted =
false;
170 contextInserted =
true;
172 }
catch (
const std::exception &) {
189 assert(c2hIt !=
fGLContextToHandle.end() &&
"DeleteGLContext, inconsistent context map");
229 assert(drawableIter !=
fDrawables.end() &&
"ReplaceDrawable, can not replace non existing drawable");
230 drawableIter->second.Reset(nsObj);
Handle_t Window_t
Window handle.
Handle_t Drawable_t
Drawable handle.
ULongptr_t Handle_t
Generic resource handle.
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
QuartzWindow * fMainWindow
QuartzView * fContentView
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.