Reimplement the PropList data structure in Rust.

While this large change has some unit tests, it has not been integration tested
thoroughly. Removing the global case insensitivity flag may be an issue in
particular.

A few of PropList API functions have been modified (mostly to get rid of
varargs). The definition of one such function has been left in C for cleanup
later.
This commit is contained in:
2025-10-23 14:46:56 -04:00
parent 5b593fb19a
commit f3961ba66f
32 changed files with 3417 additions and 1966 deletions
+32 -17
View File
@@ -174,15 +174,18 @@ static WMPropList *get_value_from_instanceclass(const char *value)
key = WMCreatePLString(value);
WMPLSetCaseSensitive(True);
if (w_global.domain.window_attr->dictionary)
val = key ? WMGetFromPLDictionary(w_global.domain.window_attr->dictionary, key) : NULL;
if (key)
WMReleasePropList(key);
WMPLSetCaseSensitive(False);
/*
* Rust rewrite note: this API surface has been removed, but we leave in
* a record of where it was invoked to set a value other than the
* default, in case it helps to track down bugs in the future.
*/
/* WMPLSetCaseSensitive(False); */
return val;
}
@@ -219,8 +222,6 @@ void wDefaultFillAttributes(const char *instance, const char *class,
dn = get_value_from_instanceclass(instance);
dc = get_value_from_instanceclass(class);
WMPLSetCaseSensitive(True);
if ((w_global.domain.window_attr->dictionary) && (useGlobalDefault))
da = WMGetFromPLDictionary(w_global.domain.window_attr->dictionary, AnyWindow);
@@ -311,8 +312,13 @@ void wDefaultFillAttributes(const char *instance, const char *class,
APPLY_VAL(value, no_language_button, ANoLanguageButton);
#endif
/*
* Rust rewrite note: this API surface has been removed, but we leave in
* a record of where it was invoked to set a value other than the
* default, in case it helps to track down bugs in the future.
*/
/* clean up */
WMPLSetCaseSensitive(False);
/* WMPLSetCaseSensitive(False); */
}
static WMPropList *get_generic_value(const char *instance, const char *class,
@@ -322,8 +328,6 @@ static WMPropList *get_generic_value(const char *instance, const char *class,
value = NULL;
WMPLSetCaseSensitive(True);
/* Search the icon name using class and instance */
if (class && instance) {
char *buffer;
@@ -371,7 +375,12 @@ static WMPropList *get_generic_value(const char *instance, const char *class,
value = WMGetFromPLDictionary(dict, option);
}
WMPLSetCaseSensitive(False);
/*
* Rust rewrite note: this API surface has been removed, but we leave in
* a record of where it was invoked to set a value other than the
* default, in case it helps to track down bugs in the future.
*/
/* WMPLSetCaseSensitive(False); */
return value;
}
@@ -545,15 +554,13 @@ void wDefaultChangeIcon(const char *instance, const char *class, const char *fil
int same = 0;
if (!dict) {
dict = WMCreatePLDictionary(NULL, NULL);
dict = WMCreateEmptyPLDictionary();
if (dict)
db->dictionary = dict;
else
return;
}
WMPLSetCaseSensitive(True);
if (instance && class) {
char *buffer;
@@ -570,7 +577,7 @@ void wDefaultChangeIcon(const char *instance, const char *class, const char *fil
if (file) {
value = WMCreatePLString(file);
icon_value = WMCreatePLDictionary(AIcon, value, NULL);
icon_value = WMCreatePLDictionary(AIcon, value);
WMReleasePropList(value);
def_win = WMGetFromPLDictionary(dict, AnyWindow);
@@ -600,7 +607,12 @@ void wDefaultChangeIcon(const char *instance, const char *class, const char *fil
if (icon_value)
WMReleasePropList(icon_value);
WMPLSetCaseSensitive(False);
/*
* Rust rewrite note: this API surface has been removed, but we leave in
* a record of where it was invoked to set a value other than the
* default, in case it helps to track down bugs in the future.
*/
/* WMPLSetCaseSensitive(False); */
}
void wDefaultPurgeInfo(const char *instance, const char *class)
@@ -612,8 +624,6 @@ void wDefaultPurgeInfo(const char *instance, const char *class)
init_wdefaults();
}
WMPLSetCaseSensitive(True);
buffer = wmalloc(strlen(class) + strlen(instance) + 2);
sprintf(buffer, "%s.%s", instance, class);
key = WMCreatePLString(buffer);
@@ -631,7 +641,12 @@ void wDefaultPurgeInfo(const char *instance, const char *class)
wfree(buffer);
WMReleasePropList(key);
WMPLSetCaseSensitive(False);
/*
* Rust rewrite note: this API surface has been removed, but we leave in
* a record of where it was invoked to set a value other than the
* default, in case it helps to track down bugs in the future.
*/
/* WMPLSetCaseSensitive(False); */
}
/* --------------------------- Local ----------------------- */