mouse button clicks on windows are now configurable
This commit is contained in:
parent
88b6f17410
commit
7a919a76fb
18
awesomerc
18
awesomerc
|
@ -165,6 +165,24 @@ mouse
|
||||||
button = "5"
|
button = "5"
|
||||||
command = "view_tag_previous"
|
command = "view_tag_previous"
|
||||||
}
|
}
|
||||||
|
client
|
||||||
|
{
|
||||||
|
modkey = {"Mod4"}
|
||||||
|
button = "1"
|
||||||
|
command = "movemouse"
|
||||||
|
}
|
||||||
|
client
|
||||||
|
{
|
||||||
|
modkey = {"Mod4"}
|
||||||
|
button = "2"
|
||||||
|
command = "zoom"
|
||||||
|
}
|
||||||
|
client
|
||||||
|
{
|
||||||
|
modkey = {"Mod4"}
|
||||||
|
button = "3"
|
||||||
|
command = "resizemouse"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keys
|
keys
|
||||||
|
|
6
client.c
6
client.c
|
@ -191,7 +191,7 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
|
||||||
awesomeconf->tags[i].client_sel->phys_screen,
|
awesomeconf->tags[i].client_sel->phys_screen,
|
||||||
awesomeconf->tags[i].client_sel->win,
|
awesomeconf->tags[i].client_sel->win,
|
||||||
False, True, awesomeconf->buttons.root,
|
False, True, awesomeconf->buttons.root,
|
||||||
awesomeconf->modkey, awesomeconf->numlockmask);
|
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||||
XSetWindowBorder(awesomeconf->tags[i].client_sel->display,
|
XSetWindowBorder(awesomeconf->tags[i].client_sel->display,
|
||||||
awesomeconf->tags[i].client_sel->win,
|
awesomeconf->tags[i].client_sel->win,
|
||||||
awesomeconf->colors_normal[ColBorder].pixel);
|
awesomeconf->colors_normal[ColBorder].pixel);
|
||||||
|
@ -203,7 +203,7 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
|
||||||
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->colors_selected[ColBorder].pixel);
|
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->colors_selected[ColBorder].pixel);
|
||||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||||
True, True, awesomeconf->buttons.root,
|
True, True, awesomeconf->buttons.root,
|
||||||
awesomeconf->modkey, awesomeconf->numlockmask);
|
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||||
}
|
}
|
||||||
if(!selscreen)
|
if(!selscreen)
|
||||||
return;
|
return;
|
||||||
|
@ -374,7 +374,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
||||||
/* grab buttons */
|
/* grab buttons */
|
||||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||||
False, True, current_acf->buttons.root,
|
False, True, current_acf->buttons.root,
|
||||||
current_acf->modkey, current_acf->numlockmask);
|
current_acf->buttons.client, current_acf->numlockmask);
|
||||||
|
|
||||||
move_client_to_screen(c, current_acf, True);
|
move_client_to_screen(c, current_acf, True);
|
||||||
|
|
||||||
|
|
4
config.c
4
config.c
|
@ -324,6 +324,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
||||||
CFG_SEC((char *) "layout", mouse_generic_opts, CFGF_MULTI),
|
CFG_SEC((char *) "layout", mouse_generic_opts, CFGF_MULTI),
|
||||||
CFG_SEC((char *) "title", mouse_generic_opts, CFGF_MULTI),
|
CFG_SEC((char *) "title", mouse_generic_opts, CFGF_MULTI),
|
||||||
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_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
static cfg_opt_t opts[] =
|
static cfg_opt_t opts[] =
|
||||||
|
@ -518,6 +519,9 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
||||||
/* Mouse: root window click bindings */
|
/* Mouse: root window click bindings */
|
||||||
awesomeconf->buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
awesomeconf->buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
||||||
|
|
||||||
|
/* Mouse: client windows click bindings */
|
||||||
|
awesomeconf->buttons.client = parse_mouse_bindings(cfg_mouse, "client", True);
|
||||||
|
|
||||||
/* Keys */
|
/* Keys */
|
||||||
awesomeconf->numlockmask = get_numlockmask(awesomeconf->display);
|
awesomeconf->numlockmask = get_numlockmask(awesomeconf->display);
|
||||||
|
|
||||||
|
|
1
config.h
1
config.h
|
@ -180,6 +180,7 @@ struct awesome_config
|
||||||
Button *title;
|
Button *title;
|
||||||
Button *layout;
|
Button *layout;
|
||||||
Button *root;
|
Button *root;
|
||||||
|
Button *client;
|
||||||
} buttons;
|
} buttons;
|
||||||
/** Default modkey */
|
/** Default modkey */
|
||||||
KeySym modkey;
|
KeySym modkey;
|
||||||
|
|
36
event.c
36
event.c
|
@ -103,33 +103,17 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XAllowEvents(c->display, ReplayPointer, CurrentTime);
|
XAllowEvents(c->display, ReplayPointer, CurrentTime);
|
||||||
focus(c, ev->same_screen, &awesomeconf[c->screen]);
|
focus(c, ev->same_screen, &awesomeconf[c->screen]);
|
||||||
if(CLEANMASK(ev->state, awesomeconf[c->screen]) != awesomeconf[c->screen].modkey)
|
if(CLEANMASK(ev->state, awesomeconf[c->screen]) == NoSymbol
|
||||||
|
&& ev->button == Button1)
|
||||||
{
|
{
|
||||||
if (ev->button == Button1)
|
restack(&awesomeconf[c->screen]);
|
||||||
{
|
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||||
restack(&awesomeconf[c->screen]);
|
True, True, awesomeconf->buttons.root,
|
||||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||||
True, True, awesomeconf->buttons.root,
|
|
||||||
awesomeconf->modkey, awesomeconf->numlockmask);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(ev->button == Button1)
|
else
|
||||||
uicb_movemouse(&awesomeconf[c->screen], NULL);
|
handle_mouse_button_press(&awesomeconf[c->screen], ev->button, ev->state,
|
||||||
else if(ev->button == Button2)
|
awesomeconf[c->screen].buttons.client, NULL);
|
||||||
{
|
|
||||||
if((get_current_layout(awesomeconf[c->screen].tags,
|
|
||||||
awesomeconf[c->screen].ntags)->arrange != layout_floating)
|
|
||||||
&& !c->isfixed && c->isfloating)
|
|
||||||
uicb_togglefloating(&awesomeconf[c->screen], NULL);
|
|
||||||
else
|
|
||||||
uicb_zoom(&awesomeconf[c->screen], NULL);
|
|
||||||
}
|
|
||||||
else if(ev->button == Button3)
|
|
||||||
uicb_resizemouse(&awesomeconf[c->screen], NULL);
|
|
||||||
else if(ev->button == Button4)
|
|
||||||
uicb_settrans(&awesomeconf[c->screen], "+5");
|
|
||||||
else if(ev->button == Button5)
|
|
||||||
uicb_settrans(&awesomeconf[c->screen], "-5");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
|
@ -250,7 +234,7 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
awesomeconf[c->screen].ntags)->arrange == layout_floating)
|
awesomeconf[c->screen].ntags)->arrange == layout_floating)
|
||||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||||
True, False, awesomeconf->buttons.root,
|
True, False, awesomeconf->buttons.root,
|
||||||
awesomeconf->modkey, awesomeconf->numlockmask);
|
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
|
|
57
window.c
57
window.c
|
@ -93,7 +93,7 @@ window_configure(Display *disp, Window win, int x, int y, int w, int h, int bord
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool raised,
|
window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool raised,
|
||||||
Button *buttons_root, KeySym modkey, unsigned int numlockmask)
|
Button *buttons_root, Button *buttons_client, unsigned int numlockmask)
|
||||||
{
|
{
|
||||||
Button *b;
|
Button *b;
|
||||||
|
|
||||||
|
@ -105,50 +105,17 @@ window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool rai
|
||||||
XGrabButton(disp, Button1, NoSymbol, win, False,
|
XGrabButton(disp, Button1, NoSymbol, win, False,
|
||||||
BUTTONMASK, GrabModeSync, GrabModeAsync, None, None);
|
BUTTONMASK, GrabModeSync, GrabModeAsync, None, None);
|
||||||
|
|
||||||
XGrabButton(disp, Button1, modkey, win, False, BUTTONMASK,
|
for(b = buttons_client; b; b = b->next)
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
{
|
||||||
XGrabButton(disp, Button1, modkey | LockMask, win, False,
|
XGrabButton(disp, b->button, b->mod, win, False, BUTTONMASK,
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(disp, Button1, modkey | numlockmask, win, False,
|
XGrabButton(disp, b->button, b->mod | LockMask, win, False,
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(disp, Button1, modkey | numlockmask | LockMask,
|
XGrabButton(disp, b->button, b->mod | numlockmask, win, False,
|
||||||
win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||||
|
XGrabButton(disp, b->button, b->mod | numlockmask | LockMask,
|
||||||
XGrabButton(disp, Button2, modkey, win, False, BUTTONMASK,
|
win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
}
|
||||||
XGrabButton(disp, Button2, modkey | LockMask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button2, modkey | numlockmask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button2, modkey | numlockmask | LockMask,
|
|
||||||
win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
|
|
||||||
XGrabButton(disp, Button3, modkey, win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button3, modkey | LockMask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button3, modkey | numlockmask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button3, modkey | numlockmask | LockMask,
|
|
||||||
win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
|
|
||||||
XGrabButton(disp, Button4, modkey, win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button4, modkey | LockMask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button4, modkey | numlockmask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button4, modkey | numlockmask | LockMask,
|
|
||||||
win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
|
|
||||||
XGrabButton(disp, Button5, modkey, win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button5, modkey | LockMask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button5, modkey | numlockmask, win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(disp, Button5, modkey | numlockmask | LockMask,
|
|
||||||
win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
|
|
||||||
XUngrabButton(disp, AnyButton, AnyModifier, RootWindow(disp, screen));
|
XUngrabButton(disp, AnyButton, AnyModifier, RootWindow(disp, screen));
|
||||||
}
|
}
|
||||||
|
|
2
window.h
2
window.h
|
@ -31,7 +31,7 @@
|
||||||
int window_setstate(Display *, Window, long);
|
int window_setstate(Display *, Window, long);
|
||||||
long window_getstate(Display *, Window);
|
long window_getstate(Display *, Window);
|
||||||
Status window_configure(Display *, Window, int, int, int, int, int);
|
Status window_configure(Display *, Window, int, int, int, int, int);
|
||||||
void window_grabbuttons(Display *, int, Window, Bool, Bool, Button *, KeySym, unsigned int);
|
void window_grabbuttons(Display *, int, Window, Bool, Bool, Button *, Button *, unsigned int);
|
||||||
void window_setshape(Display *, int, Window);
|
void window_setshape(Display *, int, Window);
|
||||||
void window_settrans(Display *, Window, double);
|
void window_settrans(Display *, Window, double);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue