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);
barwin_mousebind_new(c->titlebar, Button1, false, g,
uicb_mouse_move, cmd);
barwin_mousebind_new(c->titlebar, Button2, false, g,
uicb_mouse_tab, cmd);
barwin_mousebind_new(c->titlebar, Button3, false, g,
uicb_mouse_resize, cmd);
}

View File

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

View File

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