Use NSGLView with patched gdk
[ardour.git] / libs / canvas / nsglview.mm
index 09d0ae13424ce9e4a474b345a2d442784956c6d5..b4fea995a32f69410701c1d72d65872c2dde94f4 100644 (file)
 #include <OpenGL/gl.h>
 #import  <Cocoa/Cocoa.h>
 
+#ifndef ARDOUR_CANVAS_NSVIEW_TAG
+#define ARDOUR_CANVAS_NSVIEW_TAG 0xa2d0c2c4
+#endif
+
 __attribute__ ((visibility ("hidden")))
 @interface ArdourCanvasOpenGLView : NSOpenGLView
 {
@@ -42,9 +46,11 @@ __attribute__ ((visibility ("hidden")))
        ArdourCanvas::GtkCanvas *gtkcanvas;
 }
 
+@property (readwrite) NSInteger tag;
+
 - (id) initWithFrame:(NSRect)frame;
 - (void) dealloc;
-- (void) set_ardour_canvas:(ArdourCanvas::GtkCanvas*)c;
+- (void) setArdourCanvas:(ArdourCanvas::GtkCanvas*)c;
 - (void) reshape;
 - (void) drawRect:(NSRect)rect;
 - (BOOL) canBecomeKeyWindow:(id)sender;
@@ -54,6 +60,8 @@ __attribute__ ((visibility ("hidden")))
 
 @implementation ArdourCanvasOpenGLView
 
+@synthesize tag = _tag;
+
 - (id) initWithFrame:(NSRect)frame
 {
        NSOpenGLPixelFormatAttribute pixelAttribs[16] = {
@@ -82,7 +90,7 @@ __attribute__ ((visibility ("hidden")))
        _height = 0;
 
        if (self) {
-
+               self.tag = ARDOUR_CANVAS_NSVIEW_TAG;
                [[self openGLContext] makeCurrentContext];
                glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
                glDisable (GL_DEPTH_TEST);
@@ -105,7 +113,7 @@ __attribute__ ((visibility ("hidden")))
        [super dealloc];
 }
 
-- (void) set_ardour_canvas:(ArdourCanvas::GtkCanvas*)c
+- (void) setArdourCanvas:(ArdourCanvas::GtkCanvas*)c
 {
        gtkcanvas = c;
 }
@@ -242,7 +250,7 @@ ArdourCanvas::nsglview_create (GtkCanvas* canvas)
        if (!gl_view) {
                return 0;
        }
-       [gl_view set_ardour_canvas:canvas];
+       [gl_view setArdourCanvas:canvas];
        return gl_view;
 }