Compare commits

..

2 Commits

Author SHA1 Message Date
WarmUpTill
cc4a3560d8 Fix "Window" actions not being applied to OBS windows 2024-05-12 01:29:06 +02:00
WarmUpTill
3ab2ea9e66 Only update Twitch tab content when switching to it
This should reduce the potential lag introduced when querying the token
status using the Twitch API
2024-05-12 01:28:51 +02:00
2 changed files with 11 additions and 11 deletions

View File

@@ -181,12 +181,6 @@ static bool windowIsValid(HWND window)
return false;
}
DWORD id;
GetWindowThreadProcessId(window, &id);
if (id == GetCurrentProcessId()) {
return false;
}
// Only accept for top level windows and not controls within them
if (window != GetAncestor(window, GA_ROOT)) {
return false;

View File

@@ -29,6 +29,12 @@ static void setTabVisible(QTabWidget *tabWidget, bool visible)
obs_module_text("AdvSceneSwitcher.twitchConnectionTab.title"));
}
static bool twitchTabIsSelected(QTabWidget *tabWidget)
{
return tabWidget->tabText(tabWidget->currentIndex()) ==
obs_module_text("AdvSceneSwitcher.twitchConnectionTab.title");
}
TwitchConnectionsTable *TwitchConnectionsTable::Create()
{
tabWidget = new TwitchConnectionsTable();
@@ -211,11 +217,11 @@ static void setupTab(QTabWidget *tab)
}
});
auto timer = new QTimer(tabWidget);
timer->setInterval(1000);
QWidget::connect(timer, &QTimer::timeout,
[]() { updateConnectionStatus(tabWidget->Table()); });
timer->start();
QWidget::connect(tab, &QTabWidget::currentChanged, [tab]() {
if (twitchTabIsSelected(tab)) {
updateConnectionStatus(tabWidget->Table());
}
});
}
} // namespace advss