Merge branch 'master' of ssh://forgejo.nishi.boats:2221/pyrite-dev/milsko
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoI_xD 2026-03-23 12:36:12 -07:00
commit 6277c8837a
9 changed files with 236 additions and 234 deletions

View file

@ -589,8 +589,8 @@ HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask) {
int y, x, ys, xs;
xs = -mask->x + image->x;
ys = MwCursorDataHeight + mask->y;
ys = MwCursorDataHeight + image->y - ys;
ys = mask->height + mask->y;
ys = image->height + image->y - ys;
memset(dmask, 0xff, (MwCursorDataHeight / 8) * MwCursorDataHeight);
memset(dimage, 0, (MwCursorDataHeight / 8) * MwCursorDataHeight);
@ -621,7 +621,7 @@ HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask) {
}
}
cursor = CreateCursor(GetModuleHandle(NULL), xs, ys, MwCursorDataHeight, MwCursorDataHeight, dmask, dimage);
cursor = CreateCursor(GetModuleHandle(NULL), xs - image->x, ys + (MwCursorDataHeight + image->y), MwCursorDataHeight, MwCursorDataHeight, dmask, dimage);
free(dimage);
free(dmask);

View file

@ -811,8 +811,8 @@ Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask) {
XColor cfg, cbg;
xs = -mask->x + image->x;
ys = MwCursorDataHeight + mask->y;
ys = MwCursorDataHeight + image->y - ys;
ys = mask->height + mask->y;
ys = image->height + image->y - ys;
memset(cimage->data, 0, cimage->bytes_per_line * cimage->height);
memset(cmask->data, 0, cmask->bytes_per_line * cmask->height);
@ -849,7 +849,7 @@ Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask) {
XPutImage(display, pimage, imagegc, cimage, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
XPutImage(display, pmask, maskgc, cmask, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
cur = XCreatePixmapCursor(display, pimage, pmask, &cfg, &cbg, xs, ys);
cur = XCreatePixmapCursor(display, pimage, pmask, &cfg, &cbg, xs - image->x, ys + (MwCursorDataHeight + image->y));
XFreePixmap(display, pimage);
XFreePixmap(display, pmask);

View file

@ -70,8 +70,7 @@ void* MwFontLoad(unsigned char* data, unsigned int size) {
}
void MwFontFree(void* handle) {
if(MwFLFontFree)
return MwFLFontFree(handle);
if(MwFLFontFree) MwFLFontFree(handle);
}
static void bitmap_MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color) {

View file

@ -7,124 +7,125 @@
#import <mach-o/dyld.h>
@interface MacOpenGLWidget : NSObject {
NSOpenGLPixelFormat *pixelFormat;
NSOpenGLContext *glc;
MilskoCocoa *_win;
NSOpenGLPixelFormat* pixelFormat;
NSOpenGLContext* glc;
MilskoCocoa* _win;
}
- (MacOpenGLWidget *)initWithWindow:(MilskoCocoa *)w;
- (MacOpenGLWidget*)initWithWindow:(MilskoCocoa*)w;
- (void)destroy;
- (void)makeCurrent;
- (void)swapBuffer;
- (void *)getProcAddressWithName:(const char *)name;
- (void*)getProcAddressWithName:(const char*)name;
@end
static int create(MwWidget handle) {
void *r = NULL;
MwWidget w = handle;
void* r = NULL;
MwWidget w = handle;
int x = MwGetInteger(w, MwNx);
int y = MwGetInteger(w, MwNy);
int width = MwGetInteger(w, MwNwidth);
int height = MwGetInteger(w, MwNheight);
int x = MwGetInteger(w, MwNx);
int y = MwGetInteger(w, MwNy);
int width = MwGetInteger(w, MwNwidth);
int height = MwGetInteger(w, MwNheight);
printf("%d %d\n", width, height);
printf("%d %d\n", width, height);
handle->internal =
[[MacOpenGLWidget alloc] initWithWindow:handle->lowlevel->cocoa.real];
handle->lowlevel->common.copy_buffer = 0;
handle->internal =
[[MacOpenGLWidget alloc] initWithWindow:handle->lowlevel->cocoa.real];
handle->lowlevel->common.copy_buffer = 0;
MwSetDefault(handle);
MwSetDefault(handle);
while (w->parent != NULL)
w = w->parent;
while(w->parent != NULL)
w = w->parent;
w->berserk++;
w->berserk++;
return 0;
return 0;
}
static void destroy(MwWidget handle) {
[(MacOpenGLWidget *)handle->internal destroy];
[(MacOpenGLWidget*)handle->internal destroy];
}
static void mwOpenGLMakeCurrentImpl(MwWidget handle) {
[(MacOpenGLWidget *)handle->internal makeCurrent];
[(MacOpenGLWidget*)handle->internal makeCurrent];
}
static void mwOpenGLSwapBufferImpl(MwWidget handle) {
[(MacOpenGLWidget *)handle->internal swapBuffer];
[(MacOpenGLWidget*)handle->internal swapBuffer];
}
static void *mwOpenGLGetProcAddressImpl(MwWidget handle, const char *name) {
return [(MacOpenGLWidget *)handle->internal getProcAddressWithName:name];
static void* mwOpenGLGetProcAddressImpl(MwWidget handle, const char* name) {
return [(MacOpenGLWidget*)handle->internal getProcAddressWithName:name];
}
static void func_handler(MwWidget handle, const char *name, void *out,
va_list va) {
if (strcmp(name, "mwOpenGLMakeCurrent") == 0) {
mwOpenGLMakeCurrentImpl(handle);
}
if (strcmp(name, "mwOpenGLSwapBuffer") == 0) {
mwOpenGLSwapBufferImpl(handle);
}
if (strcmp(name, "mwOpenGLGetProcAddress") == 0) {
const char *_name = va_arg(va, const char *);
*(void **)out = mwOpenGLGetProcAddressImpl(handle, _name);
}
static void func_handler(MwWidget handle, const char* name, void* out,
va_list va) {
if(strcmp(name, "mwOpenGLMakeCurrent") == 0) {
mwOpenGLMakeCurrentImpl(handle);
}
if(strcmp(name, "mwOpenGLSwapBuffer") == 0) {
mwOpenGLSwapBufferImpl(handle);
}
if(strcmp(name, "mwOpenGLGetProcAddress") == 0) {
const char* _name = va_arg(va, const char*);
*(void**)out = mwOpenGLGetProcAddressImpl(handle, _name);
}
}
@implementation MacOpenGLWidget
- (MacOpenGLWidget *)initWithWindow:(MilskoCocoa *)w {
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAStencilSize, 8,
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADoubleBuffer, NSOpenGLPFAAccelerated,
NSOpenGLPFANoRecovery, 0};
self->pixelFormat =
[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
self->glc =
[[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
[self->glc setView:[w getView]];
self->_win = w;
return self;
- (MacOpenGLWidget*)initWithWindow:(MilskoCocoa*)w {
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAStencilSize, 8,
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADoubleBuffer, NSOpenGLPFAAccelerated,
NSOpenGLPFANoRecovery, 0};
self->pixelFormat =
[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
self->glc =
[[NSOpenGLContext alloc] initWithFormat:pixelFormat
shareContext:nil];
[self->glc setView:[w getView]];
self->_win = w;
return self;
};
- (void)destroy {
};
- (void)makeCurrent {
[self->glc makeCurrentContext];
[self->glc makeCurrentContext];
};
- (void)swapBuffer {
[self->glc flushBuffer];
[self->glc flushBuffer];
};
- (void *)getProcAddressWithName:(const char *)name {
if (NSIsSymbolNameDefined(name)) {
return NSAddressOfSymbol(NSLookupAndBindSymbol(name));
} else {
return NULL;
}
- (void*)getProcAddressWithName:(const char*)name {
if(NSIsSymbolNameDefined(name)) {
return NSAddressOfSymbol(NSLookupAndBindSymbol(name));
} else {
return NULL;
}
};
@end
MwClassRec MwOpenGLClassRec = {create, /* create */
destroy, /* destroy */
NULL, /* draw */
NULL, /* click */
NULL, /* parent_resize */
NULL, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL, /* mouse_down */
NULL, /* key */
func_handler, /* execute */
NULL, /* tick */
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL, NULL, NULL, NULL};
MwClass MwOpenGLClass = &MwOpenGLClassRec;
MwClassRec MwOpenGLClassRec = {create, /* create */
destroy, /* destroy */
NULL, /* draw */
NULL, /* click */
NULL, /* parent_resize */
NULL, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL, /* mouse_down */
NULL, /* key */
func_handler, /* execute */
NULL, /* tick */
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL, NULL, NULL, NULL};
MwClass MwOpenGLClass = &MwOpenGLClassRec;