mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-24 14:58:19 -05:00
Move tracking of cursor position changes to cursor condition
This commit is contained in:
parent
7ba4eaab9c
commit
946c90a749
|
|
@ -347,12 +347,6 @@ void SwitcherData::SetPreconditions()
|
|||
// Process name
|
||||
GetForegroundProcessName(currentForegroundProcess);
|
||||
|
||||
// Cursor
|
||||
std::pair<int, int> cursorPos = GetCursorPos();
|
||||
cursorPosChanged = cursorPos.first != switcher->lastCursorPos.first ||
|
||||
cursorPos.second != switcher->lastCursorPos.second;
|
||||
lastCursorPos = GetCursorPos();
|
||||
|
||||
// Macro
|
||||
InvalidateMacroTempVarValues();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "macro-condition-cursor.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "platform-funcs.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
|
|
@ -61,13 +60,15 @@ bool MacroConditionCursor::CheckCondition()
|
|||
std::to_string(cursorPos.second));
|
||||
break;
|
||||
case Condition::MOVING:
|
||||
ret = switcher->cursorPosChanged;
|
||||
ret = cursorPos.first != _lastCursorPosition.first ||
|
||||
cursorPos.second != _lastCursorPosition.second;
|
||||
break;
|
||||
case Condition::CLICK:
|
||||
ret = CheckClick();
|
||||
break;
|
||||
}
|
||||
_lastCheckTime = std::chrono::high_resolution_clock::now();
|
||||
_lastCursorPosition = cursorPos;
|
||||
|
||||
if (GetVariableValue().empty()) {
|
||||
SetVariableValue(ret ? "true" : "false");
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public:
|
|||
private:
|
||||
bool CheckClick();
|
||||
std::chrono::high_resolution_clock::time_point _lastCheckTime{};
|
||||
std::pair<int, int> _lastCursorPosition;
|
||||
|
||||
static bool _registered;
|
||||
static const std::string id;
|
||||
|
|
|
|||
|
|
@ -153,8 +153,6 @@ public:
|
|||
std::string lastTitle;
|
||||
std::string currentTitle;
|
||||
std::string currentForegroundProcess;
|
||||
std::pair<int, int> lastCursorPos = {0, 0};
|
||||
bool cursorPosChanged = false;
|
||||
|
||||
std::vector<int> functionNamesByPriority =
|
||||
GetDefaultFunctionPriorityList();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user