summaryrefslogtreecommitdiff
path: root/bleh_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-04-04 22:21:53 -0400
committerPietro Gagliardi <[email protected]>2014-04-04 22:21:53 -0400
commit8eee2a92b7c4e3884c3b4e0c37a6bd7e6b37d4e4 (patch)
treeeea3ea1c6d51cf1e51b820b09ba0dc4931ef35c3 /bleh_darwin.m
parent8c109a0ae96bdbcabf61ea972cceb20b4dd5e2c5 (diff)
Changed the way drawRect: was being added to our Mac OS X Area such that we no longer need a separate function to add it to the class.
Diffstat (limited to 'bleh_darwin.m')
-rw-r--r--bleh_darwin.m22
1 files changed, 8 insertions, 14 deletions
diff --git a/bleh_darwin.m b/bleh_darwin.m
index f366379..b8f7d93 100644
--- a/bleh_darwin.m
+++ b/bleh_darwin.m
@@ -210,7 +210,7 @@ id makeDummyEvent()
extern void areaView_drawRect(id, struct xrect);
-static void _areaView_drawRect(id self, SEL sel, NSRect r)
+static void __areaView_drawRect(id self, SEL sel, NSRect r)
{
struct xrect t;
@@ -221,21 +221,15 @@ static void _areaView_drawRect(id self, SEL sel, NSRect r)
areaView_drawRect(self, t);
}
-/* the only objective-c feature you'll see here */
-/* TODO correct? "v@:" @encode(NSRect) complained about missing ; */
-static char *avdrType = @encode(void(id, SEL, NSRect));
+void *_areaView_drawRect = (void *) __areaView_drawRect;
-static SEL drawRect;
-static BOOL drawRect_init = NO;
+/* the only objective-c feature you'll see here
-BOOL addAreaViewDrawMethod(Class what)
-{
- if (drawRect_init == NO) {
- drawRect = sel_getUid("drawRect:");
- drawRect_init = YES;
- }
- return class_addMethod(what, drawRect, (IMP) _areaView_drawRect, avdrType);
-}
+unfortunately NSRect both varies across architectures and is passed as just a structure, so its encoding has to be computed at compile time
+because @encode() is NOT A LITERAL, we're going to just stick it all the way back in objc_darwin.go
+see also: http://stackoverflow.com/questions/6812035/adding-methods-dynamically
+*/
+char *encodedNSRect = @encode(NSRect);
/*
the NSBitmapImageRep constructor is complex; put it here