mouse: fix args for mouse.coords_set()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
eae75c8cef
commit
a4e12b1ce0
|
@ -346,7 +346,7 @@ function hook_arrange(screen)
|
|||
if m_c.x < c_c.x or m_c.x >= c_c.x + c_c.width or
|
||||
m_c.y < c_c.y or m_c.y >= c_c.y + c_c.height then
|
||||
if table.maxn(m_c.buttons) == 0 then
|
||||
mouse.coords_set(c_c.x + 5, c_c.y + 5)
|
||||
mouse.coords_set({ x = c_c.x + 5, y = c_c.y + 5})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -150,8 +150,7 @@ function P.screen.focus(i)
|
|||
s = cycle(screen.count(), s + i)
|
||||
screen.focus(s)
|
||||
-- Move the mouse on the screen
|
||||
local screen_coords = screen.coords_get(s)
|
||||
mouse.coords_set(screen_coords['x'], screen_coords['y'])
|
||||
mouse.coords_set(screen.coords_get(s))
|
||||
end
|
||||
|
||||
--- Return a table with all visible tags
|
||||
|
@ -333,6 +332,7 @@ function P.client.movetoscreen(c, s)
|
|||
end
|
||||
if s > sc then s = 1 elseif s < 1 then s = sc end
|
||||
sel:screen_set(s)
|
||||
mouse.coords_set(screen.coords_get(s))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
32
mouse.c
32
mouse.c
|
@ -990,23 +990,28 @@ luaA_mouse_coords_get(lua_State *L)
|
|||
lua_pushnumber(L, mouse_y);
|
||||
lua_setfield(L, -2, "y");
|
||||
lua_newtable(L);
|
||||
if (mask & XCB_BUTTON_MASK_1) {
|
||||
if (mask & XCB_BUTTON_MASK_1)
|
||||
{
|
||||
lua_pushnumber(L, 1);
|
||||
lua_rawseti(L, -2, ++i);
|
||||
}
|
||||
if (mask & XCB_BUTTON_MASK_2) {
|
||||
if (mask & XCB_BUTTON_MASK_2)
|
||||
{
|
||||
lua_pushnumber(L, 2);
|
||||
lua_rawseti(L, -2, ++i);
|
||||
}
|
||||
if (mask & XCB_BUTTON_MASK_3) {
|
||||
if (mask & XCB_BUTTON_MASK_3)
|
||||
{
|
||||
lua_pushnumber(L, 3);
|
||||
lua_rawseti(L, -2, ++i);
|
||||
}
|
||||
if (mask & XCB_BUTTON_MASK_4) {
|
||||
if (mask & XCB_BUTTON_MASK_4)
|
||||
{
|
||||
lua_pushnumber(L, 4);
|
||||
lua_rawseti(L, -2, ++i);
|
||||
}
|
||||
if (mask & XCB_BUTTON_MASK_5) {
|
||||
if (mask & XCB_BUTTON_MASK_5)
|
||||
{
|
||||
lua_pushnumber(L, 5);
|
||||
lua_rawseti(L, -2, ++i);
|
||||
}
|
||||
|
@ -1018,17 +1023,24 @@ luaA_mouse_coords_get(lua_State *L)
|
|||
* \param L The Lua VM state.
|
||||
*
|
||||
* \luastack
|
||||
* \lparam The x coordinate.
|
||||
* \lparam The y coordinate.
|
||||
* \lparam The x and y coordinate in a table.
|
||||
*/
|
||||
static int
|
||||
luaA_mouse_coords_set(lua_State *L)
|
||||
{
|
||||
int x, y;
|
||||
int x, y, mouse_x, mouse_y;
|
||||
xcb_window_t root;
|
||||
uint16_t mask;
|
||||
|
||||
x = luaL_checknumber(L, 1);
|
||||
y = luaL_checknumber(L, 2);
|
||||
luaA_checktable(L, 1);
|
||||
|
||||
root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
||||
|
||||
if(!mouse_query_pointer(root, &mouse_x, &mouse_y, &mask))
|
||||
return 0;
|
||||
|
||||
x = luaA_getopt_number(L, 1, "x", mouse_x);
|
||||
y = luaA_getopt_number(L, 1, "y", mouse_y);
|
||||
|
||||
root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
||||
mouse_warp_pointer(root, x, y);
|
||||
|
|
Loading…
Reference in New Issue