From 1a7bf4cd8974bc116df17bccd908187a767d7e6e Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 4 Apr 2014 15:07:43 -0400 Subject: [PATCH] Got rid of objc_addDelegate(); it was only called in one place (Mac OS X Window creation). Also forgot to mention that the previous commit also disables mouse movements in Cocoa Areas for now; I need to replace the current code with one that uses tracking because mouse movements are system-global. --- objc_darwin.go | 5 ----- sysdata_darwin.go | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/objc_darwin.go b/objc_darwin.go index 5fdb896..76fbb54 100644 --- a/objc_darwin.go +++ b/objc_darwin.go @@ -35,7 +35,6 @@ var ( _release = sel_getUid("release") _stringWithUTF8String = sel_getUid("stringWithUTF8String:") _UTF8String = sel_getUid("UTF8String") - _setDelegate = sel_getUid("setDelegate:") ) // some helper functions @@ -66,10 +65,6 @@ func fromNSString(str C.id) string { return C.GoString((*C.char)(unsafe.Pointer(cstr))) } -func objc_setDelegate(obj C.id, delegate C.id) { - C.objc_msgSend_id(obj, _setDelegate, delegate) -} - /* These are wrapper functions for the functions in bleh_darwin.m to wrap around stdint.h type casting. */ diff --git a/sysdata_darwin.go b/sysdata_darwin.go index 09b7730..05eabf1 100644 --- a/sysdata_darwin.go +++ b/sysdata_darwin.go @@ -46,6 +46,7 @@ var ( _initWithContentRect = sel_getUid("initWithContentRect:styleMask:backing:defer:") _initWithFrame = sel_getUid("initWithFrame:") + _setDelegate = sel_getUid("setDelegate:") _setAcceptsMouseMovedEvents = sel_getUid("setAcceptsMouseMovedEvents:") _makeKeyAndOrderFront = sel_getUid("makeKeyAndOrderFront:") _orderOut = sel_getUid("orderOut:") @@ -116,7 +117,7 @@ var classTypes = [nctypes]*classData{ NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, 2, // NSBackingStoreBuffered - the only backing store method that Apple says we should use (the others are legacy) C.BOOL(C.YES)) // defer creation of device until we show the window - objc_setDelegate(win, appDelegate) + C.objc_msgSend_id(win, _setDelegate, appDelegate) // this is needed for Areas in the window to receive mouse move events // C.objc_msgSend_bool(win, _setAcceptsMouseMovedEvents, C.BOOL(C.YES)) return win