mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-28 20:13:07 +00:00
appkit
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@ examples/*/*.exe
|
|||||||
*.so
|
*.so
|
||||||
*.dll
|
*.dll
|
||||||
*.lib
|
*.lib
|
||||||
|
*.dylib
|
||||||
*.a
|
*.a
|
||||||
/Makefile
|
/Makefile
|
||||||
/build
|
/build
|
||||||
|
|||||||
65
Makefile.pl
65
Makefile.pl
@@ -18,7 +18,7 @@ our $cflags = "-fPIC -D_MILSKO";
|
|||||||
our $libdir = "";
|
our $libdir = "";
|
||||||
our $ldflags = "";
|
our $ldflags = "";
|
||||||
our $math = "-lm";
|
our $math = "-lm";
|
||||||
our $shared = "-shared";
|
our @shared = "-shared";
|
||||||
our @backends = ();
|
our @backends = ();
|
||||||
|
|
||||||
our $library_prefix = "lib";
|
our $library_prefix = "lib";
|
||||||
@@ -45,6 +45,7 @@ param_set("vulkan", 0);
|
|||||||
param_set("vulkan-string-helper", 1);
|
param_set("vulkan-string-helper", 1);
|
||||||
param_set("shared", 1);
|
param_set("shared", 1);
|
||||||
param_set("static", 1);
|
param_set("static", 1);
|
||||||
|
param_set("examples", 1);
|
||||||
|
|
||||||
my %features = (
|
my %features = (
|
||||||
"classic-theme" => "use classic theme",
|
"classic-theme" => "use classic theme",
|
||||||
@@ -166,7 +167,7 @@ print(OUT "LIBDIR = ${libdir}\n");
|
|||||||
print(OUT "LDFLAGS = ${ldflags}\n");
|
print(OUT "LDFLAGS = ${ldflags}\n");
|
||||||
print(OUT "LIBS = ${math} ${libs}\n");
|
print(OUT "LIBS = ${math} ${libs}\n");
|
||||||
print(OUT "MATH = ${math}\n");
|
print(OUT "MATH = ${math}\n");
|
||||||
print(OUT "SHARED = ${shared}\n");
|
print(OUT "SHARED = @{shared}\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
print(OUT ".PHONY: all format clean distclean lib examples install\n");
|
print(OUT ".PHONY: all format clean distclean lib examples install\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
@@ -219,7 +220,13 @@ foreach my $l (@library_targets) {
|
|||||||
my $s = $l;
|
my $s = $l;
|
||||||
my $o = $object_suffix;
|
my $o = $object_suffix;
|
||||||
$o =~ s/\./\\\./g;
|
$o =~ s/\./\\\./g;
|
||||||
$s =~ s/$o$/.c/;
|
|
||||||
|
if ($l =~ /appkit/) {
|
||||||
|
$s =~ s/$o$/.m/;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$s =~ s/$o$/.c/;
|
||||||
|
}
|
||||||
|
|
||||||
if ($l =~ /^external\//) {
|
if ($l =~ /^external\//) {
|
||||||
$warn = "";
|
$warn = "";
|
||||||
@@ -230,34 +237,42 @@ foreach my $l (@library_targets) {
|
|||||||
}
|
}
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
print(OUT "examples: " . join(" ", @examples_targets) . "\n");
|
if(param_get("examples")) {
|
||||||
print(OUT "\n");
|
print(OUT "examples: " . join(" ", @examples_targets) . "\n");
|
||||||
foreach my $l (@examples_targets) {
|
print(OUT "\n");
|
||||||
my $libs = "";
|
foreach my $l (@examples_targets) {
|
||||||
my $s = $l;
|
my $libs = "";
|
||||||
my $o = $executable_suffix;
|
my $s = $l;
|
||||||
$o =~ s/\./\\\./g;
|
my $o = $executable_suffix;
|
||||||
$s =~ s/$o$//;
|
$o =~ s/\./\\\./g;
|
||||||
|
$s =~ s/$o$//;
|
||||||
|
|
||||||
if (defined($examples_libs{$l})) {
|
if (defined($examples_libs{$l})) {
|
||||||
$libs = $examples_libs{$l};
|
$libs = $examples_libs{$l};
|
||||||
}
|
}
|
||||||
|
|
||||||
print(OUT
|
print(OUT
|
||||||
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
|
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
|
||||||
);
|
);
|
||||||
print(OUT
|
if (grep(/^appkit$/, @backends)) {
|
||||||
" \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
print(OUT
|
||||||
);
|
" \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
||||||
print(OUT "${s}${object_suffix}: ${s}.c\n");
|
);
|
||||||
print(OUT
|
} else {
|
||||||
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n"
|
print(OUT
|
||||||
);
|
" \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
print(OUT "${s}${object_suffix}: ${s}.c\n");
|
||||||
|
print(OUT
|
||||||
|
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
print(OUT "clean:\n");
|
print(OUT "clean:\n");
|
||||||
print(OUT
|
print(OUT
|
||||||
" rm -f */*.o */*/*.o */*/*/*.o */*.exe */*/*.exe */*/*/*.exe src/*.so src/*.dll src/*.a "
|
" rm -f */*.o */*/*.o */*/*/*.o */*.exe */*/*.exe */*/*/*.exe src/*.so src/*.dll src/*.dylib src/*.a "
|
||||||
. join(" ", @examples_targets)
|
. join(" ", @examples_targets)
|
||||||
. "\n");
|
. "\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ enum MwLLBackends {
|
|||||||
MwLLBackendX11 = 0,
|
MwLLBackendX11 = 0,
|
||||||
MwLLBackendGDI,
|
MwLLBackendGDI,
|
||||||
MwLLBackendWayland,
|
MwLLBackendWayland,
|
||||||
|
MwLLBackendAppKit,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MwLLCommon {
|
struct _MwLLCommon {
|
||||||
@@ -61,6 +62,9 @@ struct _MwLLCommonPixmap {
|
|||||||
#ifdef USE_WAYLAND
|
#ifdef USE_WAYLAND
|
||||||
#include <Mw/LowLevel/Wayland.h>
|
#include <Mw/LowLevel/Wayland.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_APPKIT
|
||||||
|
#include <Mw/LowLevel/AppKit.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
union _MwLL {
|
union _MwLL {
|
||||||
struct _MwLLCommon common;
|
struct _MwLLCommon common;
|
||||||
@@ -73,6 +77,9 @@ union _MwLL {
|
|||||||
#ifdef USE_WAYLAND
|
#ifdef USE_WAYLAND
|
||||||
struct _MwLLWayland wayland;
|
struct _MwLLWayland wayland;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_APPKIT
|
||||||
|
struct _MwLLAppKit appkit;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
union _MwLLColor {
|
union _MwLLColor {
|
||||||
@@ -86,6 +93,9 @@ union _MwLLColor {
|
|||||||
#ifdef USE_WAYLAND
|
#ifdef USE_WAYLAND
|
||||||
struct _MwLLWaylandColor wayland;
|
struct _MwLLWaylandColor wayland;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_APPKIT
|
||||||
|
struct _MwLLAppKitColor appkit;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
union _MwLLPixmap {
|
union _MwLLPixmap {
|
||||||
@@ -99,6 +109,9 @@ union _MwLLPixmap {
|
|||||||
#ifdef USE_WAYLAND
|
#ifdef USE_WAYLAND
|
||||||
struct _MwLLWaylandPixmap wayland;
|
struct _MwLLWaylandPixmap wayland;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_APPKIT
|
||||||
|
struct _MwLLAppKitPixmap appkit;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
|
|||||||
27
include/Mw/LowLevel/AppKit.h
Normal file
27
include/Mw/LowLevel/AppKit.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*!
|
||||||
|
* @file Mw/LowLevel/AppKit.h
|
||||||
|
* @brief Work in progress AppKit Backend
|
||||||
|
* @warning This is used internally.
|
||||||
|
*/
|
||||||
|
#ifndef __MW_LOWLEVEL_APPKIT_H__
|
||||||
|
#define __MW_LOWLEVEL_APPKIT_H__
|
||||||
|
|
||||||
|
#include <Mw/MachDep.h>
|
||||||
|
#include <Mw/TypeDefs.h>
|
||||||
|
#include <Mw/LowLevel.h>
|
||||||
|
|
||||||
|
MWDECL int MwLLAppKitCallInit(void);
|
||||||
|
|
||||||
|
struct _MwLLAppKit {
|
||||||
|
struct _MwLLCommon common;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MwLLAppKitColor {
|
||||||
|
struct _MwLLCommonColor common;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MwLLAppKitPixmap {
|
||||||
|
struct _MwLLCommonPixmap common;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -43,10 +43,15 @@
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <mach/clock.h>
|
||||||
|
#include <mach/mach.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265
|
#define M_PI 3.14159265
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
8
pl/ostype/Darwin.pl
Normal file
8
pl/ostype/Darwin.pl
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
$library_suffix = ".dylib";
|
||||||
|
set_shared_flag("-dynamiclib");
|
||||||
|
|
||||||
|
use_backend("appkit");
|
||||||
|
|
||||||
|
add_cflags("-DSTBI_NO_THREAD_LOCALS");
|
||||||
|
|
||||||
|
1;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
if (param_get("experimental-wayland")) {
|
IF (param_get("experimental-wayland")) {
|
||||||
use_backend("wayland", "x11");
|
use_backend("wayland", "x11");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ if (grep(/^wayland$/, @backends)) {
|
|||||||
$gl_libs = "-lGL -lGLU";
|
$gl_libs = "-lGL -lGLU";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (grep(/^appkit$/, @backends)) {
|
||||||
|
add_cflags("-DUSE_APPKIT");
|
||||||
|
new_object("src/backend/appkit.m");
|
||||||
|
|
||||||
|
$gl_libs = "-lGL -lGLU";
|
||||||
|
}
|
||||||
|
|
||||||
if (param_get("stb-image")) {
|
if (param_get("stb-image")) {
|
||||||
add_cflags("-DUSE_STB_IMAGE");
|
add_cflags("-DUSE_STB_IMAGE");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,14 @@ sub new_example {
|
|||||||
push(@examples_targets, "${_[0]}${executable_suffix}");
|
push(@examples_targets, "${_[0]}${executable_suffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_shared_flag {
|
||||||
|
@shared = $_[0];
|
||||||
|
}
|
||||||
|
|
||||||
sub new_object {
|
sub new_object {
|
||||||
my @l = glob($_[0]);
|
my @l = glob($_[0]);
|
||||||
foreach my $e (@l) {
|
foreach my $e (@l) {
|
||||||
$e =~ s/\.c$/$object_suffix/;
|
$e =~ s/\.(c|m)$/$object_suffix/;
|
||||||
push(@library_targets, $e);
|
push(@library_targets, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ void* MwDynamicSymbol(void* handle, const char* symbol) {
|
|||||||
void MwDynamicClose(void* handle) {
|
void MwDynamicClose(void* handle) {
|
||||||
FreeLibrary(handle);
|
FreeLibrary(handle);
|
||||||
}
|
}
|
||||||
#elif defined(__unix__)
|
#elif defined(__unix__) || defined(__APPLE__)
|
||||||
void* MwDynamicOpen(const char* path) {
|
void* MwDynamicOpen(const char* path) {
|
||||||
return dlopen(path, RTLD_LOCAL | RTLD_LAZY);
|
return dlopen(path, RTLD_LOCAL | RTLD_LAZY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,47 @@
|
|||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
long MwTimeGetTick(void) {
|
long MwTimeGetTick(void) {
|
||||||
return GetTickCount();
|
return GetTickCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwTimeSleep(int ms) {
|
void MwTimeSleep(int ms) {
|
||||||
Sleep(ms);
|
Sleep(ms);
|
||||||
}
|
}
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
long MwTimeGetTick(void) {
|
||||||
|
struct timespec ts;
|
||||||
|
long n = 0;
|
||||||
|
clock_serv_t cclock;
|
||||||
|
mach_timespec_t mts;
|
||||||
|
|
||||||
|
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||||
|
clock_get_time(cclock, &mts);
|
||||||
|
mach_port_deallocate(mach_task_self(), cclock);
|
||||||
|
|
||||||
|
n += ts.tv_nsec / 1000 / 1000;
|
||||||
|
n += ts.tv_sec * 1000;
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
void MwTimeSleep(int ms) {
|
||||||
|
struct timespec ts;
|
||||||
|
|
||||||
|
ts.tv_sec = ms / 1000;
|
||||||
|
ts.tv_nsec = (ms % 1000) * 1000 * 1000;
|
||||||
|
|
||||||
|
nanosleep(&ts, NULL);
|
||||||
|
}
|
||||||
#elif defined(__unix__)
|
#elif defined(__unix__)
|
||||||
long MwTimeGetTick(void) {
|
long MwTimeGetTick(void) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
long n = 0;
|
long n = 0;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
n += ts.tv_nsec / 1000 / 1000;
|
n += ts.tv_nsec / 1000 / 1000;
|
||||||
n += ts.tv_sec * 1000;
|
n += ts.tv_sec * 1000;
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
214
src/backend/appkit.m
Normal file
214
src/backend/appkit.m
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
|
#include "../../external/stb_ds.h"
|
||||||
|
|
||||||
|
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
||||||
|
MwLL r;
|
||||||
|
(void)x;
|
||||||
|
(void)y;
|
||||||
|
(void)width;
|
||||||
|
(void)height;
|
||||||
|
|
||||||
|
r = malloc(sizeof(*r));
|
||||||
|
|
||||||
|
|
||||||
|
MwLLCreateCommon(r);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDestroyImpl(MwLL handle) {
|
||||||
|
MwLLDestroyCommon(handle);
|
||||||
|
|
||||||
|
free(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLBeginDrawImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLEndDrawImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
||||||
|
(void)points;
|
||||||
|
(void)points_count;
|
||||||
|
(void)color;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
|
||||||
|
(void)handle;
|
||||||
|
(void)points;
|
||||||
|
(void)color;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
||||||
|
MwLLColor c = malloc(sizeof(*c));
|
||||||
|
MwLLColorUpdate(handle, c, r, g, b);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||||
|
(void)handle;
|
||||||
|
|
||||||
|
c->common.red = r;
|
||||||
|
c->common.green = g;
|
||||||
|
c->common.blue = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetXYWHImpl(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) {
|
||||||
|
*x = 0;
|
||||||
|
*y = 0;
|
||||||
|
*w = 0;
|
||||||
|
*h = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
||||||
|
(void)handle;
|
||||||
|
(void)x;
|
||||||
|
(void)y;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
|
||||||
|
(void)handle;
|
||||||
|
(void)w;
|
||||||
|
(void)h;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLFreeColorImpl(MwLLColor color) {
|
||||||
|
free(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int MwLLPendingImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLNextEventImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetTitleImpl(MwLL handle, const char* title) {
|
||||||
|
(void)title;
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int width, int height) {
|
||||||
|
(void)handle;
|
||||||
|
|
||||||
|
MwLLPixmap r = malloc(sizeof(*r));
|
||||||
|
|
||||||
|
r->common.raw = malloc(4 * width * height);
|
||||||
|
memcpy(r->common.raw, data, 4 * width * height);
|
||||||
|
|
||||||
|
r->common.width = width;
|
||||||
|
r->common.height = height;
|
||||||
|
|
||||||
|
MwLLPixmapUpdate(r);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLPixmapUpdateImpl(MwLLPixmap r) {
|
||||||
|
(void)r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
||||||
|
free(pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
||||||
|
(void)handle;
|
||||||
|
(void)rect;
|
||||||
|
(void)pixmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
||||||
|
(void)handle;
|
||||||
|
(void)pixmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLForceRenderImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||||
|
(void)handle;
|
||||||
|
(void)image;
|
||||||
|
(void)mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
|
||||||
|
(void)handle;
|
||||||
|
(void)point;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLShowImpl(MwLL handle, int show) {
|
||||||
|
(void)handle;
|
||||||
|
(void)show;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLMakePopupImpl(MwLL handle, MwLL parent) {
|
||||||
|
(void)handle;
|
||||||
|
(void)parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx, int maxy) {
|
||||||
|
(void)handle;
|
||||||
|
(void)minx;
|
||||||
|
(void)miny;
|
||||||
|
(void)maxx;
|
||||||
|
(void)maxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLMakeBorderlessImpl(MwLL handle, int toggle) {
|
||||||
|
(void)handle;
|
||||||
|
(void)toggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLFocusImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGrabPointerImpl(MwLL handle, int toggle) {
|
||||||
|
(void)handle;
|
||||||
|
(void)toggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetClipboardImpl(MwLL handle, const char* text) {
|
||||||
|
(void)handle;
|
||||||
|
(void)text;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetClipboardImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLMakeToolWindowImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
|
||||||
|
(void)handle;
|
||||||
|
(void)point;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) {
|
||||||
|
(void)handle;
|
||||||
|
(void)rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLBeginStateChangeImpl(MwLL handle) {
|
||||||
|
MwLLShow(handle, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLEndStateChangeImpl(MwLL handle) {
|
||||||
|
MwLLShow(handle, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int AppKit(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "call.c"
|
||||||
|
CALL(AppKit);
|
||||||
@@ -1,55 +1,70 @@
|
|||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
MwLL (*MwLLCreate)(MwLL parent, int x, int y, int width, int height);
|
/* Older GCC doesn't like this part of the code because of common sections.
|
||||||
void (*MwLLDestroy)(MwLL handle);
|
What are common sections? This question is so obscure and unknown
|
||||||
|
that newer GCC actually compiles with -fno-common by default because
|
||||||
|
not enough people ever figured this out. But when compiling under
|
||||||
|
older Mac OS X. specifically the gcc that comes with tigerbrew (this
|
||||||
|
has not yet been tried under XCode 10.5), this comes up. Furthermore,
|
||||||
|
adding -fno-common to either the cflags or ldflags doesn't seem to fix this.
|
||||||
|
But what does fix it is using GNU attributes. So...yeah, sure, we'll just do
|
||||||
|
this.*/
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define NOCOMMON __attribute__((nocommon))
|
||||||
|
#else
|
||||||
|
#define NOCOMMON
|
||||||
|
#endif
|
||||||
|
|
||||||
void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
|
NOCOMMON MwLL (*MwLLCreate)(MwLL parent, int x, int y, int width, int height);
|
||||||
void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
|
NOCOMMON void (*MwLLDestroy)(MwLL handle);
|
||||||
|
|
||||||
void (*MwLLBeginDraw)(MwLL handle);
|
NOCOMMON void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
|
||||||
void (*MwLLEndDraw)(MwLL handle);
|
NOCOMMON void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
|
||||||
|
|
||||||
MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
|
NOCOMMON void (*MwLLBeginDraw)(MwLL handle);
|
||||||
void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
|
NOCOMMON void (*MwLLEndDraw)(MwLL handle);
|
||||||
void (*MwLLFreeColor)(MwLLColor color);
|
|
||||||
|
|
||||||
void (*MwLLGetXYWH)(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h);
|
NOCOMMON MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
|
||||||
void (*MwLLSetXY)(MwLL handle, int x, int y);
|
NOCOMMON void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
|
||||||
void (*MwLLSetWH)(MwLL handle, int w, int h);
|
NOCOMMON void (*MwLLFreeColor)(MwLLColor color);
|
||||||
|
|
||||||
void (*MwLLSetTitle)(MwLL handle, const char* title);
|
NOCOMMON void (*MwLLGetXYWH)(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h);
|
||||||
|
NOCOMMON void (*MwLLSetXY)(MwLL handle, int x, int y);
|
||||||
|
NOCOMMON void (*MwLLSetWH)(MwLL handle, int w, int h);
|
||||||
|
|
||||||
int (*MwLLPending)(MwLL handle);
|
NOCOMMON void (*MwLLSetTitle)(MwLL handle, const char* title);
|
||||||
void (*MwLLNextEvent)(MwLL handle);
|
|
||||||
|
|
||||||
MwLLPixmap (*MwLLCreatePixmap)(MwLL handle, unsigned char* data, int width, int height);
|
NOCOMMON int (*MwLLPending)(MwLL handle);
|
||||||
void (*MwLLPixmapUpdate)(MwLLPixmap pixmap);
|
NOCOMMON void (*MwLLNextEvent)(MwLL handle);
|
||||||
void (*MwLLDestroyPixmap)(MwLLPixmap pixmap);
|
|
||||||
void (*MwLLDrawPixmap)(MwLL handle, MwRect* rect, MwLLPixmap pixmap);
|
|
||||||
void (*MwLLSetIcon)(MwLL handle, MwLLPixmap pixmap);
|
|
||||||
|
|
||||||
void (*MwLLForceRender)(MwLL handle);
|
NOCOMMON MwLLPixmap (*MwLLCreatePixmap)(MwLL handle, unsigned char* data, int width, int height);
|
||||||
|
NOCOMMON void (*MwLLPixmapUpdate)(MwLLPixmap pixmap);
|
||||||
|
NOCOMMON void (*MwLLDestroyPixmap)(MwLLPixmap pixmap);
|
||||||
|
NOCOMMON void (*MwLLDrawPixmap)(MwLL handle, MwRect* rect, MwLLPixmap pixmap);
|
||||||
|
NOCOMMON void (*MwLLSetIcon)(MwLL handle, MwLLPixmap pixmap);
|
||||||
|
|
||||||
void (*MwLLSetCursor)(MwLL handle, MwCursor* image, MwCursor* mask);
|
NOCOMMON void (*MwLLForceRender)(MwLL handle);
|
||||||
void (*MwLLDetach)(MwLL handle, MwPoint* point);
|
|
||||||
void (*MwLLShow)(MwLL handle, int show);
|
|
||||||
|
|
||||||
void (*MwLLSetSizeHints)(MwLL handle, int minx, int miny, int maxx, int maxy);
|
NOCOMMON void (*MwLLSetCursor)(MwLL handle, MwCursor* image, MwCursor* mask);
|
||||||
void (*MwLLMakeBorderless)(MwLL handle, int toggle);
|
NOCOMMON void (*MwLLDetach)(MwLL handle, MwPoint* point);
|
||||||
void (*MwLLMakeToolWindow)(MwLL handle);
|
NOCOMMON void (*MwLLShow)(MwLL handle, int show);
|
||||||
void (*MwLLMakePopup)(MwLL handle, MwLL parent);
|
|
||||||
|
|
||||||
void (*MwLLBeginStateChange)(MwLL handle);
|
NOCOMMON void (*MwLLSetSizeHints)(MwLL handle, int minx, int miny, int maxx, int maxy);
|
||||||
void (*MwLLEndStateChange)(MwLL handle);
|
NOCOMMON void (*MwLLMakeBorderless)(MwLL handle, int toggle);
|
||||||
|
NOCOMMON void (*MwLLMakeToolWindow)(MwLL handle);
|
||||||
|
NOCOMMON void (*MwLLMakePopup)(MwLL handle, MwLL parent);
|
||||||
|
|
||||||
void (*MwLLFocus)(MwLL handle);
|
NOCOMMON void (*MwLLBeginStateChange)(MwLL handle);
|
||||||
void (*MwLLGrabPointer)(MwLL handle, int toggle);
|
NOCOMMON void (*MwLLEndStateChange)(MwLL handle);
|
||||||
|
|
||||||
void (*MwLLSetClipboard)(MwLL handle, const char* text);
|
NOCOMMON void (*MwLLFocus)(MwLL handle);
|
||||||
void (*MwLLGetClipboard)(MwLL handle);
|
NOCOMMON void (*MwLLGrabPointer)(MwLL handle, int toggle);
|
||||||
|
|
||||||
void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
|
NOCOMMON void (*MwLLSetClipboard)(MwLL handle, const char* text);
|
||||||
void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);
|
NOCOMMON void (*MwLLGetClipboard)(MwLL handle);
|
||||||
|
|
||||||
|
NOCOMMON void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
|
||||||
|
NOCOMMON void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);
|
||||||
|
|
||||||
void MwLLCreateCommon(MwLL handle) {
|
void MwLLCreateCommon(MwLL handle) {
|
||||||
handle->common.handler = malloc(sizeof(*handle->common.handler));
|
handle->common.handler = malloc(sizeof(*handle->common.handler));
|
||||||
|
|||||||
Reference in New Issue
Block a user