classicmacos #17

Merged
IoI_xD merged 4 commits from classicmacos into master 2026-04-16 13:42:32 +09:00
36 changed files with 557 additions and 199 deletions

7
.gitignore vendored
View file

@ -19,3 +19,10 @@ examples/*/*.exe
compile_flags.txt compile_flags.txt
.cache .cache
.DS_Store .DS_Store
*.pef
*.dsk
*.bin
*.rsrc
*.finf
*.gdb

View file

@ -9,17 +9,27 @@ include(GNUInstallDirs)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" ON)
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" ON)
option(MW_CLASSIC_THEME "Use classic theme" OFF) option(MW_CLASSIC_THEME "Use classic theme" OFF)
option(MW_BUILD_EXAMPLES "Build examples" OFF) option(MW_BUILD_EXAMPLES "Build examples" OFF)
option(MW_USE_STB_IMAGE "Use stb_image" ON) option(MW_USE_STB_IMAGE "Use stb_image" ON)
option(MW_USE_STB_TRUETYPE "Use stb_truetype" OFF) option(MW_USE_STB_TRUETYPE "Use stb_truetype" OFF)
if(${CMAKE_SYSTEM_NAME} MATCHES Retro)
option(MW_BUILD_SHARED "Build a shared library" OFF)
option(MW_BUILD_STATIC "Build a static library" ON)
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" OFF)
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" OFF)
else()
option(MW_BUILD_SHARED "Build a shared library" ON) option(MW_BUILD_SHARED "Build a shared library" ON)
option(MW_BUILD_STATIC "Build a static library" OFF) option(MW_BUILD_STATIC "Build a static library" OFF)
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" ON)
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" ON)
endif()
option(MW_INSTALL_HEADERS "Install headers" ON) option(MW_INSTALL_HEADERS "Install headers" ON)
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin OR ${CMAKE_SYSTEM_NAME} MATCHES Retro)
option(MW_USE_FREETYPE2 "Use FreeType 2" OFF) option(MW_USE_FREETYPE2 "Use FreeType 2" OFF)
else() else()
option(MW_USE_FREETYPE2 "Use FreeType 2" ON) option(MW_USE_FREETYPE2 "Use FreeType 2" ON)
@ -298,6 +308,24 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
PRIVATE PRIVATE
-framework Cocoa -framework Cocoa
) )
elseif(CMAKE_SYSTEM_NAME MATCHES "Retro")
target_sources(
Mw
PRIVATE
src/backend/classicmacos.c
)
if(PLATFORM MATCHES retroppc)
endif()
if(PLATFORM MATCHES retroppc)
set_target_properties(Mw PROPERTIES COMPILE_FLAGS "-ffunction-sections -mcpu=601 -Os -Wall -Wextra -Wno-unused-parameter")
set_target_properties(Mw PROPERTIES LINK_FLAGS "-Wl,-gc-sections")
endif()
target_compile_definitions(
Mw
PRIVATE
CLASSIC_MAC_OS
)
else() else()
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(X11 REQUIRED x11) pkg_check_modules(X11 REQUIRED x11)

44
configure vendored
View file

@ -47,13 +47,6 @@ param_set("static", 1);
param_set("examples", 1); param_set("examples", 1);
if($target ne "Darwin") {
param_set("freetype2", 1);
param_set("stb-truetype", 0);
} else {
param_set("stb-truetype", 1);
}
my %features = ( my %features = (
"classic-theme" => "use classic theme", "classic-theme" => "use classic theme",
"stb-image" => "use stb_image, instead use libjpeg/libpng", "stb-image" => "use stb_image, instead use libjpeg/libpng",
@ -77,13 +70,6 @@ my @features_keys = (
"1wayland", "1gnustep", "1wayland", "1gnustep",
); );
if($target eq "Linux") {
param_set("x11", 1);
if(!param_get("tiny")){
param_set("wayland", 1);
}
}
foreach my $l (@ARGV) { foreach my $l (@ARGV) {
if ($l =~ /^--with-([^=]+)=(.+)$/) { if ($l =~ /^--with-([^=]+)=(.+)$/) {
param_set($1, $2); param_set($1, $2);
@ -146,6 +132,21 @@ foreach my $l (@ARGV) {
} }
} }
if($target ne "Darwin" and $target ne "ClassicMacOS") {
param_set("freetype2", 1);
param_set("stb-truetype", 0);
} else {
param_set("freetype2", 0);
param_set("stb-truetype", 0);
}
if($target eq "Linux") {
param_set("x11", 1);
if(!param_get("tiny")){
param_set("wayland", 1);
}
}
if (-f "./pl/ostype/${target}.pl") { if (-f "./pl/ostype/${target}.pl") {
require("./pl/ostype/${target}.pl"); require("./pl/ostype/${target}.pl");
} }
@ -274,9 +275,15 @@ if (param_get("examples")) {
$libs = $examples_libs{$l}; $libs = $examples_libs{$l};
} }
if (param_get("shared")) {
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"
); );
} else {
print(OUT
"${l}: ${s}${object_suffix} src/${library_prefix}Mw.a\n"
);
}
if (grep(/^cocoa$/, @backends)) { if (grep(/^cocoa$/, @backends)) {
print(OUT print(OUT
" \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n" " \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
@ -287,6 +294,15 @@ if (param_get("examples")) {
" \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n" " \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
); );
} }
if($target eq "ClassicMacOS") {
print(OUT
" ".$ENV{RETRO68_TOOLCHAIN_PATH}."/bin/MakePEF ${l} -o ${s}.pef\n");
print(OUT
" Rez -I ".$ENV{RETRO68_TOOLCHAIN_PATH}."/RIncludes ".$ENV{RETRO68_TOOLCHAIN_PATH}."/RIncludes/Retro68APPL.r -DCFRAG_NAME=\"example\" --data ${l}.pef --cc ${l}.dsk -t APPL\n"
);
}
print(OUT "${s}${object_suffix}: ${s}.c\n"); print(OUT "${s}${object_suffix}: ${s}.c\n");
print(OUT print(OUT
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n" " \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n"

View file

@ -6,7 +6,11 @@ file(
foreach(PATH IN LISTS EXAMPLES_BASIC_SOURCES) foreach(PATH IN LISTS EXAMPLES_BASIC_SOURCES)
get_filename_component(TARGET ${PATH} NAME_WE) get_filename_component(TARGET ${PATH} NAME_WE)
if(CMAKE_SYSTEM_NAME MATCHES Retro)
add_application(${TARGET} ${PATH})
else()
add_executable(${TARGET} MACOSX_BUNDLE ${PATH}) add_executable(${TARGET} MACOSX_BUNDLE ${PATH})
endif()
target_link_libraries( target_link_libraries(
${TARGET} ${TARGET}
PRIVATE PRIVATE

View file

@ -106,6 +106,9 @@ MWDECL void MwLLDBusFreeContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
#ifdef USE_COCOA #ifdef USE_COCOA
#include <Mw/LowLevel/Cocoa.h> #include <Mw/LowLevel/Cocoa.h>
#endif #endif
#ifdef CLASSIC_MAC_OS
#include <Mw/LowLevel/ClassicMacOS.h>
#endif
union _MwLL { union _MwLL {
struct _MwLLCommon common; struct _MwLLCommon common;
@ -121,6 +124,9 @@ union _MwLL {
#ifdef USE_COCOA #ifdef USE_COCOA
struct _MwLLCocoa cocoa; struct _MwLLCocoa cocoa;
#endif #endif
#ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOS cmacos;
#endif
}; };
union _MwLLColor { union _MwLLColor {

View file

@ -0,0 +1,31 @@
/*!
* @file Mw/LowLevel/ClassicMacOS.h
* @brief ClassicMacOS Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_ClassicMacOS_H__
#define __MW_LOWLEVEL_ClassicMacOS_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
struct _MwLLClassicMacOS {
struct _MwLLCommon common;
WindowRef window;
EventRecord event;
Rect winRect;
};
struct _MwLLClassicMacOSColor {
struct _MwLLCommonColor common;
};
struct _MwLLClassicMacOSPixmap {
struct _MwLLCommonPixmap common;
};
MWDECL int MwLLClassicMacOSCallInit(void);
#endif

View file

@ -37,17 +37,28 @@
#define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x)) #define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x))
#endif #endif
#endif #endif
#elif defined(CLASSIC_MAC_OS)
#include <unistd.h>
#include <MacTypes.h>
#include <CFBundle.h>
#include <CodeFragments.h>
#include <Timer.h>
#include <MacWindows.h>
#include <TextEdit.h>
#include <Dialogs.h>
#else #else
#include <unistd.h> #include <unistd.h>
#include <pwd.h> #include <pwd.h>
#include <dlfcn.h>
#include <signal.h> #include <signal.h>
#include <dirent.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#endif #endif
#ifdef __unix__
#include <dirent.h>
#include <dlfcn.h>
#endif
#ifdef __APPLE__ #ifdef __APPLE__
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/mach.h> #include <mach/mach.h>

10
pl/ostype/ClassicMacOS.pl Normal file
View file

@ -0,0 +1,10 @@
use_backend("classicmacos");
print("Compiling for Classic Mac OS via ./configure currently outputs a broken executable and it only supports PowerPC. Help is wanted. In the mean time, use CMake.")
$cc = $ENV{RETRO68_TOOLCHAIN_PATH}."/bin/powerpc-apple-macos-gcc";
$ar = $ENV{RETRO68_TOOLCHAIN_PATH}."/bin/powerpc-apple-macos-ar";
add_cflags("-DCLASSIC_MAC_OS");
add_cflags("-DSTBI_NO_THREAD_LOCALS");
1;

View file

@ -30,6 +30,13 @@ if (grep(/^gdi$/, @backends)) {
$gl_libs = "-lopengl32 -lglu32"; $gl_libs = "-lopengl32 -lglu32";
} }
if (grep(/^classicmacos$/, @backends)) {
#add_cflags("-DCLASSIC_MAC_OS");
new_object("src/backend/classicmacos.c");
$gl_libs = "";
}
if (grep(/^wayland$/, @backends)) { if (grep(/^wayland$/, @backends)) {
add_cflags("-DUSE_WAYLAND"); add_cflags("-DUSE_WAYLAND");
new_object("src/backend/wayland.c"); new_object("src/backend/wayland.c");

View file

@ -6,6 +6,10 @@ typedef struct dir {
WIN32_FIND_DATA ffd; WIN32_FIND_DATA ffd;
int next; int next;
} dir_t; } dir_t;
#elif defined(CLASSIC_MAC_OS)
typedef struct dir {
int dummy;
} dir_t;
#else #else
typedef struct dir { typedef struct dir {
DIR* dir; DIR* dir;
@ -31,6 +35,8 @@ void* MwDirectoryOpen(const char* path) {
} }
free(p); free(p);
dir->next = 1; dir->next = 1;
#elif defined(CLASSIC_MAC_OS)
/* todo */
#else #else
if((dir->dir = opendir(path)) == NULL) { if((dir->dir = opendir(path)) == NULL) {
free(dir); free(dir);
@ -47,6 +53,8 @@ void MwDirectoryClose(void* handle) {
dir_t* dir = handle; dir_t* dir = handle;
#ifdef _WIN32 #ifdef _WIN32
FindClose(dir->hFind); FindClose(dir->hFind);
#elif defined(CLASSIC_MAC_OS)
/* todo */
#else #else
closedir(dir->dir); closedir(dir->dir);
free(dir->base); free(dir->base);
@ -80,6 +88,8 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
entry->mtime = l->QuadPart / 10000000 - 11644473600; entry->mtime = l->QuadPart / 10000000 - 11644473600;
dir->next = FindNextFile(dir->hFind, &dir->ffd); dir->next = FindNextFile(dir->hFind, &dir->ffd);
#elif defined(CLASSIC_MAC_OS)
/* todo */
#else #else
struct dirent* d; struct dirent* d;
struct stat s; struct stat s;
@ -123,6 +133,8 @@ char* MwDirectoryCurrent(void) {
GetCurrentDirectory(len, out); GetCurrentDirectory(len, out);
return out; return out;
#elif CLASSIC_MAC_OS
return "";
#else #else
return getcwd(NULL, 0); return getcwd(NULL, 0);
#endif #endif

View file

@ -12,6 +12,36 @@ void* MwDynamicSymbol(void* handle, const char* symbol) {
void MwDynamicClose(void* handle) { void MwDynamicClose(void* handle) {
FreeLibrary(handle); FreeLibrary(handle);
} }
#elif defined(CLASSIC_MAC_OS)
void* MwDynamicOpen(const char* path) {
CFragConnectionID connID;
Ptr* addr;
unsigned char err[255];
if(GetSharedLibrary((ConstStr63Param)path, kPowerPCCFragArch, kPrivateCFragCopy,
&connID, addr, err)) {
printf("Error getting %s: %s\n", path, err);
return NULL;
};
return connID;
}
void* MwDynamicSymbol(void* handle, const char* symbol) {
CFragConnectionID connID = (CFragConnectionID)handle;
Ptr* symAddr;
CFragSymbolClass* symClass;
OSErr err;
if((err = FindSymbol(connID, (ConstStr63Param)symbol, symAddr, symClass))) {
printf("Error getting %s: %d\n", symbol, err);
return NULL;
};
return symAddr;
}
void MwDynamicClose(void* handle) {
CFragConnectionID connID = (CFragConnectionID)handle;
CloseConnection(&connID);
}
#elif defined(__unix__) || defined(__APPLE__) #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);

View file

@ -32,6 +32,27 @@ void MwTimeSleep(int ms) {
nanosleep(&ts, NULL); nanosleep(&ts, NULL);
} }
#elif defined(CLASSIC_MAC_OS)
static TMTask tm;
static int timer;
void timerUpdateFunc(void) {
timer += 1;
PrimeTime((QElemPtr)&tm, 1);
};
long MwTimeGetTick(void) {
UnsignedWide h;
Microseconds(&h);
return *(long*)&h;
}
void MwTimeSleep(int ms) {
tm.tmAddr = NewTimerProc(timerUpdateFunc);
tm.tmWakeUp = 0;
tm.tmReserved = 0;
InsTime((QElemPtr)&tm);
PrimeTime((QElemPtr)&tm, 1);
}
#elif defined(__unix__) #elif defined(__unix__)
long MwTimeGetTick(void) { long MwTimeGetTick(void) {
struct timespec ts; struct timespec ts;

175
src/backend/classicmacos.c Normal file
View file

@ -0,0 +1,175 @@
#include <Mw/Milsko.h>
#include "../../external/stb_ds.h"
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
MwLL r;
MwLLCreateCommon(r);
SetRect(&r->cmacos.winRect, 100, 100, width, height);
r->cmacos.window = NewCWindow(nil, &r->cmacos.winRect, (ConstStr255Param) "\p", true,
documentProc, (WindowPtr)(-1), true, 0);
SetPort(r->cmacos.window);
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) {
int i;
}
static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor 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) {
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) {
}
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
}
static void MwLLFreeColorImpl(MwLLColor color) {
free(color);
}
static int MwLLPendingImpl(MwLL handle) {
return GetNextEvent(everyEvent, &handle->cmacos.event);
}
static void MwLLNextEventImpl(MwLL handle) {
}
static void MwLLSetTitleImpl(MwLL handle, const char* title) {
}
static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int width, int height) {
MwLLPixmap r = malloc(sizeof(*r));
r->common.raw = malloc(4 * width * height);
memcpy(r->common.raw, data, 4 * width * height);
MwLLPixmapUpdate(r);
return r;
}
static void MwLLPixmapUpdateImpl(MwLLPixmap r) {
}
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
}
static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
}
static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
}
static void MwLLForceRenderImpl(MwLL handle) {
}
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
}
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
}
static void MwLLShowImpl(MwLL handle, int show) {
}
static void MwLLMakePopupImpl(MwLL handle, MwLL parent) {
}
static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx, int maxy) {
}
static void MwLLMakeBorderlessImpl(MwLL handle, int toggle) {
}
static void MwLLFocusImpl(MwLL handle) {
}
static void MwLLGrabPointerImpl(MwLL handle, int toggle) {
}
static void MwLLSetClipboardImpl(MwLL handle, const char* text) {
/* TODO */
(void)handle;
(void)text;
}
static void MwLLGetClipboardImpl(MwLL handle) {
}
static void MwLLMakeToolWindowImpl(MwLL handle) {
}
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
}
static void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) {
}
static void MwLLBeginStateChangeImpl(MwLL handle) {
MwLLShow(handle, 0);
}
static void MwLLEndStateChangeImpl(MwLL handle) {
MwLLShow(handle, 1);
}
static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) {
(void)handle;
(void)toggle;
}
static int MwLLClassicMacOSCallInitImpl(void) {
InitGraf(&qd.thePort);
InitFonts();
FlushEvents(everyEvent, 0);
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
InitCursor();
return 0;
}
#include "call.c"
CALL(ClassicMacOS);

View file

@ -53,7 +53,7 @@ static void destroy(MwWidget handle) {
MwDestroyWidget(handle); MwDestroyWidget(handle);
} }
static void cancel(MwWidget handle, void* user, void* call) { static void filecancel(MwWidget handle, void* user, void* call) {
(void)user; (void)user;
(void)call; (void)call;
@ -147,7 +147,7 @@ static void nav_activate(MwWidget handle, void* user, void* call) {
(void)user; (void)user;
if(strcmp(e, "Home") == 0) { if(strcmp(e, "Home") == 0) {
#ifdef _WIN32 #if defined(_WIN32) || defined(CLASSIC_MAC_OS)
#else #else
struct passwd* p = getpwuid(getuid()); struct passwd* p = getpwuid(getuid());
@ -383,7 +383,7 @@ static void layout(MwWidget handle) {
MwNtext, "Cancel", MwNtext, "Cancel",
NULL); NULL);
MwAddUserHandler(fc->cancel, MwNactivateHandler, cancel, NULL); MwAddUserHandler(fc->cancel, MwNactivateHandler, filecancel, NULL);
} else { } else {
MwVaApply(fc->cancel, MwVaApply(fc->cancel,
MwNx, wx, MwNx, wx,

View file

@ -2,7 +2,7 @@
#include "../../external/stb_ds.h" #include "../../external/stb_ds.h"
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwBox b = malloc(sizeof(*b)); MwBox b = malloc(sizeof(*b));
memset(b, 0, sizeof(*b)); memset(b, 0, sizeof(*b));
@ -135,7 +135,7 @@ static void children_update(MwWidget handle) {
} }
MwClassRec MwBoxClassRec = { MwClassRec MwBoxClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -2,7 +2,7 @@
#include "../../external/stb_ds.h" #include "../../external/stb_ds.h"
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwSetInteger(handle, MwNflat, 0); MwSetInteger(handle, MwNflat, 0);
@ -93,7 +93,7 @@ static void prop_change(MwWidget handle, const char* key) {
} }
MwClassRec MwButtonClassRec = { MwClassRec MwButtonClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
click, /* click */ click, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwSetInteger(handle, MwNchecked, 0); MwSetInteger(handle, MwNchecked, 0);
@ -38,7 +38,7 @@ static void prop_change(MwWidget handle, const char* key) {
} }
MwClassRec MwCheckBoxClassRec = { MwClassRec MwCheckBoxClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
click, /* click */ click, /* click */

View file

@ -2,7 +2,7 @@
#include "../../external/stb_ds.h" #include "../../external/stb_ds.h"
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwComboBox cb = malloc(sizeof(*cb)); MwComboBox cb = malloc(sizeof(*cb));
cb->list = NULL; cb->list = NULL;
@ -189,7 +189,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
} }
MwClassRec MwComboBoxClassRec = { MwClassRec MwComboBoxClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
click, /* click */ click, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwEntry t = malloc(sizeof(*t)); MwEntry t = malloc(sizeof(*t));
t->cursor = 0; t->cursor = 0;
@ -172,7 +172,7 @@ static void clipboard(MwWidget handle, const char* data) {
} }
MwClassRec MwEntryClassRec = { MwClassRec MwEntryClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwSetInteger(handle, MwNhasBorder, 0); MwSetInteger(handle, MwNhasBorder, 0);
@ -46,7 +46,7 @@ static void prop_change(MwWidget handle, const char* key) {
} }
MwClassRec MwFrameClassRec = { MwClassRec MwFrameClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwSetInteger(handle, MwNhasBorder, 0); MwSetInteger(handle, MwNhasBorder, 0);
@ -42,7 +42,7 @@ static void prop_change(MwWidget handle, const char* key) {
} }
MwClassRec MwImageClassRec = { MwClassRec MwImageClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -4,7 +4,7 @@
#define Spacing 1 #define Spacing 1
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwLabel lab = malloc(sizeof(*lab)); MwLabel lab = malloc(sizeof(*lab));
lab->segment = NULL; lab->segment = NULL;
@ -360,7 +360,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
} }
MwClassRec MwLabelClassRec = { MwClassRec MwLabelClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -347,7 +347,7 @@ static void resize(MwWidget handle) {
NULL); NULL);
} }
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwListBox lb = malloc(sizeof(*lb)); MwListBox lb = malloc(sizeof(*lb));
memset(lb, 0, sizeof(*lb)); memset(lb, 0, sizeof(*lb));
@ -595,7 +595,7 @@ static void tick(MwWidget handle) {
} }
MwClassRec MwListBoxClassRec = { MwClassRec MwListBoxClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -18,7 +18,7 @@ static void set_xywh(MwWidget handle) {
NULL); NULL);
} }
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwMenu m = malloc(sizeof(*m)); MwMenu m = malloc(sizeof(*m));
m->name = NULL; m->name = NULL;
@ -189,7 +189,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
} }
MwClassRec MwMenuClassRec = { MwClassRec MwMenuClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
int st; int st;
MwEntry e; MwEntry e;
@ -128,7 +128,7 @@ static void prop_change(MwWidget handle, const char* prop) {
} }
MwClassRec MwNumberEntryClassRec = { MwClassRec MwNumberEntryClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -101,7 +101,7 @@ typedef struct waylandopengl {
} waylandopengl_t; } waylandopengl_t;
#endif #endif
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
void* r = NULL; void* r = NULL;
MwWidget w = handle; MwWidget w = handle;

