From e8fb93d2b6ed26e8456309991e6688de83cf22ca Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 26 May 2015 01:09:12 -0400 Subject: [PATCH] lua: Use pushinteger for int type Attempt to fix #238 --- mouse.c | 10 +++++----- objects/client.c | 46 +++++++++++++++++++++++----------------------- objects/drawin.c | 8 ++++---- objects/screen.c | 2 +- objects/window.c | 4 ++-- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/mouse.c b/mouse.c index 056566e9..135bc19f 100644 --- a/mouse.c +++ b/mouse.c @@ -113,14 +113,14 @@ luaA_mouse_index(lua_State *L) * having lots of lua errors in this case. */ if (globalconf.focus.client) - lua_pushnumber(L, screen_get_index(globalconf.focus.client->screen)); + lua_pushinteger(L, screen_get_index(globalconf.focus.client->screen)); else - lua_pushnumber(L, 1); + lua_pushinteger(L, 1); return 1; } screen = screen_getbycoord(mouse_x, mouse_y); - lua_pushnumber(L, screen_get_index(screen)); + lua_pushinteger(L, screen_get_index(screen)); return 1; } @@ -152,9 +152,9 @@ int luaA_mouse_pushstatus(lua_State *L, int x, int y, uint16_t mask) { lua_createtable(L, 0, 2); - lua_pushnumber(L, x); + lua_pushinteger(L, x); lua_setfield(L, -2, "x"); - lua_pushnumber(L, y); + lua_pushinteger(L, y); lua_setfield(L, -2, "y"); lua_createtable(L, 5, 0); diff --git a/objects/client.c b/objects/client.c index 2ab769d5..ed0ea259 100644 --- a/objects/client.c +++ b/objects/client.c @@ -1758,7 +1758,7 @@ luaA_client_titlebar_ ## name(lua_State *L) \ } \ \ luaA_object_push_item(L, 1, titlebar_get_drawable(L, c, 1, index)); \ - lua_pushnumber(L, c->titlebar[index].size); \ + lua_pushinteger(L, c->titlebar[index].size); \ return 2; \ } HANDLE_TITLEBAR(top, CLIENT_TITLEBAR_TOP) @@ -1825,8 +1825,8 @@ luaA_client_apply_size_hints(lua_State *L) if (c->size_hints_honor) geometry = client_apply_size_hints(c, geometry); - lua_pushnumber(L, geometry.width); - lua_pushnumber(L, geometry.height); + lua_pushinteger(L, geometry.width); + lua_pushinteger(L, geometry.height); return 2; } @@ -1989,9 +1989,9 @@ LUA_OBJECT_EXPORT_PROPERTY(client, client_t, machine, lua_pushstring) LUA_OBJECT_EXPORT_PROPERTY(client, client_t, role, lua_pushstring) LUA_OBJECT_EXPORT_PROPERTY(client, client_t, transient_for, luaA_object_push) LUA_OBJECT_EXPORT_PROPERTY(client, client_t, skip_taskbar, lua_pushboolean) -LUA_OBJECT_EXPORT_PROPERTY(client, client_t, leader_window, lua_pushnumber) -LUA_OBJECT_EXPORT_PROPERTY(client, client_t, group_window, lua_pushnumber) -LUA_OBJECT_EXPORT_PROPERTY(client, client_t, pid, lua_pushnumber) +LUA_OBJECT_EXPORT_PROPERTY(client, client_t, leader_window, lua_pushinteger) +LUA_OBJECT_EXPORT_PROPERTY(client, client_t, group_window, lua_pushinteger) +LUA_OBJECT_EXPORT_PROPERTY(client, client_t, pid, lua_pushinteger) LUA_OBJECT_EXPORT_PROPERTY(client, client_t, hidden, lua_pushboolean) LUA_OBJECT_EXPORT_PROPERTY(client, client_t, minimized, lua_pushboolean) LUA_OBJECT_EXPORT_PROPERTY(client, client_t, fullscreen, lua_pushboolean) @@ -2037,7 +2037,7 @@ luaA_client_get_screen(lua_State *L, client_t *c) { if(!c->screen) return 0; - lua_pushnumber(L, screen_get_index(c->screen)); + lua_pushinteger(L, screen_get_index(c->screen)); return 1; } @@ -2085,9 +2085,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) if(u_or_p) { lua_createtable(L, 0, 2); - lua_pushnumber(L, c->size_hints.x); + lua_pushinteger(L, c->size_hints.x); lua_setfield(L, -2, "x"); - lua_pushnumber(L, c->size_hints.y); + lua_pushinteger(L, c->size_hints.y); lua_setfield(L, -2, "y"); lua_setfield(L, -2, u_or_p); u_or_p = NULL; @@ -2101,54 +2101,54 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) if(u_or_p) { lua_createtable(L, 0, 2); - lua_pushnumber(L, c->size_hints.width); + lua_pushinteger(L, c->size_hints.width); lua_setfield(L, -2, "width"); - lua_pushnumber(L, c->size_hints.height); + lua_pushinteger(L, c->size_hints.height); lua_setfield(L, -2, "height"); lua_setfield(L, -2, u_or_p); } if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) { - lua_pushnumber(L, c->size_hints.min_width); + lua_pushinteger(L, c->size_hints.min_width); lua_setfield(L, -2, "min_width"); - lua_pushnumber(L, c->size_hints.min_height); + lua_pushinteger(L, c->size_hints.min_height); lua_setfield(L, -2, "min_height"); } if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) { - lua_pushnumber(L, c->size_hints.max_width); + lua_pushinteger(L, c->size_hints.max_width); lua_setfield(L, -2, "max_width"); - lua_pushnumber(L, c->size_hints.max_height); + lua_pushinteger(L, c->size_hints.max_height); lua_setfield(L, -2, "max_height"); } if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC) { - lua_pushnumber(L, c->size_hints.width_inc); + lua_pushinteger(L, c->size_hints.width_inc); lua_setfield(L, -2, "width_inc"); - lua_pushnumber(L, c->size_hints.height_inc); + lua_pushinteger(L, c->size_hints.height_inc); lua_setfield(L, -2, "height_inc"); } if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT) { - lua_pushnumber(L, c->size_hints.min_aspect_num); + lua_pushinteger(L, c->size_hints.min_aspect_num); lua_setfield(L, -2, "min_aspect_num"); - lua_pushnumber(L, c->size_hints.min_aspect_den); + lua_pushinteger(L, c->size_hints.min_aspect_den); lua_setfield(L, -2, "min_aspect_den"); - lua_pushnumber(L, c->size_hints.max_aspect_num); + lua_pushinteger(L, c->size_hints.max_aspect_num); lua_setfield(L, -2, "max_aspect_num"); - lua_pushnumber(L, c->size_hints.max_aspect_den); + lua_pushinteger(L, c->size_hints.max_aspect_den); lua_setfield(L, -2, "max_aspect_den"); } if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE) { - lua_pushnumber(L, c->size_hints.base_width); + lua_pushinteger(L, c->size_hints.base_width); lua_setfield(L, -2, "base_width"); - lua_pushnumber(L, c->size_hints.base_height); + lua_pushinteger(L, c->size_hints.base_height); lua_setfield(L, -2, "base_height"); } diff --git a/objects/drawin.c b/objects/drawin.c index 5fc2d037..078ef49a 100644 --- a/objects/drawin.c +++ b/objects/drawin.c @@ -360,7 +360,7 @@ luaA_drawin_set_x(lua_State *L, drawin_t *drawin) static int luaA_drawin_get_x(lua_State *L, drawin_t *drawin) { - lua_pushnumber(L, drawin->geometry.x); + lua_pushinteger(L, drawin->geometry.x); return 1; } @@ -377,7 +377,7 @@ luaA_drawin_set_y(lua_State *L, drawin_t *drawin) static int luaA_drawin_get_y(lua_State *L, drawin_t *drawin) { - lua_pushnumber(L, drawin->geometry.y); + lua_pushinteger(L, drawin->geometry.y); return 1; } @@ -397,7 +397,7 @@ luaA_drawin_set_width(lua_State *L, drawin_t *drawin) static int luaA_drawin_get_width(lua_State *L, drawin_t *drawin) { - lua_pushnumber(L, drawin->geometry.width); + lua_pushinteger(L, drawin->geometry.width); return 1; } @@ -417,7 +417,7 @@ luaA_drawin_set_height(lua_State *L, drawin_t *drawin) static int luaA_drawin_get_height(lua_State *L, drawin_t *drawin) { - lua_pushnumber(L, drawin->geometry.height); + lua_pushinteger(L, drawin->geometry.height); return 1; } diff --git a/objects/screen.c b/objects/screen.c index 91e2bf69..d9a5993a 100644 --- a/objects/screen.c +++ b/objects/screen.c @@ -512,7 +512,7 @@ luaA_screen_get_workarea(lua_State *L, screen_t *s) static int luaA_screen_count(lua_State *L) { - lua_pushnumber(L, globalconf.screens.len); + lua_pushinteger(L, globalconf.screens.len); return 1; } diff --git a/objects/window.c b/objects/window.c index d7d1cbe3..3f913ee9 100644 --- a/objects/window.c +++ b/objects/window.c @@ -455,9 +455,9 @@ luaA_window_set_border_width(lua_State *L, window_t *c) return 0; } -LUA_OBJECT_EXPORT_PROPERTY(window, window_t, window, lua_pushnumber) +LUA_OBJECT_EXPORT_PROPERTY(window, window_t, window, lua_pushinteger) LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_color, luaA_pushcolor) -LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_width, lua_pushnumber) +LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_width, lua_pushinteger) void window_class_setup(lua_State *L)