gnustep support?

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",
"static" => "build static library",
"wayland" => "enable wayland backend",
"gnustep" => "use gnustep",
);
my @features_keys = (
"1classic-theme", "1stb-image",
@ -73,9 +74,16 @@ my @features_keys = (
"1opengl", "2xrender",
"1vulkan", "2vulkan-string-helper",
"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) {
if ($l =~ /^--with-([^=]+)=(.+)$/) {
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") {
require("./pl/ostype/${target}.pl");

View file

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

View file

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

View file

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

View file

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

View file

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