From d755a6bb644921a653fbe27a24115b8bb88ad560 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Wed, 20 Aug 2008 23:57:27 +0200 Subject: [PATCH] client: when redrawing a window, set the mouse focus on this window if it has been performed on this window. --- awesome.1.txt | 3 +++ awesomerc.lua.in | 1 + client.c | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/awesome.1.txt b/awesome.1.txt index 740cd326..14f7a195 100644 --- a/awesome.1.txt +++ b/awesome.1.txt @@ -154,6 +154,9 @@ Misc *Mod4 \+ Shift \+ i*:: Print the client class and instance. +*Mod4 \+ Shift \+ r*:: + Redraw the focused window. + CUSTOMIZATION ------------- *awesome* is customized by creating a custom '$XDG_CONFIG_HOME/awesome/rc.lua' file. diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 0bd65254..1c897657 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -224,6 +224,7 @@ keybinding({ modkey, "Control" }, "Return", function () client.focus:swap(awful. keybinding({ modkey }, "o", awful.client.movetoscreen):add() keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add() keybinding({ modkey }, "u", awful.client.urgent.jumpto):add() +keybinding({ modkey, "Shift" }, "r", function () client.focus:redraw() end):add() -- Layout manipulation keybinding({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add() diff --git a/client.c b/client.c index 1bdc4073..c3d34e9d 100644 --- a/client.c +++ b/client.c @@ -1068,8 +1068,17 @@ static int luaA_client_redraw(lua_State *L) { client_t **c = luaA_checkudata(L, 1, "client"); + xcb_unmap_window(globalconf.connection, (*c)->win); xcb_map_window(globalconf.connection, (*c)->win); + + /* Set the focus on the current window if the redraw has been + performed on the window where the pointer is currently on + because after the unmapping/mapping, the focus is lost */ + if(globalconf.screen_focus->client_focus == *c) + xcb_set_input_focus(globalconf.connection, XCB_INPUT_FOCUS_POINTER_ROOT, + (*c)->win, XCB_CURRENT_TIME); + return 0; }