Add support for mouse bindings on titlebars

This commit is contained in:
Julien Danjou 2008-03-19 15:34:07 +01:00
parent 393b6e1f88
commit c496df9fc6
5 changed files with 21 additions and 1 deletions

View File

@ -182,6 +182,16 @@ mouse
button = "3"
command = "client_resizemouse"
}
titlebar
{
button = "1"
command = "client_movemouse"
}
titlebar
{
button = "3"
command = "client_resizemouse"
}
}
keys

View File

@ -410,6 +410,7 @@ cfg_opt_t mouse_opts[] =
{
CFG_SEC((char *) "root", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "client", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "titlebar", mouse_generic_opts, CFGF_MULTI),
CFG_AWESOME_END()
};
cfg_opt_t menu_opts[] =

View File

@ -266,7 +266,7 @@ create_widgets(cfg_t* cfg_statusbar, Statusbar *statusbar)
{
widget = widget_new(statusbar, wptr);
widget_list_append(&statusbar->widgets, widget);
widget->buttons = parse_mouse_bindings(wptr, "mouse", a_strcmp(cfg_name(wptr), "taglist"));
widget->buttons = parse_mouse_bindings(wptr, "mouse", a_strcmp(cfg_name(wptr), "taglist") ? True : False);
}
else
warn("ignoring unknown widget: %s.\n", cfg_name(widgets + i));
@ -534,6 +534,9 @@ config_parse(const char *confpatharg)
/* Mouse: client windows click bindings */
globalconf.buttons.client = parse_mouse_bindings(cfg_mouse, "client", True);
/* Mouse: titlebar windows click bindings */
globalconf.buttons.titlebar = parse_mouse_bindings(cfg_mouse, "titlebar", True);
/* Keys */
globalconf.numlockmask = get_numlockmask(globalconf.display);

View File

@ -138,6 +138,10 @@ event_handle_buttonpress(XEvent *e)
event_handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL);
}
else
{
for(c = globalconf.clients; c; c = c->next)
if(c->titlebar.sw && c->titlebar.sw->window == ev->window)
event_handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.titlebar, NULL);
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
if(RootWindow(e->xany.display, screen) == ev->window
&& XQueryPointer(e->xany.display,
@ -150,6 +154,7 @@ event_handle_buttonpress(XEvent *e)
globalconf.buttons.root, NULL);
return;
}
}
}
/** Handle XConfigureRequest events

View File

@ -324,6 +324,7 @@ struct AwesomeConf
{
Button *root;
Button *client;
Button *titlebar;
} buttons;
/** Numlock mask */
unsigned int numlockmask;