Add uicb mouse_tab, set by default on mouse2 -> titlebar

This commit is contained in:
Martin Duquesnoy 2012-01-13 20:35:29 +01:00
parent e610c9c5b9
commit 38f122abbb
4 changed files with 21 additions and 3 deletions

View File

@ -733,6 +733,8 @@ client_frame_new(struct client *c)
uicb_client_focus_with_wid, cmd); uicb_client_focus_with_wid, cmd);
barwin_mousebind_new(c->titlebar, Button1, false, g, barwin_mousebind_new(c->titlebar, Button1, false, g,
uicb_mouse_move, cmd); uicb_mouse_move, cmd);
barwin_mousebind_new(c->titlebar, Button2, false, g,
uicb_mouse_tab, cmd);
barwin_mousebind_new(c->titlebar, Button3, false, g, barwin_mousebind_new(c->titlebar, Button3, false, g,
uicb_mouse_resize, cmd); uicb_mouse_resize, cmd);
} }

View File

@ -73,6 +73,7 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
/* Mouse */ /* Mouse */
{ "mouse_resize", uicb_mouse_resize }, { "mouse_resize", uicb_mouse_resize },
{ "mouse_move", uicb_mouse_move }, { "mouse_move", uicb_mouse_move },
{ "mouse_tab", uicb_mouse_tab },
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -70,7 +70,7 @@ mouse_resize(struct client *c)
#define _REV_SBORDER(c) draw_reversed_rect(W->root, &(c)->geo); #define _REV_SBORDER(c) draw_reversed_rect(W->root, &(c)->geo);
void void
mouse_move(struct client *c) mouse_move(struct client *c, bool type)
{ {
struct client *c2 = NULL, *last = c; struct client *c2 = NULL, *last = c;
XEvent ev; XEvent ev;
@ -111,7 +111,11 @@ mouse_move(struct client *c)
if(c2 && c2 != c) if(c2 && c2 != c)
{ {
_REV_SBORDER(c2); _REV_SBORDER(c2);
if(type)
client_swap2(c, c2); client_swap2(c, c2);
else
_client_tab(c, c2);
} }
XUngrabServer(W->dpy); XUngrabServer(W->dpy);
@ -134,5 +138,15 @@ uicb_mouse_move(Uicb cmd)
if(mouse_check_client(W->client)) if(mouse_check_client(W->client))
if(W->client) if(W->client)
mouse_move(W->client); mouse_move(W->client, true);
}
void
uicb_mouse_tab(Uicb cmd)
{
(void)cmd;
if(mouse_check_client(W->client))
if(W->client)
mouse_move(W->client, false);
} }

View File

@ -10,6 +10,7 @@
void uicb_mouse_resize(Uicb); void uicb_mouse_resize(Uicb);
void uicb_mouse_move(Uicb); void uicb_mouse_move(Uicb);
void uicb_mouse_tab(Uicb);
static inline bool static inline bool
mouse_check_client(struct client *c) mouse_check_client(struct client *c)