2026-01-09 21:35:23 -07:00
|
|
|
#include <Mw/Milsko.h>
|
|
|
|
|
|
2026-03-04 20:47:55 -07:00
|
|
|
#pragma clang push
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
|
|
2026-03-04 22:56:04 -07:00
|
|
|
static CGRect rectFlip(CGRect originFrame) {
|
|
|
|
|
NSScreen *zeroScreen = NSScreen.screens[0];
|
|
|
|
|
double screenHeight = zeroScreen.frame.size.height;
|
|
|
|
|
double originY = originFrame.origin.y;
|
|
|
|
|
double frameHeight = originFrame.size.height;
|
|
|
|
|
double destinationY = screenHeight - (originY + frameHeight);
|
|
|
|
|
CGRect destinationFrame = originFrame;
|
|
|
|
|
destinationFrame.origin.y = destinationY;
|
|
|
|
|
if (destinationFrame.origin.x < 0)
|
|
|
|
|
destinationFrame.origin.x = 0;
|
|
|
|
|
if (destinationFrame.origin.y < 0)
|
|
|
|
|
destinationFrame.origin.y = 0;
|
|
|
|
|
if (destinationFrame.size.width < 0)
|
|
|
|
|
destinationFrame.size.width = 0;
|
|
|
|
|
if (destinationFrame.size.height < 0)
|
|
|
|
|
destinationFrame.size.height = 0;
|
|
|
|
|
return destinationFrame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static CGPoint pointFlip(CGPoint point) {
|
|
|
|
|
return rectFlip(NSMakeRect(point.x, point.y, 0, 0)).origin;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-12 13:04:30 -07:00
|
|
|
@implementation MilskoCocoaPixmap
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
+ (MilskoCocoaPixmap *)newWithWidth:(int)width height:(int)height {
|
|
|
|
|
MilskoCocoaPixmap *p = [MilskoCocoaPixmap alloc];
|
|
|
|
|
|
|
|
|
|
p->width = width;
|
|
|
|
|
p->height = height;
|
|
|
|
|
p->data = NULL;
|
|
|
|
|
p->image = NULL;
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
- (void)updateWithData:(unsigned char *)_data {
|
|
|
|
|
[self destroy];
|
|
|
|
|
|
|
|
|
|
self->rep =
|
|
|
|
|
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&_data
|
|
|
|
|
pixelsWide:(int)width
|
|
|
|
|
pixelsHigh:(int)height
|
|
|
|
|
bitsPerSample:8
|
|
|
|
|
samplesPerPixel:4
|
|
|
|
|
hasAlpha:YES
|
|
|
|
|
isPlanar:NO
|
|
|
|
|
colorSpaceName:NSDeviceRGBColorSpace
|
|
|
|
|
bytesPerRow:(int)width * 4
|
|
|
|
|
bitsPerPixel:32];
|
|
|
|
|
|
|
|
|
|
assert(self->rep);
|
|
|
|
|
self->data = [NSData dataWithBytes:[self->rep bitmapData]
|
|
|
|
|
length:self->width * self->height * 4];
|
|
|
|
|
assert(self->data);
|
|
|
|
|
self->image = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
|
|
|
|
|
assert(self->image);
|
|
|
|
|
[self->image addRepresentation:self->rep];
|
2026-01-12 13:04:30 -07:00
|
|
|
}
|
|
|
|
|
- (void)destroy {
|
2026-03-03 23:24:28 -07:00
|
|
|
if (self->data != NULL) {
|
|
|
|
|
[self->data dealloc];
|
|
|
|
|
}
|
|
|
|
|
if (self->image != NULL) {
|
|
|
|
|
[self->image dealloc];
|
|
|
|
|
}
|
2026-01-14 17:13:12 -07:00
|
|
|
}
|
2026-03-03 23:24:28 -07:00
|
|
|
- (NSImage *)image {
|
|
|
|
|
return self->image;
|
2026-01-12 13:04:30 -07:00
|
|
|
}
|
|
|
|
|
@end
|
|
|
|
|
|
2026-01-09 21:35:23 -07:00
|
|
|
@implementation MilskoCocoa
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
+ (MilskoCocoa *)newWithParent:(MwLL)parent
|
|
|
|
|
x:(int)x
|
|
|
|
|
y:(int)y
|
|
|
|
|
width:(int)width
|
2026-03-04 19:34:19 -07:00
|
|
|
height:(int)height
|
|
|
|
|
handle:(MwLL)r {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *c = [MilskoCocoa alloc];
|
|
|
|
|
|
|
|
|
|
if (x == MwDEFAULT) {
|
2026-03-04 23:06:56 -07:00
|
|
|
x = ([NSScreen mainScreen].frame.size.width / 2.) - (width / 2.);
|
2026-03-03 23:24:28 -07:00
|
|
|
}
|
|
|
|
|
if (y == MwDEFAULT) {
|
2026-03-04 23:06:56 -07:00
|
|
|
y = ([NSScreen mainScreen].frame.size.height / 2.) - (height / 2.);
|
2026-03-03 23:24:28 -07:00
|
|
|
}
|
|
|
|
|
c->application = [NSApplication sharedApplication];
|
2026-03-04 22:56:04 -07:00
|
|
|
c->rect = rectFlip(NSMakeRect(x, y, width, height));
|
2026-03-03 23:24:28 -07:00
|
|
|
|
|
|
|
|
if (parent == NULL) {
|
|
|
|
|
c->window = [[NSWindow alloc]
|
|
|
|
|
initWithContentRect:c->rect
|
|
|
|
|
styleMask:(NSTitledWindowMask | NSClosableWindowMask |
|
|
|
|
|
NSMiniaturizableWindowMask | NSResizableWindowMask)
|
|
|
|
|
backing:NSBackingStoreBuffered
|
|
|
|
|
defer:NO];
|
|
|
|
|
} else {
|
2026-03-04 22:56:04 -07:00
|
|
|
double offset = 0;
|
2026-03-03 23:24:28 -07:00
|
|
|
NSWindow *parentWindow = parent->cocoa.real->window;
|
2026-03-04 22:56:04 -07:00
|
|
|
offset =
|
|
|
|
|
[parentWindow frameRectForContentRect:parentWindow.frame].size.height -
|
2026-03-03 23:24:28 -07:00
|
|
|
[parentWindow contentRectForFrameRect:parentWindow.frame].size.height;
|
2026-03-04 23:06:56 -07:00
|
|
|
|
|
|
|
|
c->rect.origin.x += parentWindow.frame.origin.x;
|
|
|
|
|
c->rect.origin.y -= parentWindow.frame.origin.y - offset;
|
2026-03-04 22:56:04 -07:00
|
|
|
c->rect.origin.y -= offset;
|
2026-03-03 23:24:28 -07:00
|
|
|
|
|
|
|
|
c->window = [[NSWindow alloc] initWithContentRect:c->rect
|
|
|
|
|
styleMask:NSBorderlessWindowMask
|
|
|
|
|
backing:NSBackingStoreBuffered
|
|
|
|
|
defer:NO];
|
|
|
|
|
}
|
2026-03-04 20:47:55 -07:00
|
|
|
c->window.delegate = (id<NSWindowDelegate>)[[MilskoCocoaWindowDelegate alloc]
|
|
|
|
|
initWithWin:c->window];
|
2026-03-03 23:24:28 -07:00
|
|
|
|
|
|
|
|
[c->window makeKeyAndOrderFront:c->application];
|
|
|
|
|
|
|
|
|
|
if (parent != NULL) {
|
|
|
|
|
MilskoCocoa *p = parent->cocoa.real;
|
|
|
|
|
[p->window addChildWindow:c->window ordered:NSWindowAbove];
|
2026-03-04 00:02:14 -07:00
|
|
|
[c->window setHasShadow:MwFALSE];
|
2026-03-03 23:24:28 -07:00
|
|
|
} else {
|
2026-03-05 19:29:43 -07:00
|
|
|
[c->application setActivationPolicy:NSApplicationActivationPolicyRegular];
|
|
|
|
|
[c->application activateIgnoringOtherApps:true];
|
|
|
|
|
[c->window makeFirstResponder:c->view];
|
2026-03-03 23:24:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c->view = [[MilskoCocoaView alloc] initWithFrame:c->rect];
|
2026-03-04 19:34:19 -07:00
|
|
|
c->handle = [[MilskoFakePointer alloc] initWithFrame:NSMakeRect(0, 0, 1, 1)];
|
|
|
|
|
[c->handle setPointer:r];
|
|
|
|
|
[c->view addSubview:c->handle];
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
[c->window setContentView:c->view];
|
|
|
|
|
|
|
|
|
|
c->parent = parent;
|
|
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
c->_forceRender = MwTRUE;
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
- (void)polygonWithPoints:(MwPoint *)points
|
|
|
|
|
points_count:(int)points_count
|
|
|
|
|
color:(MwLLColor)color {
|
2026-03-04 00:02:14 -07:00
|
|
|
NSGraphicsContext *ctx = [self->view context];
|
|
|
|
|
if (ctx) {
|
|
|
|
|
int i;
|
|
|
|
|
NSBezierPath *path = [NSBezierPath bezierPath];
|
|
|
|
|
NSColor *nscolor = [NSColor colorWithRed:color->common.red / 255.
|
|
|
|
|
green:color->common.green / 255.
|
|
|
|
|
blue:color->common.blue / 255.
|
|
|
|
|
alpha:1.0];
|
|
|
|
|
|
|
|
|
|
[NSGraphicsContext saveGraphicsState];
|
|
|
|
|
[NSGraphicsContext setCurrentContext:ctx];
|
|
|
|
|
|
|
|
|
|
[nscolor setFill];
|
|
|
|
|
for (i = 0; i < points_count; i++) {
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
[path moveToPoint:NSMakePoint(points[i].x,
|
|
|
|
|
[self->window frame].size.height -
|
|
|
|
|
points[i].y)];
|
|
|
|
|
} else {
|
|
|
|
|
[path lineToPoint:NSMakePoint(points[i].x,
|
|
|
|
|
[self->window frame].size.height -
|
|
|
|
|
points[i].y)];
|
|
|
|
|
}
|
2026-03-03 23:24:28 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-04 00:02:14 -07:00
|
|
|
[path closePath];
|
|
|
|
|
[path fill];
|
|
|
|
|
|
|
|
|
|
[NSGraphicsContext restoreGraphicsState];
|
|
|
|
|
|
|
|
|
|
[self->view setNeedsDisplay:YES];
|
|
|
|
|
|
|
|
|
|
[nscolor dealloc];
|
|
|
|
|
}
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)lineWithPoints:(MwPoint *)points color:(MwLLColor)color {
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)getX:(int *)x Y:(int *)y W:(unsigned int *)w H:(unsigned int *)h {
|
2026-03-04 22:56:04 -07:00
|
|
|
NSRect frame = rectFlip([self->window frame]);
|
2026-01-12 13:04:30 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
*x = frame.origin.x;
|
2026-03-04 22:56:04 -07:00
|
|
|
*y = frame.origin.y;
|
2026-03-04 19:34:19 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
*w = frame.size.width;
|
|
|
|
|
*h = frame.size.height;
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)setX:(int)x Y:(int)y {
|
2026-03-03 23:24:28 -07:00
|
|
|
NSRect frame = [self->window frame];
|
|
|
|
|
|
|
|
|
|
frame.origin.x = x;
|
|
|
|
|
frame.origin.y = y;
|
|
|
|
|
|
2026-03-04 22:56:04 -07:00
|
|
|
frame = rectFlip(frame);
|
|
|
|
|
|
|
|
|
|
if (parent) {
|
|
|
|
|
double offset = 0;
|
|
|
|
|
NSWindow *parentWindow = parent->cocoa.real->window;
|
|
|
|
|
offset =
|
|
|
|
|
[parentWindow frameRectForContentRect:parentWindow.frame].size.height -
|
|
|
|
|
[parentWindow contentRectForFrameRect:parentWindow.frame].size.height;
|
2026-03-04 23:06:56 -07:00
|
|
|
|
|
|
|
|
if (x < parentWindow.frame.origin.x) {
|
|
|
|
|
frame.origin.x += parentWindow.frame.origin.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (y < parentWindow.frame.origin.y) {
|
|
|
|
|
frame.origin.y -= parentWindow.frame.origin.y - offset;
|
|
|
|
|
frame.origin.y -= offset;
|
|
|
|
|
}
|
2026-03-03 23:24:28 -07:00
|
|
|
}
|
2026-03-04 22:56:04 -07:00
|
|
|
[self->view setFrameSize:frame.size];
|
2026-03-03 23:24:28 -07:00
|
|
|
|
|
|
|
|
[self->window setFrame:frame display:YES animate:false];
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)setW:(int)w H:(int)h {
|
2026-03-03 23:24:28 -07:00
|
|
|
NSRect frame = [self->window frame];
|
|
|
|
|
frame.size.width = w;
|
|
|
|
|
frame.size.height = h;
|
2026-03-04 22:56:04 -07:00
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
self->rect = frame;
|
2026-03-03 23:24:28 -07:00
|
|
|
|
2026-03-04 22:56:04 -07:00
|
|
|
[self->view setFrameSize:frame.size];
|
2026-03-03 23:24:28 -07:00
|
|
|
[self->window setFrame:frame display:YES animate:false];
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (int)pending {
|
2026-03-04 19:34:19 -07:00
|
|
|
if (_forceRender) {
|
|
|
|
|
_forceRender = MwFALSE;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2026-03-05 19:29:43 -07:00
|
|
|
|
|
|
|
|
self->lastEvent = [self->window nextEventMatchingMask:NSAnyEventMask
|
|
|
|
|
untilDate:[NSDate distantPast]
|
|
|
|
|
inMode:NSDefaultRunLoopMode
|
|
|
|
|
dequeue:YES];
|
2026-03-03 23:24:28 -07:00
|
|
|
return self->lastEvent != NULL;
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-05 19:29:43 -07:00
|
|
|
|
2026-01-09 21:35:23 -07:00
|
|
|
- (void)getNextEvent {
|
2026-03-05 19:29:43 -07:00
|
|
|
int i;
|
|
|
|
|
NSEvent *ev;
|
|
|
|
|
|
|
|
|
|
[self eventProcess:lastEvent];
|
2026-03-04 19:34:19 -07:00
|
|
|
|
2026-03-05 19:29:43 -07:00
|
|
|
while ((ev = [self->window nextEventMatchingMask:NSAnyEventMask
|
|
|
|
|
untilDate:[NSDate distantPast]
|
|
|
|
|
inMode:NSDefaultRunLoopMode
|
|
|
|
|
dequeue:YES])) {
|
|
|
|
|
[self eventProcess:ev];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
- (void)eventProcess:(NSEvent *)ev {
|
|
|
|
|
NSWindow *win = [ev window];
|
|
|
|
|
NSWindow *parentWindow = [self parentWindow];
|
|
|
|
|
MwLL h;
|
|
|
|
|
MwBool doSendEvent = MwTRUE;
|
|
|
|
|
if (!win) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ([win contentView].subviews.count == 0) {
|
|
|
|
|
printf("no subviews on %p\n", win);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
2026-03-04 19:34:19 -07:00
|
|
|
h = [((MilskoFakePointer *)[win contentView].subviews[0]) pointer];
|
2026-03-05 19:29:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (ev.type) {
|
|
|
|
|
case NSEventTypeLeftMouseDown:
|
|
|
|
|
case NSEventTypeRightMouseDown:
|
|
|
|
|
case NSEventTypeOtherMouseDown:
|
|
|
|
|
case NSEventTypeLeftMouseUp:
|
|
|
|
|
case NSEventTypeRightMouseUp:
|
|
|
|
|
case NSEventTypeOtherMouseUp: {
|
|
|
|
|
MwLLMouse mouse = {};
|
|
|
|
|
MwBool isDown = MwTRUE;
|
|
|
|
|
CGPoint mousePoint = pointFlip([ev locationInWindow]);
|
|
|
|
|
switch (ev.type) {
|
|
|
|
|
case NSEventTypeLeftMouseUp:
|
|
|
|
|
isDown = MwFALSE;
|
2026-03-04 19:34:19 -07:00
|
|
|
case NSEventTypeLeftMouseDown:
|
2026-03-05 19:29:43 -07:00
|
|
|
mouse.button = MwLLMouseLeft;
|
|
|
|
|
break;
|
|
|
|
|
case NSEventTypeRightMouseUp:
|
|
|
|
|
isDown = MwFALSE;
|
2026-03-04 19:34:19 -07:00
|
|
|
case NSEventTypeRightMouseDown:
|
2026-03-05 19:29:43 -07:00
|
|
|
mouse.button = MwLLMouseRight;
|
|
|
|
|
break;
|
|
|
|
|
case NSEventTypeOtherMouseUp:
|
|
|
|
|
isDown = MwFALSE;
|
2026-03-04 19:34:19 -07:00
|
|
|
case NSEventTypeOtherMouseDown:
|
2026-03-05 19:29:43 -07:00
|
|
|
mouse.button = MwLLMouseMiddle;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
|
|
|
|
}
|
2026-03-05 19:29:43 -07:00
|
|
|
mouse.point.x = mousePoint.x;
|
|
|
|
|
mouse.point.y = mousePoint.y;
|
2026-03-04 19:34:19 -07:00
|
|
|
|
2026-03-05 19:29:43 -07:00
|
|
|
if (isDown) {
|
|
|
|
|
MwLLDispatch(h, down, &mouse);
|
|
|
|
|
} else {
|
|
|
|
|
MwLLDispatch(h, up, &mouse);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case NSEventTypeLeftMouseDragged:
|
|
|
|
|
case NSEventTypeRightMouseDragged:
|
|
|
|
|
case NSEventTypeOtherMouseDragged:
|
|
|
|
|
case NSEventTypeMouseMoved: {
|
|
|
|
|
MwPoint pos;
|
|
|
|
|
pos.x = [ev locationInWindow].x;
|
|
|
|
|
pos.y = [win contentRectForFrameRect:win.frame].size.height -
|
|
|
|
|
[ev locationInWindow].y;
|
|
|
|
|
MwLLDispatch(h, move, &pos);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case NSEventTypeMouseEntered:
|
|
|
|
|
MwLLDispatch(h, focus_in, NULL);
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case NSEventTypeMouseExited:
|
|
|
|
|
MwLLDispatch(h, focus_out, NULL);
|
|
|
|
|
break;
|
|
|
|
|
case NSEventTypeKeyDown:
|
|
|
|
|
case NSEventTypeKeyUp: {
|
|
|
|
|
int ch;
|
|
|
|
|
enum {
|
|
|
|
|
kVK_ANSI_A = 0x00,
|
|
|
|
|
kVK_ANSI_S = 0x01,
|
|
|
|
|
kVK_ANSI_D = 0x02,
|
|
|
|
|
kVK_ANSI_F = 0x03,
|
|
|
|
|
kVK_ANSI_H = 0x04,
|
|
|
|
|
kVK_ANSI_G = 0x05,
|
|
|
|
|
kVK_ANSI_Z = 0x06,
|
|
|
|
|
kVK_ANSI_X = 0x07,
|
|
|
|
|
kVK_ANSI_C = 0x08,
|
|
|
|
|
kVK_ANSI_V = 0x09,
|
|
|
|
|
kVK_ANSI_B = 0x0B,
|
|
|
|
|
kVK_ANSI_Q = 0x0C,
|
|
|
|
|
kVK_ANSI_W = 0x0D,
|
|
|
|
|
kVK_ANSI_E = 0x0E,
|
|
|
|
|
kVK_ANSI_R = 0x0F,
|
|
|
|
|
kVK_ANSI_Y = 0x10,
|
|
|
|
|
kVK_ANSI_T = 0x11,
|
|
|
|
|
kVK_ANSI_1 = 0x12,
|
|
|
|
|
kVK_ANSI_2 = 0x13,
|
|
|
|
|
kVK_ANSI_3 = 0x14,
|
|
|
|
|
kVK_ANSI_4 = 0x15,
|
|
|
|
|
kVK_ANSI_6 = 0x16,
|
|
|
|
|
kVK_ANSI_5 = 0x17,
|
|
|
|
|
kVK_ANSI_Equal = 0x18,
|
|
|
|
|
kVK_ANSI_9 = 0x19,
|
|
|
|
|
kVK_ANSI_7 = 0x1A,
|
|
|
|
|
kVK_ANSI_Minus = 0x1B,
|
|
|
|
|
kVK_ANSI_8 = 0x1C,
|
|
|
|
|
kVK_ANSI_0 = 0x1D,
|
|
|
|
|
kVK_ANSI_RightBracket = 0x1E,
|
|
|
|
|
kVK_ANSI_O = 0x1F,
|
|
|
|
|
kVK_ANSI_U = 0x20,
|
|
|
|
|
kVK_ANSI_LeftBracket = 0x21,
|
|
|
|
|
kVK_ANSI_I = 0x22,
|
|
|
|
|
kVK_ANSI_P = 0x23,
|
|
|
|
|
kVK_ANSI_L = 0x25,
|
|
|
|
|
kVK_ANSI_J = 0x26,
|
|
|
|
|
kVK_ANSI_Quote = 0x27,
|
|
|
|
|
kVK_ANSI_K = 0x28,
|
|
|
|
|
kVK_ANSI_Semicolon = 0x29,
|
|
|
|
|
kVK_ANSI_Backslash = 0x2A,
|
|
|
|
|
kVK_ANSI_Comma = 0x2B,
|
|
|
|
|
kVK_ANSI_Slash = 0x2C,
|
|
|
|
|
kVK_ANSI_N = 0x2D,
|
|
|
|
|
kVK_ANSI_M = 0x2E,
|
|
|
|
|
kVK_ANSI_Period = 0x2F,
|
|
|
|
|
kVK_ANSI_Grave = 0x32,
|
|
|
|
|
kVK_ANSI_KeypadDecimal = 0x41,
|
|
|
|
|
kVK_ANSI_KeypadMultiply = 0x43,
|
|
|
|
|
kVK_ANSI_KeypadPlus = 0x45,
|
|
|
|
|
kVK_ANSI_KeypadClear = 0x47,
|
|
|
|
|
kVK_ANSI_KeypadDivide = 0x4B,
|
|
|
|
|
kVK_ANSI_KeypadEnter = 0x4C,
|
|
|
|
|
kVK_ANSI_KeypadMinus = 0x4E,
|
|
|
|
|
kVK_ANSI_KeypadEquals = 0x51,
|
|
|
|
|
kVK_ANSI_Keypad0 = 0x52,
|
|
|
|
|
kVK_ANSI_Keypad1 = 0x53,
|
|
|
|
|
kVK_ANSI_Keypad2 = 0x54,
|
|
|
|
|
kVK_ANSI_Keypad3 = 0x55,
|
|
|
|
|
kVK_ANSI_Keypad4 = 0x56,
|
|
|
|
|
kVK_ANSI_Keypad5 = 0x57,
|
|
|
|
|
kVK_ANSI_Keypad6 = 0x58,
|
|
|
|
|
kVK_ANSI_Keypad7 = 0x59,
|
|
|
|
|
kVK_ANSI_Keypad8 = 0x5B,
|
|
|
|
|
kVK_ANSI_Keypad9 = 0x5C,
|
|
|
|
|
kVK_Return = 0x24,
|
|
|
|
|
kVK_Tab = 0x30,
|
|
|
|
|
kVK_Space = 0x31,
|
|
|
|
|
kVK_Delete = 0x33,
|
|
|
|
|
kVK_Escape = 0x35,
|
|
|
|
|
kVK_Command = 0x37,
|
|
|
|
|
kVK_Shift = 0x38,
|
|
|
|
|
kVK_CapsLock = 0x39,
|
|
|
|
|
kVK_Option = 0x3A,
|
|
|
|
|
kVK_Control = 0x3B,
|
|
|
|
|
kVK_RightCommand = 0x36,
|
|
|
|
|
kVK_RightShift = 0x3C,
|
|
|
|
|
kVK_RightOption = 0x3D,
|
|
|
|
|
kVK_RightControl = 0x3E,
|
|
|
|
|
kVK_Function = 0x3F,
|
|
|
|
|
kVK_F17 = 0x40,
|
|
|
|
|
kVK_VolumeUp = 0x48,
|
|
|
|
|
kVK_VolumeDown = 0x49,
|
|
|
|
|
kVK_Mute = 0x4A,
|
|
|
|
|
kVK_F18 = 0x4F,
|
|
|
|
|
kVK_F19 = 0x50,
|
|
|
|
|
kVK_F20 = 0x5A,
|
|
|
|
|
kVK_F5 = 0x60,
|
|
|
|
|
kVK_F6 = 0x61,
|
|
|
|
|
kVK_F7 = 0x62,
|
|
|
|
|
kVK_F3 = 0x63,
|
|
|
|
|
kVK_F8 = 0x64,
|
|
|
|
|
kVK_F9 = 0x65,
|
|
|
|
|
kVK_F11 = 0x67,
|
|
|
|
|
kVK_F13 = 0x69,
|
|
|
|
|
kVK_F16 = 0x6A,
|
|
|
|
|
kVK_F14 = 0x6B,
|
|
|
|
|
kVK_F10 = 0x6D,
|
|
|
|
|
kVK_F12 = 0x6F,
|
|
|
|
|
kVK_F15 = 0x71,
|
|
|
|
|
kVK_Help = 0x72,
|
|
|
|
|
kVK_Home = 0x73,
|
|
|
|
|
kVK_PageUp = 0x74,
|
|
|
|
|
kVK_ForwardDelete = 0x75,
|
|
|
|
|
kVK_F4 = 0x76,
|
|
|
|
|
kVK_End = 0x77,
|
|
|
|
|
kVK_F2 = 0x78,
|
|
|
|
|
kVK_PageDown = 0x79,
|
|
|
|
|
kVK_F1 = 0x7A,
|
|
|
|
|
kVK_LeftArrow = 0x7B,
|
|
|
|
|
kVK_RightArrow = 0x7C,
|
|
|
|
|
kVK_DownArrow = 0x7D,
|
|
|
|
|
kVK_UpArrow = 0x7E
|
|
|
|
|
};
|
|
|
|
|
// [view.nextResponder
|
|
|
|
|
// interpretKeyEvents:[NSArray arrayWithObject:lastEvent]];
|
|
|
|
|
switch (ev.keyCode) {
|
|
|
|
|
case kVK_ANSI_A:
|
|
|
|
|
ch = 'a';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_B:
|
|
|
|
|
ch = 'b';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_C:
|
|
|
|
|
ch = 'c';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_D:
|
|
|
|
|
ch = 'd';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_E:
|
|
|
|
|
ch = 'e';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_F:
|
|
|
|
|
ch = 'f';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_G:
|
|
|
|
|
ch = 'g';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_H:
|
|
|
|
|
ch = 'h';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_I:
|
|
|
|
|
ch = 'i';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_J:
|
|
|
|
|
ch = 'j';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_K:
|
|
|
|
|
ch = 'k';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_L:
|
|
|
|
|
ch = 'l';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_M:
|
|
|
|
|
ch = 'm';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_N:
|
|
|
|
|
ch = 'n';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_O:
|
|
|
|
|
ch = 'o';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_P:
|
|
|
|
|
ch = 'p';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_Q:
|
|
|
|
|
ch = 'q';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_R:
|
|
|
|
|
ch = 'r';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_S:
|
|
|
|
|
ch = 's';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_T:
|
|
|
|
|
ch = 't';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_U:
|
|
|
|
|
ch = 'u';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_V:
|
|
|
|
|
ch = 'v';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_W:
|
|
|
|
|
ch = 'w';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_X:
|
|
|
|
|
ch = 'x';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_Y:
|
|
|
|
|
ch = 'y';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_Z:
|
|
|
|
|
ch = 'z';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_0:
|
|
|
|
|
ch = '0';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_1:
|
|
|
|
|
ch = '1';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-03-05 19:29:43 -07:00
|
|
|
case kVK_ANSI_2:
|
|
|
|
|
ch = '2';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_3:
|
|
|
|
|
ch = '3';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_4:
|
|
|
|
|
ch = '4';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_5:
|
|
|
|
|
ch = '5';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_6:
|
|
|
|
|
ch = '6';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_7:
|
|
|
|
|
ch = '7';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_8:
|
|
|
|
|
ch = '8';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_9:
|
|
|
|
|
ch = '9';
|
2026-03-04 19:34:19 -07:00
|
|
|
break;
|
2026-01-14 17:13:12 -07:00
|
|
|
|
2026-03-05 19:29:43 -07:00
|
|
|
// case kVK_ANSI_Keypad0:
|
|
|
|
|
// ch = MwLLKey;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad1:
|
|
|
|
|
// ch = keypad1;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad2:
|
|
|
|
|
// ch = keypad2;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad3:
|
|
|
|
|
// ch = keypad3;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad4:
|
|
|
|
|
// ch = keypad4;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad5:
|
|
|
|
|
// ch = keypad5;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad6:
|
|
|
|
|
// ch = keypad6;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad7:
|
|
|
|
|
// ch = keypad7;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad8:
|
|
|
|
|
// ch = keypad8;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Keypad9:
|
|
|
|
|
// ch = keypad9;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadClear:
|
|
|
|
|
// ch = keypadClear;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadDivide:
|
|
|
|
|
// ch = keypadDivide;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadEnter:
|
|
|
|
|
// ch = keypadEnter;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadEquals:
|
|
|
|
|
// ch = keypadEquals;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadMinus:
|
|
|
|
|
// ch = keypadMinus;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadPlus:
|
|
|
|
|
// ch = keypadPlus;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_PageDown:
|
|
|
|
|
// ch = MwLLKey;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_PageUp:
|
|
|
|
|
// ch = pageUp;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_End:
|
|
|
|
|
// ch = end;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_Home:
|
|
|
|
|
// ch = home;
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
|
|
// case kVK_F1:
|
|
|
|
|
// ch = f1;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F2:
|
|
|
|
|
// ch = f2;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F3:
|
|
|
|
|
// ch = f3;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F4:
|
|
|
|
|
// ch = f4;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F5:
|
|
|
|
|
// ch = f5;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F6:
|
|
|
|
|
// ch = f6;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F7:
|
|
|
|
|
// ch = f7;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F8:
|
|
|
|
|
// ch = f8;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F9:
|
|
|
|
|
// ch = f9;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F10:
|
|
|
|
|
// ch = f10;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F11:
|
|
|
|
|
// ch = f11;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F12:
|
|
|
|
|
// ch = f12;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F13:
|
|
|
|
|
// ch = f13;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F14:
|
|
|
|
|
// ch = f14;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F15:
|
|
|
|
|
// ch = f15;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F16:
|
|
|
|
|
// ch = f16;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F17:
|
|
|
|
|
// ch = f17;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F18:
|
|
|
|
|
// ch = f18;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F19:
|
|
|
|
|
// ch = f19;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_F20:
|
|
|
|
|
// ch = f20;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadDecimal:
|
|
|
|
|
// ch = decimal;
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
|
|
case kVK_ANSI_Quote:
|
|
|
|
|
ch = '\"';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_Grave:
|
|
|
|
|
ch = '`';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_Backslash:
|
|
|
|
|
ch = '/';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_Comma:
|
|
|
|
|
ch = ',';
|
|
|
|
|
break;
|
|
|
|
|
// case kVK_Delete:
|
|
|
|
|
// ch = delete;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Equal:
|
|
|
|
|
// ch = equals;
|
|
|
|
|
// break;
|
|
|
|
|
case kVK_Escape:
|
|
|
|
|
ch = MwLLKeyEscape;
|
|
|
|
|
break;
|
|
|
|
|
// case kVK_ANSI_LeftBracket:
|
|
|
|
|
// ch = leftBracket;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Minus:
|
|
|
|
|
// ch = minus;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_KeypadMultiply:
|
|
|
|
|
// ch = multiply;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_ANSI_Period:
|
|
|
|
|
// ch = period;
|
|
|
|
|
// break;
|
|
|
|
|
case kVK_Return:
|
|
|
|
|
ch = MwLLKeyEnter;
|
|
|
|
|
break;
|
|
|
|
|
// case kVK_ANSI_RightBracket:
|
|
|
|
|
// ch = rightBracket;
|
|
|
|
|
// break;
|
|
|
|
|
case kVK_ANSI_Semicolon:
|
|
|
|
|
ch = ';';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_ANSI_Slash:
|
|
|
|
|
ch = '\\';
|
|
|
|
|
break;
|
|
|
|
|
case kVK_Space:
|
|
|
|
|
ch = ' ';
|
|
|
|
|
break;
|
|
|
|
|
// case kVK_Tab:
|
|
|
|
|
// ch = tab;
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
|
|
// case kVK_Mute:
|
|
|
|
|
// ch = mute;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_VolumeDown:
|
|
|
|
|
// ch = volumeDown;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_VolumeUp:
|
|
|
|
|
// ch = volumeUp;
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
|
|
// case kVK_Command:
|
|
|
|
|
// ch = MwLLKey;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_RightCommand:
|
|
|
|
|
// ch = rightCommand;
|
|
|
|
|
// break;
|
|
|
|
|
case kVK_Control:
|
|
|
|
|
ch = MwLLKeyControl;
|
|
|
|
|
break;
|
|
|
|
|
case kVK_RightControl:
|
|
|
|
|
ch = MwLLKeyControl;
|
|
|
|
|
break;
|
|
|
|
|
// case kVK_Function:
|
|
|
|
|
// ch = function;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_Option:
|
|
|
|
|
// ch = option;
|
|
|
|
|
// break;
|
|
|
|
|
// case kVK_RightOption:
|
|
|
|
|
// ch = rightOption;
|
|
|
|
|
// break;
|
|
|
|
|
case kVK_Shift:
|
|
|
|
|
ch = MwLLKeyLeftShift;
|
|
|
|
|
break;
|
|
|
|
|
case kVK_RightShift:
|
|
|
|
|
ch = MwLLKeyRightShift;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case kVK_DownArrow:
|
|
|
|
|
ch = MwLLKeyDown;
|
|
|
|
|
break;
|
|
|
|
|
case kVK_LeftArrow:
|
|
|
|
|
ch = MwLLKeyLeft;
|
|
|
|
|
break;
|
|
|
|
|
case kVK_RightArrow:
|
|
|
|
|
ch = MwLLKeyRight;
|
|
|
|
|
break;
|
|
|
|
|
case kVK_UpArrow:
|
|
|
|
|
ch = MwLLKeyUp;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (ev.type) {
|
|
|
|
|
case NSEventTypeKeyDown:
|
|
|
|
|
MwLLDispatch(h, key, &ch);
|
|
|
|
|
break;
|
|
|
|
|
case NSEventTypeKeyUp:
|
|
|
|
|
MwLLDispatch(h, key_released, &ch);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
doSendEvent = MwFALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case NSEventTypeCursorUpdate:
|
|
|
|
|
break;
|
|
|
|
|
case NSEventTypeScrollWheel:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
};
|
|
|
|
|
if (doSendEvent) {
|
|
|
|
|
[win sendEvent:ev];
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-03-04 19:34:19 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)setTitle:(const char *)title {
|
|
|
|
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
|
|
|
[self->window
|
|
|
|
|
setTitleWithRepresentedFilename:[NSString stringWithUTF8String:title]];
|
|
|
|
|
[pool release];
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)drawPixmap:(MwLLPixmap)pixmap rect:(MwRect *)_rect {
|
|
|
|
|
MilskoCocoaPixmap *p = pixmap->cocoa.real;
|
|
|
|
|
NSGraphicsContext *ctx = [self->view context];
|
|
|
|
|
if (ctx) {
|
|
|
|
|
[NSGraphicsContext saveGraphicsState];
|
|
|
|
|
[NSGraphicsContext setCurrentContext:ctx];
|
|
|
|
|
|
|
|
|
|
[[p image] drawInRect:NSMakeRect(_rect->x, _rect->y, _rect->width,
|
|
|
|
|
_rect->height)
|
|
|
|
|
fromRect:NSZeroRect
|
|
|
|
|
operation:NSCompositeSourceOver
|
|
|
|
|
fraction:1.0
|
|
|
|
|
respectFlipped:NO
|
|
|
|
|
hints:nil];
|
|
|
|
|
|
|
|
|
|
[NSGraphicsContext restoreGraphicsState];
|
|
|
|
|
|
|
|
|
|
[self->view setNeedsDisplay:YES];
|
|
|
|
|
}
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)setIcon:(MwLLPixmap)pixmap {
|
|
|
|
|
};
|
|
|
|
|
- (void)forceRender {
|
2026-03-04 19:34:19 -07:00
|
|
|
_forceRender = MwTRUE;
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)setCursor:(MwCursor *)image mask:(MwCursor *)mask {
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)detachWithPoint:(MwPoint *)point {
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)show:(int)show {
|
|
|
|
|
};
|
|
|
|
|
- (void)makePopupWithParent:(MwLL)parent {
|
|
|
|
|
};
|
|
|
|
|
- (void)setSizeHintsWithMinX:(int)minx
|
2026-03-03 23:24:28 -07:00
|
|
|
MinY:(int)miny
|
|
|
|
|
MaxX:(int)maxx
|
|
|
|
|
MaxY:(int)maxy {
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)makeBorderless:(int)toggle {
|
2026-03-03 23:24:28 -07:00
|
|
|
MwU32 mask = [self->window styleMask];
|
|
|
|
|
if (mask & NSBorderlessWindowMask) {
|
|
|
|
|
mask ^= NSBorderlessWindowMask;
|
|
|
|
|
mask |= NSTitledWindowMask;
|
|
|
|
|
} else {
|
|
|
|
|
mask |= NSBorderlessWindowMask;
|
|
|
|
|
mask ^= NSTitledWindowMask;
|
|
|
|
|
}
|
|
|
|
|
[self->window initWithContentRect:self->rect
|
|
|
|
|
styleMask:mask
|
|
|
|
|
backing:NSBackingStoreBuffered
|
|
|
|
|
defer:NO];
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)focus {
|
2026-03-03 23:24:28 -07:00
|
|
|
[self->window makeMainWindow];
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)grabPointer:(int)toggle {
|
2026-03-04 19:34:19 -07:00
|
|
|
/* MacOS didn't have a "pointer grab" function
|
|
|
|
|
* until 10.13.2 so I need to do this manually */
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)setClipboard:(const char *)text {
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)getClipboard {
|
|
|
|
|
};
|
|
|
|
|
- (void)makeToolWindow {
|
|
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)getCursorCoord:(MwPoint *)point {
|
|
|
|
|
NSPoint p = [NSEvent mouseLocation];
|
|
|
|
|
point->x = p.x;
|
|
|
|
|
point->y = p.y;
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
2026-03-03 23:24:28 -07:00
|
|
|
- (void)getScreenSize:(MwRect *)_rect {
|
|
|
|
|
NSScreen *screen = [self->window screen];
|
|
|
|
|
_rect->x = [screen frame].origin.x;
|
|
|
|
|
_rect->y = [screen frame].origin.y;
|
|
|
|
|
_rect->width = [screen frame].size.width;
|
|
|
|
|
_rect->height = [screen frame].size.height;
|
2026-01-09 21:35:23 -07:00
|
|
|
};
|
|
|
|
|
- (void)destroy {
|
2026-03-03 23:24:28 -07:00
|
|
|
[self->window dealloc];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
2026-01-14 17:13:12 -07:00
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
- (NSWindow *)parentWindow {
|
|
|
|
|
NSWindow *topmostWindow = self->window;
|
|
|
|
|
while (topmostWindow.parentWindow)
|
|
|
|
|
topmostWindow = topmostWindow.parentWindow;
|
|
|
|
|
return topmostWindow;
|
|
|
|
|
}
|
2026-03-04 22:56:04 -07:00
|
|
|
|
|
|
|
|
- (NSView *)getView {
|
|
|
|
|
return view;
|
|
|
|
|
}
|
2026-03-05 19:29:43 -07:00
|
|
|
- (NSWindow *)getWindow {
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (MilskoFakePointer *)getHandle {
|
|
|
|
|
return handle;
|
|
|
|
|
}
|
2026-01-14 17:13:12 -07:00
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation MilskoCocoaView
|
|
|
|
|
- (id)initWithFrame:(NSRect)frame {
|
2026-03-04 19:34:19 -07:00
|
|
|
width = frame.size.width;
|
|
|
|
|
height = frame.size.height;
|
2026-03-03 23:24:28 -07:00
|
|
|
self = [super initWithFrame:frame];
|
|
|
|
|
self->space = CGColorSpaceCreateDeviceRGB();
|
|
|
|
|
|
|
|
|
|
if (width == 0 || height == 0) {
|
|
|
|
|
self->rep = NULL;
|
|
|
|
|
self->context = NULL;
|
|
|
|
|
} else {
|
|
|
|
|
self->rep =
|
|
|
|
|
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
|
|
|
|
pixelsWide:width
|
|
|
|
|
pixelsHigh:height
|
|
|
|
|
bitsPerSample:8
|
|
|
|
|
samplesPerPixel:4
|
|
|
|
|
hasAlpha:YES
|
|
|
|
|
isPlanar:NO
|
|
|
|
|
colorSpaceName:NSDeviceRGBColorSpace
|
|
|
|
|
bytesPerRow:width * 4
|
|
|
|
|
bitsPerPixel:32];
|
|
|
|
|
assert(self->rep);
|
|
|
|
|
|
|
|
|
|
self->context =
|
|
|
|
|
[NSGraphicsContext graphicsContextWithBitmapImageRep:self->rep];
|
|
|
|
|
assert(self->context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSGraphicsContext *)context {
|
|
|
|
|
return self->context;
|
2026-01-14 17:13:12 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
- (NSBitmapImageRep *)getRep {
|
|
|
|
|
return self->rep;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-14 17:13:12 -07:00
|
|
|
- (void)drawRect:(NSRect)dirtyRect {
|
2026-03-04 22:56:04 -07:00
|
|
|
NSSize sz = self->rep.size;
|
2026-03-03 23:24:28 -07:00
|
|
|
[super drawRect:dirtyRect];
|
|
|
|
|
if (!self->rep) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-01-14 17:13:12 -07:00
|
|
|
|
2026-03-04 22:56:04 -07:00
|
|
|
[self->rep drawInRect:NSMakeRect(0, 0, sz.width, sz.height)];
|
2026-03-04 19:34:19 -07:00
|
|
|
|
2026-03-04 20:44:25 -07:00
|
|
|
[self->rep bitmapData];
|
2026-01-14 17:13:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)destroy {
|
2026-03-03 23:24:28 -07:00
|
|
|
CGColorSpaceRelease(self->space);
|
2026-01-14 17:13:12 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
- (void)setFrameSize:(NSSize)newSize {
|
|
|
|
|
[super setFrameSize:newSize];
|
2026-03-04 22:56:04 -07:00
|
|
|
[self->rep setSize:newSize];
|
2026-03-04 19:34:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)displayRect:(NSRect)rect {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation MilskoCocoaWindowDelegate
|
|
|
|
|
|
|
|
|
|
- (NSSize)windowWillResize:(NSWindow *)win toSize:(NSSize)frameSize;
|
|
|
|
|
{
|
|
|
|
|
if (win.contentView.subviews.count >= 1) {
|
|
|
|
|
MilskoFakePointer *ptr = win.contentView.subviews[0];
|
|
|
|
|
MwLL h = [ptr pointer];
|
|
|
|
|
|
|
|
|
|
// MwLLDispatch(h, resize, NULL);
|
|
|
|
|
MwLLDispatch(h, draw, NULL);
|
|
|
|
|
}
|
|
|
|
|
return frameSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)windowDidResize:(NSNotification *)notification {
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-05 19:29:43 -07:00
|
|
|
// This will close/terminate the application when the main window is closed.
|
|
|
|
|
- (void)windowWillClose:(NSNotification *)notification {
|
|
|
|
|
// MilskoCocoa *window = notification.object;
|
|
|
|
|
// MwLL handle = [window getHandle].pointer;
|
|
|
|
|
// MwLLDispatch(handle, close, NULL);
|
|
|
|
|
[NSApp terminate:nil];
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
- (instancetype)initWithWin:(NSWindow *)win {
|
|
|
|
|
self->w = win;
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-05 19:29:43 -07:00
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation MilskoFakePointer
|
|
|
|
|
- (void)setPointer:(void *)pointer {
|
|
|
|
|
self.frame = *(NSRect *)&pointer;
|
|
|
|
|
self->ptr = pointer;
|
|
|
|
|
};
|
|
|
|
|
- (void *)pointer {
|
|
|
|
|
return self->ptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
- (void)drawRect:(NSRect)dirtyRect {
|
|
|
|
|
/* explicitly do nothing */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)destroy {
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
@end
|
2026-01-09 21:35:23 -07:00
|
|
|
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MwLL r;
|
|
|
|
|
(void)x;
|
|
|
|
|
(void)y;
|
|
|
|
|
(void)width;
|
|
|
|
|
(void)height;
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
r = malloc(sizeof(*r));
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
MwLLCreateCommon(r);
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-04 19:34:19 -07:00
|
|
|
MilskoCocoa *o = [MilskoCocoa newWithParent:parent
|
|
|
|
|
x:x
|
|
|
|
|
y:y
|
|
|
|
|
width:width
|
|
|
|
|
height:height
|
|
|
|
|
handle:r];
|
2026-03-03 23:24:28 -07:00
|
|
|
r->cocoa.real = o;
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
return r;
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLDestroyImpl(MwLL handle) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
[h destroy];
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
MwLLDestroyCommon(handle);
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
free(handle);
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLBeginDrawImpl(MwLL handle) { (void)handle; }
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLEndDrawImpl(MwLL handle) { (void)handle; }
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLPolygonImpl(MwLL handle, MwPoint *points, int points_count,
|
|
|
|
|
MwLLColor color) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h polygonWithPoints:points points_count:points_count color:color];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLLineImpl(MwLL handle, MwPoint *points, MwLLColor color) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h lineWithPoints:points color:color];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MwLLColor c = malloc(sizeof(*c));
|
|
|
|
|
MwLLColorUpdate(handle, c, r, g, b);
|
|
|
|
|
return c;
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
2026-03-03 23:24:28 -07:00
|
|
|
(void)handle;
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
c->common.red = r;
|
|
|
|
|
c->common.green = g;
|
|
|
|
|
c->common.blue = b;
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLGetXYWHImpl(MwLL handle, int *x, int *y, unsigned int *w,
|
|
|
|
|
unsigned int *height) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h getX:x Y:y W:w H:height];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h setX:x Y:y];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLSetWHImpl(MwLL handle, int w, int height) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h setW:w H:height];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLFreeColorImpl(MwLLColor color) { free(color); }
|
2026-01-09 21:35:23 -07:00
|
|
|
|
|
|
|
|
static int MwLLPendingImpl(MwLL handle) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
if ([h pending]) {
|
|
|
|
|
MwLLDispatch(handle, draw, NULL);
|
|
|
|
|
return 1;
|
|
|
|
|
};
|
2026-03-04 20:47:55 -07:00
|
|
|
return 0;
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLNextEventImpl(MwLL handle) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h getNextEvent];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLSetTitleImpl(MwLL handle, const char *title) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h setTitle:title];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char *data,
|
|
|
|
|
int width, int height) {
|
|
|
|
|
(void)handle;
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
MwLLPixmap r = malloc(sizeof(*r));
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
r->common.raw = malloc(4 * width * height);
|
|
|
|
|
memcpy(r->common.raw, data, 4 * width * height);
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
r->common.width = width;
|
|
|
|
|
r->common.height = height;
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
r->cocoa.real = [MilskoCocoaPixmap newWithWidth:width height:height];
|
2026-01-12 13:04:30 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
MwLLPixmapUpdate(r);
|
|
|
|
|
return r;
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-01-12 13:04:30 -07:00
|
|
|
static void MwLLPixmapUpdateImpl(MwLLPixmap pixmap) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoaPixmap *p = pixmap->cocoa.real;
|
|
|
|
|
[p updateWithData:pixmap->common.raw];
|
2026-01-12 13:04:30 -07:00
|
|
|
}
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-01-12 13:04:30 -07:00
|
|
|
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoaPixmap *p = pixmap->cocoa.real;
|
|
|
|
|
[p destroy];
|
|
|
|
|
free(pixmap);
|
2026-01-12 13:04:30 -07:00
|
|
|
}
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLDrawPixmapImpl(MwLL handle, MwRect *rect, MwLLPixmap pixmap) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h drawPixmap:pixmap rect:rect];
|
|
|
|
|
MwLLForceRender(handle);
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h setIcon:pixmap];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLForceRenderImpl(MwLL handle) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h forceRender];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLSetCursorImpl(MwLL handle, MwCursor *image, MwCursor *mask) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h setCursor:image mask:mask];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLDetachImpl(MwLL handle, MwPoint *point) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h detachWithPoint:point];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLShowImpl(MwLL handle, int show) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h show:show];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLMakePopupImpl(MwLL handle, MwLL parent) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h makePopupWithParent:parent];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx,
|
2026-03-03 23:24:28 -07:00
|
|
|
int maxy) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h setSizeHintsWithMinX:minx MinY:miny MaxX:maxx MaxY:maxy];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLMakeBorderlessImpl(MwLL handle, int toggle) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h makeBorderless:toggle];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLFocusImpl(MwLL handle) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h focus];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MwLLGrabPointerImpl(MwLL handle, int toggle) {
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h grabPointer:toggle];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLSetClipboardImpl(MwLL handle, const char *text) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h setClipboard:text];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLGetClipboardImpl(MwLL handle) { (void)handle; }
|
2026-01-09 21:35:23 -07:00
|
|
|
|
|
|
|
|
static void MwLLMakeToolWindowImpl(MwLL handle) {
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h makeToolWindow];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint *point) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h getCursorCoord:point];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLGetScreenSizeImpl(MwLL handle, MwRect *rect) {
|
|
|
|
|
MilskoCocoa *h = handle->cocoa.real;
|
|
|
|
|
[h getScreenSize:rect];
|
2026-01-09 21:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLBeginStateChangeImpl(MwLL handle) { MwLLShow(handle, 0); }
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static void MwLLEndStateChangeImpl(MwLL handle) { MwLLShow(handle, 1); }
|
2026-01-09 21:35:23 -07:00
|
|
|
|
2026-03-03 23:24:28 -07:00
|
|
|
static int MwLLCocoaCallInitImpl(void) { return 0; }
|
2026-01-09 21:35:23 -07:00
|
|
|
|
|
|
|
|
#include "call.c"
|
|
|
|
|
CALL(Cocoa);
|