From 6f99f13cf590c323fd5bd5b4d6855e59f582fb0e Mon Sep 17 00:00:00 2001 From: aunsane Date: Tue, 12 Sep 2017 22:02:30 +0300 Subject: MirLua: massive refactoring - m_msg_buttonbar moved to m_srrm - version bump --- plugins/MirLua/Modules/m_toptoolbar/src/main.cpp | 20 +++++++++++++------- plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'plugins/MirLua/Modules/m_toptoolbar') diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp index af73c963ce..17a8d95b00 100644 --- a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp +++ b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp @@ -29,11 +29,11 @@ static TTBButton* MakeTBButton(lua_State *L) lua_pop(L, 1); lua_getfield(L, -1, "wParamUp"); - tbb->wParamUp = (WPARAM)lua_touserdata(L, -1); + tbb->wParamUp = (WPARAM)luaM_tomparam(L, -1); lua_pop(L, 1); lua_getfield(L, -1, "lParamUp"); - tbb->lParamUp = (LPARAM)lua_touserdata(L, -1); + tbb->lParamUp = (LPARAM)luaM_tomparam(L, -1); lua_pop(L, 1); // dn state @@ -46,11 +46,11 @@ static TTBButton* MakeTBButton(lua_State *L) lua_pop(L, 1); lua_getfield(L, -1, "wParamDown"); - tbb->wParamDown = (WPARAM)lua_touserdata(L, -1); + tbb->wParamDown = (WPARAM)luaM_tomparam(L, -1); lua_pop(L, 1); lua_getfield(L, -1, "lParamDown"); - tbb->lParamDown = (LPARAM)lua_touserdata(L, -1); + tbb->lParamDown = (LPARAM)luaM_tomparam(L, -1); lua_pop(L, 1); return tbb; @@ -64,9 +64,15 @@ static int lua_AddButton(lua_State *L) return 1; } - TTBButton* tbb = MakeTBButton(L); + TTBButton *tbb = MakeTBButton(L); + + HANDLE res = TopToolbar_AddButton(tbb); + if (res == (HANDLE)-1) + { + lua_pushnil(L); + return 1; + } - HANDLE res = ::TopToolbar_AddButton(tbb); lua_pushlightuserdata(L, res); mir_free(tbb->name); @@ -81,7 +87,7 @@ static int lua_RemoveButton(lua_State *L) { HANDLE hTTButton = (HANDLE)lua_touserdata(L, 1); - INT_PTR res = ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0); + INT_PTR res = CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0); lua_pushinteger(L, res); return 1; diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h index d69907bf2c..45e1eea058 100644 --- a/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h +++ b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h @@ -3,7 +3,7 @@ #include -#include +#include #include #include -- cgit v1.2.3