1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-31 11:02:35 +01:00

small cleanup

This commit is contained in:
dan
2001-10-10 18:52:14 +00:00
parent 4be9abcdbc
commit 8cb297a671
2 changed files with 28 additions and 26 deletions

View File

@@ -202,12 +202,15 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
if (class && instance) { if (class && instance) {
char *buffer = NULL; char *buffer;
buffer = wmalloc(strlen(class)+strlen(instance)+4);
key1 = WMCreatePLString(strcat(strcat(strcpy(buffer,instance),"."),class)); buffer = wmalloc(strlen(class)+strlen(instance)+2);
wfree(buffer); sprintf(buffer, "%s.%s", instance, class);
} else key1 = WMCreatePLString(buffer);
key1 = NULL; wfree(buffer);
} else {
key1 = NULL;
}
if (instance) if (instance)
key2 = WMCreatePLString(instance); key2 = WMCreatePLString(instance);
@@ -342,13 +345,15 @@ get_generic_value(WScreen *scr, char *instance, char *class, WMPropList *option,
WMPLSetCaseSensitive(True); WMPLSetCaseSensitive(True);
if (class && instance) { if (class && instance) {
char *buffer = NULL; char *buffer;
buffer = wmalloc(strlen(class)+strlen(instance)+4);
key = WMCreatePLString(strcat(strcat(strcpy(buffer,instance),"."),class)); buffer = wmalloc(strlen(class)+strlen(instance)+2);
sprintf(buffer, "%s.%s", instance, class);
key = WMCreatePLString(buffer);
wfree(buffer);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key); dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
WMReleasePropList(key); WMReleasePropList(key);
wfree(buffer);
if (dict) { if (dict) {
value = WMGetFromPLDictionary(dict, option); value = WMGetFromPLDictionary(dict, option);
@@ -508,7 +513,7 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
if (instance && class) { if (instance && class) {
char *buffer; char *buffer;
buffer = wmalloc(strlen(instance) + strlen(class) + 2); buffer = wmalloc(strlen(instance) + strlen(class) + 2);
strcat(strcat(strcpy(buffer, instance), "."), class); sprintf(buffer, "%s.%s", instance, class);
key = WMCreatePLString(buffer); key = WMCreatePLString(buffer);
wfree(buffer); wfree(buffer);
} else if (instance) { } else if (instance) {

View File

@@ -525,10 +525,10 @@ saveSettings(WMButton *button, InspectorPanel *panel)
else if (WMGetButtonSelected(panel->clsRb) != 0) else if (WMGetButtonSelected(panel->clsRb) != 0)
key = WMCreatePLString(wwin->wm_class); key = WMCreatePLString(wwin->wm_class);
else if (WMGetButtonSelected(panel->bothRb) != 0) { else if (WMGetButtonSelected(panel->bothRb) != 0) {
char *buffer; char *buffer;
buffer = wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+4); buffer = wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+2);
strcat(strcat(strcpy(buffer, wwin->wm_instance), "."), wwin->wm_class); sprintf(buffer, "%s.%s", wwin->wm_instance, wwin->wm_class);
key = WMCreatePLString(buffer); key = WMCreatePLString(buffer);
wfree(buffer); wfree(buffer);
} else if (WMGetButtonSelected(panel->defaultRb) != 0) { } else if (WMGetButtonSelected(panel->defaultRb) != 0) {
@@ -682,25 +682,22 @@ saveSettings(WMButton *button, InspectorPanel *panel)
wapp = wApplicationOf(panel->inspected->main_window); wapp = wApplicationOf(panel->inspected->main_window);
if (wapp) { if (wapp) {
char *iconFile; char *instance = wapp->main_window_desc->wm_instance;
char *buffer; char *class = wapp->main_window_desc->wm_class;
char *iconFile, *buffer;
appDic = WMCreatePLDictionary(NULL, NULL, NULL); appDic = WMCreatePLDictionary(NULL, NULL, NULL);
assert(wapp->main_window_desc->wm_instance!=NULL); assert(instance!=NULL);
assert(wapp->main_window_desc->wm_class!=NULL); assert(class!=NULL);
buffer = wmalloc(strlen(wapp->main_window_desc->wm_instance) buffer = wmalloc(strlen(instance)+strlen(class)+2);
+strlen(wapp->main_window_desc->wm_class)+4); sprintf(buffer, "%s.%s", instance, class);
strcat(strcpy(buffer, wapp->main_window_desc->wm_instance), ".");
strcat(buffer, wapp->main_window_desc->wm_class);
key = WMCreatePLString(buffer); key = WMCreatePLString(buffer);
wfree(buffer); wfree(buffer);
iconFile = wDefaultGetIconFile(wwin->screen_ptr, iconFile = wDefaultGetIconFile(wwin->screen_ptr,
wapp->main_window_desc->wm_instance, instance, class, False);
wapp->main_window_desc->wm_class,
False);
if (iconFile && iconFile[0]!=0) { if (iconFile && iconFile[0]!=0) {
value = WMCreatePLString(iconFile); value = WMCreatePLString(iconFile);