gnustep support?
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoI_xD 2026-04-13 17:44:27 -07:00
commit a4c61b0e38
6 changed files with 38 additions and 41 deletions

17
configure vendored
View file

@ -66,6 +66,7 @@ my %features = (
"shared" => "build shared library", "shared" => "build shared library",
"static" => "build static library", "static" => "build static library",
"wayland" => "enable wayland backend", "wayland" => "enable wayland backend",
"gnustep" => "use gnustep",
); );
my @features_keys = ( my @features_keys = (
"1classic-theme", "1stb-image", "1classic-theme", "1stb-image",
@ -73,9 +74,16 @@ my @features_keys = (
"1opengl", "2xrender", "1opengl", "2xrender",
"1vulkan", "2vulkan-string-helper", "1vulkan", "2vulkan-string-helper",
"1shared", "1static", "1shared", "1static",
"1wayland", "1wayland", "1gnustep",
); );
if($target eq "Linux") {
param_set("x11", 1);
if(!param_get("tiny")){
param_set("wayland", 1);
}
}
foreach my $l (@ARGV) { foreach my $l (@ARGV) {
if ($l =~ /^--with-([^=]+)=(.+)$/) { if ($l =~ /^--with-([^=]+)=(.+)$/) {
param_set($1, $2); param_set($1, $2);
@ -138,12 +146,7 @@ foreach my $l (@ARGV) {
} }
} }
if($target eq "Linux") {
param_set("x11", 1);
if(!param_get("tiny")){
param_set("wayland", 1);
}
}
if (-f "./pl/ostype/${target}.pl") { if (-f "./pl/ostype/${target}.pl") {
require("./pl/ostype/${target}.pl"); require("./pl/ostype/${target}.pl");

View file

@ -15,12 +15,6 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <Foundation/NSGeometry.h> #import <Foundation/NSGeometry.h>
#ifdef __APPLE__
#import <CoreServices/CoreServices.h>
#else
#import <CoreGraphics/CoreGraphics.h>
#endif
@interface MilskoCocoaApplication : NSApplication { @interface MilskoCocoaApplication : NSApplication {
MwBool doPending; MwBool doPending;
} }
@ -29,9 +23,9 @@
// Note: implements NSApplicationDelegate // Note: implements NSApplicationDelegate
@interface MilskoCocoaApplicationDelegate : NSObject { @interface MilskoCocoaApplicationDelegate : NSObject {
MilskoCocoaApplication* appl; NSApplication* appl;
} }
- (MilskoCocoaApplicationDelegate*)initWithAppl:(MilskoCocoaApplication*)appl; - (MilskoCocoaApplicationDelegate*)initWithAppl:(NSApplication*)appl;
@end @end
@interface MilskoCocoaWindow : NSWindow { @interface MilskoCocoaWindow : NSWindow {
@ -40,7 +34,7 @@
// Note: implements NSWindowDelegate // Note: implements NSWindowDelegate
@interface MilskoCocoaWindowDelegate : NSObject { @interface MilskoCocoaWindowDelegate : NSObject {
MilskoCocoaWindow* w; NSWindow* w;
} }
- (MilskoCocoaWindowDelegate*)initWithWin:(MilskoCocoaWindow*)win; - (MilskoCocoaWindowDelegate*)initWithWin:(MilskoCocoaWindow*)win;
@end @end
@ -89,8 +83,6 @@
NSBitmapImageRep* rep; NSBitmapImageRep* rep;
NSGraphicsContext* context; NSGraphicsContext* context;
MwBool valid; MwBool valid;
CGColorSpaceRef space;
CGDataProviderRef provider;
NSRect givenRect; NSRect givenRect;
float x; float x;
float y; float y;
@ -111,16 +103,16 @@
@end @end
@interface MilskoCocoa : NSObject { @interface MilskoCocoa : NSObject {
MilskoCocoaApplication* application; NSApplication* application;
MwBool _forceRender; MwBool _forceRender;
MwBool _eventsPending; MwBool _eventsPending;
MilskoCocoaWindow* window; MilskoCocoaWindow* 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;

View file

@ -52,10 +52,14 @@ if (grep(/^wayland$/, @backends)) {
$gl_libs = "-lGL -lGLU"; $gl_libs = "-lGL -lGLU";
} }
if (grep(/^cocoa$/, @backends)) { if (grep(/^cocoa$/, @backends) || param_get("gnustep")) {
add_cflags("-DUSE_COCOA"); add_cflags("-DUSE_COCOA");
new_object("src/backend/cocoa.m"); new_object("src/backend/cocoa.m");
if(param_get("gnustep")){
add_ldflags("-lobjc -lgnustep-base -lm -lgnustep-gui");
}
if (param_get("opengl")) { if (param_get("opengl")) {
new_object("src/widget/opengl_cocoa.m"); new_object("src/widget/opengl_cocoa.m");
} }

View file

@ -55,7 +55,6 @@ sub new_object {
my @l = glob($_[0]); my @l = glob($_[0]);
foreach my $e (@l) { foreach my $e (@l) {
$e =~ s/\.(c|m)$/$object_suffix/; $e =~ s/\.(c|m)$/$object_suffix/;
print($e."\n");
push(@library_targets, $e); push(@library_targets, $e);
} }
} }

View file

@ -325,7 +325,7 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
if(!parent) { if(!parent) {
frame = rectFlip(frame); frame = rectFlip(frame);
[self->window setFrame:frame display:TRUE animate:TRUE]; [self->window setFrame:frame display:MwTRUE animate:MwTRUE];
} else { } else {
frame = localRectFlip(frame, parent->cocoa.real->view); frame = localRectFlip(frame, parent->cocoa.real->view);
[self->view setBounds:frame]; [self->view setBounds:frame];
@ -367,6 +367,7 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
} }
[self sendClipboardEvent]; [self sendClipboardEvent];
#ifdef __APPLE__
if(self->pointerLocked && [self->window isMainWindow] && self->lastEvent) { if(self->pointerLocked && [self->window isMainWindow] && self->lastEvent) {
struct CGPoint pos; struct CGPoint pos;
pos.x = [window frame].origin.x + [window frame].size.width / 2; pos.x = [window frame].origin.x + [window frame].size.width / 2;
@ -374,6 +375,7 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
CGWarpMouseCursorPosition(pos); CGWarpMouseCursorPosition(pos);
} }
#endif
[self->application updateWindows]; [self->application updateWindows];
}; };
@ -617,13 +619,12 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
@implementation MilskoCocoaView @implementation MilskoCocoaView
- (id)initWithFrame:(NSRect)frame { - (id)initWithFrame:(NSRect)frame {
givenRect = frame; givenRect = frame;
x = frame.origin.x; x = frame.origin.x;
y = frame.origin.y; y = frame.origin.y;
width = frame.size.width; width = frame.size.width;
height = frame.size.height; height = frame.size.height;
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
self->space = CGColorSpaceCreateDeviceRGB();
if(width == 0 || height == 0) { if(width == 0 || height == 0) {
self->rep = NULL; self->rep = NULL;
@ -701,7 +702,6 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
} }
- (void)destroy { - (void)destroy {
CGColorSpaceRelease(self->space);
[self->rep release]; [self->rep release];
[self->context release]; [self->context release];
} }

View file

@ -1280,8 +1280,7 @@ static int MwLLX11CallInitImpl(void) {
if(getenv("MILSKO_BACKEND")) { if(getenv("MILSKO_BACKEND")) {
loadX11 |= loadX11 |=
(strcmp(getenv("MILSKO_BACKEND"), "x11") == 0); (strcmp(getenv("MILSKO_BACKEND"), "x11") == 0);
} } else if(getenv("DISPLAY")) {
if(getenv("DISPLAY")) {
loadX11 |= (getenv("DISPLAY") != NULL); loadX11 |= (getenv("DISPLAY") != NULL);
} }