summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--area_darwin.m7
-rw-r--r--bleh_darwin.m24
-rw-r--r--objc_darwin.h1
3 files changed, 6 insertions, 26 deletions
diff --git a/area_darwin.m b/area_darwin.m
index 041841d..f283b5e 100644
--- a/area_darwin.m
+++ b/area_darwin.m
@@ -55,7 +55,12 @@
- (void)retrack
{
- trackingArea = makeTrackingArea(self); // TODO make inline
+ trackingArea = [[NSTrackingArea alloc]
+ initWithRect:[self bounds]
+ // this bit mask (except for NSTrackingInVisibleRect, which was added later to prevent events from being triggered outside the visible area of the Area) comes from https://github.com/andlabs/misctestprogs/blob/master/cocoaviewmousetest.m (and I wrote this bit mask on 25 april 2014) and yes I know it includes enter/exit even though we don't watch those events; it probably won't really matter anyway but if it does I can change it easily
+ options:(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingEnabledDuringMouseDrag | NSTrackingInVisibleRect)
+ owner:self
+ userInfo:nil];
[self addTrackingArea:trackingArea];
}
diff --git a/bleh_darwin.m b/bleh_darwin.m
index b3fe85f..2d179fd 100644
--- a/bleh_darwin.m
+++ b/bleh_darwin.m
@@ -206,30 +206,6 @@ void *_appDelegate_applicationShouldTerminate = (void *) __appDelegate_applicati
char *encodedTerminateReply = @encode(NSApplicationTerminateReply);
/*
-tracking areas; also here for convenience only
-*/
-
-/* IDK if this is needed; just to be safe */
-static id (*objc_msgSend_initTrackingArea)(id, SEL, NSRect, NSTrackingAreaOptions, id, id) =
- (id (*)(id, SEL, NSRect, NSTrackingAreaOptions, id, id)) objc_msgSend;
-#include <AppKit/NSView.h>
-id makeTrackingArea(id area)
-{
- id trackingArea;
-
- trackingArea = objc_msgSend(c_NSTrackingArea, s_alloc);
-NSView *v;
-v = (NSView *) area;
- trackingArea = (*objc_msgSend_initTrackingArea)(trackingArea, s_initTrackingArea,
- [v bounds], /* initWithRect: */
- /* this bit mask (except for NSTrackingInVisibleRect, which was added later to prevent events from being triggered outside the visible area of the Area) comes from https://github.com/andlabs/misctestprogs/blob/master/cocoaviewmousetest.m (and I wrote this bit mask on 25 april 2014) and yes I know it includes enter/exit even though we don't watch those events; it probably won't really matter anyway but if it does I can change it easily */
- (NSTrackingAreaOptions) (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingEnabledDuringMouseDrag | NSTrackingInVisibleRect), /* options: */
- area, /* owner: */
- nil); /* userData: */
- return trackingArea;
-}
-
-/*
Objective-C 1.0 has the class field of struct objc_super field as class
Objective-C 2.0 has it as super_class
and objc_darwin.h is compiled by both C and Objective-C code
diff --git a/objc_darwin.h b/objc_darwin.h
index e3ca56f..c99d619 100644
--- a/objc_darwin.h
+++ b/objc_darwin.h
@@ -57,7 +57,6 @@ extern id makeDummyEvent();
/* TODO apparently ISO C forbids casting a function pointer to a non-function pointer; this will need to change???? */
extern void *_areaView_drawRect;
extern void drawImage(void *, int64_t, int64_t, int64_t, int64_t, int64_t);
-extern id makeTrackingArea(id);
extern struct xpoint getTranslatedEventPoint(id, id);
/* for objc_darwin.go */