Removed the event point translation from bleh_darwin.m and rewrote it in Objective-C in area_darwin.m.
This commit is contained in:
parent
82101036b8
commit
31fc77a99d
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#define to(T, x) ((T *) (x))
|
#define to(T, x) ((T *) (x))
|
||||||
#define toNSEvent(x) to(NSEvent, (x))
|
#define toNSEvent(x) to(NSEvent, (x))
|
||||||
|
#define toAreaView(x) to(areaView, (x))
|
||||||
|
|
||||||
#define toNSInteger(x) ((NSInteger) (x))
|
#define toNSInteger(x) ((NSInteger) (x))
|
||||||
#define fromNSInteger(x) ((intptr_t) (x))
|
#define fromNSInteger(x) ((intptr_t) (x))
|
||||||
|
@ -110,7 +111,16 @@ uintptr_t modifierFlags(id e)
|
||||||
return fromNSUInteger([toNSEvent(e) modifierFlags]);
|
return fromNSUInteger([toNSEvent(e) modifierFlags]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO move getTranslatedEventPoint() here
|
struct xpoint getTranslatedEventPoint(id area, id e)
|
||||||
|
{
|
||||||
|
NSPoint p;
|
||||||
|
struct xpoint q;
|
||||||
|
|
||||||
|
p = [toAreaView(area) convertPoint:[toNSEvent(e) locationInWindow] fromView:nil];
|
||||||
|
q.x = (intptr_t) p.x;
|
||||||
|
q.y = (intptr_t) p.y;
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
intptr_t buttonNumber(id e)
|
intptr_t buttonNumber(id e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,24 +151,3 @@ void drawImage(void *pixels, int64_t width, int64_t height, int64_t stride, int6
|
||||||
nil); /* hints: */
|
nil); /* hints: */
|
||||||
objc_msgSend(bitmap, s_release);
|
objc_msgSend(bitmap, s_release);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
more NSPoint fumbling
|
|
||||||
*/
|
|
||||||
|
|
||||||
static NSPoint (*objc_msgSend_stret_point)(id, SEL, ...) =
|
|
||||||
(NSPoint (*)(id, SEL, ...)) objc_msgSend;
|
|
||||||
|
|
||||||
struct xpoint getTranslatedEventPoint(id self, id event)
|
|
||||||
{
|
|
||||||
NSPoint p;
|
|
||||||
struct xpoint ret;
|
|
||||||
|
|
||||||
p = objc_msgSend_stret_point(event, s_locationInWindow);
|
|
||||||
p = objc_msgSend_stret_point(self, s_convertPointFromView,
|
|
||||||
p, /* convertPoint: */
|
|
||||||
nil); /* fromView: */
|
|
||||||
ret.x = (int64_t) p.x;
|
|
||||||
ret.y = (int64_t) p.y;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
|
@ -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???? */
|
/* 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 *_areaView_drawRect;
|
||||||
extern void drawImage(void *, int64_t, int64_t, int64_t, int64_t, int64_t);
|
extern void drawImage(void *, int64_t, int64_t, int64_t, int64_t, int64_t);
|
||||||
extern struct xpoint getTranslatedEventPoint(id, id);
|
|
||||||
|
|
||||||
/* for objc_darwin.go */
|
/* for objc_darwin.go */
|
||||||
extern char *encodedNSRect;
|
extern char *encodedNSRect;
|
||||||
|
|
Loading…
Reference in New Issue