Style changes platform-funcs.hpp

This commit is contained in:
WarmUpTill 2023-04-29 22:59:45 +02:00 committed by WarmUpTill
parent 443ffb7906
commit cd0d3862c7
10 changed files with 28 additions and 28 deletions

View File

@ -103,7 +103,7 @@ bool SwitcherData::checkExeSwitch(OBSWeakSource &scene,
bool equals = runningProcesses.contains(s.exe);
bool matches = (runningProcesses.indexOf(
QRegularExpression(s.exe)) != -1);
bool focus = (!s.inFocus || isInFocus(s.exe));
bool focus = (!s.inFocus || IsInFocus(s.exe));
// True if current window is ignored AND switch equals OR matches last window
bool ignore =

View File

@ -42,7 +42,7 @@ bool SwitcherData::checkIdleSwitch(OBSWeakSource &scene,
}
}
if (!ignoreIdle && secondsSinceLastInput() > idleData.time) {
if (!ignoreIdle && SecondsSinceLastInput() > idleData.time) {
if (idleData.alreadySwitched) {
return false;
}

View File

@ -181,8 +181,8 @@ void checkWindowTitleSwitchDirect(WindowSwitch &s,
OBSWeakSource &transition)
{
bool focus = (!s.focus || s.window == currentWindowTitle);
bool fullscreen = (!s.fullscreen || isFullscreen(s.window));
bool max = (!s.maximized || isMaximized(s.window));
bool fullscreen = (!s.fullscreen || IsFullscreen(s.window));
bool max = (!s.maximized || IsMaximized(s.window));
if (focus && fullscreen && max) {
match = true;
@ -207,8 +207,8 @@ void checkWindowTitleSwitchRegex(WindowSwitch &s,
}
bool focus = (!s.focus || window == currentWindowTitle);
bool fullscreen = (!s.fullscreen || isFullscreen(window));
bool max = (!s.maximized || isMaximized(window));
bool fullscreen = (!s.fullscreen || IsFullscreen(window));
bool max = (!s.maximized || IsMaximized(window));
if (focus && fullscreen && max) {
match = true;

View File

@ -317,7 +317,7 @@ bool windowStatesAreSet(const std::string &windowTitle,
return false;
}
bool isMaximized(const std::string &title)
bool IsMaximized(const std::string &title)
{
std::vector<QString> states;
states.emplace_back("_NET_WM_STATE_MAXIMIZED_VERT");
@ -325,7 +325,7 @@ bool isMaximized(const std::string &title)
return windowStatesAreSet(title, states);
}
bool isFullscreen(const std::string &title)
bool IsFullscreen(const std::string &title)
{
std::vector<QString> states;
states.emplace_back("_NET_WM_STATE_FULLSCREEN");
@ -430,7 +430,7 @@ void GetForegroundProcessName(std::string &proc)
proc = getProcNameFromPid(pid);
}
bool isInFocus(const QString &executable)
bool IsInFocus(const QString &executable)
{
std::string current;
GetForegroundProcessName(current);
@ -444,7 +444,7 @@ bool isInFocus(const QString &executable)
return (equals || matches);
}
int secondsSinceLastInput()
int SecondsSinceLastInput()
{
if (!canGetIdleTime) {
return 0;

View File

@ -13,7 +13,7 @@ bool MacroConditionIdle::_registered = MacroConditionFactory::Register(
bool MacroConditionIdle::CheckCondition()
{
auto seconds = secondsSinceLastInput();
auto seconds = SecondsSinceLastInput();
SetVariableValue(std::to_string(seconds));
return seconds >= _duration.Seconds();
}

View File

@ -22,7 +22,7 @@ bool MacroConditionProcess::CheckCondition()
bool equals = runningProcesses.contains(proc);
bool matches = runningProcesses.indexOf(QRegularExpression(proc)) != -1;
bool focus = !_focus || isInFocus(proc);
bool focus = !_focus || IsInFocus(proc);
if (IsReferencedInVars()) {
std::string name;

View File

@ -18,8 +18,8 @@ bool MacroConditionWindow::CheckWindowTitleSwitchDirect(
const std::string &currentWindowTitle)
{
bool focus = (!_focus || _window == currentWindowTitle);
bool fullscreen = (!_fullscreen || isFullscreen(_window));
bool max = (!_maximized || isMaximized(_window));
bool fullscreen = (!_fullscreen || IsFullscreen(_window));
bool max = (!_maximized || IsMaximized(_window));
return focus && fullscreen && max;
}
@ -39,8 +39,8 @@ bool MacroConditionWindow::CheckWindowTitleSwitchRegex(
}
bool focus = (!_focus || window == currentWindowTitle);
bool fullscreen = (!_fullscreen || isFullscreen(window));
bool max = (!_maximized || isMaximized(window));
bool fullscreen = (!_fullscreen || IsFullscreen(window));
bool max = (!_maximized || IsMaximized(window));
if (focus && fullscreen && max) {
match = true;

View File

@ -160,7 +160,7 @@ bool nameMachesPattern(std::string windowName, std::string pattern)
.contains(QRegularExpression(QString::fromStdString(pattern)));
}
bool isMaximized(const std::string &title)
bool IsMaximized(const std::string &title)
{
@autoreleasepool {
NSArray *screens = [NSScreen screens];
@ -213,7 +213,7 @@ bool isWindowFullscreenOnScreen(NSDictionary *app, NSScreen *screen)
return NSEqualSizes(windowBounds.size, screenFrame.size);
}
bool isFullscreen(const std::string &title)
bool IsFullscreen(const std::string &title)
{
@autoreleasepool {
NSArray *screens = [NSScreen screens];
@ -255,7 +255,7 @@ bool isFullscreen(const std::string &title)
return false;
}
int secondsSinceLastInput()
int SecondsSinceLastInput()
{
double time = CGEventSourceSecondsSinceLastEventType(
kCGEventSourceStateCombinedSessionState,
@ -312,7 +312,7 @@ void GetForegroundProcessName(QString &proc)
proc = QString::fromStdString(temp);
}
bool isInFocus(const QString &executable)
bool IsInFocus(const QString &executable)
{
std::string current;
GetForegroundProcessName(current);

View File

@ -16,12 +16,12 @@ extern std::chrono::high_resolution_clock::time_point lastMouseRightClickTime;
void GetWindowList(std::vector<std::string> &windows);
void GetWindowList(QStringList &windows);
void GetCurrentWindowTitle(std::string &title);
bool isFullscreen(const std::string &title);
bool isMaximized(const std::string &title);
int secondsSinceLastInput();
bool IsFullscreen(const std::string &title);
bool IsMaximized(const std::string &title);
int SecondsSinceLastInput();
void GetProcessList(QStringList &processes);
void GetForegroundProcessName(std::string &name);
bool isInFocus(const QString &executable);
bool IsInFocus(const QString &executable);
void PressKeys(const std::vector<HotkeyType> keys, int duration);
void PlatformInit();
void PlatformCleanup();

View File

@ -148,7 +148,7 @@ static HWND getHWNDfromTitle(std::string title)
return hwnd;
}
bool isMaximized(const std::string &title)
bool IsMaximized(const std::string &title)
{
RECT appBounds;
MONITORINFO monitorInfo = {0};
@ -178,7 +178,7 @@ bool isMaximized(const std::string &title)
return false;
}
bool isFullscreen(const std::string &title)
bool IsFullscreen(const std::string &title)
{
RECT appBounds;
MONITORINFO monitorInfo = {0};
@ -272,7 +272,7 @@ void GetForegroundProcessName(std::string &proc)
proc = temp.toStdString();
}
bool isInFocus(const QString &executable)
bool IsInFocus(const QString &executable)
{
// only checks if the current foreground window is from the same executable,
// may return true for any window from a program
@ -459,7 +459,7 @@ static int getTime()
return GetTickCount();
}
int secondsSinceLastInput()
int SecondsSinceLastInput()
{
return (getTime() - getLastInputTime()) / 1000;
}