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

This commit is contained in:
IoIxD 2026-09-11 16:22:48 -07:00
commit eaa8e089e9
4 changed files with 54 additions and 22 deletions

View file

@ -25,13 +25,15 @@ void* MwDirectoryOpen(const char* path) {
return NULL; return NULL;
} }
#ifdef _WIN32 #ifdef _WIN32
p = MwStringDuplicate(path); p = malloc(strlen(path) + 2 + 1);
strcpy(p, path);
if(strchr(path, '/') != NULL) { if(strchr(path, '/') != NULL) {
MwStringConcat(p, "/"); strcat(p, "/");
} else { } else {
MwStringConcat(p, "\\"); strcat(p, "\\");
} }
MwStringConcat(p, "*"); strcat(p, "*");
if((dir->hFind = FindFirstFile(p, &dir->ffd)) == INVALID_HANDLE_VALUE) { if((dir->hFind = FindFirstFile(p, &dir->ffd)) == INVALID_HANDLE_VALUE) {
free(p); free(p);
free(dir); free(dir);

View file

@ -64,8 +64,6 @@ void MwStringTime(char* out, time_t t) {
struct tm* tm = localtime(&t); struct tm* tm = localtime(&t);
const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
if(tm == NULL) { if(tm == NULL) {
#if defined(_MSC_VER) && (_MSC_VER >= 1400) #if defined(_MSC_VER) && (_MSC_VER >= 1400)
sprintf_s(out, 255, "localtime error"); sprintf_s(out, 255, "localtime error");

View file

@ -11,6 +11,8 @@ static int wcreate(MwWidget handle) {
static void draw(MwWidget handle) { static void draw(MwWidget handle) {
MwRect r; MwRect r;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
MwLLColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
r.x = 0; r.x = 0;
@ -27,12 +29,42 @@ static void draw(MwWidget handle) {
r.x = (MwGetInteger(handle, MwNwidth) - r.width) / 2; r.x = (MwGetInteger(handle, MwNwidth) - r.width) / 2;
r.y = (MwGetInteger(handle, MwNheight) - r.height) / 2; r.y = (MwGetInteger(handle, MwNheight) - r.height) / 2;
MwDrawWidgetBack(handle, &r, base, (handle->pressed || MwGetInteger(handle, MwNchecked)) ? 1 : 0, MwDEFAULT); MwDrawFrame(handle, &r, base, 1);
MwDrawRect(handle, &r, base2);
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx); if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
if(handle->pressed || MwGetInteger(handle, MwNchecked)) { if(handle->pressed || MwGetInteger(handle, MwNchecked)) {
/* TODO: write check mark */ MwPoint p[6];
int gap_w = r.width / 4 / 3;
int gap_h = r.height / 4 / 3;
r.x += gap_w;
r.y += gap_h;
r.width -= gap_w * 2;
r.height -= gap_h * 2;
p[0].x = r.x;
p[0].y = r.y + r.height * 2 / 3;
p[1].x = r.x + r.width / 3;
p[1].y = r.y + r.height;
p[2].x = r.x + r.width;
p[2].y = r.y + r.height / 3;
p[3] = p[2];
p[3].y -= r.height / 3;
p[4] = p[1];
p[4].y -= r.height / 3;
p[5] = p[0];
p[5].y -= r.height / 3;
MwLLPolygon(handle->lowlevel, p, 6, text2);
} }
MwLLFreeColor(text2);
MwLLFreeColor(base2);
MwLLFreeColor(base); MwLLFreeColor(base);
} }