Replace many pushnumber calls with pushinteger
The only remaining calls are for a window's opacity and in the DBus type handling. Everything else wants integers, not something with a comma. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
720768330c
commit
051d0de85f
|
@ -150,7 +150,7 @@ luaA_checkudataornil(lua_State *L, int udx, lua_class_t *class)
|
||||||
static inline int \
|
static inline int \
|
||||||
luaA_##prefix##_class_instances(lua_State *L) \
|
luaA_##prefix##_class_instances(lua_State *L) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, (lua_class).instances); \
|
lua_pushinteger(L, (lua_class).instances); \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
40
dbus.c
40
dbus.c
|
@ -136,7 +136,7 @@ a_dbus_message_iter(lua_State *L, DBusMessageIter *iter)
|
||||||
switch(array_type)
|
switch(array_type)
|
||||||
{
|
{
|
||||||
int datalen = 0;
|
int datalen = 0;
|
||||||
#define DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(type, dbustype) \
|
#define DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(type, dbustype, pusher) \
|
||||||
case dbustype: \
|
case dbustype: \
|
||||||
{ \
|
{ \
|
||||||
const type *data; \
|
const type *data; \
|
||||||
|
@ -144,19 +144,19 @@ a_dbus_message_iter(lua_State *L, DBusMessageIter *iter)
|
||||||
lua_createtable(L, datalen, 0); \
|
lua_createtable(L, datalen, 0); \
|
||||||
for(int i = 0; i < datalen; i++) \
|
for(int i = 0; i < datalen; i++) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, data[i]); \
|
pusher(L, data[i]); \
|
||||||
lua_rawseti(L, -2, i + 1); \
|
lua_rawseti(L, -2, i + 1); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
break;
|
break;
|
||||||
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int16_t, DBUS_TYPE_INT16)
|
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(int16_t, DBUS_TYPE_INT16, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint16_t, DBUS_TYPE_UINT16)
|
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(uint16_t, DBUS_TYPE_UINT16, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int32_t, DBUS_TYPE_INT32)
|
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(int32_t, DBUS_TYPE_INT32, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint32_t, DBUS_TYPE_UINT32)
|
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(uint32_t, DBUS_TYPE_UINT32, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int64_t, DBUS_TYPE_INT64)
|
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(int64_t, DBUS_TYPE_INT64, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint64_t, DBUS_TYPE_UINT64)
|
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(uint64_t, DBUS_TYPE_UINT64, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(double, DBUS_TYPE_DOUBLE)
|
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(double, DBUS_TYPE_DOUBLE, lua_pushnumber)
|
||||||
#undef DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER
|
#undef DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT
|
||||||
case DBUS_TYPE_BYTE:
|
case DBUS_TYPE_BYTE:
|
||||||
{
|
{
|
||||||
const char *c;
|
const char *c;
|
||||||
|
@ -232,23 +232,23 @@ a_dbus_message_iter(lua_State *L, DBusMessageIter *iter)
|
||||||
}
|
}
|
||||||
nargs++;
|
nargs++;
|
||||||
break;
|
break;
|
||||||
#define DBUS_MSG_HANDLE_TYPE_NUMBER(type, dbustype) \
|
#define DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(type, dbustype, pusher) \
|
||||||
case dbustype: \
|
case dbustype: \
|
||||||
{ \
|
{ \
|
||||||
type ui; \
|
type ui; \
|
||||||
dbus_message_iter_get_basic(iter, &ui); \
|
dbus_message_iter_get_basic(iter, &ui); \
|
||||||
lua_pushnumber(L, ui); \
|
pusher(L, ui); \
|
||||||
} \
|
} \
|
||||||
nargs++; \
|
nargs++; \
|
||||||
break;
|
break;
|
||||||
DBUS_MSG_HANDLE_TYPE_NUMBER(int16_t, DBUS_TYPE_INT16)
|
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(int16_t, DBUS_TYPE_INT16, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_TYPE_NUMBER(uint16_t, DBUS_TYPE_UINT16)
|
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(uint16_t, DBUS_TYPE_UINT16, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_TYPE_NUMBER(int32_t, DBUS_TYPE_INT32)
|
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(int32_t, DBUS_TYPE_INT32, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_TYPE_NUMBER(uint32_t, DBUS_TYPE_UINT32)
|
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(uint32_t, DBUS_TYPE_UINT32, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_TYPE_NUMBER(int64_t, DBUS_TYPE_INT64)
|
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(int64_t, DBUS_TYPE_INT64, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_TYPE_NUMBER(uint64_t, DBUS_TYPE_UINT64)
|
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(uint64_t, DBUS_TYPE_UINT64, lua_pushinteger)
|
||||||
DBUS_MSG_HANDLE_TYPE_NUMBER(double, DBUS_TYPE_DOUBLE)
|
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(double, DBUS_TYPE_DOUBLE, lua_pushnumber)
|
||||||
#undef DBUS_MSG_HANDLE_TYPE_NUMBER
|
#undef DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT
|
||||||
case DBUS_TYPE_STRING:
|
case DBUS_TYPE_STRING:
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
18
event.c
18
event.c
|
@ -153,9 +153,9 @@ event_emit_button(lua_State *L, xcb_button_press_event_t *ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Push the event's info */
|
/* Push the event's info */
|
||||||
lua_pushnumber(L, ev->event_x);
|
lua_pushinteger(L, ev->event_x);
|
||||||
lua_pushnumber(L, ev->event_y);
|
lua_pushinteger(L, ev->event_y);
|
||||||
lua_pushnumber(L, ev->detail);
|
lua_pushinteger(L, ev->detail);
|
||||||
luaA_pushmodifiers(L, ev->state);
|
luaA_pushmodifiers(L, ev->state);
|
||||||
/* And emit the signal */
|
/* And emit the signal */
|
||||||
luaA_object_emit_signal(L, -5, name, 4);
|
luaA_object_emit_signal(L, -5, name, 4);
|
||||||
|
@ -480,8 +480,8 @@ event_handle_motionnotify(xcb_motion_notify_event_t *ev)
|
||||||
if((c = client_getbyframewin(ev->event)))
|
if((c = client_getbyframewin(ev->event)))
|
||||||
{
|
{
|
||||||
luaA_object_push(L, c);
|
luaA_object_push(L, c);
|
||||||
lua_pushnumber(L, ev->event_x);
|
lua_pushinteger(L, ev->event_x);
|
||||||
lua_pushnumber(L, ev->event_y);
|
lua_pushinteger(L, ev->event_y);
|
||||||
luaA_object_emit_signal(L, -3, "mouse::move", 2);
|
luaA_object_emit_signal(L, -3, "mouse::move", 2);
|
||||||
|
|
||||||
/* now check if a titlebar was "hit" */
|
/* now check if a titlebar was "hit" */
|
||||||
|
@ -491,8 +491,8 @@ event_handle_motionnotify(xcb_motion_notify_event_t *ev)
|
||||||
{
|
{
|
||||||
luaA_object_push_item(L, -1, d);
|
luaA_object_push_item(L, -1, d);
|
||||||
event_drawable_under_mouse(L, -1);
|
event_drawable_under_mouse(L, -1);
|
||||||
lua_pushnumber(L, x);
|
lua_pushinteger(L, x);
|
||||||
lua_pushnumber(L, y);
|
lua_pushinteger(L, y);
|
||||||
luaA_object_emit_signal(L, -3, "mouse::move", 2);
|
luaA_object_emit_signal(L, -3, "mouse::move", 2);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
@ -504,8 +504,8 @@ event_handle_motionnotify(xcb_motion_notify_event_t *ev)
|
||||||
luaA_object_push(L, w);
|
luaA_object_push(L, w);
|
||||||
luaA_object_push_item(L, -1, w->drawable);
|
luaA_object_push_item(L, -1, w->drawable);
|
||||||
event_drawable_under_mouse(L, -1);
|
event_drawable_under_mouse(L, -1);
|
||||||
lua_pushnumber(L, ev->event_x);
|
lua_pushinteger(L, ev->event_x);
|
||||||
lua_pushnumber(L, ev->event_y);
|
lua_pushinteger(L, ev->event_y);
|
||||||
luaA_object_emit_signal(L, -3, "mouse::move", 2);
|
luaA_object_emit_signal(L, -3, "mouse::move", 2);
|
||||||
lua_pop(L, 2);
|
lua_pop(L, 2);
|
||||||
}
|
}
|
||||||
|
|
2
luaa.c
2
luaa.c
|
@ -193,7 +193,7 @@ static int
|
||||||
luaA_mbstrlen(lua_State *L)
|
luaA_mbstrlen(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *cmd = luaL_checkstring(L, 1);
|
const char *cmd = luaL_checkstring(L, 1);
|
||||||
lua_pushnumber(L, (ssize_t) mbstowcs(NULL, NONULL(cmd), 0));
|
lua_pushinteger(L, (ssize_t) mbstowcs(NULL, NONULL(cmd), 0));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
luaa.h
8
luaa.h
|
@ -175,13 +175,13 @@ static inline int
|
||||||
luaA_pusharea(lua_State *L, area_t geometry)
|
luaA_pusharea(lua_State *L, area_t geometry)
|
||||||
{
|
{
|
||||||
lua_createtable(L, 0, 4);
|
lua_createtable(L, 0, 4);
|
||||||
lua_pushnumber(L, geometry.x);
|
lua_pushinteger(L, geometry.x);
|
||||||
lua_setfield(L, -2, "x");
|
lua_setfield(L, -2, "x");
|
||||||
lua_pushnumber(L, geometry.y);
|
lua_pushinteger(L, geometry.y);
|
||||||
lua_setfield(L, -2, "y");
|
lua_setfield(L, -2, "y");
|
||||||
lua_pushnumber(L, geometry.width);
|
lua_pushinteger(L, geometry.width);
|
||||||
lua_setfield(L, -2, "width");
|
lua_setfield(L, -2, "width");
|
||||||
lua_pushnumber(L, geometry.height);
|
lua_pushinteger(L, geometry.height);
|
||||||
lua_setfield(L, -2, "height");
|
lua_setfield(L, -2, "height");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ luaA_button_array_get(lua_State *L, int oidx, button_array_t *buttons)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(button, button_t, button, lua_pushnumber);
|
LUA_OBJECT_EXPORT_PROPERTY(button, button_t, button, lua_pushinteger);
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(button, button_t, modifiers, luaA_pushmodifiers);
|
LUA_OBJECT_EXPORT_PROPERTY(button, button_t, modifiers, luaA_pushmodifiers);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
8
spawn.c
8
spawn.c
|
@ -151,7 +151,7 @@ spawn_monitor_event(SnMonitorEvent *event, void *data)
|
||||||
lua_setfield(L, -2, "description");
|
lua_setfield(L, -2, "description");
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_pushnumber(L, sn_startup_sequence_get_workspace(sequence));
|
lua_pushinteger(L, sn_startup_sequence_get_workspace(sequence));
|
||||||
lua_setfield(L, -2, "workspace");
|
lua_setfield(L, -2, "workspace");
|
||||||
|
|
||||||
if((s = sn_startup_sequence_get_binary_name(sequence)))
|
if((s = sn_startup_sequence_get_binary_name(sequence)))
|
||||||
|
@ -352,11 +352,11 @@ child_exit_callback(GPid pid, gint status, gpointer user_data)
|
||||||
/* 'Decode' the exit status */
|
/* 'Decode' the exit status */
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
lua_pushliteral(L, "exit");
|
lua_pushliteral(L, "exit");
|
||||||
lua_pushnumber(L, WEXITSTATUS(status));
|
lua_pushinteger(L, WEXITSTATUS(status));
|
||||||
} else {
|
} else {
|
||||||
assert(WIFSIGNALED(status));
|
assert(WIFSIGNALED(status));
|
||||||
lua_pushliteral(L, "signal");
|
lua_pushliteral(L, "signal");
|
||||||
lua_pushnumber(L, WTERMSIG(status));
|
lua_pushinteger(L, WTERMSIG(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, exit_callback);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, exit_callback);
|
||||||
|
@ -461,7 +461,7 @@ luaA_spawn(lua_State *L)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* push pid on stack */
|
/* push pid on stack */
|
||||||
lua_pushnumber(L, pid);
|
lua_pushinteger(L, pid);
|
||||||
|
|
||||||
/* push sn on stack */
|
/* push sn on stack */
|
||||||
if (context)
|
if (context)
|
||||||
|
|
8
strut.c
8
strut.c
|
@ -31,13 +31,13 @@ int
|
||||||
luaA_pushstrut(lua_State *L, strut_t strut)
|
luaA_pushstrut(lua_State *L, strut_t strut)
|
||||||
{
|
{
|
||||||
lua_createtable(L, 4, 0);
|
lua_createtable(L, 4, 0);
|
||||||
lua_pushnumber(L, strut.left);
|
lua_pushinteger(L, strut.left);
|
||||||
lua_setfield(L, -2, "left");
|
lua_setfield(L, -2, "left");
|
||||||
lua_pushnumber(L, strut.right);
|
lua_pushinteger(L, strut.right);
|
||||||
lua_setfield(L, -2, "right");
|
lua_setfield(L, -2, "right");
|
||||||
lua_pushnumber(L, strut.top);
|
lua_pushinteger(L, strut.top);
|
||||||
lua_setfield(L, -2, "top");
|
lua_setfield(L, -2, "top");
|
||||||
lua_pushnumber(L, strut.bottom);
|
lua_pushinteger(L, strut.bottom);
|
||||||
lua_setfield(L, -2, "bottom");
|
lua_setfield(L, -2, "bottom");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
2
xkb.c
2
xkb.c
|
@ -247,7 +247,7 @@ event_handle_xkb_notify(xcb_generic_event_t* event)
|
||||||
|
|
||||||
if (state_notify_event->changed & XCB_XKB_STATE_PART_GROUP_STATE)
|
if (state_notify_event->changed & XCB_XKB_STATE_PART_GROUP_STATE)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, state_notify_event->group);
|
lua_pushinteger(L, state_notify_event->group);
|
||||||
signal_object_emit(L, &global_signals, "xkb::group_changed", 1);
|
signal_object_emit(L, &global_signals, "xkb::group_changed", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue