root: fix arguments in fake_input

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-11 08:19:15 +02:00
parent 309932be32
commit 18fd559da7
1 changed files with 10 additions and 11 deletions

21
root.c
View File

@ -31,7 +31,6 @@
* \param L The Lua VM state. * \param L The Lua VM state.
* \return The number of element pushed on stack. * \return The number of element pushed on stack.
* \luastack * \luastack
* \lvalue A client.
* \lparam The event type: key_press, key_release, button_press, button_release * \lparam The event type: key_press, key_release, button_press, button_release
* or motion_notify. * or motion_notify.
* \lparam The detail: in case of a key event, this is the keycode to send, in * \lparam The detail: in case of a key event, this is the keycode to send, in
@ -52,7 +51,7 @@ luaA_root_fake_input(lua_State *L)
} }
size_t tlen; size_t tlen;
const char *stype = luaL_checklstring(L, 2, &tlen); const char *stype = luaL_checklstring(L, 1, &tlen);
uint8_t type, detail; uint8_t type, detail;
int x = 0, y = 0; int x = 0, y = 0;
xcb_window_t root = XCB_NONE; xcb_window_t root = XCB_NONE;
@ -61,28 +60,28 @@ luaA_root_fake_input(lua_State *L)
{ {
case A_TK_KEY_PRESS: case A_TK_KEY_PRESS:
type = XCB_KEY_PRESS; type = XCB_KEY_PRESS;
detail = luaL_checknumber(L, 3); /* keycode */ detail = luaL_checknumber(L, 2); /* keycode */
break; break;
case A_TK_KEY_RELEASE: case A_TK_KEY_RELEASE:
type = XCB_KEY_RELEASE; type = XCB_KEY_RELEASE;
detail = luaL_checknumber(L, 3); /* keycode */ detail = luaL_checknumber(L, 2); /* keycode */
break; break;
case A_TK_BUTTON_PRESS: case A_TK_BUTTON_PRESS:
type = XCB_BUTTON_PRESS; type = XCB_BUTTON_PRESS;
detail = luaL_checknumber(L, 3); /* button number */ detail = luaL_checknumber(L, 2); /* button number */
break; break;
case A_TK_BUTTON_RELEASE: case A_TK_BUTTON_RELEASE:
type = XCB_BUTTON_RELEASE; type = XCB_BUTTON_RELEASE;
detail = luaL_checknumber(L, 3); /* button number */ detail = luaL_checknumber(L, 2); /* button number */
break; break;
case A_TK_MOTION_NOTIFY: case A_TK_MOTION_NOTIFY:
type = XCB_MOTION_NOTIFY; type = XCB_MOTION_NOTIFY;
detail = luaA_checkboolean(L, 3); /* relative to the current position or not */ detail = luaA_checkboolean(L, 2); /* relative to the current position or not */
x = luaL_checknumber(L, 4); x = luaL_checknumber(L, 3);
y = luaL_checknumber(L, 5); y = luaL_checknumber(L, 4);
if(lua_gettop(L) == 6 && !globalconf.xinerama_is_active) if(lua_gettop(L) == 5 && !globalconf.xinerama_is_active)
{ {
int screen = luaL_checknumber(L, 6) - 1; int screen = luaL_checknumber(L, 5) - 1;
luaA_checkscreen(screen); luaA_checkscreen(screen);
root = xutil_screen_get(globalconf.connection, screen)->root; root = xutil_screen_get(globalconf.connection, screen)->root;
} }