renamed appkit backend to cocoa and got something that compiles

This commit is contained in:
IoIxD 2026-01-09 21:35:23 -07:00
commit e73964882e
8 changed files with 465 additions and 84 deletions

View file

@ -1,70 +1,55 @@
#include <Mw/Milsko.h>
/* Older GCC doesn't like this part of the code because of common sections.
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
MwLL (*MwLLCreate)(MwLL parent, int x, int y, int width, int height) = NULL;
void (*MwLLDestroy)(MwLL handle) = NULL;
NOCOMMON MwLL (*MwLLCreate)(MwLL parent, int x, int y, int width, int height);
NOCOMMON void (*MwLLDestroy)(MwLL handle);
void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color) = NULL;
void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color) = NULL;
NOCOMMON void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
NOCOMMON void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
void (*MwLLBeginDraw)(MwLL handle) = NULL;
void (*MwLLEndDraw)(MwLL handle) = NULL;
NOCOMMON void (*MwLLBeginDraw)(MwLL handle);
NOCOMMON void (*MwLLEndDraw)(MwLL handle);
MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b) = NULL;
void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b) = NULL;
void (*MwLLFreeColor)(MwLLColor color) = NULL;
NOCOMMON MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
NOCOMMON void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
NOCOMMON void (*MwLLFreeColor)(MwLLColor color);
void (*MwLLGetXYWH)(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) = NULL;
void (*MwLLSetXY)(MwLL handle, int x, int y) = NULL;
void (*MwLLSetWH)(MwLL handle, int w, int h) = NULL;
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);
void (*MwLLSetTitle)(MwLL handle, const char* title) = NULL;
NOCOMMON void (*MwLLSetTitle)(MwLL handle, const char* title);
int (*MwLLPending)(MwLL handle) = NULL;
void (*MwLLNextEvent)(MwLL handle) = NULL;
NOCOMMON int (*MwLLPending)(MwLL handle);
NOCOMMON void (*MwLLNextEvent)(MwLL handle);
MwLLPixmap (*MwLLCreatePixmap)(MwLL handle, unsigned char* data, int width, int height) = NULL;
void (*MwLLPixmapUpdate)(MwLLPixmap pixmap) = NULL;
void (*MwLLDestroyPixmap)(MwLLPixmap pixmap) = NULL;
void (*MwLLDrawPixmap)(MwLL handle, MwRect* rect, MwLLPixmap pixmap) = NULL;
void (*MwLLSetIcon)(MwLL handle, MwLLPixmap pixmap) = NULL;
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 (*MwLLForceRender)(MwLL handle) = NULL;
NOCOMMON void (*MwLLForceRender)(MwLL handle);
void (*MwLLSetCursor)(MwLL handle, MwCursor* image, MwCursor* mask) = NULL;
void (*MwLLDetach)(MwLL handle, MwPoint* point) = NULL;
void (*MwLLShow)(MwLL handle, int show) = NULL;
NOCOMMON void (*MwLLSetCursor)(MwLL handle, MwCursor* image, MwCursor* mask);
NOCOMMON void (*MwLLDetach)(MwLL handle, MwPoint* point);
NOCOMMON void (*MwLLShow)(MwLL handle, int show);
void (*MwLLSetSizeHints)(MwLL handle, int minx, int miny, int maxx, int maxy) = NULL;
void (*MwLLMakeBorderless)(MwLL handle, int toggle) = NULL;
void (*MwLLMakeToolWindow)(MwLL handle) = NULL;
void (*MwLLMakePopup)(MwLL handle, MwLL parent) = NULL;
NOCOMMON void (*MwLLSetSizeHints)(MwLL handle, int minx, int miny, int maxx, int maxy);
NOCOMMON void (*MwLLMakeBorderless)(MwLL handle, int toggle);
NOCOMMON void (*MwLLMakeToolWindow)(MwLL handle);
NOCOMMON void (*MwLLMakePopup)(MwLL handle, MwLL parent);
void (*MwLLBeginStateChange)(MwLL handle) = NULL;
void (*MwLLEndStateChange)(MwLL handle) = NULL;
NOCOMMON void (*MwLLBeginStateChange)(MwLL handle);
NOCOMMON void (*MwLLEndStateChange)(MwLL handle);
void (*MwLLFocus)(MwLL handle) = NULL;
void (*MwLLGrabPointer)(MwLL handle, int toggle) = NULL;
NOCOMMON void (*MwLLFocus)(MwLL handle);
NOCOMMON void (*MwLLGrabPointer)(MwLL handle, int toggle);
void (*MwLLSetClipboard)(MwLL handle, const char* text) = NULL;
void (*MwLLGetClipboard)(MwLL handle) = NULL;
NOCOMMON void (*MwLLSetClipboard)(MwLL handle, const char* text);
NOCOMMON void (*MwLLGetClipboard)(MwLL handle);
NOCOMMON void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
NOCOMMON void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);
void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point) = NULL;
void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect) = NULL;
void MwLLCreateCommon(MwLL handle) {
handle->common.handler = malloc(sizeof(*handle->common.handler));