summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-03-21 15:45:21 +0100
committerRobin Gareus <robin@gareus.org>2017-03-21 15:53:29 +0100
commit5e9492b996a8c7b7cc15957decebe2f006a085a2 (patch)
treef2b8c6f95792f96ce74158c239df51be3c2ed57e /libs/gtkmm2ext
parentd294d0367076ce31468d84a0ecd41f4b0f3c9e7f (diff)
consolidate NSGLView
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/cairo_widget.cc2
-rw-r--r--libs/gtkmm2ext/nsglview.mm40
2 files changed, 22 insertions, 20 deletions
diff --git a/libs/gtkmm2ext/cairo_widget.cc b/libs/gtkmm2ext/cairo_widget.cc
index d06f07ced2..4cf3fc3ae6 100644
--- a/libs/gtkmm2ext/cairo_widget.cc
+++ b/libs/gtkmm2ext/cairo_widget.cc
@@ -85,10 +85,8 @@ CairoWidget::use_nsglview ()
assert (!_canvas_widget);
assert (!is_realized());
#ifdef ARDOUR_CANVAS_NSVIEW_TAG // patched gdkquartz.h
-# ifndef __ppc__ // would need to flip RGBA <> RGBA
_nsglview = Gtkmm2ext::nsglview_create (this);
#endif
-#endif
}
int
diff --git a/libs/gtkmm2ext/nsglview.mm b/libs/gtkmm2ext/nsglview.mm
index 6c84eef494..9115fc7287 100644
--- a/libs/gtkmm2ext/nsglview.mm
+++ b/libs/gtkmm2ext/nsglview.mm
@@ -19,20 +19,6 @@
*/
-/* the API is currently only used on intel mac
- * for big-endian RGBA <> RGBA byte order of the texture
- * will have to be swapped.
- *
- * Also it does not currently compile as-is:
- *
- * warning: Mac OS X version 10.5 or later is needed for use of property
- * error: synthesized property 'tag' must either be named the same as a compatible ivar or must explicitly name an ivar
- *
- * the wscipt would have to relax MAC_OS_X_VERSION_MIN_REQUIRED=1040
- * (ardour's PPC build-stack is 10.5)
- */
-#ifndef __ppc__
-
/* include order matter due to apple defines */
#include <gtkmm/window.h>
@@ -45,8 +31,19 @@
#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")))
@@ -58,6 +55,7 @@ __attribute__ ((visibility ("hidden")))
int _height;
Cairo::RefPtr<Cairo::ImageSurface> surf;
Gtkmm2ext::CairoCanvas *cairo_canvas;
+ NSInteger _tag;
}
@property (readwrite) NSInteger tag;
@@ -74,7 +72,7 @@ __attribute__ ((visibility ("hidden")))
@implementation ArdourCanvasOpenGLView
-@synthesize tag = tag;
+@synthesize tag = _tag;
- (id) initWithFrame:(NSRect)frame
{
@@ -260,6 +258,7 @@ __attribute__ ((visibility ("hidden")))
glFlush();
glSwapAPPLE();
[NSOpenGLContext clearCurrentContext];
+ [super setNeedsDisplay:NO];
}
@end
@@ -267,6 +266,13 @@ __attribute__ ((visibility ("hidden")))
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;
@@ -308,5 +314,3 @@ Gtkmm2ext::nsglview_set_visible (void* glv, bool vis)
[gl_view setHidden:YES];
}
}
-
-#endif