config: Add option place_at_mouse in the client section
This commit is contained in:
36
src/client.c
36
src/client.c
@@ -355,28 +355,38 @@ client_manage(Window w, XWindowAttributes *wa)
|
||||
Window trans;
|
||||
Status rettrans;
|
||||
XSetWindowAttributes at;
|
||||
int mx = 0, my = 0, dint;
|
||||
uint duint;
|
||||
Window dw;
|
||||
int mx, my;
|
||||
|
||||
c = emalloc(1, sizeof(Client));
|
||||
c->win = w;
|
||||
c->screen = screen_get_sel();
|
||||
|
||||
XQueryPointer(dpy, root, &dw, &dw, &mx, &my, &dint, &dint, &duint);
|
||||
if(conf.client.place_at_mouse)
|
||||
{
|
||||
int dint;
|
||||
uint duint;
|
||||
Window dw;
|
||||
|
||||
mx += BORDH;
|
||||
my += TBARH;
|
||||
XQueryPointer(dpy, root, &dw, &dw, &mx, &my, &dint, &dint, &duint);
|
||||
|
||||
if(mx == 0)
|
||||
mx += BORDH;
|
||||
else if(mx == MAXW)
|
||||
mx -= wa->width + BORDH;
|
||||
my += TBARH;
|
||||
|
||||
if(my == 0)
|
||||
my += TBARH + INFOBARH;
|
||||
else if(my == MAXH)
|
||||
my -= wa->height + BORDH;
|
||||
if(mx == 0)
|
||||
mx += BORDH;
|
||||
else if(mx == MAXW)
|
||||
mx -= wa->width + BORDH;
|
||||
|
||||
if(my == 0)
|
||||
my += TBARH + INFOBARH;
|
||||
else if(my == MAXH)
|
||||
my -= wa->height + BORDH;
|
||||
}
|
||||
else
|
||||
{
|
||||
mx = wa->x + BORDH;
|
||||
my = wa->y + TBARH + INFOBARH;
|
||||
}
|
||||
|
||||
c->ogeo.x = c->geo.x = mx;
|
||||
c->ogeo.y = c->geo.y = my;
|
||||
|
||||
@@ -87,6 +87,7 @@ static cfg_opt_t titlebar_opts[] =
|
||||
|
||||
static cfg_opt_t client_opts[]=
|
||||
{
|
||||
CFG_BOOL("place_at_mouse", cfg_false, CFGF_NONE),
|
||||
CFG_INT("border_height", 1, CFGF_NONE),
|
||||
CFG_STR("border_normal", "#354B5C", CFGF_NONE),
|
||||
CFG_STR("border_focus", "#6286A1", CFGF_NONE),
|
||||
@@ -395,6 +396,7 @@ init_conf(void)
|
||||
/* client */
|
||||
conf.client.borderheight = (cfg_getint(cfg_client, "border_height"))
|
||||
? cfg_getint(cfg_client, "border_height") : 1;
|
||||
conf.client.place_at_mouse = cfg_getbool(cfg_client, "place_at_mouse");
|
||||
conf.client.bordernormal = getcolor(var_to_str(cfg_getstr(cfg_client, "border_normal")));
|
||||
conf.client.borderfocus = getcolor(var_to_str(cfg_getstr(cfg_client, "border_focus")));
|
||||
conf.client.resizecorner_normal = getcolor(var_to_str(cfg_getstr(cfg_client, "resize_corner_normal")));
|
||||
|
||||
@@ -186,6 +186,7 @@ typedef struct
|
||||
} root;
|
||||
struct
|
||||
{
|
||||
Bool place_at_mouse;
|
||||
int borderheight;
|
||||
uint bordernormal;
|
||||
uint borderfocus;
|
||||
|
||||
Reference in New Issue
Block a user