significant macos progress, now compiles/runs on monetery
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
11fec984cf
commit
efa43456c1
3 changed files with 450 additions and 385 deletions
46
README.txt
46
README.txt
|
|
@ -1,23 +1,25 @@
|
||||||
|
|
||||||
Greetings - Welcome to the Milsko GUI Toolkit (Version pre-1.0)
|
Greetings - Welcome to the Milsko GUI Toolkit (Version pre-1.0)
|
||||||
|
|
||||||
This document contains a brief summary of the contents of this source
|
This document contains a brief summary of the contents of this source
|
||||||
distributions and building instructions for Milsko GUI Toolkit.
|
distributions and building instructions for Milsko GUI Toolkit.
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
|
|
||||||
Milsko requires the Windows environment with GDI (so anything NT or 9x) or
|
Milsko requires either
|
||||||
the Unix-like environment with X11 for runtime.
|
* A Windows environment with GDI (so anything NT or 9x)
|
||||||
|
* A Mac OS environment with Cocoa (10.4 is the minimum tested)
|
||||||
|
* Unix-like environment with X11 for runtime.
|
||||||
|
|
||||||
To build Milsko for Windows, you must have one of following compilers:
|
To build Milsko for Windows, you must have one of following compilers:
|
||||||
* Visual C++ 6.0 or newer
|
* Visual C++ 6.0 or newer
|
||||||
* Borland C++ 5.5 or newer
|
* Borland C++ 5.5 or newer
|
||||||
* Open Watcom 2.0 or newer
|
* Open Watcom 2.0 or newer
|
||||||
* MinGW-w64
|
* MinGW-w64
|
||||||
|
|
||||||
and for Unix-like:
|
and for Unix-like/Mac OS:
|
||||||
* GNU C Compiler
|
* GNU C Compiler
|
||||||
* Clang
|
* Clang
|
||||||
|
|
||||||
|
|
||||||
Contents
|
Contents
|
||||||
|
|
@ -39,31 +41,31 @@ the Unix-like environment with X11 for runtime.
|
||||||
|
|
||||||
Building Milsko
|
Building Milsko
|
||||||
|
|
||||||
Building Milsko depends on the platform you use, and the compiler you use.
|
Building Milsko depends on the platform you use, and the compiler you use.
|
||||||
|
|
||||||
A. Visual C++
|
A. Visual C++
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
1) Run `nmake -f NTMakefile'.
|
1) Run `nmake -f NTMakefile'.
|
||||||
|
|
||||||
B. Borland C++
|
B. Borland C++
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
1) Run `make -f BorMakefile'.
|
1) Run `make -f BorMakefile'.
|
||||||
|
|
||||||
C. Open Watcom
|
C. Open Watcom
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
1) Run `wmake -f WatMakefile'.
|
1) Run `wmake -f WatMakefile'.
|
||||||
|
|
||||||
D. MinGW-w64/GCC/Clang
|
D. MinGW-w64/GCC/Clang
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
1) Determine if you need Vulkan and/or OpenGL.
|
1) Determine if you need Vulkan and/or OpenGL.
|
||||||
|
|
||||||
2) Run `./Makefile.pl'.
|
2) Run `./Makefile.pl'.
|
||||||
For help, run `./Makefile.pl --help'.
|
For help, run `./Makefile.pl --help'.
|
||||||
|
|
||||||
3) Run `make'.
|
3) Run `make'.
|
||||||
|
|
||||||
-- Nishi (nishi@nishi.boats)
|
-- Nishi (nishi@nishi.boats)
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,9 @@
|
||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
|
|
||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
|
|
||||||
#import <Foundation/NSGeometry.h>
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <Foundation/NSGeometry.h>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#import <CoreServices/CoreServices.h>
|
#import <CoreServices/CoreServices.h>
|
||||||
|
|
@ -23,97 +22,104 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface MilskoCocoaPixmap : NSObject {
|
@interface MilskoCocoaPixmap : NSObject {
|
||||||
int width;
|
MwBool valid;
|
||||||
int height;
|
int width;
|
||||||
NSData* data;
|
int height;
|
||||||
NSImage* image;
|
NSData *data;
|
||||||
|
NSImage *image;
|
||||||
|
NSBitmapImageRep *rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (MilskoCocoaPixmap*)newWithWidth:(int)width height:(int)height;
|
+ (MilskoCocoaPixmap *)newWithWidth:(int)width height:(int)height;
|
||||||
- (void)updateWithData:(void*)data;
|
- (void)updateWithData:(unsigned char *)data;
|
||||||
- (void)destroy;
|
- (void)destroy;
|
||||||
|
|
||||||
/* using @property to create instance variables fucks up 10.4 gcc for some reason? */
|
/* using @property to create instance variables fucks up 10.4 gcc for some
|
||||||
- (NSImage*)image;
|
* reason? */
|
||||||
|
- (NSImage *)image;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MilskoCocoaView : NSView {
|
@interface MilskoCocoaView : NSView {
|
||||||
CGContextRef cg;
|
NSBitmapImageRep *rep;
|
||||||
CGColorSpaceRef space;
|
NSGraphicsContext *context;
|
||||||
CGDataProviderRef provider;
|
MwBool valid;
|
||||||
MwU32* buf;
|
CGColorSpaceRef space;
|
||||||
float width;
|
CGDataProviderRef provider;
|
||||||
float height;
|
unsigned char *buf;
|
||||||
|
float width;
|
||||||
|
float height;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGContextRef)context;
|
- (NSGraphicsContext *)context;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MilskoCocoa : NSObject {
|
@interface MilskoCocoa : NSObject {
|
||||||
NSApplication* application;
|
NSApplication *application;
|
||||||
NSWindow* window;
|
NSEvent *lastEvent;
|
||||||
NSRect rect;
|
NSWindow *window;
|
||||||
MilskoCocoaView* view;
|
NSRect rect;
|
||||||
|
MilskoCocoaView *view;
|
||||||
|
MwLL parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (MilskoCocoa*)newWithParent:(MwLL)parent
|
+ (MilskoCocoa *)newWithParent:(MwLL)parent
|
||||||
x:(int)x
|
x:(int)x
|
||||||
y:(int)y
|
y:(int)y
|
||||||
width:(int)width
|
width:(int)width
|
||||||
height:(int)height;
|
height:(int)height;
|
||||||
- (void)polygonWithPoints:(MwPoint*)points
|
- (void)polygonWithPoints:(MwPoint *)points
|
||||||
points_count:(int)points_count
|
points_count:(int)points_count
|
||||||
color:(MwLLColor)color;
|
color:(MwLLColor)color;
|
||||||
- (void)lineWithPoints:(MwPoint*)points color:(MwLLColor)color;
|
- (void)lineWithPoints:(MwPoint *)points color:(MwLLColor)color;
|
||||||
- (void)getX:(int*)x Y:(int*)y W:(unsigned int*)w H:(unsigned int*)h;
|
- (void)getX:(int *)x Y:(int *)y W:(unsigned int *)w H:(unsigned int *)h;
|
||||||
- (void)setX:(int)x Y:(int)y;
|
- (void)setX:(int)x Y:(int)y;
|
||||||
- (void)setW:(int)w H:(int)h;
|
- (void)setW:(int)w H:(int)h;
|
||||||
- (int)pending;
|
- (int)pending;
|
||||||
- (void)getNextEvent;
|
- (void)getNextEvent;
|
||||||
- (void)setTitle:(const char*)title;
|
- (void)setTitle:(const char *)title;
|
||||||
- (void)drawPixmap:(MwLLPixmap)pixmap rect:(MwRect*)rect;
|
- (void)drawPixmap:(MwLLPixmap)pixmap rect:(MwRect *)rect;
|
||||||
- (void)setIcon:(MwLLPixmap)pixmap;
|
- (void)setIcon:(MwLLPixmap)pixmap;
|
||||||
- (void)forceRender;
|
- (void)forceRender;
|
||||||
- (void)setCursor:(MwCursor*)image mask:(MwCursor*)mask;
|
- (void)setCursor:(MwCursor *)image mask:(MwCursor *)mask;
|
||||||
- (void)detachWithPoint:(MwPoint*)point;
|
- (void)detachWithPoint:(MwPoint *)point;
|
||||||
- (void)show:(int)show;
|
- (void)show:(int)show;
|
||||||
- (void)makePopupWithParent:(MwLL)parent;
|
- (void)makePopupWithParent:(MwLL)parent;
|
||||||
- (void)setSizeHintsWithMinX:(int)minx
|
- (void)setSizeHintsWithMinX:(int)minx
|
||||||
MinY:(int)miny
|
MinY:(int)miny
|
||||||
MaxX:(int)maxx
|
MaxX:(int)maxx
|
||||||
MaxY:(int)maxy;
|
MaxY:(int)maxy;
|
||||||
- (void)makeBorderless:(int)toggle;
|
- (void)makeBorderless:(int)toggle;
|
||||||
- (void)focus;
|
- (void)focus;
|
||||||
- (void)grabPointer:(int)toggle;
|
- (void)grabPointer:(int)toggle;
|
||||||
- (void)setClipboard:(const char*)text;
|
- (void)setClipboard:(const char *)text;
|
||||||
- (void)makeToolWindow;
|
- (void)makeToolWindow;
|
||||||
- (void)getCursorCoord:(MwPoint*)point;
|
- (void)getCursorCoord:(MwPoint *)point;
|
||||||
- (void)getScreenSize:(MwRect*)rect;
|
- (void)getScreenSize:(MwRect *)rect;
|
||||||
- (void)destroy;
|
- (void)destroy;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
#define OBJC(x) x
|
#define OBJC(x) x
|
||||||
#else
|
#else
|
||||||
#define OBJC(x) void*
|
#define OBJC(x) void *
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MWDECL int MwLLCocoaCallInit(void);
|
MWDECL int MwLLCocoaCallInit(void);
|
||||||
|
|
||||||
struct _MwLLCocoa {
|
struct _MwLLCocoa {
|
||||||
struct _MwLLCommon common;
|
struct _MwLLCommon common;
|
||||||
OBJC(MilskoCocoa*)
|
OBJC(MilskoCocoa *)
|
||||||
real;
|
real;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MwLLCocoaColor {
|
struct _MwLLCocoaColor {
|
||||||
struct _MwLLCommonColor common;
|
struct _MwLLCommonColor common;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MwLLCocoaPixmap {
|
struct _MwLLCocoaPixmap {
|
||||||
struct _MwLLCommonPixmap common;
|
struct _MwLLCommonPixmap common;
|
||||||
OBJC(MilskoCocoaPixmap*)
|
OBJC(MilskoCocoaPixmap *)
|
||||||
real;
|
real;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,490 +1,547 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <AppKit/NSGraphicsContext.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "../../external/stb_ds.h"
|
|
||||||
|
|
||||||
@implementation MilskoCocoaPixmap
|
@implementation MilskoCocoaPixmap
|
||||||
|
|
||||||
+ (MilskoCocoaPixmap*)newWithWidth:(int)width height:(int)height {
|
+ (MilskoCocoaPixmap *)newWithWidth:(int)width height:(int)height {
|
||||||
MilskoCocoaPixmap* p = [MilskoCocoaPixmap alloc];
|
MilskoCocoaPixmap *p = [MilskoCocoaPixmap alloc];
|
||||||
|
|
||||||
p->width = width;
|
p->width = width;
|
||||||
p->height = height;
|
p->height = height;
|
||||||
p->data = NULL;
|
p->data = NULL;
|
||||||
p->image = NULL;
|
p->image = NULL;
|
||||||
|
return p;
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
- (void)updateWithData:(void*)_data {
|
- (void)updateWithData:(unsigned char *)_data {
|
||||||
[self destroy];
|
[self destroy];
|
||||||
|
|
||||||
self->data = [NSData dataWithBytes:_data length:self->width * self->height * 4];
|
self->rep =
|
||||||
self->image = [[NSImage alloc] initWithData:self->data];
|
[[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];
|
||||||
}
|
}
|
||||||
- (void)destroy {
|
- (void)destroy {
|
||||||
if(self->data != NULL) {
|
if (self->data != NULL) {
|
||||||
[self->data dealloc];
|
[self->data dealloc];
|
||||||
}
|
}
|
||||||
if(self->image != NULL) {
|
if (self->image != NULL) {
|
||||||
[self->image dealloc];
|
[self->image dealloc];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
- (NSImage*)image {
|
- (NSImage *)image {
|
||||||
return self->image;
|
return self->image;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MilskoCocoa
|
@implementation MilskoCocoa
|
||||||
|
|
||||||
+ (MilskoCocoa*)newWithParent:(MwLL)parent
|
+ (MilskoCocoa *)newWithParent:(MwLL)parent
|
||||||
x:(int)x
|
x:(int)x
|
||||||
y:(int)y
|
y:(int)y
|
||||||
width:(int)width
|
width:(int)width
|
||||||
height:(int)height {
|
height:(int)height {
|
||||||
MilskoCocoa* c = [MilskoCocoa alloc];
|
MilskoCocoa *c = [MilskoCocoa alloc];
|
||||||
bool centerX = false, centerY = false;
|
bool centerX = false, centerY = false;
|
||||||
|
|
||||||
if(x == MwDEFAULT) {
|
if (x == MwDEFAULT) {
|
||||||
x = 0;
|
x = 0;
|
||||||
centerX = true;
|
centerX = true;
|
||||||
}
|
}
|
||||||
if(y == MwDEFAULT) {
|
if (y == MwDEFAULT) {
|
||||||
y = 0;
|
y = 0;
|
||||||
centerY = true;
|
centerY = true;
|
||||||
}
|
}
|
||||||
c->application = [NSApplication sharedApplication];
|
c->application = [NSApplication sharedApplication];
|
||||||
|
|
||||||
c->rect = NSMakeRect(x, y, width, height);
|
c->rect = NSMakeRect(x, y, width, height);
|
||||||
|
|
||||||
c->window = [[NSWindow alloc]
|
if (parent == NULL) {
|
||||||
initWithContentRect:c->rect
|
c->window = [[NSWindow alloc]
|
||||||
styleMask:parent == NULL
|
initWithContentRect:c->rect
|
||||||
? (NSTitledWindowMask | NSClosableWindowMask |
|
styleMask:(NSTitledWindowMask | NSClosableWindowMask |
|
||||||
NSMiniaturizableWindowMask |
|
NSMiniaturizableWindowMask | NSResizableWindowMask)
|
||||||
NSResizableWindowMask)
|
backing:NSBackingStoreBuffered
|
||||||
: NSBorderlessWindowMask
|
defer:NO];
|
||||||
backing:NSBackingStoreBuffered
|
} else {
|
||||||
defer:NO];
|
NSWindow *parentWindow = parent->cocoa.real->window;
|
||||||
[c->window makeKeyAndOrderFront:c->application];
|
|
||||||
|
|
||||||
if(parent != NULL) {
|
c->rect = [parentWindow frameRectForContentRect:c->rect];
|
||||||
MilskoCocoa* p = parent->cocoa.real;
|
c->rect.origin.y =
|
||||||
[p->window addChildWindow:c->window ordered:NSWindowAbove];
|
y -
|
||||||
} else {
|
[parentWindow contentRectForFrameRect:parentWindow.frame].size.height;
|
||||||
[c->application activateIgnoringOtherApps:true];
|
|
||||||
}
|
|
||||||
|
|
||||||
c->view = [[MilskoCocoaView alloc] initWithFrame:c->rect];
|
c->window = [[NSWindow alloc] initWithContentRect:c->rect
|
||||||
[c->window setContentView:c->view];
|
styleMask:NSBorderlessWindowMask
|
||||||
|
backing:NSBackingStoreBuffered
|
||||||
|
defer:NO];
|
||||||
|
}
|
||||||
|
|
||||||
return c;
|
[c->window makeKeyAndOrderFront:c->application];
|
||||||
|
|
||||||
|
if (parent != NULL) {
|
||||||
|
MilskoCocoa *p = parent->cocoa.real;
|
||||||
|
[p->window addChildWindow:c->window ordered:NSWindowAbove];
|
||||||
|
} else {
|
||||||
|
[c->application activateIgnoringOtherApps:true];
|
||||||
|
}
|
||||||
|
|
||||||
|
c->view = [[MilskoCocoaView alloc] initWithFrame:c->rect];
|
||||||
|
[c->window setContentView:c->view];
|
||||||
|
|
||||||
|
c->parent = parent;
|
||||||
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
- (void)polygonWithPoints:(MwPoint*)points
|
- (void)polygonWithPoints:(MwPoint *)points
|
||||||
points_count:(int)points_count
|
points_count:(int)points_count
|
||||||
color:(MwLLColor)color {
|
color:(MwLLColor)color {
|
||||||
int i;
|
int i;
|
||||||
CGContextRef cg = [self->view context];
|
CGContextRef cg = [self->view context];
|
||||||
|
|
||||||
CGContextSetRGBFillColor(cg, color->common.red / 255., color->common.blue / 255., color->common.green / 255., 1);
|
[self->view lockFocus];
|
||||||
CGContextBeginPath(cg);
|
|
||||||
for(i = 0; i < points_count; i++) {
|
|
||||||
CGContextMoveToPoint(cg, points[i].x, points[i].y);
|
|
||||||
if(i < points_count - 1) {
|
|
||||||
CGContextAddLineToPoint(cg, points[i + 1].x, points[i + 1].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CGContextFillPath(cg);
|
|
||||||
|
|
||||||
// [self->view setNeedsDisplay:true];
|
CGContextSetRGBFillColor(cg, color->common.red / 255.,
|
||||||
|
color->common.blue / 255.,
|
||||||
|
color->common.green / 255., 1);
|
||||||
|
CGContextBeginPath(cg);
|
||||||
|
for (i = 0; i < points_count; i++) {
|
||||||
|
CGContextMoveToPoint(cg, points[i].x, points[i].y);
|
||||||
|
if (i < points_count - 1) {
|
||||||
|
CGContextAddLineToPoint(cg, points[i + 1].x, points[i + 1].y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CGContextFillPath(cg);
|
||||||
|
[self->view unlockFocus];
|
||||||
|
|
||||||
|
[self->view setNeedsDisplay:true];
|
||||||
};
|
};
|
||||||
- (void)lineWithPoints:(MwPoint*)points color:(MwLLColor)color {
|
- (void)lineWithPoints:(MwPoint *)points color:(MwLLColor)color {
|
||||||
};
|
};
|
||||||
- (void)getX:(int*)x Y:(int*)y W:(unsigned int*)w H:(unsigned int*)h {
|
- (void)getX:(int *)x Y:(int *)y W:(unsigned int *)w H:(unsigned int *)h {
|
||||||
NSRect frame = [self->window frame];
|
NSRect frame = [self->window frame];
|
||||||
|
|
||||||
*x = frame.origin.x;
|
*x = frame.origin.x;
|
||||||
*y = frame.origin.y;
|
*y = frame.origin.y - frame.size.height;
|
||||||
*w = frame.size.width;
|
*w = frame.size.width;
|
||||||
*h = frame.size.height;
|
*h = frame.size.height;
|
||||||
};
|
};
|
||||||
- (void)setX:(int)x Y:(int)y {
|
- (void)setX:(int)x Y:(int)y {
|
||||||
NSPoint p;
|
NSRect frame = [self->window frame];
|
||||||
p.x = x;
|
|
||||||
p.y = y;
|
frame.origin.x = x;
|
||||||
NSRect frame = [self->window frame];
|
frame.origin.y = y;
|
||||||
frame.origin.x = x;
|
|
||||||
frame.origin.y = y;
|
if (self->parent) {
|
||||||
[self->window setFrame:frame display:YES animate:true];
|
NSWindow *parentWindow = self->parent->cocoa.real->window;
|
||||||
|
frame = [parentWindow contentRectForFrameRect:frame];
|
||||||
|
frame.origin.y =
|
||||||
|
[parentWindow contentRectForFrameRect:parentWindow.frame].size.height -
|
||||||
|
y;
|
||||||
|
}
|
||||||
|
|
||||||
|
[self->window setFrame:frame display:YES animate:false];
|
||||||
};
|
};
|
||||||
- (void)setW:(int)w H:(int)h {
|
- (void)setW:(int)w H:(int)h {
|
||||||
NSRect frame = [self->window frame];
|
NSRect frame = [self->window frame];
|
||||||
frame.size.width = w;
|
frame.size.width = w;
|
||||||
frame.size.height = h;
|
frame.size.height = h;
|
||||||
[self->window setFrame:frame display:YES animate:true];
|
|
||||||
|
if (self->parent) {
|
||||||
|
NSWindow *parentWindow = self->parent->cocoa.real->window;
|
||||||
|
// frame = [parentWindow contentRectForFrameRect:frame];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self->window setFrame:frame display:YES animate:false];
|
||||||
};
|
};
|
||||||
- (int)pending {
|
- (int)pending {
|
||||||
return 1;
|
self->lastEvent =
|
||||||
|
[self->application nextEventMatchingMask:NSAnyEventMask
|
||||||
|
untilDate:nil
|
||||||
|
inMode:NSDefaultRunLoopMode
|
||||||
|
dequeue:YES];
|
||||||
|
return self->lastEvent != NULL;
|
||||||
};
|
};
|
||||||
- (void)getNextEvent {
|
- (void)getNextEvent {
|
||||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
NSEvent* event = [self->application nextEventMatchingMask:NSAnyEventMask
|
if (self->lastEvent != nil) {
|
||||||
untilDate:nil
|
// printf("got event: %ld\n", self->lastEvent.type);
|
||||||
inMode:NSDefaultRunLoopMode
|
}
|
||||||
dequeue:YES];
|
|
||||||
|
|
||||||
if(event != nil) {
|
[self->application sendEvent:self->lastEvent];
|
||||||
printf("got event: %p\n", event);
|
|
||||||
}
|
|
||||||
|
|
||||||
[self->application sendEvent:event];
|
/* this should be in the draw functions but it's here for now for testing */
|
||||||
|
[self->view setNeedsDisplay:true];
|
||||||
|
|
||||||
/* this should be in the draw functions but it's here for now for testing */
|
[pool release];
|
||||||
[self->view setNeedsDisplay:true];
|
|
||||||
|
|
||||||
[pool release];
|
|
||||||
};
|
};
|
||||||
- (void)setTitle:(const char*)title {
|
- (void)setTitle:(const char *)title {
|
||||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
[self->window
|
[self->window
|
||||||
setTitleWithRepresentedFilename:[NSString stringWithUTF8String:title]];
|
setTitleWithRepresentedFilename:[NSString stringWithUTF8String:title]];
|
||||||
[pool release];
|
[pool release];
|
||||||
};
|
};
|
||||||
- (void)drawPixmap:(MwLLPixmap)pixmap rect:(MwRect*)_rect {
|
- (void)drawPixmap:(MwLLPixmap)pixmap rect:(MwRect *)_rect {
|
||||||
MilskoCocoaPixmap* p = pixmap->cocoa.real;
|
MilskoCocoaPixmap *p = pixmap->cocoa.real;
|
||||||
[[p image] drawAtPoint:NSMakePoint(_rect->x, _rect->y) fromRect:NSMakeRect(_rect->x, _rect->y, _rect->width, _rect->height) operation:NSCompositeClear fraction:1.0];
|
NSGraphicsContext *ctx = [self->view context];
|
||||||
|
if (ctx) {
|
||||||
|
[NSGraphicsContext saveGraphicsState];
|
||||||
|
[NSGraphicsContext setCurrentContext:ctx];
|
||||||
|
|
||||||
|
[[NSColor redColor] setFill];
|
||||||
|
[[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];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
- (void)setIcon:(MwLLPixmap)pixmap {
|
- (void)setIcon:(MwLLPixmap)pixmap {
|
||||||
};
|
};
|
||||||
- (void)forceRender {
|
- (void)forceRender {
|
||||||
};
|
};
|
||||||
- (void)setCursor:(MwCursor*)image mask:(MwCursor*)mask {
|
- (void)setCursor:(MwCursor *)image mask:(MwCursor *)mask {
|
||||||
};
|
};
|
||||||
- (void)detachWithPoint:(MwPoint*)point {
|
- (void)detachWithPoint:(MwPoint *)point {
|
||||||
};
|
};
|
||||||
- (void)show:(int)show {
|
- (void)show:(int)show {
|
||||||
};
|
};
|
||||||
- (void)makePopupWithParent:(MwLL)parent {
|
- (void)makePopupWithParent:(MwLL)parent {
|
||||||
};
|
};
|
||||||
- (void)setSizeHintsWithMinX:(int)minx
|
- (void)setSizeHintsWithMinX:(int)minx
|
||||||
MinY:(int)miny
|
MinY:(int)miny
|
||||||
MaxX:(int)maxx
|
MaxX:(int)maxx
|
||||||
MaxY:(int)maxy {
|
MaxY:(int)maxy {
|
||||||
};
|
};
|
||||||
- (void)makeBorderless:(int)toggle {
|
- (void)makeBorderless:(int)toggle {
|
||||||
MwU32 mask = [self->window styleMask];
|
MwU32 mask = [self->window styleMask];
|
||||||
if(mask & NSBorderlessWindowMask) {
|
if (mask & NSBorderlessWindowMask) {
|
||||||
mask ^= NSBorderlessWindowMask;
|
mask ^= NSBorderlessWindowMask;
|
||||||
mask |= NSTitledWindowMask;
|
mask |= NSTitledWindowMask;
|
||||||
} else {
|
} else {
|
||||||
mask |= NSBorderlessWindowMask;
|
mask |= NSBorderlessWindowMask;
|
||||||
mask ^= NSTitledWindowMask;
|
mask ^= NSTitledWindowMask;
|
||||||
}
|
}
|
||||||
[self->window initWithContentRect:self->rect
|
[self->window initWithContentRect:self->rect
|
||||||
styleMask:mask
|
styleMask:mask
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:NO];
|
defer:NO];
|
||||||
};
|
};
|
||||||
- (void)focus {
|
- (void)focus {
|
||||||
[self->window makeMainWindow];
|
[self->window makeMainWindow];
|
||||||
};
|
};
|
||||||
- (void)grabPointer:(int)toggle {
|
- (void)grabPointer:(int)toggle {
|
||||||
/* MacOS didn't have a "pointer grab" function until 10.13.2 so I need to do
|
/* MacOS didn't have a "pointer grab" function until 10.13.2 so I need to do
|
||||||
* this manually */
|
* this manually */
|
||||||
};
|
};
|
||||||
- (void)setClipboard:(const char*)text {
|
- (void)setClipboard:(const char *)text {
|
||||||
};
|
};
|
||||||
- (void)getClipboard {
|
- (void)getClipboard {
|
||||||
};
|
};
|
||||||
- (void)makeToolWindow {
|
- (void)makeToolWindow {
|
||||||
};
|
};
|
||||||
- (void)getCursorCoord:(MwPoint*)point {
|
- (void)getCursorCoord:(MwPoint *)point {
|
||||||
NSPoint p = [NSEvent mouseLocation];
|
NSPoint p = [NSEvent mouseLocation];
|
||||||
point->x = p.x;
|
point->x = p.x;
|
||||||
point->y = p.y;
|
point->y = p.y;
|
||||||
};
|
};
|
||||||
- (void)getScreenSize:(MwRect*)_rect {
|
- (void)getScreenSize:(MwRect *)_rect {
|
||||||
NSScreen* screen = [self->window screen];
|
NSScreen *screen = [self->window screen];
|
||||||
_rect->x = [screen frame].origin.x;
|
_rect->x = [screen frame].origin.x;
|
||||||
_rect->y = [screen frame].origin.y;
|
_rect->y = [screen frame].origin.y;
|
||||||
_rect->width = [screen frame].size.width;
|
_rect->width = [screen frame].size.width;
|
||||||
_rect->height = [screen frame].size.height;
|
_rect->height = [screen frame].size.height;
|
||||||
};
|
};
|
||||||
- (void)destroy {
|
- (void)destroy {
|
||||||
[self->window dealloc];
|
[self->window dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MilskoCocoaView
|
@implementation MilskoCocoaView
|
||||||
- (id)initWithFrame:(NSRect)frame {
|
- (id)initWithFrame:(NSRect)frame {
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
self->width = frame.size.width;
|
self->width = frame.size.width;
|
||||||
self->height = frame.size.height;
|
self->height = frame.size.height;
|
||||||
self->buf = malloc(self->width * self->height * 4);
|
self->buf = malloc(self->width * self->height * 4);
|
||||||
self->space = CGColorSpaceCreateDeviceRGB();
|
self->space = CGColorSpaceCreateDeviceRGB();
|
||||||
self->cg = CGBitmapContextCreate(self->buf,
|
|
||||||
self->width,
|
if (width == 0 || height == 0) {
|
||||||
self->height,
|
self->rep = NULL;
|
||||||
CHAR_BIT,
|
self->context = NULL;
|
||||||
self->width * sizeof(MwU32),
|
} else {
|
||||||
self->space, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedLast);
|
self->rep =
|
||||||
assert(self->cg);
|
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||||
printf("%p\n", self->cg);
|
pixelsWide:width
|
||||||
return self;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGContextRef)context {
|
- (NSGraphicsContext *)context {
|
||||||
return self->cg;
|
return self->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)dirtyRect {
|
- (void)drawRect:(NSRect)dirtyRect {
|
||||||
[super drawRect:dirtyRect];
|
[super drawRect:dirtyRect];
|
||||||
if(self) {
|
if (!self->rep) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[self->rep drawInRect:NSMakeRect(0, 0, self->width, self->height)];
|
||||||
|
|
||||||
CGImageRef img = CGBitmapContextCreateImage(self->cg);
|
unsigned char *pixels = [self->rep bitmapData];
|
||||||
if(!img) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
printf("printed image\n");
|
|
||||||
|
|
||||||
CGContextDrawImage([[NSGraphicsContext currentContext] graphicsPort], CGRectMake(0, 0, self->width, self->height), img);
|
|
||||||
CGImageRelease(img);
|
|
||||||
}
|
|
||||||
// printf("%0.2f %0.2f %0.2f %0.2f\n", dirtyRect.origin.x, dirtyRect.origin.y, dirtyRect.size.width, dirtyRect.size.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)destroy {
|
- (void)destroy {
|
||||||
free(self->buf);
|
free(self->buf);
|
||||||
CGContextRelease(self->cg);
|
CGColorSpaceRelease(self->space);
|
||||||
CGColorSpaceRelease(self->space);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
||||||
MwLL r;
|
MwLL r;
|
||||||
(void)x;
|
(void)x;
|
||||||
(void)y;
|
(void)y;
|
||||||
(void)width;
|
(void)width;
|
||||||
(void)height;
|
(void)height;
|
||||||
|
|
||||||
r = malloc(sizeof(*r));
|
r = malloc(sizeof(*r));
|
||||||
|
|
||||||
MwLLCreateCommon(r);
|
MwLLCreateCommon(r);
|
||||||
|
|
||||||
MilskoCocoa* o =
|
MilskoCocoa *o =
|
||||||
[MilskoCocoa newWithParent:parent
|
[MilskoCocoa newWithParent:parent x:x y:y width:width height:height];
|
||||||
x:x
|
r->cocoa.real = o;
|
||||||
y:y
|
|
||||||
width:width
|
|
||||||
height:height];
|
|
||||||
r->cocoa.real = o;
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLDestroyImpl(MwLL handle) {
|
static void MwLLDestroyImpl(MwLL handle) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
|
|
||||||
[h destroy];
|
[h destroy];
|
||||||
|
|
||||||
MwLLDestroyCommon(handle);
|
MwLLDestroyCommon(handle);
|
||||||
|
|
||||||
free(handle);
|
free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLBeginDrawImpl(MwLL handle) {
|
static void MwLLBeginDrawImpl(MwLL handle) { (void)handle; }
|
||||||
(void)handle;
|
|
||||||
|
static void MwLLEndDrawImpl(MwLL handle) { (void)handle; }
|
||||||
|
|
||||||
|
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];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLEndDrawImpl(MwLL handle) {
|
static void MwLLLineImpl(MwLL handle, MwPoint *points, MwLLColor color) {
|
||||||
(void)handle;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
}
|
[h lineWithPoints:points color:color];
|
||||||
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
|
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
|
||||||
[h lineWithPoints:points color:color];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
||||||
MwLLColor c = malloc(sizeof(*c));
|
MwLLColor c = malloc(sizeof(*c));
|
||||||
MwLLColorUpdate(handle, c, r, g, b);
|
MwLLColorUpdate(handle, c, r, g, b);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||||
(void)handle;
|
(void)handle;
|
||||||
|
|
||||||
c->common.red = r;
|
c->common.red = r;
|
||||||
c->common.green = g;
|
c->common.green = g;
|
||||||
c->common.blue = b;
|
c->common.blue = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLGetXYWHImpl(MwLL handle, int* x, int* y, unsigned int* w,
|
static void MwLLGetXYWHImpl(MwLL handle, int *x, int *y, unsigned int *w,
|
||||||
unsigned int* height) {
|
unsigned int *height) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h getX:x Y:y W:w H:height];
|
[h getX:x Y:y W:w H:height];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h setX:x Y:y];
|
[h setX:x Y:y];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetWHImpl(MwLL handle, int w, int height) {
|
static void MwLLSetWHImpl(MwLL handle, int w, int height) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h setW:w H:height];
|
[h setW:w H:height];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLFreeColorImpl(MwLLColor color) {
|
static void MwLLFreeColorImpl(MwLLColor color) { free(color); }
|
||||||
free(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int MwLLPendingImpl(MwLL handle) {
|
static int MwLLPendingImpl(MwLL handle) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
return [h pending];
|
if ([h pending]) {
|
||||||
|
MwLLDispatch(handle, draw, NULL);
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLNextEventImpl(MwLL handle) {
|
static void MwLLNextEventImpl(MwLL handle) {
|
||||||
|
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h getNextEvent];
|
[h getNextEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetTitleImpl(MwLL handle, const char* title) {
|
static void MwLLSetTitleImpl(MwLL handle, const char *title) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h setTitle:title];
|
[h setTitle:title];
|
||||||
}
|
}
|
||||||
|
|
||||||
static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data,
|
static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char *data,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
(void)handle;
|
(void)handle;
|
||||||
|
|
||||||
MwLLPixmap r = malloc(sizeof(*r));
|
MwLLPixmap r = malloc(sizeof(*r));
|
||||||
|
|
||||||
r->common.raw = malloc(4 * width * height);
|
r->common.raw = malloc(4 * width * height);
|
||||||
memcpy(r->common.raw, data, 4 * width * height);
|
memcpy(r->common.raw, data, 4 * width * height);
|
||||||
|
|
||||||
r->common.width = width;
|
r->common.width = width;
|
||||||
r->common.height = height;
|
r->common.height = height;
|
||||||
|
|
||||||
r->cocoa.real = [MilskoCocoaPixmap newWithWidth:width height:height];
|
r->cocoa.real = [MilskoCocoaPixmap newWithWidth:width height:height];
|
||||||
|
|
||||||
MwLLPixmapUpdate(r);
|
MwLLPixmapUpdate(r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLPixmapUpdateImpl(MwLLPixmap pixmap) {
|
static void MwLLPixmapUpdateImpl(MwLLPixmap pixmap) {
|
||||||
MilskoCocoaPixmap* p = pixmap->cocoa.real;
|
MilskoCocoaPixmap *p = pixmap->cocoa.real;
|
||||||
[p updateWithData:pixmap->common.raw];
|
[p updateWithData:pixmap->common.raw];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
||||||
MilskoCocoaPixmap* p = pixmap->cocoa.real;
|
MilskoCocoaPixmap *p = pixmap->cocoa.real;
|
||||||
[p destroy];
|
[p destroy];
|
||||||
free(pixmap);
|
free(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
static void MwLLDrawPixmapImpl(MwLL handle, MwRect *rect, MwLLPixmap pixmap) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h drawPixmap:pixmap rect:rect];
|
[h drawPixmap:pixmap rect:rect];
|
||||||
|
MwLLForceRender(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h setIcon:pixmap];
|
[h setIcon:pixmap];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLForceRenderImpl(MwLL handle) {
|
static void MwLLForceRenderImpl(MwLL handle) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h forceRender];
|
[h forceRender];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
static void MwLLSetCursorImpl(MwLL handle, MwCursor *image, MwCursor *mask) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h setCursor:image mask:mask];
|
[h setCursor:image mask:mask];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
|
static void MwLLDetachImpl(MwLL handle, MwPoint *point) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h detachWithPoint:point];
|
[h detachWithPoint:point];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLShowImpl(MwLL handle, int show) {
|
static void MwLLShowImpl(MwLL handle, int show) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h show:show];
|
[h show:show];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLMakePopupImpl(MwLL handle, MwLL parent) {
|
static void MwLLMakePopupImpl(MwLL handle, MwLL parent) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h makePopupWithParent:parent];
|
[h makePopupWithParent:parent];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx,
|
static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx,
|
||||||
int maxy) {
|
int maxy) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h setSizeHintsWithMinX:minx MinY:miny MaxX:maxx MaxY:maxy];
|
[h setSizeHintsWithMinX:minx MinY:miny MaxX:maxx MaxY:maxy];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLMakeBorderlessImpl(MwLL handle, int toggle) {
|
static void MwLLMakeBorderlessImpl(MwLL handle, int toggle) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h makeBorderless:toggle];
|
[h makeBorderless:toggle];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLFocusImpl(MwLL handle) {
|
static void MwLLFocusImpl(MwLL handle) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h focus];
|
[h focus];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLGrabPointerImpl(MwLL handle, int toggle) {
|
static void MwLLGrabPointerImpl(MwLL handle, int toggle) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h grabPointer:toggle];
|
[h grabPointer:toggle];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetClipboardImpl(MwLL handle, const char* text) {
|
static void MwLLSetClipboardImpl(MwLL handle, const char *text) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h setClipboard:text];
|
[h setClipboard:text];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLGetClipboardImpl(MwLL handle) {
|
static void MwLLGetClipboardImpl(MwLL handle) { (void)handle; }
|
||||||
(void)handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MwLLMakeToolWindowImpl(MwLL handle) {
|
static void MwLLMakeToolWindowImpl(MwLL handle) {
|
||||||
|
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h makeToolWindow];
|
[h makeToolWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
|
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint *point) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h getCursorCoord:point];
|
[h getCursorCoord:point];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) {
|
static void MwLLGetScreenSizeImpl(MwLL handle, MwRect *rect) {
|
||||||
MilskoCocoa* h = handle->cocoa.real;
|
MilskoCocoa *h = handle->cocoa.real;
|
||||||
[h getScreenSize:rect];
|
[h getScreenSize:rect];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLBeginStateChangeImpl(MwLL handle) {
|
static void MwLLBeginStateChangeImpl(MwLL handle) { MwLLShow(handle, 0); }
|
||||||
MwLLShow(handle, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MwLLEndStateChangeImpl(MwLL handle) {
|
static void MwLLEndStateChangeImpl(MwLL handle) { MwLLShow(handle, 1); }
|
||||||
MwLLShow(handle, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int MwLLCocoaCallInitImpl(void) {
|
static int MwLLCocoaCallInitImpl(void) { return 0; }
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "call.c"
|
#include "call.c"
|
||||||
CALL(Cocoa);
|
CALL(Cocoa);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue