diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 8c914d68..f4f2d885 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -153,28 +153,28 @@ end for i = 1, keynumber do keybinding({ modkey }, i, function () - local screen = mouse.screen_get() + local screen = mouse.screen if tags[screen][i] then awful.tag.viewonly(tags[screen][i]) end end):add() keybinding({ modkey, "Control" }, i, function () - local screen = mouse.screen_get() + local screen = mouse.screen if tags[screen][i] then tags[screen][i].selected = not tags[screen][i].selected end end):add() keybinding({ modkey, "Shift" }, i, function () - local screen = mouse.screen_get() + local screen = mouse.screen if tags[screen][i] then awful.client.movetotag(tags[screen][i]) end end):add() keybinding({ modkey, "Control", "Shift" }, i, function () - local screen = mouse.screen_get() + local screen = mouse.screen if tags[screen][i] then awful.client.toggletag(tags[screen][i]) end @@ -270,7 +270,7 @@ end):add() for i = 1, keynumber do keybinding({ modkey, "Shift" }, "F" .. i, function () - local screen = mouse.screen_get() + local screen = mouse.screen if tags[screen][i] then for k, c in pairs(awful.client.getmarked()) do awful.client.movetotag(tags[screen][i], c) diff --git a/lib/awful.lua b/lib/awful.lua index 70898cd2..9818ea45 100644 --- a/lib/awful.lua +++ b/lib/awful.lua @@ -117,7 +117,7 @@ end -- @param screen Optional screen number, otherwise screen mouse is used. -- @return The master window. function P.client.master(screen) - local s = screen or mouse.screen_get() + local s = screen or mouse.screen return client.visible_get(s)[1] end @@ -145,7 +145,7 @@ function P.screen.focus(i) if sel then s = sel.screen else - s = mouse.screen_get() + s = mouse.screen end s = cycle(screen.count(), s + i) screen.focus(s) @@ -157,7 +157,7 @@ end -- @param s Screen number. -- @return A table with all selected tags. function P.tag.selectedlist(s) - local screen = s or mouse.screen_get() + local screen = s or mouse.screen local tags = tag.geti(screen) local vtags = {} for i, t in pairs(tags) do @@ -231,7 +231,7 @@ end --- View no tag. -- @param Optional screen number. function P.tag.viewnone(screen) - local tags = tag.get(screen or mouse.screen_get()) + local tags = tag.get(screen or mouse.screen) for i, t in pairs(tags) do t.selected = false end @@ -241,7 +241,7 @@ end -- @param i The relative index to see. -- @param screen Optional screen number. function P.tag.viewidx(i, screen) - local tags = tag.geti(screen or mouse.screen_get()) + local tags = tag.geti(screen or mouse.screen) local sel = P.tag.selected() P.tag.viewnone() for k, t in ipairs(tags) do diff --git a/mouse.c b/mouse.c index 37a9572c..94d480b7 100644 --- a/mouse.c +++ b/mouse.c @@ -266,7 +266,7 @@ mouse_infobox_new(int phys_screen, int border, area_t geometry, simple_window_t *sw; area_t geom; draw_parser_data_t pdata; - + draw_parser_data_init(&pdata); geom = draw_text_extents(globalconf.connection, @@ -1025,32 +1025,6 @@ luaA_client_mouse_move(lua_State *L) return 0; } -/** Get the screen number where the mouse ic. - * \param L The Lua VM state. - * - * \luastack - * \lreturn The screen number. - */ -static int -luaA_mouse_screen_get(lua_State *L) -{ - int screen, mouse_x, mouse_y; - xcb_window_t root; - - root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root; - - if(!mouse_query_pointer(root, &mouse_x, &mouse_y, NULL)) - return 0; - - screen = screen_get_bycoord(globalconf.screens_info, - globalconf.default_screen, - mouse_x, mouse_y); - - lua_pushnumber(L, screen + 1); - - return 1; -} - /** Create a new mouse button bindings. * \param L The Lua VM state. * \return The number of elements pushed on stack. @@ -1140,6 +1114,18 @@ luaA_mouse_index(lua_State *L) } lua_setfield(L, -2, "buttons"); break; + case A_TK_SCREEN: + root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root; + + if(!mouse_query_pointer(root, &mouse_x, &mouse_y, NULL)) + return 0; + + i = screen_get_bycoord(globalconf.screens_info, + globalconf.default_screen, + mouse_x, mouse_y); + + lua_pushnumber(L, i + 1); + break; default: return 0; } @@ -1186,7 +1172,6 @@ const struct luaL_reg awesome_mouse_methods[] = { "__call", luaA_mouse_new }, { "__index", luaA_mouse_index }, { "__newindex", luaA_mouse_newindex }, - { "screen_get", luaA_mouse_screen_get }, { NULL, NULL } }; const struct luaL_reg awesome_mouse_meta[] =