Fix an unbalanced lua stack

event_button_callback() pops the top element from the stack, but
event_emit_button() doesn't. This got was expecting both to pop the top from the
stack so Bad Things(tm) happen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-10-10 13:32:47 +02:00
parent 38d4602425
commit e55ed50b89
1 changed files with 5 additions and 10 deletions

15
event.c
View File

@ -189,23 +189,18 @@ event_handle_button(xcb_button_press_event_t *ev)
/* Push the drawin */ /* Push the drawin */
luaA_object_push(globalconf.L, drawin); luaA_object_push(globalconf.L, drawin);
/* Duplicate the drawin */ /* and handle the button raw button event */
lua_pushvalue(globalconf.L, -1);
/* Handle the button event on it */
event_button_callback(ev, &drawin->buttons, -1, 1, NULL);
/* And handle the button event on it again */
event_emit_button(ev); event_emit_button(ev);
/* check if any button object matches */
event_button_callback(ev, &drawin->buttons, -1, 1, NULL);
} }
else if((c = client_getbyframewin(ev->event))) else if((c = client_getbyframewin(ev->event)))
{ {
luaA_object_push(globalconf.L, c); luaA_object_push(globalconf.L, c);
/* Duplicate the client */ /* And handle the button raw button event */
lua_pushvalue(globalconf.L, -1); event_emit_button(ev);
/* then check if any button objects match */ /* then check if any button objects match */
event_button_callback(ev, &c->buttons, -1, 1, NULL); event_button_callback(ev, &c->buttons, -1, 1, NULL);
/* And handle the button event on it again */
event_emit_button(ev);
xcb_allow_events(globalconf.connection, xcb_allow_events(globalconf.connection,
XCB_ALLOW_REPLAY_POINTER, XCB_ALLOW_REPLAY_POINTER,
XCB_CURRENT_TIME); XCB_CURRENT_TIME);