Skip to content

Commit

Permalink
*: Rename [bf]g_color->[bf]gcolor
Browse files Browse the repository at this point in the history
This is just an internal variable change, nothing user-facing.
  • Loading branch information
jcs committed Jul 24, 2024
1 parent b777d1d commit abb4c58
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 54 deletions.
30 changes: 15 additions & 15 deletions actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,8 +1931,8 @@ read_frame(struct sbuf *s, struct cmdarg **arg)
* Loop through each frame and display its number in its top
* left corner.
*/
attr.border_pixel = rp_glob_screen.fg_color;
attr.background_pixel = rp_glob_screen.bg_color;
attr.border_pixel = rp_glob_screen.fgcolor;
attr.background_pixel = rp_glob_screen.bgcolor;
attr.override_redirect = True;

list_for_each_entry(cur_frame, &rp_current_vscreen->frames,
Expand Down Expand Up @@ -3764,17 +3764,17 @@ update_gc(rp_screen * s)
{
XGCValues gcv;

gcv.foreground = rp_glob_screen.fg_color;
gcv.background = rp_glob_screen.bg_color;
gcv.foreground = rp_glob_screen.fgcolor;
gcv.background = rp_glob_screen.bgcolor;
gcv.function = GXcopy;
gcv.line_width = 1;
gcv.subwindow_mode = IncludeInferiors;
XFreeGC(dpy, s->normal_gc);
s->normal_gc = XCreateGC(dpy, s->root,
GCForeground | GCBackground | GCFunction | GCLineWidth |
GCSubwindowMode, &gcv);
gcv.foreground = rp_glob_screen.bg_color;
gcv.background = rp_glob_screen.fg_color;
gcv.foreground = rp_glob_screen.bgcolor;
gcv.background = rp_glob_screen.fgcolor;
XFreeGC(dpy, s->inverse_gc);
s->inverse_gc = XCreateGC(dpy, s->root,
GCForeground | GCBackground | GCFunction | GCLineWidth |
Expand Down Expand Up @@ -4101,12 +4101,12 @@ set_fgcolor(struct cmdarg **args)
return cmdret_new(RET_FAILURE,
"set fgcolor: unknown color");

rp_glob_screen.fg_color = color.pixel | (0xff << 24);
rp_glob_screen.fgcolor = color.pixel | (0xff << 24);
update_gc(s);

if (!XftColorAllocName(dpy, DefaultVisual(dpy, s->screen_num),
DefaultColormap(dpy, s->screen_num), ARG_STRING(0),
&s->xft_fg_color))
&s->xft_fgcolor))
return cmdret_new(RET_FAILURE,
"set fgcolor: unknown color");

Expand Down Expand Up @@ -4135,7 +4135,7 @@ set_bgcolor(struct cmdarg **args)
"set bgcolor: unknown color");

color.pixel |= (0xff << 24);
rp_glob_screen.bg_color = color.pixel;
rp_glob_screen.bgcolor = color.pixel;
update_gc(s);
XSetWindowBackground(dpy, s->bar_window, color.pixel);
XSetWindowBackground(dpy, s->input_window, color.pixel);
Expand All @@ -4144,7 +4144,7 @@ set_bgcolor(struct cmdarg **args)

if (!XftColorAllocName(dpy, DefaultVisual(dpy, s->screen_num),
DefaultColormap(dpy, s->screen_num), ARG_STRING(0),
&s->xft_bg_color))
&s->xft_bgcolor))
return cmdret_new(RET_FAILURE,
"set fgcolor: unknown color");

Expand Down Expand Up @@ -4173,7 +4173,7 @@ set_fwcolor(struct cmdarg **args)
return cmdret_new(RET_FAILURE,
"set fwcolor: unknown color");

rp_glob_screen.fw_color = color.pixel | (0xff << 24);
rp_glob_screen.fwcolor = color.pixel | (0xff << 24);
update_gc(s);

free(defaults.fwcolor_string);
Expand All @@ -4182,7 +4182,7 @@ set_fwcolor(struct cmdarg **args)

/* Update current window. */
if (win != NULL)
XSetWindowBorder(dpy, win->w, rp_glob_screen.fw_color);
XSetWindowBorder(dpy, win->w, rp_glob_screen.fwcolor);

return cmdret_new(RET_SUCCESS, NULL);
}
Expand All @@ -4203,7 +4203,7 @@ set_bwcolor(struct cmdarg **args)
return cmdret_new(RET_FAILURE,
"set bwcolor: unknown color");

rp_glob_screen.bw_color = color.pixel | (0xff << 24);
rp_glob_screen.bwcolor = color.pixel | (0xff << 24);
update_gc(s);

free(defaults.bwcolor_string);
Expand All @@ -4213,7 +4213,7 @@ set_bwcolor(struct cmdarg **args)
/* Update all the visible windows. */
list_for_each_entry(win, &rp_mapped_window, node) {
if (win != cur_win)
XSetWindowBorder(dpy, win->w, rp_glob_screen.bw_color);
XSetWindowBorder(dpy, win->w, rp_glob_screen.bwcolor);
}

return cmdret_new(RET_SUCCESS, NULL);
Expand All @@ -4236,7 +4236,7 @@ set_barbordercolor(struct cmdarg **args)
"set barbordercolor: unknown color");

color.pixel |= (0xff << 24);
rp_glob_screen.bar_border_color = color.pixel;
rp_glob_screen.bar_bordercolor = color.pixel;
update_gc(s);
XSetWindowBorder(dpy, s->bar_window, color.pixel);
XSetWindowBorder(dpy, s->input_window, color.pixel);
Expand Down
2 changes: 1 addition & 1 deletion bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ draw_box(rp_screen *s, int x, int y, int width, int height)
GC lgc;
unsigned long mask;

lgv.foreground = rp_glob_screen.fg_color;
lgv.foreground = rp_glob_screen.fgcolor;
mask = GCForeground;
lgc = XCreateGC(dpy, s->root, mask, &lgv);

Expand Down
4 changes: 2 additions & 2 deletions data.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct rp_window_elem {

struct rp_global_screen {
Window root, wm_check;
unsigned long fg_color, bg_color, fw_color, bw_color, bar_border_color;
unsigned long fgcolor, bgcolor, fwcolor, bwcolor, bar_bordercolor;

/* This numset is responsible for giving out numbers for each screen */
struct numset *numset;
Expand Down Expand Up @@ -232,7 +232,7 @@ struct rp_screen {

XftFont *xft_font;
struct rp_font xft_font_cache[5];
XftColor xft_fg_color, xft_bg_color;
XftColor xft_fgcolor, xft_bgcolor;

struct list_head vscreens;
struct numset *vscreens_numset;
Expand Down
6 changes: 3 additions & 3 deletions globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ rp_draw_string(rp_screen *s, Drawable d, int style, int x, int y, char *string,

if (color == NULL) {
if (style == STYLE_NORMAL)
memcpy(&xftcolor, &s->xft_fg_color, sizeof(XftColor));
memcpy(&xftcolor, &s->xft_fgcolor, sizeof(XftColor));
else
memcpy(&xftcolor, &s->xft_bg_color, sizeof(XftColor));
memcpy(&xftcolor, &s->xft_bgcolor, sizeof(XftColor));
} else {
/*
* This won't actually allocate anything if the color is
Expand All @@ -389,7 +389,7 @@ rp_draw_string(rp_screen *s, Drawable d, int style, int x, int y, char *string,
if (!XftColorAllocName(dpy, DefaultVisual(dpy, s->screen_num),
DefaultColormap(dpy, s->screen_num), color, &xftcolor)) {
warnx("couldn't XftColorAllocName \"%s\"", color);
memcpy(&xftcolor, &s->xft_fg_color, sizeof(XftColor));
memcpy(&xftcolor, &s->xft_fgcolor, sizeof(XftColor));
}
}

Expand Down
2 changes: 1 addition & 1 deletion input.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ update_input_window(rp_screen *s, rp_input_line *line)
line->length, NULL, NULL);

gcv.function = GXxor;
gcv.foreground = rp_glob_screen.fg_color ^ rp_glob_screen.bg_color;
gcv.foreground = rp_glob_screen.fgcolor ^ rp_glob_screen.bgcolor;
lgc = XCreateGC(dpy, s->input_window, GCFunction | GCForeground, &gcv);

/* Draw a cheap-o cursor - MkIII */
Expand Down
2 changes: 1 addition & 1 deletion manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ hide_window(rp_window *win)
* Ensure that the window doesn't have the focused border color. This
* is needed by remove_frame and possibly others.
*/
XSetWindowBorder(dpy, win->w, rp_glob_screen.bw_color);
XSetWindowBorder(dpy, win->w, rp_glob_screen.bwcolor);
set_state(win, IconicState);
}

Expand Down
58 changes: 29 additions & 29 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,51 +237,51 @@ init_global_screen(rp_global_screen *s)
s->root = RootWindow(dpy, screen_num);

s->numset = numset_new();
s->fg_color = WhitePixel(dpy, screen_num);
s->fgcolor = WhitePixel(dpy, screen_num);

if (XAllocNamedColor(dpy, DefaultColormap(dpy, screen_num),
defaults.fgcolor_string, &color, &junk))
rp_glob_screen.fg_color = color.pixel | (0xff << 24);
rp_glob_screen.fgcolor = color.pixel | (0xff << 24);
else {
warnx("failed allocating fgcolor %s", defaults.fgcolor_string);
s->fg_color = WhitePixel(dpy, screen_num);
s->fgcolor = WhitePixel(dpy, screen_num);
}

if (XAllocNamedColor(dpy, DefaultColormap(dpy, screen_num),
defaults.bgcolor_string, &color, &junk))
rp_glob_screen.bg_color = color.pixel | (0xff << 24);
rp_glob_screen.bgcolor = color.pixel | (0xff << 24);
else {
warnx("failed allocating bgcolor %s",defaults.bgcolor_string);
s->bg_color = BlackPixel(dpy, screen_num);
warnx("failed allocating bgcolor %s", defaults.bgcolor_string);
s->bgcolor = BlackPixel(dpy, screen_num);
}

if (XAllocNamedColor(dpy, DefaultColormap(dpy, screen_num),
defaults.fwcolor_string, &color, &junk))
rp_glob_screen.fw_color = color.pixel | (0xff << 24);
rp_glob_screen.fwcolor = color.pixel | (0xff << 24);
else {
warnx("failed allocating fwcolor %s", defaults.fwcolor_string);
s->fw_color = BlackPixel(dpy, screen_num);
s->fwcolor = BlackPixel(dpy, screen_num);
}

if (XAllocNamedColor(dpy, DefaultColormap(dpy, screen_num),
defaults.bwcolor_string, &color, &junk))
rp_glob_screen.bw_color = color.pixel | (0xff << 24);
rp_glob_screen.bwcolor = color.pixel | (0xff << 24);
else {
warnx("failed allocating bwcolor %s", defaults.bwcolor_string);
s->bw_color = BlackPixel(dpy, screen_num);
s->bwcolor = BlackPixel(dpy, screen_num);
}

if (XAllocNamedColor(dpy, DefaultColormap(dpy, screen_num),
defaults.barbordercolor_string, &color, &junk))
rp_glob_screen.bar_border_color = color.pixel | (0xff << 24);
rp_glob_screen.bar_bordercolor = color.pixel | (0xff << 24);
else {
warnx("failed allocating barbordercolor %s",
defaults.barbordercolor_string);
s->bar_border_color = BlackPixel(dpy, screen_num);
s->bar_bordercolor = BlackPixel(dpy, screen_num);
}

s->wm_check = XCreateSimpleWindow(dpy, s->root, 0, 0, 1, 1,
0, 0, rp_glob_screen.bg_color);
0, 0, rp_glob_screen.bgcolor);
set_atom(s->wm_check, _net_supporting_wm_check, XA_WINDOW,
&s->wm_check, 1);
set_atom(s->root, _net_supporting_wm_check, XA_WINDOW,
Expand Down Expand Up @@ -406,17 +406,17 @@ init_screen(rp_screen *s)
init_rat_cursor(s);

/* Setup the GC for drawing the font. */
gcv.foreground = rp_glob_screen.fg_color;
gcv.background = rp_glob_screen.bg_color;
gcv.foreground = rp_glob_screen.fgcolor;
gcv.background = rp_glob_screen.bgcolor;
gcv.function = GXcopy;
gcv.line_width = 1;
gcv.subwindow_mode = IncludeInferiors;
s->normal_gc = XCreateGC(dpy, s->root,
GCForeground | GCBackground | GCFunction
| GCLineWidth | GCSubwindowMode,
&gcv);
gcv.foreground = rp_glob_screen.bg_color;
gcv.background = rp_glob_screen.fg_color;
gcv.foreground = rp_glob_screen.bgcolor;
gcv.background = rp_glob_screen.fgcolor;
s->inverse_gc = XCreateGC(dpy, s->root,
GCForeground | GCBackground | GCFunction
| GCLineWidth | GCSubwindowMode,
Expand All @@ -430,21 +430,21 @@ init_screen(rp_screen *s)

if (!XftColorAllocName(dpy, DefaultVisual(dpy, screen_num),
DefaultColormap(dpy, screen_num),
defaults.fgcolor_string, &s->xft_fg_color))
defaults.fgcolor_string, &s->xft_fgcolor))
errx(1, "failed to allocate font fg color %s",
defaults.fgcolor_string);

if (!XftColorAllocName(dpy, DefaultVisual(dpy, screen_num),
DefaultColormap(dpy, screen_num),
defaults.bgcolor_string, &s->xft_bg_color))
defaults.bgcolor_string, &s->xft_bgcolor))
errx(1, "failed to allocate font bg color %s",
defaults.bgcolor_string);

/* Create the program bar window. */
s->bar_is_raised = 0;
s->bar_window = XCreateSimpleWindow(dpy, s->root, 0, 0, 1, 1,
defaults.bar_border_width, rp_glob_screen.bar_border_color,
rp_glob_screen.bg_color);
defaults.bar_border_width, rp_glob_screen.bar_bordercolor,
rp_glob_screen.bgcolor);
set_atom(s->bar_window, _net_wm_window_type, XA_ATOM,
&_net_wm_window_type_dock, 1);
XSelectInput(dpy, s->bar_window, ButtonPressMask);
Expand All @@ -462,23 +462,23 @@ init_screen(rp_screen *s)

