Button: Add line multi section in button section (button { line { coord = {x1, y1, x2, y2} } }) to make your own button motive.
This commit is contained in:
parent
ba5202b9f5
commit
436aaf5856
21
src/config.c
21
src/config.c
@ -158,8 +158,8 @@ conf_root_section(cfg_t *cfg_r)
|
|||||||
void
|
void
|
||||||
conf_client_section(cfg_t *cfg_c)
|
conf_client_section(cfg_t *cfg_c)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
cfg_t *cfgtmp2;
|
cfg_t *cfgtmp2, *cfgtmp3;
|
||||||
|
|
||||||
/* Client misc */
|
/* Client misc */
|
||||||
conf.client.borderheight = (cfg_getint(cfg_c, "border_height")) ? cfg_getint(cfg_c, "border_height") : 1;
|
conf.client.borderheight = (cfg_getint(cfg_c, "border_height")) ? cfg_getint(cfg_c, "border_height") : 1;
|
||||||
@ -197,11 +197,28 @@ conf_client_section(cfg_t *cfg_c)
|
|||||||
for(i = 0; i < conf.titlebar.nbutton; ++i)
|
for(i = 0; i < conf.titlebar.nbutton; ++i)
|
||||||
{
|
{
|
||||||
cfgtmp2 = cfg_getnsec(cfgtmp, "button", i);
|
cfgtmp2 = cfg_getnsec(cfgtmp, "button", i);
|
||||||
|
|
||||||
|
/* Multi mouse section */
|
||||||
if((conf.titlebar.button[i].nmouse = cfg_size(cfgtmp2, "mouse")))
|
if((conf.titlebar.button[i].nmouse = cfg_size(cfgtmp2, "mouse")))
|
||||||
{
|
{
|
||||||
conf.titlebar.button[i].mouse = emalloc(conf.titlebar.button[i].nmouse, sizeof(MouseBinding));
|
conf.titlebar.button[i].mouse = emalloc(conf.titlebar.button[i].nmouse, sizeof(MouseBinding));
|
||||||
mouse_section(conf.titlebar.button[i].mouse, cfgtmp2, conf.titlebar.button[i].nmouse);
|
mouse_section(conf.titlebar.button[i].mouse, cfgtmp2, conf.titlebar.button[i].nmouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Multi line section */
|
||||||
|
if((conf.titlebar.button[i].nlines = cfg_size(cfgtmp2, "line")))
|
||||||
|
{
|
||||||
|
conf.titlebar.button[i].linecoord = emalloc(conf.titlebar.button[i].nlines, sizeof(XSegment));
|
||||||
|
|
||||||
|
for(j = 0; j < conf.titlebar.button[i].nlines; ++j)
|
||||||
|
{
|
||||||
|
cfgtmp3 = cfg_getnsec(cfgtmp2, "line", j);
|
||||||
|
conf.titlebar.button[i].linecoord[j].x1 = cfg_getnint(cfgtmp3, "coord", 0);
|
||||||
|
conf.titlebar.button[i].linecoord[j].y1 = cfg_getnint(cfgtmp3, "coord", 1);
|
||||||
|
conf.titlebar.button[i].linecoord[j].x2 = cfg_getnint(cfgtmp3, "coord", 2);
|
||||||
|
conf.titlebar.button[i].linecoord[j].y2 = cfg_getnint(cfgtmp3, "coord", 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }} */
|
/* }} */
|
||||||
|
|||||||
@ -72,9 +72,16 @@ cfg_opt_t root_opts[] =
|
|||||||
|
|
||||||
/* CLIENT {{{ */
|
/* CLIENT {{{ */
|
||||||
|
|
||||||
|
cfg_opt_t line_opts[] =
|
||||||
|
{
|
||||||
|
CFG_INT_LIST("coord", "{0, 0, 0, 0}", CFGF_MULTI),
|
||||||
|
CFG_END()
|
||||||
|
};
|
||||||
|
|
||||||
cfg_opt_t button_opts[] =
|
cfg_opt_t button_opts[] =
|
||||||
{
|
{
|
||||||
CFG_SEC("mouse", mouse_button_opts, CFGF_MULTI),
|
CFG_SEC("mouse", mouse_button_opts, CFGF_MULTI),
|
||||||
|
CFG_SEC("line", line_opts, CFGF_MULTI),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
22
src/frame.c
22
src/frame.c
@ -191,7 +191,7 @@ frame_moveresize(Client *c, XRectangle geo)
|
|||||||
void
|
void
|
||||||
frame_update(Client *c)
|
frame_update(Client *c)
|
||||||
{
|
{
|
||||||
int i ;
|
int i, j;
|
||||||
|
|
||||||
CHECK(c);
|
CHECK(c);
|
||||||
|
|
||||||
@ -214,6 +214,26 @@ frame_update(Client *c)
|
|||||||
XSetWindowBackground(dpy, c->button[i], c->colors.frame);
|
XSetWindowBackground(dpy, c->button[i], c->colors.frame);
|
||||||
XClearWindow(dpy, c->button[i]);
|
XClearWindow(dpy, c->button[i]);
|
||||||
XSetWindowBorder(dpy, c->button[i], getcolor(c->colors.fg));
|
XSetWindowBorder(dpy, c->button[i], getcolor(c->colors.fg));
|
||||||
|
|
||||||
|
/* Button's lines */
|
||||||
|
if(conf.titlebar.button[i].nlines)
|
||||||
|
{
|
||||||
|
XSetForeground(dpy, gc, getcolor(c->colors.fg));
|
||||||
|
XDrawSegments(dpy, c->button[i], gc,
|
||||||
|
conf.titlebar.button[i].linecoord,
|
||||||
|
conf.titlebar.button[i].nlines);
|
||||||
|
/*
|
||||||
|
for(j = 0; j < conf.titlebar.button[i].nlines; ++j)
|
||||||
|
{
|
||||||
|
|
||||||
|
XDrawLine(dpy, c->button[i], gc,
|
||||||
|
conf.titlebar.button[i].linecoord[j].x1,
|
||||||
|
conf.titlebar.button[i].linecoord[j].y1,
|
||||||
|
conf.titlebar.button[i].linecoord[j].x2,
|
||||||
|
conf.titlebar.button[i].linecoord[j].y2);
|
||||||
|
|
||||||
|
} */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -250,6 +250,8 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
MouseBinding *mouse;
|
MouseBinding *mouse;
|
||||||
|
XSegment *linecoord;
|
||||||
|
int nlines;
|
||||||
int nmouse;
|
int nmouse;
|
||||||
} Button;
|
} Button;
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,11 @@ quit(void)
|
|||||||
IFREE(conf.ntag);
|
IFREE(conf.ntag);
|
||||||
IFREE(conf.titlebar.mouse);
|
IFREE(conf.titlebar.mouse);
|
||||||
for(i = 0; i < conf.titlebar.nbutton; ++i)
|
for(i = 0; i < conf.titlebar.nbutton; ++i)
|
||||||
|
{
|
||||||
IFREE(conf.titlebar.button[i].mouse);
|
IFREE(conf.titlebar.button[i].mouse);
|
||||||
|
IFREE(conf.titlebar.button[i].linecoord);
|
||||||
|
}
|
||||||
|
|
||||||
IFREE(conf.titlebar.button);
|
IFREE(conf.titlebar.button);
|
||||||
IFREE(conf.client.mouse);
|
IFREE(conf.client.mouse);
|
||||||
IFREE(conf.root.mouse);
|
IFREE(conf.root.mouse);
|
||||||
|
|||||||
8
wmfsrc
8
wmfsrc
@ -106,7 +106,13 @@ client
|
|||||||
mouse { button = "3" func = "client_raise" }
|
mouse { button = "3" func = "client_raise" }
|
||||||
mouse { button = "3" func = "mouse_resize" }
|
mouse { button = "3" func = "mouse_resize" }
|
||||||
|
|
||||||
button { mouse { button = "1" func = "client_kill" } }
|
button
|
||||||
|
{
|
||||||
|
mouse { button = "1" func = "client_kill" }
|
||||||
|
# Make a cross with line
|
||||||
|
line { coord = {1, 1, 4, 4} }
|
||||||
|
line { coord = {4, 1, 1, 4} }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user