forked from pyrite-dev/milsko
mac: took a detour and got it working in 10.4, before accidentally fixing the remaining memory leak I think
This commit is contained in:
parent
4549e4f75b
commit
3b78872ce8
2 changed files with 871 additions and 834 deletions
|
|
@ -21,135 +21,136 @@
|
||||||
#import <CoreGraphics/CoreGraphics.h>
|
#import <CoreGraphics/CoreGraphics.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface MilskoCocoaWindowDelegate<NSWindowDelegate> : NSObject {
|
// Note: implements NSWindowDelegate
|
||||||
NSWindow *w;
|
@interface MilskoCocoaWindowDelegate : NSObject {
|
||||||
|
NSWindow* w;
|
||||||
}
|
}
|
||||||
- (instancetype)initWithWin:(NSWindow *)win;
|
- (MilskoCocoaWindowDelegate*)initWithWin:(NSWindow*)win;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MilskoFakePointer : NSView {
|
@interface MilskoFakePointer : NSView {
|
||||||
void *ptr;
|
void* ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setPointer:(void *)ptr;
|
- (void)setPointer:(void*)ptr;
|
||||||
- (void *)pointer;
|
- (void*)pointer;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MilskoCocoaPixmap : NSObject {
|
@interface MilskoCocoaPixmap : NSObject {
|
||||||
MwBool valid;
|
MwBool valid;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
unsigned char *buf;
|
unsigned char* buf;
|
||||||
NSImage *image;
|
NSImage* image;
|
||||||
NSBitmapImageRep *rep;
|
NSBitmapImageRep* rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (MilskoCocoaPixmap *)newWithWidth:(int)width height:(int)height;
|
+ (MilskoCocoaPixmap*)newWithWidth:(int)width height:(int)height;
|
||||||
- (void)updateWithData:(unsigned char *)data;
|
- (void)updateWithData:(unsigned char*)data;
|
||||||
- (void)destroy;
|
- (void)destroy;
|
||||||
|
|
||||||
/* using @property to create instance variables fucks up 10.4 gcc for some
|
/* using @property to create instance variables fucks up 10.4 gcc for some
|
||||||
* reason? */
|
* reason? */
|
||||||
- (NSImage *)image;
|
- (NSImage*)image;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MilskoCocoaView : NSView {
|
@interface MilskoCocoaView : NSView {
|
||||||
NSBitmapImageRep *rep;
|
NSBitmapImageRep* rep;
|
||||||
NSGraphicsContext *context;
|
NSGraphicsContext* context;
|
||||||
MwBool valid;
|
MwBool valid;
|
||||||
CGColorSpaceRef space;
|
CGColorSpaceRef space;
|
||||||
CGDataProviderRef provider;
|
CGDataProviderRef provider;
|
||||||
float width;
|
float width;
|
||||||
float height;
|
float height;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSGraphicsContext *)context;
|
- (NSGraphicsContext*)context;
|
||||||
- (void)destroy;
|
- (void)destroy;
|
||||||
- (NSBitmapImageRep *)getRep;
|
- (NSBitmapImageRep*)getRep;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MilskoCocoa : NSObject {
|
@interface MilskoCocoa : NSObject {
|
||||||
NSApplication *application;
|
NSApplication* application;
|
||||||
MwBool _forceRender;
|
MwBool _forceRender;
|
||||||
NSWindow *window;
|
NSWindow* window;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
MilskoCocoaView *view;
|
MilskoCocoaView* view;
|
||||||
MwLL parent;
|
MwLL parent;
|
||||||
MilskoFakePointer *handle;
|
MilskoFakePointer* handle;
|
||||||
NSUInteger strHash;
|
unsigned int strHash;
|
||||||
NSEvent *lastEvent;
|
NSEvent* lastEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (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
|
||||||
handle:(MwLL)handle;
|
handle:(MwLL)handle;
|
||||||
- (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)eventProcess:(NSEvent *)ev;
|
- (void)eventProcess:(NSEvent*)ev;
|
||||||
- (void)handleKeyEvent:(NSEvent *)ev;
|
- (void)handleKeyEvent:(NSEvent*)ev;
|
||||||
- (void)handleMouseEvent:(NSEvent *)ev ll:(MwLL)ll;
|
- (void)handleMouseEvent:(NSEvent*)ev ll:(MwLL)ll;
|
||||||
- (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;
|
||||||
- (void)sendClipboardEvent;
|
- (void)sendClipboardEvent;
|
||||||
|
|
||||||
- (NSWindow *)parentWindow;
|
- (NSWindow*)parentWindow;
|
||||||
- (NSView *)getView;
|
- (NSView*)getView;
|
||||||
- (NSWindow *)getWindow;
|
- (NSWindow*)getWindow;
|
||||||
- (MilskoFakePointer *)getHandle;
|
- (MilskoFakePointer*)getHandle;
|
||||||
|
|
||||||
@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
|
||||||
|
|
|
||||||
1474
src/backend/cocoa.m
1474
src/backend/cocoa.m
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue