summaryrefslogtreecommitdiff
path: root/plugins/MirLua/Modules/m_toptoolbar/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/Modules/m_toptoolbar/src')
-rw-r--r--plugins/MirLua/Modules/m_toptoolbar/src/main.cpp20
-rw-r--r--plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h2
2 files changed, 14 insertions, 8 deletions
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 <windows.h>
-#include <lua.hpp>
+#include <mirlua.h>
#include <m_core.h>
#include <m_utils.h>