/* Create the input window. */
s->input_window = XCreateSimpleWindow(dpy, s->root, 0, 0, 1, 1,
defaults.bar_border_width, rp_glob_screen.bar_border_color,
rp_glob_screen.bg_color);
defaults.bar_border_width, rp_glob_screen.bar_bordercolor,
rp_glob_screen.bgcolor);
set_atom(s->input_window, _net_wm_window_type, XA_ATOM,
&_net_wm_window_type_dock, 1);
XSelectInput(dpy, s->input_window, KeyPressMask | KeyReleaseMask);

/* Create the frame indicator window */
s->frame_window = XCreateSimpleWindow(dpy, s->root, 1, 1, 1, 1,
defaults.bar_border_width, rp_glob_screen.bar_border_color,
rp_glob_screen.bg_color);
defaults.bar_border_width, rp_glob_screen.bar_bordercolor,
rp_glob_screen.bgcolor);
set_atom(s->frame_window, _net_wm_window_type, XA_ATOM,
&_net_wm_window_type_tooltip, 1);

/* Create the help window */
s->help_window = XCreateSimpleWindow(dpy, s->root, s->left, s->top,
s->width, s->height, 0, rp_glob_screen.bar_border_color,
rp_glob_screen.bg_color);
s->width, s->height, 0, rp_glob_screen.bar_bordercolor,
rp_glob_screen.bgcolor);
set_atom(s->help_window, _net_wm_window_type, XA_ATOM,
&_net_wm_window_type_splash, 1);
XSelectInput(dpy, s->help_window, KeyPressMask);
Expand Down Expand Up @@ -763,9 +763,9 @@ screen_free(rp_screen *s)

if (s->xft_font) {
XftColorFree(dpy, DefaultVisual(dpy, s->screen_num),
DefaultColormap(dpy, s->screen_num), &s->xft_fg_color);
DefaultColormap(dpy, s->screen_num), &s->xft_fgcolor);
XftColorFree(dpy, DefaultVisual(dpy, s->screen_num),
DefaultColormap(dpy, s->screen_num), &s->xft_bg_color);
DefaultColormap(dpy, s->screen_num), &s->xft_bgcolor);
XftFontClose(dpy, s->xft_font);
}
rp_clear_cached_fonts(s);
Expand Down
4 changes: 2 additions & 2 deletions window.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ give_window_focus(rp_window *win, rp_window *last_win)
if (last_win->full_screen)
window_full_screen(NULL);
save_mouse_position(last_win);
XSetWindowBorder(dpy, last_win->w, rp_glob_screen.bw_color);
XSetWindowBorder(dpy, last_win->w, rp_glob_screen.bwcolor);
}
if (win == NULL)
return;
Expand All @@ -403,7 +403,7 @@ give_window_focus(rp_window *win, rp_window *last_win)
XUninstallColormap(dpy, last_win->colormap);
XInstallColormap(dpy, win->colormap);

XSetWindowBorder(dpy, win->w, rp_glob_screen.fw_color);
XSetWindowBorder(dpy, win->w, rp_glob_screen.fwcolor);

/* Finally, give the window focus */
rp_current_screen = win->vscreen->screen;
Expand Down

0 comments on commit abb4c58

Please sign in to comment.