barbutton: Remove barbutton feature provisionally (leak check)
This commit is contained in:
parent
4c9c324780
commit
4861329972
67
src/bar.c
67
src/bar.c
@ -135,72 +135,6 @@ updatebar(void)
|
||||
/* Refresh the bar */
|
||||
bar_refresh(bar);
|
||||
|
||||
/* Update Bar Buttons */
|
||||
updatebutton(True);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* BARBUTTON MANAGE FUNCTION
|
||||
* if c is False, you can execute this function for the first time
|
||||
* else the button is just updated *TestingButWorking* */
|
||||
void
|
||||
updatebutton(Bool c)
|
||||
{
|
||||
int i, j, x, pm = 0, buttonw = 0;
|
||||
int y = 0, hi = 0;
|
||||
|
||||
/* Calcul the position of the first button with the layout image size */
|
||||
j = taglen[conf.ntag] + textw(tags[seltag].layout.symbol) + PAD/2;
|
||||
|
||||
if(!conf.bartop)
|
||||
y = bary + 2;
|
||||
if(conf.tagbordwidth)
|
||||
hi = -1;
|
||||
|
||||
for(i = 0; i < conf.nbutton; ++i)
|
||||
{
|
||||
|
||||
/* CALCUL POSITION */
|
||||
{
|
||||
buttonw = textw(conf.barbutton[i].content) + BPAD;
|
||||
|
||||
if(!(x = conf.barbutton[i].x))
|
||||
{
|
||||
if(i)
|
||||
pm += textw(conf.barbutton[i-1].content) + BPAD;
|
||||
|
||||
buttonw = textw(conf.barbutton[i].content) + BPAD;
|
||||
x = (!i) ? j : j + pm;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIRST TIME */
|
||||
{
|
||||
if(!c)
|
||||
{
|
||||
conf.barbutton[i].bw = bar_create(x, y, buttonw, barheight + hi, 0,
|
||||
conf.barbutton[i].bg_color, False);
|
||||
XMapRaised(dpy, conf.barbutton[i].bw->win);
|
||||
}
|
||||
}
|
||||
|
||||
/* REFRESH TEXT */
|
||||
{
|
||||
if(!conf.barbutton[i].bw)
|
||||
return;
|
||||
|
||||
bar_refresh_color(conf.barbutton[i].bw);
|
||||
bar_moveresize(conf.barbutton[i].bw, x, y, buttonw, barheight + hi);
|
||||
draw_text(conf.barbutton[i].bw->dr, BPAD/2, fonth - 1, conf.barbutton[i].fg_color,
|
||||
conf.barbutton[i].bg_color, PAD, conf.barbutton[i].content);
|
||||
|
||||
/* Refresh button */
|
||||
bar_refresh(conf.barbutton[i].bw);
|
||||
}
|
||||
}
|
||||
XSync(dpy, False);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -223,7 +157,6 @@ uicb_togglebarpos(uicb_t cmd)
|
||||
updatebar();
|
||||
for(i = 0; i < conf.nbutton; ++i)
|
||||
XUnmapWindow(dpy, conf.barbutton[i].bw->win);
|
||||
updatebutton(False);
|
||||
for(i = 0; i < conf.nbutton; ++i)
|
||||
XMapWindow(dpy, conf.barbutton[i].bw->win);
|
||||
|
||||
|
||||
42
src/config.c
42
src/config.c
@ -261,22 +261,6 @@ init_conf(void)
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
static cfg_opt_t button_opts[] =
|
||||
{
|
||||
CFG_STR("content", "", CFGF_NONE),
|
||||
CFG_SEC("mouse", mouse_button_opts, CFGF_MULTI),
|
||||
CFG_STR("fg_color", "#000000", CFGF_NONE),
|
||||
CFG_STR("bg_color", "#FFFFFF", CFGF_NONE),
|
||||
CFG_INT("x", 0, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
static cfg_opt_t buttons_opts[] =
|
||||
{
|
||||
CFG_SEC("button", button_opts, CFGF_MULTI),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
static cfg_opt_t variable_opts[] =
|
||||
{
|
||||
CFG_STR("content", "", CFGF_NONE),
|
||||
@ -299,7 +283,6 @@ init_conf(void)
|
||||
CFG_SEC("layouts", layouts_opts, CFGF_NONE),
|
||||
CFG_SEC("tags", tags_opts, CFGF_NONE),
|
||||
CFG_SEC("keys", keys_opts, CFGF_NONE),
|
||||
CFG_SEC("buttons", buttons_opts, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
@ -312,8 +295,7 @@ init_conf(void)
|
||||
cfg_t *cfg_layouts;
|
||||
cfg_t *cfg_tags;
|
||||
cfg_t *cfg_keys;
|
||||
cfg_t *cfg_buttons;
|
||||
cfg_t *cfgtmp, *cfgtmp2, *cfgtmp3;
|
||||
cfg_t *cfgtmp;
|
||||
char final_path[128];
|
||||
char sfinal_path[128];
|
||||
char buf[256] = {0};
|
||||
@ -343,7 +325,6 @@ init_conf(void)
|
||||
cfg_layouts = cfg_getsec(cfg, "layouts");
|
||||
cfg_tags = cfg_getsec(cfg, "tags");
|
||||
cfg_keys = cfg_getsec(cfg, "keys");
|
||||
cfg_buttons = cfg_getsec(cfg, "buttons");
|
||||
|
||||
if((cfg_size(cfg_variables, "var")) > 256)
|
||||
{
|
||||
@ -518,27 +499,6 @@ init_conf(void)
|
||||
? NULL : strdup(var_to_str(cfg_getstr(cfgtmp, "cmd"))));
|
||||
}
|
||||
|
||||
/* button */
|
||||
conf.nbutton = cfg_size(cfg_buttons, "button");
|
||||
conf.barbutton = emalloc(conf.nbutton, sizeof(BarButton));
|
||||
|
||||
for(i = 0; i < conf.nbutton; ++i)
|
||||
{
|
||||
cfgtmp2 = cfg_getnsec(cfg_buttons, "button", i);
|
||||
for(j = 0; j < cfg_size(cfgtmp2, "mouse"); ++j)
|
||||
{
|
||||
cfgtmp3 = cfg_getnsec(cfgtmp2, "mouse", j);
|
||||
conf.barbutton[i].mouse[j].func = name_to_func(cfg_getstr(cfgtmp3, "func"), func_list);
|
||||
conf.barbutton[i].mouse[j].cmd = strdup(var_to_str(cfg_getstr(cfgtmp3, "cmd")));
|
||||
conf.barbutton[i].mouse[j].button = char_to_button(cfg_getstr(cfgtmp3, "button"));
|
||||
}
|
||||
conf.barbutton[i].nmousesec = cfg_size(cfgtmp2, "mouse");
|
||||
conf.barbutton[i].content = strdup(var_to_str(cfg_getstr(cfgtmp2, "content")));
|
||||
conf.barbutton[i].fg_color = strdup(var_to_str(cfg_getstr(cfgtmp2, "fg_color")));
|
||||
conf.barbutton[i].bg_color = getcolor(strdup(var_to_str(cfg_getstr(cfgtmp2, "bg_color"))));
|
||||
conf.barbutton[i].x = cfg_getint(cfgtmp2, "x");
|
||||
}
|
||||
|
||||
cfg_free(cfg);
|
||||
|
||||
return;
|
||||
|
||||
@ -51,8 +51,10 @@ draw_text(Drawable d, int x, int y, char* fg, uint bg, int pad, char *str)
|
||||
/* Draw the text */
|
||||
XftDrawStringUtf8(xftd, &xftcolor, xftfont, x, y, (FcChar8 *)str, strlen(str));
|
||||
|
||||
/* Free the text color */
|
||||
/* Free the text color and XftDraw */
|
||||
XftColorFree(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), &xftcolor);
|
||||
XftDrawDestroy(xftd);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
11
src/event.c
11
src/event.c
@ -37,7 +37,7 @@ void
|
||||
buttonpress(XEvent ev)
|
||||
{
|
||||
Client *c;
|
||||
int i, j;
|
||||
int i;
|
||||
char s[6];
|
||||
|
||||
/* Titlebar */
|
||||
@ -55,14 +55,6 @@ buttonpress(XEvent ev)
|
||||
if(conf.client.mouse[i].func)
|
||||
conf.client.mouse[i].func(conf.client.mouse[i].cmd);
|
||||
|
||||
/* Bar Buttons */
|
||||
for(i = 0; i < conf.nbutton ; ++i)
|
||||
for(j = 0; j < conf.barbutton[i].nmousesec; ++j)
|
||||
if(ev.xbutton.window == conf.barbutton[i].bw->win
|
||||
&& ev.xbutton.button == conf.barbutton[i].mouse[j].button)
|
||||
if(conf.barbutton[i].mouse[j].func)
|
||||
conf.barbutton[i].mouse[j].func(conf.barbutton[i].mouse[j].cmd);
|
||||
|
||||
/* Root */
|
||||
if(ev.xbutton.window == root)
|
||||
{
|
||||
@ -113,7 +105,6 @@ buttonpress(XEvent ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
efree(c);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -173,7 +173,6 @@ init(void)
|
||||
bar = bar_create(0, bary, mw, barheight, 0, conf.colors.bar, False);
|
||||
XMapRaised(dpy, bar->win);
|
||||
strcpy(bartext, "WMFS-" WMFS_VERSION);
|
||||
updatebutton(False);
|
||||
updatebar();
|
||||
|
||||
/* INIT WORKABLE SPACE GEOMETRY */
|
||||
|
||||
@ -69,7 +69,6 @@ void bar_moveresize(BarWindow *bw, int x, int y, uint w, uint h);
|
||||
void bar_refresh_color(BarWindow *bw);
|
||||
void bar_refresh(BarWindow *bw);
|
||||
void updatebar(void);
|
||||
void updatebutton(Bool c);
|
||||
void uicb_togglebarpos(uicb_t);
|
||||
|
||||
/* draw.c */
|
||||
|
||||
47
wmfsrc
47
wmfsrc
@ -77,50 +77,6 @@ titlebar
|
||||
mouse { button = "3" func = "mouse_resize" }
|
||||
}
|
||||
|
||||
buttons
|
||||
{
|
||||
# MWFACT BUTTON {{{
|
||||
button
|
||||
{
|
||||
content = "[-]"
|
||||
mouse { button = "1" func = "set_mwfact" cmd = "-0.01" }
|
||||
fg_color = "#FFFFFF"
|
||||
bg_color = "#191919"
|
||||
}
|
||||
button
|
||||
{
|
||||
content = "Mwfact" fg_color = "#FFFFFF" bg_color = "#3E3E3E"
|
||||
mouse { button = "4" func = "set_mwfact" cmd = "+0.01" }
|
||||
mouse { button = "5" func = "set_mwfact" cmd = "-0.01" }
|
||||
}
|
||||
button
|
||||
{
|
||||
content = "[+] "
|
||||
mouse { button = "1" func = "set_mwfact" cmd = "+0.01" }
|
||||
fg_color = "#FFFFFF"
|
||||
bg_color = "#191919"
|
||||
}
|
||||
# }}}
|
||||
|
||||
# NMASTER BUTTON {{{
|
||||
button
|
||||
{
|
||||
content = "[-]"
|
||||
mouse { button = "1" func = "set_nmaster" cmd = "-1" }
|
||||
fg_color = "#FFFFFF"
|
||||
bg_color = "#191919"
|
||||
}
|
||||
button { content = "Nmaster" fg_color = "#FFFFFF" bg_color = "#3E3E3E" }
|
||||
button
|
||||
{
|
||||
content = "[+] "
|
||||
mouse { button = "1" func = "set_nmaster" cmd = "+1" }
|
||||
fg_color = "#FFFFFF"
|
||||
bg_color = "#191919"
|
||||
}
|
||||
# }}}
|
||||
}
|
||||
|
||||
keys
|
||||
{
|
||||
# general keybind
|
||||
@ -137,6 +93,9 @@ keys
|
||||
key { mod = {"Control"} key = "Down" func = "layout_prev" }
|
||||
key { mod = {"Alt"} key = "l" func = "set_mwfact" cmd = "+0.025" }
|
||||
key { mod = {"Alt"} key = "h" func = "set_mwfact" cmd = "-0.025" }
|
||||
key { mod = {"Alt", "Shift"} key = "l" func = "set_nmaster" cmd = "+1" }
|
||||
key { mod = {"Alt", "Shift"} key = "h" func = "set_nmaster" cmd = "-1" }
|
||||
|
||||
|
||||
# tag manipulation keybind
|
||||
key { mod = {"Alt"} key = "F1" func = "tag" cmd = "1" }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user