IOWindow: use BlockUserInputFilter
This commit is contained in:
parent
c624ef43f0
commit
0437f4c486
|
@ -22,6 +22,7 @@
|
||||||
#include "DolphinQt2/Config/Mapping/MappingCommon.h"
|
#include "DolphinQt2/Config/Mapping/MappingCommon.h"
|
||||||
#include "DolphinQt2/Config/Mapping/MappingWidget.h"
|
#include "DolphinQt2/Config/Mapping/MappingWidget.h"
|
||||||
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
|
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
|
||||||
|
#include "DolphinQt2/QtUtils/BlockUserInputFilter.h"
|
||||||
#include "InputCommon/ControlReference/ControlReference.h"
|
#include "InputCommon/ControlReference/ControlReference.h"
|
||||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
|
@ -172,11 +173,10 @@ void IOWindow::OnDialogButtonPressed(QAbstractButton* button)
|
||||||
|
|
||||||
void IOWindow::OnDetectButtonPressed()
|
void IOWindow::OnDetectButtonPressed()
|
||||||
{
|
{
|
||||||
if (m_block.IsSet())
|
installEventFilter(BlockUserInputFilter::Instance());
|
||||||
return;
|
grabKeyboard();
|
||||||
|
grabMouse();
|
||||||
|
|
||||||
m_block.Set(true);
|
|
||||||
m_expression_text->setEnabled(false);
|
|
||||||
std::thread([this] {
|
std::thread([this] {
|
||||||
auto* btn = m_type == IOWindow::Type::Input ? m_detect_button : m_test_button;
|
auto* btn = m_type == IOWindow::Type::Input ? m_detect_button : m_test_button;
|
||||||
const auto old_label = btn->text();
|
const auto old_label = btn->text();
|
||||||
|
@ -195,8 +195,10 @@ void IOWindow::OnDetectButtonPressed()
|
||||||
if (list.size() > 0)
|
if (list.size() > 0)
|
||||||
m_option_list->setCurrentItem(list[0]);
|
m_option_list->setCurrentItem(list[0]);
|
||||||
}
|
}
|
||||||
m_expression_text->setEnabled(true);
|
|
||||||
m_block.Set(false);
|
releaseMouse();
|
||||||
|
releaseKeyboard();
|
||||||
|
removeEventFilter(BlockUserInputFilter::Instance());
|
||||||
}).detach();
|
}).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,9 +211,6 @@ void IOWindow::OnRangeChanged(int value)
|
||||||
|
|
||||||
void IOWindow::UpdateOptionList()
|
void IOWindow::UpdateOptionList()
|
||||||
{
|
{
|
||||||
if (m_block.IsSet())
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_option_list->clear();
|
m_option_list->clear();
|
||||||
|
|
||||||
const auto device = g_controller_interface.FindDevice(m_devq);
|
const auto device = g_controller_interface.FindDevice(m_devq);
|
||||||
|
@ -234,7 +233,6 @@ void IOWindow::UpdateOptionList()
|
||||||
|
|
||||||
void IOWindow::UpdateDeviceList()
|
void IOWindow::UpdateDeviceList()
|
||||||
{
|
{
|
||||||
m_block.Set(true);
|
|
||||||
m_devices_combo->clear();
|
m_devices_combo->clear();
|
||||||
|
|
||||||
Core::RunAsCPUThread([&] {
|
Core::RunAsCPUThread([&] {
|
||||||
|
@ -255,6 +253,4 @@ void IOWindow::UpdateDeviceList()
|
||||||
|
|
||||||
m_devices_combo->setCurrentIndex(0);
|
m_devices_combo->setCurrentIndex(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_block.Set(false);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,5 @@ private:
|
||||||
ControllerEmu::EmulatedController* m_controller;
|
ControllerEmu::EmulatedController* m_controller;
|
||||||
|
|
||||||
ciface::Core::DeviceQualifier m_devq;
|
ciface::Core::DeviceQualifier m_devq;
|
||||||
Common::Flag m_block;
|
|
||||||
Type m_type;
|
Type m_type;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue