Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Jun 25, 2020
2 parents d392048 + e530620 commit ca0bf2d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 24 deletions.
4 changes: 2 additions & 2 deletions vstgui/lib/platform/mac/caviewlayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ - (void)setDrawDelegate:(VSTGUI::IPlatformViewLayerDelegate*)viewLayerDelegate;
//-----------------------------------------------------------------------------
static id VSTGUI_CALayer_Init (id self, SEL _cmd)
{
__OBJC_SUPER(self)
self = objc_msgSendSuper (SUPER, @selector(init));
__OBJC_SUPER (self)
self = SuperInit (SUPER, @selector (init));
if (self)
{
[self setNeedsDisplayOnBoundsChange:YES];
Expand Down
12 changes: 11 additions & 1 deletion vstgui/lib/platform/mac/cocoa/cocoahelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,20 @@ inline HIDDEN void set_Objc_Value (id obj, const char* name, id value)
}

#define __OBJC_SUPER(x) objc_super __os; __os.receiver = x; __os.super_class = class_getSuperclass ([x class]);
#define SUPER &__os
#define SUPER static_cast<id> (&__os)
#define OBJC_GET_VALUE(x,y) get_Objc_Value (x, #y)
#define OBJC_SET_VALUE(x,y,z) set_Objc_Value (x, #y, (id)z)

//------------------------------------------------------------------------------------
static id (*SuperInit) (id, SEL) = (id (*) (id, SEL))objc_msgSendSuper;
static id (*SuperInitWithFrame) (id, SEL, NSRect) = (id (*) (id, SEL, NSRect))objc_msgSendSuper;
static void (*SuperDealloc) (id, SEL) = (void (*) (id, SEL))objc_msgSendSuper;
static void (*SuperRemoveFromSuperview) (id, SEL) = SuperDealloc;
static void (*SuperEventMsg) (id, SEL, NSEvent*) = (void (*) (id, SEL, NSEvent*))objc_msgSendSuper;
static void (*SuperUpdateTrackingAreas) (id, SEL) = (void (*) (id, SEL))objc_msgSendSuper;
static void (*SuperTextDidChange) (id, SEL, NSNotification*) = (void (*) (id, SEL, NSNotification*))objc_msgSendSuper;

//------------------------------------------------------------------------------------
extern HIDDEN Class generateUniqueClass (NSMutableString* className, Class baseClass);
extern HIDDEN VstKeyCode CreateVstKeyCodeFromNSEvent (NSEvent* theEvent);
extern HIDDEN NSString* GetVirtualKeyCodeString (int32_t virtualKeyCode);
Expand Down
5 changes: 3 additions & 2 deletions vstgui/lib/platform/mac/cocoa/cocoaopenglview.mm
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,12 @@ - (id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat *)format
objc_disposeClassPair (openGLViewClass);
}

static id (*SuperInitWithFramePixelFormat) (id, SEL, NSRect, NSOpenGLPixelFormat*) = (id (*) (id, SEL, NSRect, NSOpenGLPixelFormat*))objc_msgSendSuper;
//-----------------------------------------------------------------------------
static id VSTGUI_NSOpenGLView_Init (id self, SEL _cmd, NSRect frameRect, NSOpenGLPixelFormat* format, CocoaOpenGLView* callback)
{
__OBJC_SUPER(self)
self = objc_msgSendSuper (SUPER, @selector(initWithFrame:pixelFormat:), frameRect, format);
self = SuperInitWithFramePixelFormat (SUPER, @selector(initWithFrame:pixelFormat:), frameRect, format);
if (self)
{
OBJC_SET_VALUE(self, cocoaOpenGLView, callback);
Expand All @@ -267,7 +268,7 @@ static void VSTGUI_NSOpenGLView_Dealloc (id self, SEL _cmd)
if (callback)
callback->forget ();
__OBJC_SUPER(self)
objc_msgSendSuper (SUPER, @selector(dealloc));
SuperDealloc (SUPER, @selector(dealloc));
}

//-----------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions vstgui/lib/platform/mac/cocoa/cocoatextedit.mm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static id VSTGUI_NSTextField_Init (id self, SEL _cmd, void* textEdit)
editFrameRect.origin.y = static_cast<CGFloat> (textInset.y/2.);
editFrameRect.size.width -= textInset.x/2.;
editFrameRect.size.height -= textInset.y/2. - 1.;
self = objc_msgSendSuper (SUPER, @selector(initWithFrame:), editFrameRect);
self = SuperInitWithFrame (SUPER, @selector(initWithFrame:), editFrameRect);
if (!self)
{
[containerView release];
Expand Down Expand Up @@ -191,8 +191,8 @@ static void VSTGUI_NSTextField_RemoveFromSuperview (id self, SEL _cmd)
{
[[containerView window] makeFirstResponder:[containerView superview]];
[containerView removeFromSuperview];
__OBJC_SUPER(self)
objc_msgSendSuper (SUPER, @selector(removeFromSuperview)); // [super removeFromSuperview];
__OBJC_SUPER(self)
SuperRemoveFromSuperview (SUPER, @selector(removeFromSuperview)); // [super removeFromSuperview];
[containerView release];
}
}
Expand All @@ -206,7 +206,7 @@ static void VSTGUI_NSTextField_TextDidChange (id self, SEL _cmd, NSNotification*
te->getTextEdit ()->platformTextDidChange ();
}
__OBJC_SUPER(self)
objc_msgSendSuper (SUPER, @selector(textDidChange:), notification);
SuperTextDidChange (SUPER, @selector(textDidChange:), notification);
}

//------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/platform/mac/cocoa/nsviewdraggingsession.mm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (id)initWithData:(const void*)data andSize:(size_t)size;
static id Init (id self, SEL, const void* buffer, size_t bufferSize)
{
__OBJC_SUPER (self)
self = objc_msgSendSuper (SUPER, @selector (init));
self = SuperInit (SUPER, @selector (init));
if (self)
{
auto data = [[[NSData alloc] initWithBytes:buffer length:bufferSize] autorelease];
Expand Down
24 changes: 12 additions & 12 deletions vstgui/lib/platform/mac/cocoa/nsviewframe.mm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static id VSTGUI_NSView_Init (id self, SEL _cmd, void* _frame, NSView* parentVie
NSRect nsSize = nsRectFromCRect (*size);

__OBJC_SUPER(self)
self = objc_msgSendSuper (SUPER, @selector(initWithFrame:), nsSize); // self = [super initWithFrame: nsSize];
self = SuperInitWithFrame (SUPER, @selector(initWithFrame:), nsSize); // self = [super initWithFrame: nsSize];
if (self)
{
OBJC_SET_VALUE(self, _nsViewFrame, frame); // _vstguiframe = frame;
Expand Down Expand Up @@ -163,7 +163,7 @@ static void VSTGUI_NSView_updateTrackingAreas (id self, SEL _cmd)
if (viewFrame)
viewFrame->initTrackingArea ();

objc_msgSendSuper (SUPER, @selector(updateTrackingAreas));
SuperUpdateTrackingAreas (SUPER, @selector(updateTrackingAreas));
}

//------------------------------------------------------------------------------------
Expand Down Expand Up @@ -289,79 +289,79 @@ static void VSTGUI_NSView_mouseDown (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseDown: theEvent])
objc_msgSendSuper (SUPER, @selector(mouseDown:), theEvent);
SuperEventMsg (SUPER, @selector(mouseDown:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_rightMouseDown (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseDown: theEvent])
objc_msgSendSuper (SUPER, @selector(rightMouseDown:), theEvent);
SuperEventMsg (SUPER, @selector(rightMouseDown:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_otherMouseDown (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseDown: theEvent])
objc_msgSendSuper (SUPER, @selector(otherMouseDown:), theEvent);
SuperEventMsg (SUPER, @selector(otherMouseDown:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_mouseUp (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseUp: theEvent])
objc_msgSendSuper (SUPER, @selector(mouseUp:), theEvent);
SuperEventMsg (SUPER, @selector(mouseUp:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_rightMouseUp (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseUp: theEvent])
objc_msgSendSuper (SUPER, @selector(rightMouseUp:), theEvent);
SuperEventMsg (SUPER, @selector(rightMouseUp:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_otherMouseUp (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseUp: theEvent])
objc_msgSendSuper (SUPER, @selector(otherMouseUp:), theEvent);
SuperEventMsg (SUPER, @selector(otherMouseUp:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_mouseMoved (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseMoved: theEvent])
objc_msgSendSuper (SUPER, @selector(mouseMoved:), theEvent);
SuperEventMsg (SUPER, @selector(mouseMoved:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_mouseDragged (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseMoved: theEvent])
objc_msgSendSuper (SUPER, @selector(mouseDragged:), theEvent);
SuperEventMsg (SUPER, @selector(mouseDragged:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_rightMouseDragged (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseMoved: theEvent])
objc_msgSendSuper (SUPER, @selector(rightMouseDragged:), theEvent);
SuperEventMsg (SUPER, @selector(rightMouseDragged:), theEvent);
}

//------------------------------------------------------------------------------------
static void VSTGUI_NSView_otherMouseDragged (id self, SEL _cmd, NSEvent* theEvent)
{
__OBJC_SUPER(self)
if (![self onMouseMoved: theEvent])
objc_msgSendSuper (SUPER, @selector(otherMouseDragged:), theEvent);
SuperEventMsg (SUPER, @selector(otherMouseDragged:), theEvent);
}

//------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions vstgui/lib/platform/mac/cocoa/nsviewoptionmenu.mm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static id VSTGUI_NSMenu_Init (id self, SEL _cmd, void* _menu)
menuClassCount++;
#endif
__OBJC_SUPER(self)
self = objc_msgSendSuper (SUPER, @selector(init));
self = SuperInit (SUPER, @selector(init));
if (self)
{
NSMenu* nsMenu = (NSMenu*)self;
Expand Down Expand Up @@ -163,7 +163,7 @@ static void VSTGUI_NSMenu_Dealloc (id self, SEL _cmd)
if (var)
delete var;
__OBJC_SUPER(self)
objc_msgSendSuper (SUPER, @selector(dealloc)); // [super dealloc];
SuperDealloc (SUPER, @selector(dealloc)); // [super dealloc];
}

//------------------------------------------------------------------------------------
Expand Down

0 comments on commit ca0bf2d

Please sign in to comment.