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" button = "3"
command = "client_resizemouse" command = "client_resizemouse"
} }
titlebar
{
button = "1"
command = "client_movemouse"
}
titlebar
{
button = "3"
command = "client_resizemouse"
}
} }
keys keys

View File

@ -410,6 +410,7 @@ cfg_opt_t mouse_opts[] =
{ {
CFG_SEC((char *) "root", mouse_generic_opts, CFGF_MULTI), CFG_SEC((char *) "root", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "client", 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_AWESOME_END()
}; };
cfg_opt_t menu_opts[] = 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 = widget_new(statusbar, wptr);
widget_list_append(&statusbar->widgets, widget); 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 else
warn("ignoring unknown widget: %s.\n", cfg_name(widgets + i)); warn("ignoring unknown widget: %s.\n", cfg_name(widgets + i));
@ -534,6 +534,9 @@ config_parse(const char *confpatharg)
/* Mouse: client windows click bindings */ /* Mouse: client windows click bindings */
globalconf.buttons.client = parse_mouse_bindings(cfg_mouse, "client", True); 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 */ /* Keys */
globalconf.numlockmask = get_numlockmask(globalconf.display); 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); event_handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL);
} }
else 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++) for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
if(RootWindow(e->xany.display, screen) == ev->window if(RootWindow(e->xany.display, screen) == ev->window
&& XQueryPointer(e->xany.display, && XQueryPointer(e->xany.display,
@ -151,6 +155,7 @@ event_handle_buttonpress(XEvent *e)
return; return;
} }
} }
}
/** Handle XConfigureRequest events /** Handle XConfigureRequest events
* \param e XEvent * \param e XEvent

View File

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