Client: Add new_client_get_mouse feature requested by thechitowncubs

This commit is contained in:
Martin Duquesnoy
2011-02-21 03:20:58 +01:00
parent 4898e07e5e
commit bf26e8c22e
4 changed files with 36 additions and 23 deletions

View File

@@ -689,7 +689,7 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
Window trans, dw;
Status rettrans;
XSetWindowAttributes at;
int mx, my, dint;
int mx, my, dint, x, y, d;
uint duint;
screen_get_sel();
@@ -789,6 +789,16 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
if(c->tag == (uint)seltag[selscreen])
client_focus(c);
if(conf.client.new_client_get_mouse)
{
/* Move pointer on client */
XQueryPointer(dpy, ROOT, &dw, &dw, &x, &y, &d, &d, (uint *)&d);
XWarpPointer(dpy, ROOT, ROOT, x, y, d, d,
c->geo.x + c->geo.width / 2,
c->geo.y + c->geo.height / 2);
}
return c;
}
@@ -1199,7 +1209,7 @@ client_update_attributes(Client *c)
void
client_raise(Client *c)
{
if(!c || !(c->flags & AboveFlag)
if(!c || !(c->flags & AboveFlag)
|| ((c->flags & TileFlag) && !conf.client_tile_raise))
return;

View File

@@ -286,19 +286,20 @@ conf_client_section(void)
if ((conf.client.borderheight = fetch_opt_first(sec, "1", "border_height").num) < 1)
conf.client.borderheight = 1;
conf.client.border_shadow = fetch_opt_first(sec, "false", "border_shadow").bool;
conf.client.place_at_mouse = fetch_opt_first(sec, "false", "place_at_mouse").bool;
conf.client.bordernormal = getcolor(fetch_opt_first(sec, "#000000", "border_normal").str);
conf.client.borderfocus = getcolor(fetch_opt_first(sec, "#ffffff", "border_focus").str);
conf.client.resizecorner_normal = getcolor(fetch_opt_first(sec, "#222222", "resize_corner_normal").str);
conf.client.resizecorner_focus = getcolor(fetch_opt_first(sec, "#DDDDDD", "resize_corner_focus").str);
conf.client.mod |= char_to_modkey(fetch_opt_first(sec, "Alt", "modifier").str, key_list);
conf.client.set_new_win_master = fetch_opt_first(sec, "true", "set_new_win_master").bool;
conf.client.padding = fetch_opt_first(sec, "0", "padding").num;
conf.client.autofree = fetch_opt_first(sec, "", "autofree").str;
conf.client.automax = fetch_opt_first(sec, "", "automax").str;
conf.client.default_open_tag = fetch_opt_first(sec, "0", "default_open_tag").num;
conf.client.default_open_screen = fetch_opt_first(sec, "-1", "default_open_screen").num;
conf.client.border_shadow = fetch_opt_first(sec, "false", "border_shadow").bool;
conf.client.place_at_mouse = fetch_opt_first(sec, "false", "place_at_mouse").bool;
conf.client.bordernormal = getcolor(fetch_opt_first(sec, "#000000", "border_normal").str);
conf.client.borderfocus = getcolor(fetch_opt_first(sec, "#ffffff", "border_focus").str);
conf.client.resizecorner_normal = getcolor(fetch_opt_first(sec, "#222222", "resize_corner_normal").str);
conf.client.resizecorner_focus = getcolor(fetch_opt_first(sec, "#DDDDDD", "resize_corner_focus").str);
conf.client.mod |= char_to_modkey(fetch_opt_first(sec, "Alt", "modifier").str, key_list);
conf.client.set_new_win_master = fetch_opt_first(sec, "true", "set_new_win_master").bool;
conf.client.padding = fetch_opt_first(sec, "0", "padding").num;
conf.client.autofree = fetch_opt_first(sec, "", "autofree").str;
conf.client.automax = fetch_opt_first(sec, "", "automax").str;
conf.client.default_open_tag = fetch_opt_first(sec, "0", "default_open_tag").num;
conf.client.default_open_screen = fetch_opt_first(sec, "-1", "default_open_screen").num;
conf.client.new_client_get_mouse = fetch_opt_first(sec, "false", "new_client_get_mouse").bool;
mouse = fetch_section(sec, "mouse");

View File

@@ -437,6 +437,7 @@ typedef struct
Bool set_new_win_master;
Bool place_at_mouse;
Bool border_shadow;
Bool new_client_get_mouse;
int borderheight;
char *autofree, *automax;
uint bordernormal;