diff --git a/src/config.c b/src/config.c index 75276c8..dcc8b00 100644 --- a/src/config.c +++ b/src/config.c @@ -158,8 +158,8 @@ conf_root_section(cfg_t *cfg_r) void conf_client_section(cfg_t *cfg_c) { - int i; - cfg_t *cfgtmp2; + int i, j; + cfg_t *cfgtmp2, *cfgtmp3; /* Client misc */ 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) { cfgtmp2 = cfg_getnsec(cfgtmp, "button", i); + + /* Multi mouse section */ if((conf.titlebar.button[i].nmouse = cfg_size(cfgtmp2, "mouse"))) { 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); } + + /* 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); + } + } } } /* }} */ diff --git a/src/config_struct.h b/src/config_struct.h index 28bd87e..e2f47a4 100644 --- a/src/config_struct.h +++ b/src/config_struct.h @@ -72,9 +72,16 @@ cfg_opt_t root_opts[] = /* CLIENT {{{ */ +cfg_opt_t line_opts[] = +{ + CFG_INT_LIST("coord", "{0, 0, 0, 0}", CFGF_MULTI), + CFG_END() +}; + cfg_opt_t button_opts[] = { CFG_SEC("mouse", mouse_button_opts, CFGF_MULTI), + CFG_SEC("line", line_opts, CFGF_MULTI), CFG_END() }; diff --git a/src/frame.c b/src/frame.c index f55f768..7db721e 100644 --- a/src/frame.c +++ b/src/frame.c @@ -191,7 +191,7 @@ frame_moveresize(Client *c, XRectangle geo) void frame_update(Client *c) { - int i ; + int i, j; CHECK(c); @@ -214,6 +214,26 @@ frame_update(Client *c) XSetWindowBackground(dpy, c->button[i], c->colors.frame); XClearWindow(dpy, c->button[i]); 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); + + } */ + } } } diff --git a/src/structs.h b/src/structs.h index 3adf22d..aea2017 100644 --- a/src/structs.h +++ b/src/structs.h @@ -250,6 +250,8 @@ typedef struct typedef struct { MouseBinding *mouse; + XSegment *linecoord; + int nlines; int nmouse; } Button; diff --git a/src/wmfs.c b/src/wmfs.c index eb88547..d266fdb 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -123,7 +123,11 @@ quit(void) IFREE(conf.ntag); IFREE(conf.titlebar.mouse); for(i = 0; i < conf.titlebar.nbutton; ++i) + { IFREE(conf.titlebar.button[i].mouse); + IFREE(conf.titlebar.button[i].linecoord); + } + IFREE(conf.titlebar.button); IFREE(conf.client.mouse); IFREE(conf.root.mouse); diff --git a/wmfsrc b/wmfsrc index bed502f..3d620e5 100644 --- a/wmfsrc +++ b/wmfsrc @@ -106,7 +106,13 @@ client mouse { button = "3" func = "client_raise" } 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} } + } } }