Skip to content

Commit

Permalink
modules: convert to use fvwm_debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAdam committed Dec 30, 2024
1 parent e89aee2 commit cce26bb
Show file tree
Hide file tree
Showing 14 changed files with 317 additions and 303 deletions.
47 changes: 28 additions & 19 deletions modules/FvwmBacker/FvwmBacker.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ int main(int argc, char **argv)

if ((argc != 6) && (argc != 7))
{
fvwm_debug(__func__,
fvwm_debug(Module,
"%s Version %s should only be executed by fvwm!\n",
Module, VERSION);
__func__, VERSION);
exit(1);
}

Expand All @@ -160,8 +160,8 @@ int main(int argc, char **argv)
dpy = XOpenDisplay(displayName);
if (!dpy)
{
fvwm_debug(__func__, "%s: unable to open display '%s'\n",
Module, XDisplayName (displayName));
fvwm_debug(Module, "%s: unable to open display '%s'\n",
__func__, XDisplayName (displayName));
exit (2);
}
screen = DefaultScreen(dpy);
Expand Down Expand Up @@ -302,8 +302,9 @@ void SetDeskPageBackground(const Command *c)
dpy2 = XOpenDisplay(displayName);
if (!dpy2)
{
fvwm_debug(__func__,
"Fail to create a forking dpy, Exit!");
fvwm_debug(Module,
"%s: Fail to create a forking dpy, Exit!",
__func__);
exit(2);
}
screen2 = DefaultScreen(dpy2);
Expand All @@ -321,19 +322,19 @@ void SetDeskPageBackground(const Command *c)
/* Process a colorset */
if (CSET_IS_TRANSPARENT(c->colorset))
{
fvwm_debug(__func__, "You cannot "
fvwm_debug(Module, "%s: You cannot "
"use a transparent colorset as "
"background!");
"background!", __func__);
XUngrabServer(dpy2);
XCloseDisplay(dpy2);
return;
}
else if (Pdepth != DefaultDepth(dpy2, screen2))
{
fvwm_debug(__func__, "You cannot "
fvwm_debug(Module, "%s: You cannot "
"use a colorset background if\n"
"the fvwm depth is not equal "
"to the root depth!");
"to the root depth!", __func__);
XUngrabServer(dpy2);
XCloseDisplay(dpy2);
return;
Expand Down Expand Up @@ -531,6 +532,10 @@ int ParseConfigLine(char *line)
else if (strncasecmp(line, "colorset", 8) == 0)
{
return LoadColorset(line + 8);
} else if (strncasecmp(line, "LoggingFD", 9) == 0) {
int fd = -1;
sscanf((line + 10), "%d", &fd);
log_set_fd(fd);
}
}
return -1;
Expand Down Expand Up @@ -585,8 +590,9 @@ Bool ParseNewCommand(
{
if (GetNextToken(option_val, &value) == NULL)
{
fvwm_debug(__func__,
"Desk option requires a value");
fvwm_debug(Module,
"%s: Desk option requires a value",
__func__);
return 1;
}
if (!StrEquals(value, "*"))
Expand All @@ -602,17 +608,19 @@ Bool ParseNewCommand(
if ((option_val = GetNextToken(
option_val,&value)) == NULL)
{
fvwm_debug(__func__,
"Page option requires 2 values");
fvwm_debug(Module,
"%s: Page option requires 2 values",
__func__);
return 1;
}
if (!StrEquals(value, "*"))
this->x = atoi(value);
free(value);
if (GetNextToken(option_val, &value) == NULL)
{
fvwm_debug(__func__,
"Desk option requires 2 values");
fvwm_debug(Module,
"%s: Desk option requires 2 values",
__func__);
return 1;
}
if (!StrEquals(value, "*"))
Expand Down Expand Up @@ -679,8 +687,9 @@ void AddCommand(char *line)
line, &parens, ")", NULL, NULL, NULL);
if (line == NULL)
{
fvwm_debug(__func__,
"Syntax error: no closing brace");
fvwm_debug(Module,
"%s: Syntax error: no closing brace",
__func__);
free(this);
return;
}
Expand All @@ -697,7 +706,7 @@ void AddCommand(char *line)
}
else
{
fvwm_debug(__func__, "Unknown directive: %s", line);
fvwm_debug(Module, "%s: Unknown directive: %s", __func__, line);
return;
}
this->flags.do_ignore_desk = do_ignore_desk;
Expand Down
6 changes: 3 additions & 3 deletions modules/FvwmBacker/root_bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ unsigned long BackerGetColor(char *name)
color.pixel = 0;
if (!XParseColor (dpy, DefaultColormap(dpy,screen), name, &color))
{
fvwm_debug(__func__, "%s: unknown color \"%s\"\n",Module,name);
fvwm_debug(Module, "%s: unknown color \"%s\"\n",__func__,name);
exit(1);
}
else if(!XAllocColor (dpy, DefaultColormap(dpy,screen), &color))
{
fvwm_debug(__func__, "%s: unable to allocate color for \"%s\"\n",
Module, name);
fvwm_debug(Module, "%s: unable to allocate color for \"%s\"\n",
__func__, name);
exit(1);
}

Expand Down
Loading

0 comments on commit cce26bb

Please sign in to comment.