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;

17
wmfsrc
View File

@ -25,7 +25,7 @@
fg = "#D4D4D4"
border = true
#height = "-1"
[systray]
# Enable/disable systray
active = true
@ -103,7 +103,7 @@
# whether client_next on the last tag will send you on the first
# and client_prev on the first tag will send you on the last one
tag_round = false
# Going twice on the same tag will bring you back on the previous one
tag_auto_prev = true
@ -113,7 +113,7 @@
sel_bg = "#7E89A2"
urgent_bg = "#DD1111"
urgent_fg = "#000000"
# If true, number of the tag will be used for name
name_count = false
#default_name = "new tag" # deprecated, use [default_tag] instead
@ -176,11 +176,12 @@
resize_corner_focus = "#003366"
set_new_win_master = true
client_tile_raise = false
new_client_get_mouse = false
# send all client that have no tag rule in this default tag
#default_open_tag = 4
#default_open_tag = 4
# same as above but for the screen
#default_open_screen = 1
#default_open_screen = 1
# Space between tiled clients
padding = 0
@ -418,7 +419,7 @@
# change screen
[key] mod = {"Super"} key = "Tab" func = "screen_next" [/key]
[key] mod = {"Super", "Shift"} key = "Tab" func = "screen_prev" [/key]
# swap client in the next/prev screen
[key] mod = {"Super", "Shift"} key = "a" func = "client_screen_next" [/key]
[key] mod = {"Super", "Shift"} key = "z" func = "client_screen_prev" [/key]
@ -427,12 +428,12 @@
# client_focus_{right, left, top, bottom}
# client_ignore_tag # Toggle the client in ignore_tag (display the client on all tags)
# tag_prev_sel # go back to the previous selected tag
# tag_transfert_{next, prev}
# tag_transfert_{next, prev}
# tag_urgent # go to the urgent tag
# tag_swap_{next, prev} # swap tag with the previous/next one
# tag_last # go to the last tag
# tag_stay_last # toggle the current tag as the last one
# toggle_abovefc
# toggle_abovefc
# screen_prev_sel # go to the previous screen selected
# set_layout # set layout. need to be called with cmd = "<layout_name>"
# ignore_next_client_rules # ignore the rule the next time a rule is called