From 845be77805e72b4d01eb9a52e32f599b811e013c Mon Sep 17 00:00:00 2001 From: Nishi Date: Sun, 27 Sep 2026 06:15:29 +0900 Subject: [PATCH] MwSetVoid/MwGetVoid to Pointer --- examples/basic/periodic.c | 4 ++-- include/Mw/Core.h | 8 ++++---- include/Mw/StringDefs.h | 18 +++++++++--------- milsko.xml | 6 +++--- src/core.c | 10 +++++----- src/dialog/messagebox.c | 4 ++-- src/text/text.c | 4 ++-- src/widget/button.c | 4 ++-- src/widget/checkbox.c | 2 +- src/widget/entry.c | 2 +- src/widget/frame.c | 2 +- src/widget/image.c | 2 +- src/widget/label.c | 4 ++-- src/widget/progressbar.c | 2 +- src/widget/radiobox.c | 2 +- src/widget/scrollbar.c | 2 +- src/widget/subwindow.c | 2 +- src/widget/tab.c | 4 ++-- src/widget/vulkan.c | 2 +- 19 files changed, 42 insertions(+), 42 deletions(-) diff --git a/examples/basic/periodic.c b/examples/basic/periodic.c index fb2fbd9d..a5bf531d 100644 --- a/examples/basic/periodic.c +++ b/examples/basic/periodic.c @@ -118,7 +118,7 @@ static MwWidget frame(const char* name, int width, int height, MwClass cl, ...) MwAddUserHandler(frame, MwNresizeHandler, resize_content, NULL); MwVaApply(f, - "VhandledWidget", w, + "PhandledWidget", w, MwNcolumnSpan, MwGetInteger(w, MwNcolumnSpan), MwNrowSpan, MwGetInteger(w, MwNrowSpan), NULL); @@ -132,7 +132,7 @@ static MwWidget frame(const char* name, int width, int height, MwClass cl, ...) } static MwWidget child(MwWidget w) { - return MwGetVoid(w, "VhandledWidget"); + return MwGetPointer(w, "PhandledWidget"); } static void MWAPI menu_handler(MwWidget handle, void* user, void* call) { diff --git a/include/Mw/Core.h b/include/Mw/Core.h index 318a8cab..66a3372a 100644 --- a/include/Mw/Core.h +++ b/include/Mw/Core.h @@ -162,12 +162,12 @@ MWDECL void MWAPI MwSetInteger(MwWidget handle, const char* key, int n); MWDECL void MWAPI MwSetText(MwWidget handle, const char* key, const char* value); /*! - * @brief Sets a void pointer property + * @brief Sets a pointer property * @param handle Widget * @param key Key * @param value Value */ -MWDECL void MWAPI MwSetVoid(MwWidget handle, const char* key, void* value); +MWDECL void MWAPI MwSetPointer(MwWidget handle, const char* key, void* value); /*! * @brief Gets the integer property @@ -186,12 +186,12 @@ MWDECL int MWAPI MwGetInteger(MwWidget handle, const char* key); MWDECL const char* MWAPI MwGetText(MwWidget handle, const char* key); /*! - * @brief Gets the void pointer property + * @brief Gets the pointer property * @param handle Widget * @param key Key * @return Value */ -MWDECL void* MWAPI MwGetVoid(MwWidget handle, const char* key); +MWDECL void* MWAPI MwGetPointer(MwWidget handle, const char* key); /*! * @brief Sets the default property diff --git a/include/Mw/StringDefs.h b/include/Mw/StringDefs.h index 8d00b409..d04aee08 100644 --- a/include/Mw/StringDefs.h +++ b/include/Mw/StringDefs.h @@ -72,16 +72,16 @@ #define MwNvulkanExtension "SEvulkanExtension" #define MwNvulkanLayer "SEvulkanLayer" -#define MwNvulkanConfig "VEvulkanConfig" +#define MwNvulkanConfig "PEvulkanConfig" -#define MwNpixmap "Vpixmap" -#define MwNiconPixmap "ViconPixmap" -#define MwNsizeHints "VsizeHints" -#define MwNfont "Vfont" -#define MwNboldFont "VboldFont" -#define MwNbackgroundPixmap "VbackgroundPixmap" -#define MwNmonospaceFont "VmonospaceFont" -#define MwNboldMonospaceFont "VboldMonospaceFont" +#define MwNpixmap "Ppixmap" +#define MwNiconPixmap "PiconPixmap" +#define MwNsizeHints "PsizeHints" +#define MwNfont "Pfont" +#define MwNboldFont "PboldFont" +#define MwNbackgroundPixmap "PbackgroundPixmap" +#define MwNmonospaceFont "PmonospaceFont" +#define MwNboldMonospaceFont "PboldMonospaceFont" #define MwNactivateHandler "Cactivate" #define MwNlistBoxActivateHandler "ClistBoxActivate" diff --git a/milsko.xml b/milsko.xml index 81d6e136..c053bf7b 100644 --- a/milsko.xml +++ b/milsko.xml @@ -55,7 +55,7 @@ Integer properties must be prefixed with I. String properties must be prefixed with S. Handler properties must be prefixed with C. - Other properties must be prefixed with V. + Other properties must be prefixed with P. "Early" properties must have letter "E" as 2nd letter. e.g. vulkanExtension would be SEvulkanExtension @@ -383,7 +383,7 @@ - + @@ -408,7 +408,7 @@ - + diff --git a/src/core.c b/src/core.c index a2e520fd..c06241e7 100644 --- a/src/core.c +++ b/src/core.c @@ -745,7 +745,7 @@ void MwSetText(MwWidget handle, const char* key, const char* value) { } } -void MwSetVoid(MwWidget handle, const char* key, void* value) { +void MwSetPointer(MwWidget handle, const char* key, void* value) { if(IsFirstVisible(handle) && strcmp(key, MwNiconPixmap) == 0) { MwLLSetIcon(handle->lowlevel, value); } else if(strcmp(key, MwNsizeHints) == 0) { @@ -851,14 +851,14 @@ const char* MwGetText(MwWidget handle, const char* key) { static void* inherit_void(MwWidget handle, const char* key) { void* v; - if(handle->parent != NULL && (v = MwGetVoid(handle->parent, key)) != NULL) { + if(handle->parent != NULL && (v = MwGetPointer(handle->parent, key)) != NULL) { return v; } return NULL; } #endif -void* MwGetVoid(MwWidget handle, const char* key) { +void* MwGetPointer(MwWidget handle, const char* key) { void* v = shget(handle->data, key); if(v != NULL) return v; @@ -936,10 +936,10 @@ static void MwVaListApply_Internal(MwWidget handle, va_list va, int only_early) if(only_early && key[1] != 'E') continue; MwAddUserHandler(handle, key, h, NULL); - } else if(key[0] == 'V') { + } else if(key[0] == 'P') { void* v = va_arg(va, void*); if(only_early && key[1] != 'E') continue; - MwSetVoid(handle, key, v); + MwSetPointer(handle, key, v); } } if(x != MwDEFAULT && y != MwDEFAULT) { diff --git a/src/dialog/messagebox.c b/src/dialog/messagebox.c index 4a319ff1..a1542190 100644 --- a/src/dialog/messagebox.c +++ b/src/dialog/messagebox.c @@ -21,7 +21,7 @@ static void spawn_button(MwWidget handle, int x, int y, int id, const char* text static void messagebox_destroy_inject(MwWidget handle) { void* px; - if((px = MwGetVoid(handle, MwNpixmap)) != NULL) MwDestroyPixmap(px); + if((px = MwGetPointer(handle, MwNpixmap)) != NULL) MwDestroyPixmap(px); } static void MWAPI messagebox_close(MwWidget handle, void* user, void* call) { @@ -109,7 +109,7 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi px = MwLoadIcon(icon, data); - MwSetVoid(icon, MwNpixmap, px); + MwSetPointer(icon, MwNpixmap, px); left = 8 + 48 + 8; } diff --git a/src/text/text.c b/src/text/text.c index 327a32ca..f7ebd402 100644 --- a/src/text/text.c +++ b/src/text/text.c @@ -71,8 +71,8 @@ static int is_monospace(MwWidget handle, MwFLFont ttf) { static MwFLFont assume_ttf(MwWidget handle, MwFLFont ttf) { if(is_bitmap(handle, ttf)) return NULL; - if(is_monospace(handle, ttf)) return is_bold(handle, ttf) ? MwGetVoid(handle, MwNboldMonospaceFont) : MwGetVoid(handle, MwNmonospaceFont); - return is_bold(handle, ttf) ? MwGetVoid(handle, MwNboldFont) : MwGetVoid(handle, MwNfont); + if(is_monospace(handle, ttf)) return is_bold(handle, ttf) ? MwGetPointer(handle, MwNboldMonospaceFont) : MwGetPointer(handle, MwNmonospaceFont); + return is_bold(handle, ttf) ? MwGetPointer(handle, MwNboldFont) : MwGetPointer(handle, MwNfont); } #endif diff --git a/src/widget/button.c b/src/widget/button.c index a0857c18..1df22469 100644 --- a/src/widget/button.c +++ b/src/widget/button.c @@ -18,8 +18,8 @@ static void draw(MwWidget handle) { MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground)); const char* str = MwGetText(handle, MwNtext); - MwPixmap px = MwGetVoid(handle, MwNpixmap); - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap px = MwGetPointer(handle, MwNpixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); int inv; if(str == NULL) str = ""; diff --git a/src/widget/checkbox.c b/src/widget/checkbox.c index 5e9cff13..2b29ac65 100644 --- a/src/widget/checkbox.c +++ b/src/widget/checkbox.c @@ -13,7 +13,7 @@ static void draw(MwWidget handle) { MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground)); MwColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground)); - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); r.x = 0; r.y = 0; diff --git a/src/widget/entry.c b/src/widget/entry.c index 6f363f20..305545c1 100644 --- a/src/widget/entry.c +++ b/src/widget/entry.c @@ -50,7 +50,7 @@ static void draw(MwWidget handle) { MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground)); const char* str = MwGetText(handle, MwNtext); - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); MwFLFont font = MwFLBuildFont(MwFLFlagMonospace); if(str == NULL) str = ""; diff --git a/src/widget/frame.c b/src/widget/frame.c index 841fae27..5ed79f52 100644 --- a/src/widget/frame.c +++ b/src/widget/frame.c @@ -14,7 +14,7 @@ static void draw(MwWidget handle) { MwRect rr; MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); int inverted; - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); if(MwGetInteger(handle, MwNhasBorder)) { inverted = MwGetInteger(handle, MwNinverted); diff --git a/src/widget/image.c b/src/widget/image.c index 17c0d3ab..6d5423b5 100644 --- a/src/widget/image.c +++ b/src/widget/image.c @@ -12,7 +12,7 @@ static int wcreate(MwWidget handle) { static void draw(MwWidget handle) { MwRect r; - MwPixmap px = MwGetVoid(handle, MwNpixmap); + MwPixmap px = MwGetPointer(handle, MwNpixmap); MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); r.x = 0; diff --git a/src/widget/label.c b/src/widget/label.c index 7dc8b52d..e11fcc40 100644 --- a/src/widget/label.c +++ b/src/widget/label.c @@ -129,7 +129,7 @@ static void draw_seven_segment(MwWidget handle) { MwColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow); int align; const char* str = MwGetText(handle, MwNtext); - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); MwLabel lab = handle->internal; int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2); int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1; @@ -320,7 +320,7 @@ static void draw_normal(MwWidget handle) { MwColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow); int align; const char* str = MwGetText(handle, MwNtext); - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); if(str == NULL) str = ""; diff --git a/src/widget/progressbar.c b/src/widget/progressbar.c index 97352b0a..879bd42e 100644 --- a/src/widget/progressbar.c +++ b/src/widget/progressbar.c @@ -16,7 +16,7 @@ static void draw(MwWidget handle) { MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwColor fill = MwParseColor(handle, MwGetText(handle, MwNforeground)); double w; - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); r.x = 0; r.y = 0; diff --git a/src/widget/radiobox.c b/src/widget/radiobox.c index 6fce85a9..475991fe 100644 --- a/src/widget/radiobox.c +++ b/src/widget/radiobox.c @@ -13,7 +13,7 @@ static int wcreate(MwWidget handle) { static void draw(MwWidget handle) { MwRect r; MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); r.x = 0; r.y = 0; diff --git a/src/widget/scrollbar.c b/src/widget/scrollbar.c index 82e82861..613868bd 100644 --- a/src/widget/scrollbar.c +++ b/src/widget/scrollbar.c @@ -60,7 +60,7 @@ static void draw(MwWidget handle) { MwScrollBar scr = handle->internal; int or ; int uy, dy, ux, dx; - MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap); r.x = 0; r.y = 0; diff --git a/src/widget/subwindow.c b/src/widget/subwindow.c index 484b998a..37c7b14a 100644 --- a/src/widget/subwindow.c +++ b/src/widget/subwindow.c @@ -291,7 +291,7 @@ static void draw(MwWidget handle) { MwRect r, r2, r3; const char* title = MwGetText(handle, MwNtitle); int incr = 0; - MwPixmap px = MwGetVoid(handle, MwNiconPixmap); + MwPixmap px = MwGetPointer(handle, MwNiconPixmap); r.x = 0; r.y = 0; diff --git a/src/widget/tab.c b/src/widget/tab.c index 87066890..3ae47dc2 100644 --- a/src/widget/tab.c +++ b/src/widget/tab.c @@ -45,7 +45,7 @@ static int icon_width(MwWidget handle, const char* text) { for(i = 0; i < arrlen(t->names); i++) { if(strcmp(t->names[i], text) == 0) { - MwPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap); + MwPixmap px = MwGetPointer(t->frames[i], MwNiconPixmap); if(px == NULL) return 0; @@ -97,7 +97,7 @@ static void draw(MwWidget handle) { x += r2.width; if(iw > 0) { - MwPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap); + MwPixmap px = MwGetPointer(t->frames[i], MwNiconPixmap); MwRect rp; rp = r2; diff --git a/src/widget/vulkan.c b/src/widget/vulkan.c index 0bc0703d..a57e142b 100644 --- a/src/widget/vulkan.c +++ b/src/widget/vulkan.c @@ -576,7 +576,7 @@ static void prop_change(MwWidget handle, const char* prop) { arrput(o->enabledLayers, str); } else if(strcmp(prop, MwNvulkanConfig) == 0) { - memcpy(&o->vulkan_config, MwGetVoid(handle, MwNvulkanConfig), sizeof(MwVulkanConfig)); + memcpy(&o->vulkan_config, MwGetPointer(handle, MwNvulkanConfig), sizeof(MwVulkanConfig)); } }