View file

@ -20,7 +20,7 @@
@end @end
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
void* r = NULL; void* r = NULL;
MwWidget w = handle; MwWidget w = handle;

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwVaApply(handle, MwVaApply(handle,
MwNminValue, 0, MwNminValue, 0,
@ -46,7 +46,7 @@ static void prop_change(MwWidget handle, const char* key) {
} }
MwClassRec MwProgressBarClassRec = { MwClassRec MwProgressBarClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -2,7 +2,7 @@
#include "../../external/stb_ds.h" #include "../../external/stb_ds.h"
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwSetInteger(handle, MwNchecked, 0); MwSetInteger(handle, MwNchecked, 0);
@ -47,7 +47,7 @@ static void prop_change(MwWidget handle, const char* key) {
} }
MwClassRec MwRadioBoxClassRec = { MwClassRec MwRadioBoxClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
click, /* click */ click, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwScrollBar scr = malloc(sizeof(*scr)); MwScrollBar scr = malloc(sizeof(*scr));
handle->internal = scr; handle->internal = scr;
@ -257,7 +257,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
} }
MwClassRec MwScrollBarClassRec = { MwClassRec MwScrollBarClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwSetInteger(handle, MwNorientation, MwHORIZONTAL); MwSetInteger(handle, MwNorientation, MwHORIZONTAL);
@ -35,7 +35,7 @@ static void prop_change(MwWidget handle, const char* key) {
} }
MwClassRec MwSeparatorClassRec = { MwClassRec MwSeparatorClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -2,7 +2,7 @@
#include "../../external/stb_ds.h" #include "../../external/stb_ds.h"
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwLLBeginStateChange(handle->lowlevel); MwLLBeginStateChange(handle->lowlevel);
MwSetDefault(handle); MwSetDefault(handle);
@ -241,7 +241,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
} }
MwClassRec MwSubMenuClassRec = { MwClassRec MwSubMenuClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
click, /* click */ click, /* click */

View file

@ -297,7 +297,7 @@ static void resize(MwWidget handle) {
NULL); NULL);
} }
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwTreeView tv = malloc(sizeof(*tv)); MwTreeView tv = malloc(sizeof(*tv));
memset(tv, 0, sizeof(*tv)); memset(tv, 0, sizeof(*tv));
@ -481,7 +481,7 @@ static void tick(MwWidget handle) {
} }
MwClassRec MwTreeViewClassRec = { MwClassRec MwTreeViewClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -74,7 +74,7 @@ static void resize(MwWidget handle) {
NULL); NULL);
} }
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwViewport vp = malloc(sizeof(*vp)); MwViewport vp = malloc(sizeof(*vp));
memset(vp, 0, sizeof(*vp)); memset(vp, 0, sizeof(*vp));
@ -176,7 +176,7 @@ static void tick(MwWidget handle) {
} }
MwClassRec MwViewportClassRec = { MwClassRec MwViewportClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -116,7 +116,7 @@ static int vulkan_instance_setup(MwWidget handle, vulkan_t* o);
static int vulkan_surface_setup(MwWidget handle, vulkan_t* o); static int vulkan_surface_setup(MwWidget handle, vulkan_t* o);
static int vulkan_devices_setup(MwWidget handle, vulkan_t* o); static int vulkan_devices_setup(MwWidget handle, vulkan_t* o);
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
vulkan_t* o = malloc(sizeof(*o)); vulkan_t* o = malloc(sizeof(*o));
int err; int err;
@ -556,7 +556,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
} }
MwClassRec MwVulkanClassRec = { MwClassRec MwVulkanClassRec = {
create, /* create */ wcreate, /* create */
destroy, /* destroy */ destroy, /* destroy */
NULL, /* draw */ NULL, /* draw */
NULL, /* click */ NULL, /* click */

View file

@ -1,6 +1,6 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
static int create(MwWidget handle) { static int wcreate(MwWidget handle) {
MwSetDefault(handle); MwSetDefault(handle);
MwSetInteger(handle, MwNhasBorder, 0); MwSetInteger(handle, MwNhasBorder, 0);
@ -44,7 +44,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
} }
} }
MwClassRec MwWindowClassRec = { MwClassRec MwWindowClassRec = {
create, /* create */ wcreate, /* create */
NULL, /* destroy */ NULL, /* destroy */
draw, /* draw */ draw, /* draw */
NULL, /* click */ NULL, /* click */