links to gnustep but doesn't run
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoI_xD 2026-04-13 20:07:00 -07:00
commit 9283455cb9
4 changed files with 34 additions and 33 deletions

2
configure vendored
View file

@ -146,8 +146,6 @@ foreach my $l (@ARGV) {
} }
} }
if (-f "./pl/ostype/${target}.pl") { if (-f "./pl/ostype/${target}.pl") {
require("./pl/ostype/${target}.pl"); require("./pl/ostype/${target}.pl");
} }

View file

@ -23,9 +23,9 @@
// Note: implements NSApplicationDelegate // Note: implements NSApplicationDelegate
@interface MilskoCocoaApplicationDelegate : NSObject { @interface MilskoCocoaApplicationDelegate : NSObject {
NSApplication* appl; MilskoCocoaApplication* appl;
} }
- (MilskoCocoaApplicationDelegate*)initWithAppl:(NSApplication*)appl; - (MilskoCocoaApplicationDelegate*)initWithAppl:(MilskoCocoaApplication*)appl;
@end @end
@interface MilskoCocoaWindow : NSWindow { @interface MilskoCocoaWindow : NSWindow {
@ -36,7 +36,7 @@
@interface MilskoCocoaWindowDelegate : NSObject { @interface MilskoCocoaWindowDelegate : NSObject {
NSWindow* w; NSWindow* w;
} }
- (MilskoCocoaWindowDelegate*)initWithWin:(MilskoCocoaWindow*)win; - (MilskoCocoaWindowDelegate*)initWithWin:(NSWindow*)win;
@end @end
/* /*
@ -103,16 +103,16 @@
@end @end
@interface MilskoCocoa : NSObject { @interface MilskoCocoa : NSObject {
NSApplication* application; MilskoCocoaApplication* application;
MwBool _forceRender; MwBool _forceRender;
MwBool _eventsPending; MwBool _eventsPending;
MilskoCocoaWindow* window; NSWindow* window;
NSRect rect; NSRect rect;
MilskoCocoaView* view; MilskoCocoaView* view;
MwLL parent; MwLL parent;
MilskoFakePointer* handle; MilskoFakePointer* handle;
unsigned int strHash; unsigned int strHash;
NSEvent* lastEvent; NSEvent* lastEvent;
MilskoCocoaPixmap* cursorPixmap; MilskoCocoaPixmap* cursorPixmap;
NSCursor* cursor; NSCursor* cursor;
@ -163,14 +163,13 @@
- (MwLL)getParent; - (MwLL)getParent;
- (NSView*)getView; - (NSView*)getView;
- (MilskoCocoaWindow*)getWindow; - (NSWindow*)getWindow;
- (void)nudge; - (void)nudge;
- (void)pushCursor; - (void)pushCursor;
- (void)popCursor; - (void)popCursor;
- (MilskoFakePointer*)getHandle; - (MilskoFakePointer*)getHandle;
+ (void)eventCanceller:(MilskoCocoa*)this;
@end @end
#define OBJC(x) x #define OBJC(x) x

View file

@ -57,9 +57,10 @@ if (grep(/^cocoa$/, @backends) || param_get("gnustep")) {
new_object("src/backend/cocoa.m"); new_object("src/backend/cocoa.m");
if(param_get("gnustep")){ if(param_get("gnustep")){
add_incdir2("-I/usr/GNUstep/System/Library/Headers"); add_incdir("-I".`gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS`);
add_libdir("-L/usr/GNUstep/System/Library/Libraries"); add_libdir("-L".`gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES`);
add_ldflags("-fblocks -lobjc -lgnustep-base -lm -lgnustep-gui"); add_cflags("-fobjc-runtime=gnustep-2.0 -fblocks");
add_ldflags("-lobjc -lgnustep-base -lm -lgnustep-gui");
} }
if (param_get("opengl")) { if (param_get("opengl")) {

View file

@ -136,8 +136,9 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
handle:(MwLL)r { handle:(MwLL)r {
MilskoCocoa* c = [MilskoCocoa alloc]; MilskoCocoa* c = [MilskoCocoa alloc];
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[c retain]; [c retain];
c->application = (MilskoCocoaApplication*)[MilskoCocoaApplication sharedApplication];
[c->application retain];
/* /*
* MacOS doesn't really have a "default" window position, you're actually * MacOS doesn't really have a "default" window position, you're actually
@ -151,11 +152,10 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
y = r ? ([[NSScreen mainScreen] frame].size.height / 2.) - (height / 2.) y = r ? ([[NSScreen mainScreen] frame].size.height / 2.) - (height / 2.)
: 0; : 0;
} }
c->application = NSApp; c->rect = NSMakeRect(x, y, width, height);
c->rect = NSMakeRect(x, y, width, height);
if(parent == NULL) { if(parent == NULL) {
c->window = [[MilskoCocoaWindow alloc] c->window = [[NSWindow alloc]
initWithContentRect:rectFlip(c->rect) initWithContentRect:rectFlip(c->rect)
styleMask:(NSTitledWindowMask | styleMask:(NSTitledWindowMask |
NSClosableWindowMask | NSMiniaturizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask |
@ -183,6 +183,7 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
[c->application retain]; [c->application retain];
[c->view addTrackingRect:c->rect owner:c->view userData:NULL assumeInside:MwFALSE]; [c->view addTrackingRect:c->rect owner:c->view userData:NULL assumeInside:MwFALSE];
c->modalSession = [c->application beginModalSessionForWindow:c->window];
} else { } else {
MilskoCocoa* p = parent->cocoa.real; MilskoCocoa* p = parent->cocoa.real;
@ -197,6 +198,8 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
[c->view addTrackingRect:c->rect owner:c->view userData:NULL assumeInside:MwFALSE]; [c->view addTrackingRect:c->rect owner:c->view userData:NULL assumeInside:MwFALSE];
[p->view addSubview:c->view]; [p->view addSubview:c->view];
c->modalSession = p->modalSession;
} }
[c->window setAcceptsMouseMovedEvents:MwTRUE]; [c->window setAcceptsMouseMovedEvents:MwTRUE];
@ -205,8 +208,7 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
[c->handle setPointer:r]; [c->handle setPointer:r];
[c->view addSubview:c->handle]; [c->view addSubview:c->handle];
c->modalSession = [c->application beginModalSessionForWindow:c->window]; c->parent = parent;
c->parent = parent;
c->_forceRender = MwTRUE; c->_forceRender = MwTRUE;
c->strHash = 0; c->strHash = 0;
@ -350,7 +352,7 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
- (int)pending { - (int)pending {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
MwBool isPending = [self->application pending]; MwBool isPending = [self->application pending];
[NSApp runModalSession:self->modalSession]; [self->application runModalSession:self->modalSession];
[pool release]; [pool release];
return _forceRender || _eventsPending || isPending; return _forceRender || _eventsPending || isPending;
}; };
@ -954,7 +956,7 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
@end @end
@implementation MilskoCocoaApplicationDelegate @implementation MilskoCocoaApplicationDelegate
- (MilskoCocoaApplicationDelegate*)initWithAppl:(NSApplication*)_appl { - (MilskoCocoaApplicationDelegate*)initWithAppl:(MilskoCocoaApplication*)_appl {
self->appl = _appl; self->appl = _appl;
return self; return self;
} }
@ -1001,10 +1003,9 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
// This will close/terminate the application when the main window is closed. // This will close/terminate the application when the main window is closed.
- (void)windowWillClose:(NSNotification*)notification { - (void)windowWillClose:(NSNotification*)notification {
(void)notification; (void)notification;
// MilskoCocoa *window = notification.object; MilskoCocoa* window = notification.object;
// MwLL handle = [window getHandle].pointer; MwLL handle = [window getHandle].pointer;
// MwLLDispatch(handle, close, NULL); MwLLDispatch(handle, close, NULL);
[NSApp terminate:nil];
} }
- (MilskoCocoaWindowDelegate*)initWithWin:(NSWindow*)win { - (MilskoCocoaWindowDelegate*)initWithWin:(NSWindow*)win {
@ -1235,7 +1236,9 @@ static void MwLLEndStateChangeImpl(MwLL handle) {
} }
static int MwLLCocoaCallInitImpl(void) { static int MwLLCocoaCallInitImpl(void) {
[NSApplication sharedApplication]; printf("Using GNUStep Backend\n");
[MilskoCocoaApplication sharedApplication];
return 0; return 0;
} }