#include <OpenGL/gl.h>
#import <Cocoa/Cocoa.h>
+/* the gtk-quartz library which ardour links against
+ * is patched to pass events directly through to
+ * NSView child-views (AU Plugin GUIs).
+ *
+ * In this particular case however we do want the
+ * events to reach the GTK widget instead of the
+ * NSView subview.
+ *
+ * If a NSVIew tag equals to the given magic-number,
+ * Gdk events propagate.
+ */
#ifndef ARDOUR_CANVAS_NSVIEW_TAG
-#define ARDOUR_CANVAS_NSVIEW_TAG 0xa2d0c2c4
+#define ARDOUR_CANVAS_NSVIEW_TAG 0x0
#endif
__attribute__ ((visibility ("hidden")))
int _height;
Cairo::RefPtr<Cairo::ImageSurface> surf;
Gtkmm2ext::CairoCanvas *cairo_canvas;
+ NSInteger _tag;
}
@property (readwrite) NSInteger tag;
- (void) dealloc;
- (void) setCairoCanvas:(Gtkmm2ext::CairoCanvas*)c;
- (void) reshape;
+- (void) setNeedsDisplayInRect:(NSRect)rect;
- (void) drawRect:(NSRect)rect;
- (BOOL) canBecomeKeyWindow:(id)sender;
- (BOOL) acceptsFirstResponder:(id)sender;
_height = height;
}
+- (void) setNeedsDisplayInRect:(NSRect)rect
+{
+ [super setNeedsDisplayInRect:rect];
+#ifdef DEBUG_NSVIEW_EXPOSURE
+ printf ("needsDisplay: %5.1f %5.1f %5.1f %5.1f\n",
+ rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+#endif
+}
+
- (void) drawRect:(NSRect)rect
{
[[self openGLContext] makeCurrentContext];
}
ctx->fill ();
+#ifdef DEBUG_NSVIEW_EXPOSURE
+ printf ("drawRect: %.1f %.1f %.1f %1.f\n",
+ cairo_rect.x, cairo_rect.y, cairo_rect.width, cairo_rect.height);
+#endif
+
cairo_canvas->render (ctx, &cairo_rect);
surf->flush ();
glFlush();
glSwapAPPLE();
[NSOpenGLContext clearCurrentContext];
+ [super setNeedsDisplay:NO];
}
@end
void*
Gtkmm2ext::nsglview_create (Gtkmm2ext::CairoCanvas* canvas)
{
+/* the API is currently only used on intel mac
+ * for big-endian RGBA <> RGBA byte order of the texture
+ * will have to be swapped.
+ */
+#ifdef __ppc__
+ return 0;
+#endif
ArdourCanvasOpenGLView* gl_view = [ArdourCanvasOpenGLView new];
if (!gl_view) {
return 0;
{
ArdourCanvasOpenGLView* gl_view = (ArdourCanvasOpenGLView*) glv;
[gl_view setNeedsDisplayInRect:NSMakeRect(x, y, w, h)];
+#ifdef DEBUG_NSVIEW_EXPOSURE
+ printf ("Queue Draw %5d %5d %5d %5d\n", x, y, w, h);
+#endif
}
void