conf/event: Fix mouse binding for root (add screen specification in mouse {} too)

This commit is contained in:
Martin Duquesnoy 2008-12-03 18:20:45 +01:00
parent 2450db1d64
commit 0c6e3212ed
3 changed files with 5 additions and 2 deletions

View File

@ -63,7 +63,8 @@ static cfg_opt_t bar_opts[] =
static cfg_opt_t mouse_button_opts[] =
{
CFG_INT("tag", 0, CFGF_NONE),
CFG_INT("tag", -1, CFGF_NONE),
CFG_INT("screen", 0, CFGF_NONE),
CFG_STR("button", "Button1", CFGF_NONE),
CFG_STR("func", "", CFGF_NONE),
CFG_STR("cmd", "", CFGF_NONE),
@ -323,6 +324,7 @@ mouse_section(MouseBinding mb[], cfg_t *cfg, int ns)
{
tmp = cfg_getnsec(cfg, "mouse", i);
mb[i].tag = cfg_getint(tmp, "tag");
mb[i].screen = cfg_getint(tmp, "screen");
mb[i].button = char_to_button(cfg_getstr(tmp, "button"));
mb[i].func = name_to_func(cfg_getstr(tmp, "func"), func_list);
mb[i].cmd = strdup(alias_to_str(cfg_getstr(tmp, "cmd")));

View File

@ -65,7 +65,7 @@ buttonpress(XButtonEvent *ev)
/* Root */
if(ev->window == root)
for(i = 0; i < conf.root.nmouse; ++i)
if(conf.root.mouse[i].tag == seltag[screen_get_sel()]
if(conf.root.mouse[i].tag == seltag[conf.root.mouse[i].screen]
|| conf.root.mouse[i].tag < 0)
if(ev->button == conf.root.mouse[i].button)
if(conf.root.mouse[i].func)

View File

@ -124,6 +124,7 @@ typedef struct
typedef struct
{
int tag;
int screen;
uint button;
void (*func)(uicb_t);
uicb_t cmd;