DolphinQt: Update mapping indicators at screen refresh rate.
This commit is contained in:
parent
26f2e5f022
commit
e7a8e2fca1
|
@ -27,8 +27,6 @@ class NumericSettingBase;
|
||||||
enum class SettingVisibility;
|
enum class SettingVisibility;
|
||||||
} // namespace ControllerEmu
|
} // namespace ControllerEmu
|
||||||
|
|
||||||
constexpr int INDICATOR_UPDATE_FREQ = 30;
|
|
||||||
|
|
||||||
class MappingWidget : public QWidget
|
class MappingWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QScreen>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "Core/Core.h"
|
|
||||||
#include "Core/HotkeyManager.h"
|
#include "Core/HotkeyManager.h"
|
||||||
|
|
||||||
#include "Common/CommonPaths.h"
|
#include "Common/CommonPaths.h"
|
||||||
|
@ -73,12 +73,15 @@ MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
|
||||||
SetMappingType(type);
|
SetMappingType(type);
|
||||||
|
|
||||||
const auto timer = new QTimer(this);
|
const auto timer = new QTimer(this);
|
||||||
connect(timer, &QTimer::timeout, this, [this] {
|
connect(timer, &QTimer::timeout, this, [this, timer] {
|
||||||
|
const double refresh_rate = screen()->refreshRate();
|
||||||
|
timer->setInterval(1000 / refresh_rate);
|
||||||
|
|
||||||
const auto lock = GetController()->GetStateLock();
|
const auto lock = GetController()->GetStateLock();
|
||||||
emit Update();
|
emit Update();
|
||||||
});
|
});
|
||||||
|
|
||||||
timer->start(1000 / INDICATOR_UPDATE_FREQ);
|
timer->start(100);
|
||||||
|
|
||||||
const auto lock = GetController()->GetStateLock();
|
const auto lock = GetController()->GetStateLock();
|
||||||
emit ConfigChanged();
|
emit ConfigChanged();
|
||||||
|
|
Loading…
Reference in New Issue