1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-30 19:04:30 +00:00

Capture this explicitly

This commit is contained in:
Evil Eye 2025-11-05 22:09:23 +01:00
parent 4f8b418c23
commit baefea94e8
3 changed files with 8 additions and 8 deletions

View file

@ -46,7 +46,7 @@ namespace LuaUi
void LuaTextEdit::textChange(MyGUI::EditBox*) void LuaTextEdit::textChange(MyGUI::EditBox*)
{ {
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([this](LuaUtil::LuaView& view) {
triggerEvent("textChanged", sol::make_object(view.sol(), mEditBox->getCaption().asUTF8())); triggerEvent("textChanged", sol::make_object(view.sol(), mEditBox->getCaption().asUTF8()));
}); });
} }

View file

@ -367,7 +367,7 @@ namespace LuaUi
void WidgetExtension::keyPress(MyGUI::Widget*, MyGUI::KeyCode code, MyGUI::Char ch) void WidgetExtension::keyPress(MyGUI::Widget*, MyGUI::KeyCode code, MyGUI::Char ch)
{ {
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([=, this](LuaUtil::LuaView& view) {
if (code == MyGUI::KeyCode::None) if (code == MyGUI::KeyCode::None)
{ {
propagateEvent("textInput", [&](auto w) { propagateEvent("textInput", [&](auto w) {
@ -383,21 +383,21 @@ namespace LuaUi
void WidgetExtension::keyRelease(MyGUI::Widget*, MyGUI::KeyCode code) void WidgetExtension::keyRelease(MyGUI::Widget*, MyGUI::KeyCode code)
{ {
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([=, this](LuaUtil::LuaView& view) {
propagateEvent("keyRelease", [&](auto w) { return w->keyEvent(view, code); }); propagateEvent("keyRelease", [&](auto w) { return w->keyEvent(view, code); });
}); });
} }
void WidgetExtension::mouseMove(MyGUI::Widget*, int left, int top) void WidgetExtension::mouseMove(MyGUI::Widget*, int left, int top)
{ {
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([=, this](LuaUtil::LuaView& view) {
propagateEvent("mouseMove", [&](auto w) { return w->mouseEvent(view, left, top); }); propagateEvent("mouseMove", [&](auto w) { return w->mouseEvent(view, left, top); });
}); });
} }
void WidgetExtension::mouseDrag(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button) void WidgetExtension::mouseDrag(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button)
{ {
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([=, this](LuaUtil::LuaView& view) {
propagateEvent("mouseMove", [&](auto w) { return w->mouseEvent(view, left, top, button); }); propagateEvent("mouseMove", [&](auto w) { return w->mouseEvent(view, left, top, button); });
}); });
} }
@ -414,14 +414,14 @@ namespace LuaUi
void WidgetExtension::mousePress(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button) void WidgetExtension::mousePress(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button)
{ {
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([=, this](LuaUtil::LuaView& view) {
propagateEvent("mousePress", [&](auto w) { return w->mouseEvent(view, left, top, button); }); propagateEvent("mousePress", [&](auto w) { return w->mouseEvent(view, left, top, button); });
}); });
} }
void WidgetExtension::mouseRelease(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button) void WidgetExtension::mouseRelease(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button)
{ {
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([=, this](LuaUtil::LuaView& view) {
propagateEvent("mouseRelease", [&](auto w) { return w->mouseEvent(view, left, top, button); }); propagateEvent("mouseRelease", [&](auto w) { return w->mouseEvent(view, left, top, button); });
}); });
} }

View file

@ -78,7 +78,7 @@ namespace LuaUi
mPreviousMouse.left = left; mPreviousMouse.left = left;
mPreviousMouse.top = top; mPreviousMouse.top = top;
protectedCall([=](LuaUtil::LuaView& view) { protectedCall([this](LuaUtil::LuaView& view) {
sol::table table = view.newTable(); sol::table table = view.newTable();
table["position"] = osg::Vec2f(mCoord.left, mCoord.top); table["position"] = osg::Vec2f(mCoord.left, mCoord.top);
table["size"] = osg::Vec2f(mCoord.width, mCoord.height); table["size"] = osg::Vec2f(mCoord.width, mCoord.height);