mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
fixed bug of handling non string values in string type options in defaults.c
This commit is contained in:
@@ -154,7 +154,6 @@ static int setMenuTextFont();
|
|||||||
static int setIconTitleFont();
|
static int setIconTitleFont();
|
||||||
static int setIconTitleColor();
|
static int setIconTitleColor();
|
||||||
static int setIconTitleBack();
|
static int setIconTitleBack();
|
||||||
static int setDisplayFont();
|
|
||||||
static int setLargeDisplayFont();
|
static int setLargeDisplayFont();
|
||||||
static int setWTitleColor();
|
static int setWTitleColor();
|
||||||
static int setFTitleBack();
|
static int setFTitleBack();
|
||||||
@@ -568,9 +567,6 @@ WDefaultEntry optionList[] = {
|
|||||||
{"ClipTitleFont", DEF_CLIP_TITLE_FONT, NULL,
|
{"ClipTitleFont", DEF_CLIP_TITLE_FONT, NULL,
|
||||||
NULL, getFont, setClipTitleFont
|
NULL, getFont, setClipTitleFont
|
||||||
},
|
},
|
||||||
{"DisplayFont", DEF_INFO_TEXT_FONT, NULL,
|
|
||||||
NULL, getFont, setDisplayFont
|
|
||||||
},
|
|
||||||
{"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT, NULL,
|
{"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT, NULL,
|
||||||
NULL, getFont, setLargeDisplayFont
|
NULL, getFont, setLargeDisplayFont
|
||||||
},
|
},
|
||||||
@@ -1316,10 +1312,14 @@ wDefaultUpdateIcons(WScreen *scr)
|
|||||||
|
|
||||||
/* --------------------------- Local ----------------------- */
|
/* --------------------------- Local ----------------------- */
|
||||||
|
|
||||||
#define STRINGP(x) if (!PLIsString(value)) { \
|
#define GET_STRING_OR_DEFAULT(x, var) if (!PLIsString(value)) { \
|
||||||
wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
|
wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
|
||||||
entry->key, x); \
|
entry->key, x); \
|
||||||
return False; }
|
wwarning(_("using default \"%s\" instead"), entry->default_value); \
|
||||||
|
var = entry->default_value;\
|
||||||
|
} else var = PLGetString(value)\
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1373,9 +1373,7 @@ getBool(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
|||||||
char *val;
|
char *val;
|
||||||
int second_pass=0;
|
int second_pass=0;
|
||||||
|
|
||||||
STRINGP("Boolean");
|
GET_STRING_OR_DEFAULT("Boolean", val);
|
||||||
|
|
||||||
val = PLGetString(value);
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
if ((val[1]=='\0' && (val[0]=='y' || val[0]=='Y'))
|
if ((val[1]=='\0' && (val[0]=='y' || val[0]=='Y'))
|
||||||
@@ -1424,9 +1422,7 @@ getInt(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
|||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
|
|
||||||
STRINGP("Integer");
|
GET_STRING_OR_DEFAULT("Integer", val);
|
||||||
|
|
||||||
val = PLGetString(value);
|
|
||||||
|
|
||||||
if (sscanf(val, "%i", &data)!=1) {
|
if (sscanf(val, "%i", &data)!=1) {
|
||||||
wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
|
wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
|
||||||
@@ -1540,9 +1536,7 @@ getString(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
|||||||
{
|
{
|
||||||
static char *data;
|
static char *data;
|
||||||
|
|
||||||
STRINGP("String");
|
GET_STRING_OR_DEFAULT("String", data);
|
||||||
|
|
||||||
data = PLGetString(value);
|
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = PLGetString(entry->plvalue);
|
data = PLGetString(entry->plvalue);
|
||||||
@@ -2211,9 +2205,7 @@ getFont(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
|||||||
static WMFont *font;
|
static WMFont *font;
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
STRINGP("Font");
|
GET_STRING_OR_DEFAULT("Font", val);
|
||||||
|
|
||||||
val = PLGetString(value);
|
|
||||||
|
|
||||||
font = WMCreateFont(scr->wmscreen, val);
|
font = WMCreateFont(scr->wmscreen, val);
|
||||||
if (!font)
|
if (!font)
|
||||||
@@ -2242,9 +2234,8 @@ getColor(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
|||||||
char *val;
|
char *val;
|
||||||
int second_pass=0;
|
int second_pass=0;
|
||||||
|
|
||||||
STRINGP("Color");
|
GET_STRING_OR_DEFAULT("Color", val);
|
||||||
|
|
||||||
val = PLGetString(value);
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
if (!wGetColor(scr, val, &color)) {
|
if (!wGetColor(scr, val, &color)) {
|
||||||
@@ -2284,9 +2275,7 @@ getKeybind(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
|||||||
char buf[128], *b;
|
char buf[128], *b;
|
||||||
|
|
||||||
|
|
||||||
STRINGP("Key spec");
|
GET_STRING_OR_DEFAULT("Key spec", val);
|
||||||
|
|
||||||
val = PLGetString(value);
|
|
||||||
|
|
||||||
if (!val || strcasecmp(val, "NONE")==0) {
|
if (!val || strcasecmp(val, "NONE")==0) {
|
||||||
shortcut.keycode = 0;
|
shortcut.keycode = 0;
|
||||||
@@ -2345,9 +2334,8 @@ getModMask(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
|||||||
static unsigned int mask;
|
static unsigned int mask;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
STRINGP("Modifier Key");
|
GET_STRING_OR_DEFAULT("Modifier Key", str);
|
||||||
|
|
||||||
str = PLGetString(value);
|
|
||||||
if (!str)
|
if (!str)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
@@ -2379,9 +2367,7 @@ getRImages(WScreen *scr, WDefaultEntry *entry, proplist_t value,
|
|||||||
int i, n;
|
int i, n;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
STRINGP("Image File Path");
|
GET_STRING_OR_DEFAULT("Image File Path", str);
|
||||||
|
|
||||||
str = PLGetString(value);
|
|
||||||
if (!str)
|
if (!str)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
@@ -2586,28 +2572,6 @@ setClipTitleFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
setDisplayFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
|
||||||
{
|
|
||||||
if (scr->info_text_font) {
|
|
||||||
WMReleaseFont(scr->info_text_font);
|
|
||||||
}
|
|
||||||
|
|
||||||
scr->info_text_font = font;
|
|
||||||
|
|
||||||
/* This test works because the scr structure is initially zeroed out
|
|
||||||
and None = 0. Any other time, the window should be valid. */
|
|
||||||
if (scr->geometry_display != None) {
|
|
||||||
wGetGeometryWindowSize(scr, &scr->geometry_display_width,
|
|
||||||
&scr->geometry_display_height);
|
|
||||||
XResizeWindow(dpy, scr->geometry_display,
|
|
||||||
scr->geometry_display_width, scr->geometry_display_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
@@ -2950,10 +2914,6 @@ setWidgetColor(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo
|
|||||||
}
|
}
|
||||||
scr->widget_texture = *(WTexSolid**)texture;
|
scr->widget_texture = *(WTexSolid**)texture;
|
||||||
|
|
||||||
if (scr->geometry_display != None)
|
|
||||||
XSetWindowBackground(dpy, scr->geometry_display,
|
|
||||||
scr->widget_texture->normal.pixel);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user