Add blur lua event, called when opening another interface window
This commit is contained in:
parent
9e94abb150
commit
3b3775addf
@ -863,6 +863,14 @@ void GameController::Tick()
|
||||
commandInterface->OnTick();
|
||||
}
|
||||
|
||||
void GameController::Blur()
|
||||
{
|
||||
// Tell lua that mouse is up (even if it really isn't)
|
||||
MouseUp(0, 0, 0, 1);
|
||||
BlurEvent ev;
|
||||
commandInterface->HandleEvent(LuaEvents::blur, &ev);
|
||||
}
|
||||
|
||||
void GameController::Exit()
|
||||
{
|
||||
CloseEvent ev;
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
bool KeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
|
||||
bool KeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
|
||||
void Tick();
|
||||
void Blur();
|
||||
void Exit();
|
||||
|
||||
void Install();
|
||||
|
@ -1700,9 +1700,7 @@ void GameView::OnBlur()
|
||||
disableShiftBehaviour();
|
||||
isMouseDown = false;
|
||||
drawMode = DrawPoints;
|
||||
c->MouseUp(0, 0, 0, 1); // tell lua that mouse is up (even if it really isn't)
|
||||
if (GetModifiers())
|
||||
c->KeyRelease(0, 0, false, false, false, false);
|
||||
c->Blur();
|
||||
}
|
||||
|
||||
void GameView::OnTick(float dt)
|
||||
|
@ -98,6 +98,12 @@ public:
|
||||
int PushToStack(lua_State *l) override { return 0; }
|
||||
};
|
||||
|
||||
class BlurEvent: public Event
|
||||
{
|
||||
public:
|
||||
int PushToStack(lua_State *l) override { return 0; }
|
||||
};
|
||||
|
||||
class CloseEvent: public Event
|
||||
{
|
||||
public:
|
||||
@ -116,6 +122,7 @@ public:
|
||||
mousemove,
|
||||
mousewheel,
|
||||
tick,
|
||||
blur,
|
||||
close
|
||||
};
|
||||
|
||||
|
@ -3314,6 +3314,7 @@ void LuaScriptInterface::initEventAPI()
|
||||
lua_pushinteger(l, LuaEvents::mousemove); lua_setfield(l, -2, "mousemove");
|
||||
lua_pushinteger(l, LuaEvents::mousewheel); lua_setfield(l, -2, "mousewheel");
|
||||
lua_pushinteger(l, LuaEvents::tick); lua_setfield(l, -2, "tick");
|
||||
lua_pushinteger(l, LuaEvents::blur); lua_setfield(l, -2, "blur");
|
||||
lua_pushinteger(l, LuaEvents::close); lua_setfield(l, -2, "close");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user