From 3046af6f5450d5b8e265f5b070932805ee4a9515 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 8 Oct 2007 14:25:36 +0200 Subject: [PATCH] new feature: add option to center pointer on focused client --- awesomerc | 3 +++ config.c | 3 +++ config.h | 2 ++ layout.c | 2 ++ 4 files changed, 10 insertions(+) diff --git a/awesomerc b/awesomerc index 12a12e227..2392f71d4 100644 --- a/awesomerc +++ b/awesomerc @@ -38,6 +38,9 @@ awesome: # Resize hints resize_hints = true; + # Move pointer to the center of the focused window + focus_move_pointer = false; + # Set of rules to put some windows floating # or to tag them on launch rules = ({ name = "Gimp"; diff --git a/config.c b/config.c index f261c3b0b..a89a3c7ac 100644 --- a/config.c +++ b/config.c @@ -402,6 +402,9 @@ parse_config(Display * disp, int scr, DC * drawcontext, const char *confpatharg, /* resize_hints */ awesomeconf->resize_hints = config_lookup_bool(&awesomelibconf, "awesome.resize_hints"); + /* focus_move_pointer */ + awesomeconf->focus_move_pointer = config_lookup_bool(&awesomelibconf, "awesome.focus_move_pointer"); + /* colors */ tmp = config_lookup_string(&awesomelibconf, "awesome.normal_border_color"); colorbuf = initxcolor(disp, awesomeconf->phys_screen, tmp ? tmp : "#dddddd"); diff --git a/config.h b/config.h index e8409f121..6d799a7d5 100644 --- a/config.h +++ b/config.h @@ -145,6 +145,8 @@ struct awesome_config int ncols; /** Transparency of unfocused clients */ int opacity_unfocused; + /** Focus move pointer */ + Bool focus_move_pointer; /** Respect resize hints */ Bool resize_hints; /** Text displayed in bar */ diff --git a/layout.c b/layout.c index 29e023b99..606809917 100644 --- a/layout.c +++ b/layout.c @@ -142,6 +142,8 @@ restack(Display * disp, DC * drawcontext, awesome_config *awesomeconf) wc.sibling = c->win; } } + if(awesomeconf->focus_move_pointer) + XWarpPointer(disp, None, sel->win, 0, 0, 0, 0, sel->w / 2, sel->h / 2); XSync(disp, False); while(XCheckMaskEvent(disp, EnterWindowMask, &ev)); }