MwSetVoid/MwGetVoid to Pointer
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-09-27 06:15:29 +09:00
commit 845be77805
19 changed files with 42 additions and 42 deletions

View file

@ -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) {

View file

@ -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

View file

@ -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"

View file

@ -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 @@
<string name="value" />
</arguments>
</function>
<function name="MwSetVoid">
<function name="MwSetPointer">
<arguments>
<widget name="handle" />
<string name="key" />
@ -408,7 +408,7 @@
<string name="key" />
</arguments>
</function>
<function name="MwGetVoid">
<function name="MwGePointer">
<return>
<pointer />
</return>

View file

@ -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) {

View file

@ -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;
}

View file

@ -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

View file

@ -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 = "";

View file

@ -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;

View file

@ -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 = "";

View file

@ -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);

View file

@ -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;

View file

@ -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 = "";

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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));
}
}