mouse buttons are now configurable for click on layout symbols
This commit is contained in:
parent
99370f0ccd
commit
0bee56e27d
|
@ -70,6 +70,8 @@ cleanup_screen(awesome_config *awesomeconf)
|
||||||
p_delete(&awesomeconf->keys[i].arg);
|
p_delete(&awesomeconf->keys[i].arg);
|
||||||
for(i = 0; i< awesomeconf->buttons.ntitle; i++)
|
for(i = 0; i< awesomeconf->buttons.ntitle; i++)
|
||||||
p_delete(&awesomeconf->buttons.title[i].arg);
|
p_delete(&awesomeconf->buttons.title[i].arg);
|
||||||
|
for(i = 0; i< awesomeconf->buttons.nlayout; i++)
|
||||||
|
p_delete(&awesomeconf->buttons.layout[i].arg);
|
||||||
for(i = 0; i < awesomeconf->nlayouts; i++)
|
for(i = 0; i < awesomeconf->nlayouts; i++)
|
||||||
p_delete(&awesomeconf->layouts[i].symbol);
|
p_delete(&awesomeconf->layouts[i].symbol);
|
||||||
for(i = 0; i < awesomeconf->nrules; i++)
|
for(i = 0; i < awesomeconf->nrules; i++)
|
||||||
|
@ -83,6 +85,7 @@ cleanup_screen(awesome_config *awesomeconf)
|
||||||
p_delete(&awesomeconf->keys);
|
p_delete(&awesomeconf->keys);
|
||||||
p_delete(&awesomeconf->buttons.tag);
|
p_delete(&awesomeconf->buttons.tag);
|
||||||
p_delete(&awesomeconf->buttons.title);
|
p_delete(&awesomeconf->buttons.title);
|
||||||
|
p_delete(&awesomeconf->buttons.layout);
|
||||||
p_delete(&awesomeconf->configpath);
|
p_delete(&awesomeconf->configpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
config.c
21
config.c
|
@ -268,6 +268,13 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
||||||
CFG_STR((char *) "button", (char *) "None", CFGF_NONE),
|
CFG_STR((char *) "button", (char *) "None", CFGF_NONE),
|
||||||
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
|
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
|
||||||
};
|
};
|
||||||
|
static cfg_opt_t mouse_layout_opts[] =
|
||||||
|
{
|
||||||
|
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
|
||||||
|
CFG_STR((char *) "button", (char *) "None", CFGF_NONE),
|
||||||
|
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
|
||||||
|
CFG_STR((char *) "arg", NULL, CFGF_NONE),
|
||||||
|
};
|
||||||
static cfg_opt_t mouse_title_opts[] =
|
static cfg_opt_t mouse_title_opts[] =
|
||||||
{
|
{
|
||||||
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
|
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
|
||||||
|
@ -279,6 +286,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
CFG_STR((char *) "modkey", (char *) "Mod4", CFGF_NONE),
|
CFG_STR((char *) "modkey", (char *) "Mod4", CFGF_NONE),
|
||||||
CFG_SEC((char *) "tag", mouse_tag_opts, CFGF_MULTI),
|
CFG_SEC((char *) "tag", mouse_tag_opts, CFGF_MULTI),
|
||||||
|
CFG_SEC((char *) "layout", mouse_layout_opts, CFGF_MULTI),
|
||||||
CFG_SEC((char *) "title", mouse_title_opts, CFGF_MULTI),
|
CFG_SEC((char *) "title", mouse_title_opts, CFGF_MULTI),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
|
@ -454,6 +462,19 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
||||||
awesomeconf->buttons.tag[i].arg = NULL; /* for now */
|
awesomeconf->buttons.tag[i].arg = NULL; /* for now */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mouse: layout click bindings */
|
||||||
|
awesomeconf->buttons.nlayout = cfg_size(cfg_mouse, "layout");
|
||||||
|
awesomeconf->buttons.layout = p_new(Button, awesomeconf->buttons.nlayout);
|
||||||
|
for(i = 0; i < awesomeconf->buttons.nlayout; i++)
|
||||||
|
{
|
||||||
|
cfgsectmp = cfg_getnsec(cfg_mouse, "layout", i);
|
||||||
|
for(j = 0; j < cfg_size(cfgsectmp, "modkey"); j++)
|
||||||
|
awesomeconf->buttons.layout[i].mod |= key_mask_lookup(cfg_getnstr(cfgsectmp, "modkey", j));
|
||||||
|
awesomeconf->buttons.layout[i].button = mouse_button_lookup(cfg_getstr(cfgsectmp, "button"));
|
||||||
|
awesomeconf->buttons.layout[i].func = name_func_lookup(cfg_getstr(cfgsectmp, "command"), UicbList);
|
||||||
|
awesomeconf->buttons.layout[i].arg = a_strdup(cfg_getstr(cfgsectmp, "arg"));
|
||||||
|
}
|
||||||
|
|
||||||
/* Mouse: title click bindings */
|
/* Mouse: title click bindings */
|
||||||
awesomeconf->buttons.ntitle = cfg_size(cfg_mouse, "title");
|
awesomeconf->buttons.ntitle = cfg_size(cfg_mouse, "title");
|
||||||
awesomeconf->buttons.title = p_new(Button, awesomeconf->buttons.ntitle);
|
awesomeconf->buttons.title = p_new(Button, awesomeconf->buttons.ntitle);
|
||||||
|
|
2
config.h
2
config.h
|
@ -179,6 +179,8 @@ struct awesome_config
|
||||||
int ntag;
|
int ntag;
|
||||||
Button *title;
|
Button *title;
|
||||||
int ntitle;
|
int ntitle;
|
||||||
|
Button *layout;
|
||||||
|
int nlayout;
|
||||||
} buttons;
|
} buttons;
|
||||||
/** Number of keys binding in *keys */
|
/** Number of keys binding in *keys */
|
||||||
int nkeys;
|
int nkeys;
|
||||||
|
|
17
event.c
17
event.c
|
@ -171,10 +171,19 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += awesomeconf[screen].statusbar.txtlayoutwidth;
|
x += awesomeconf[screen].statusbar.txtlayoutwidth;
|
||||||
if(ev->x < x && (ev->button == Button1 || ev->button == Button4))
|
if(ev->x <x)
|
||||||
uicb_setlayout(&awesomeconf[screen], "+1");
|
{
|
||||||
else if(ev->x < x && (ev->button == Button3 || ev->button == Button5))
|
for(j = 0; j < awesomeconf[screen].buttons.nlayout; j++)
|
||||||
uicb_setlayout(&awesomeconf[screen], "-1");
|
if(ev->button == awesomeconf[screen].buttons.layout[j].button
|
||||||
|
&& (ev->state == awesomeconf[screen].buttons.layout[j].mod
|
||||||
|
|| ev->state == (awesomeconf[screen].buttons.layout[j].mod | awesomeconf[screen].numlockmask))
|
||||||
|
&& awesomeconf[screen].buttons.layout[j].func)
|
||||||
|
{
|
||||||
|
awesomeconf[screen].buttons.layout[j].func(&awesomeconf[screen],
|
||||||
|
awesomeconf[screen].buttons.layout[j].arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(j = 0; j < awesomeconf[screen].buttons.ntitle; j++)
|
for(j = 0; j < awesomeconf[screen].buttons.ntitle; j++)
|
||||||
|
|
Loading…
Reference in New Issue