Use NSGLView with patched gdk
Special case Ardour's Canvas NSView to forward gdk-events which are otherwise special-cased to read AU-views..
This commit is contained in:
parent
c371fc5115
commit
5fe355af92
|
@ -45,6 +45,7 @@
|
||||||
#include "canvas/utils.h"
|
#include "canvas/utils.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
#include <gdk/gdk.h>
|
||||||
#include "canvas/nsglview.h"
|
#include "canvas/nsglview.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -401,7 +402,7 @@ GtkCanvas::GtkCanvas ()
|
||||||
Gdk::SCROLL_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK |
|
Gdk::SCROLL_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK |
|
||||||
Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
|
Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
|
||||||
|
|
||||||
#ifdef __APPLE__NotYetToDueGdkForeignViewMousePatch // XXX
|
#ifdef ARDOUR_CANVAS_NSVIEW_TAG // patched gdkquartz.h
|
||||||
# ifndef __ppc__ // would need to flip RGBA <> RGBA
|
# ifndef __ppc__ // would need to flip RGBA <> RGBA
|
||||||
_nsglview = nsglview_create (this);
|
_nsglview = nsglview_create (this);
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
#ifndef ARDOUR_CANVAS_NSVIEW_TAG
|
||||||
|
#define ARDOUR_CANVAS_NSVIEW_TAG 0xa2d0c2c4
|
||||||
|
#endif
|
||||||
|
|
||||||
__attribute__ ((visibility ("hidden")))
|
__attribute__ ((visibility ("hidden")))
|
||||||
@interface ArdourCanvasOpenGLView : NSOpenGLView
|
@interface ArdourCanvasOpenGLView : NSOpenGLView
|
||||||
{
|
{
|
||||||
|
@ -42,9 +46,11 @@ __attribute__ ((visibility ("hidden")))
|
||||||
ArdourCanvas::GtkCanvas *gtkcanvas;
|
ArdourCanvas::GtkCanvas *gtkcanvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property (readwrite) NSInteger tag;
|
||||||
|
|
||||||
- (id) initWithFrame:(NSRect)frame;
|
- (id) initWithFrame:(NSRect)frame;
|
||||||
- (void) dealloc;
|
- (void) dealloc;
|
||||||
- (void) set_ardour_canvas:(ArdourCanvas::GtkCanvas*)c;
|
- (void) setArdourCanvas:(ArdourCanvas::GtkCanvas*)c;
|
||||||
- (void) reshape;
|
- (void) reshape;
|
||||||
- (void) drawRect:(NSRect)rect;
|
- (void) drawRect:(NSRect)rect;
|
||||||
- (BOOL) canBecomeKeyWindow:(id)sender;
|
- (BOOL) canBecomeKeyWindow:(id)sender;
|
||||||
|
@ -54,6 +60,8 @@ __attribute__ ((visibility ("hidden")))
|
||||||
|
|
||||||
@implementation ArdourCanvasOpenGLView
|
@implementation ArdourCanvasOpenGLView
|
||||||
|
|
||||||
|
@synthesize tag = _tag;
|
||||||
|
|
||||||
- (id) initWithFrame:(NSRect)frame
|
- (id) initWithFrame:(NSRect)frame
|
||||||
{
|
{
|
||||||
NSOpenGLPixelFormatAttribute pixelAttribs[16] = {
|
NSOpenGLPixelFormatAttribute pixelAttribs[16] = {
|
||||||
|
@ -82,7 +90,7 @@ __attribute__ ((visibility ("hidden")))
|
||||||
_height = 0;
|
_height = 0;
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
|
self.tag = ARDOUR_CANVAS_NSVIEW_TAG;
|
||||||
[[self openGLContext] makeCurrentContext];
|
[[self openGLContext] makeCurrentContext];
|
||||||
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
|
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
glDisable (GL_DEPTH_TEST);
|
glDisable (GL_DEPTH_TEST);
|
||||||
|
@ -105,7 +113,7 @@ __attribute__ ((visibility ("hidden")))
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_ardour_canvas:(ArdourCanvas::GtkCanvas*)c
|
- (void) setArdourCanvas:(ArdourCanvas::GtkCanvas*)c
|
||||||
{
|
{
|
||||||
gtkcanvas = c;
|
gtkcanvas = c;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +250,7 @@ ArdourCanvas::nsglview_create (GtkCanvas* canvas)
|
||||||
if (!gl_view) {
|
if (!gl_view) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
[gl_view set_ardour_canvas:canvas];
|
[gl_view setArdourCanvas:canvas];
|
||||||
return gl_view;
|
return gl_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user