mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Qt: Fix incorrect mouse button event being fired
Fixes left click bindings.
This commit is contained in:
parent
f3ec05f1ba
commit
ddbe28830e
|
@ -292,7 +292,7 @@ bool DisplayWidget::event(QEvent* event)
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
{
|
{
|
||||||
const u32 button_index = CountTrailingZeros(static_cast<u32>(static_cast<const QMouseEvent*>(event)->button()));
|
const u32 button_index = CountTrailingZeros(static_cast<u32>(static_cast<const QMouseEvent*>(event)->button()));
|
||||||
emit windowMouseButtonEvent(static_cast<int>(button_index + 1u), event->type() != QEvent::MouseButtonRelease);
|
emit windowMouseButtonEvent(static_cast<int>(button_index), event->type() != QEvent::MouseButtonRelease);
|
||||||
|
|
||||||
// don't toggle fullscreen when we're bound.. that wouldn't end well.
|
// don't toggle fullscreen when we're bound.. that wouldn't end well.
|
||||||
if (event->type() == QEvent::MouseButtonDblClick &&
|
if (event->type() == QEvent::MouseButtonDblClick &&
|
||||||
|
|
|
@ -745,11 +745,11 @@ void ImGuiManager::UpdateMousePosition(float x, float y)
|
||||||
|
|
||||||
bool ImGuiManager::ProcessPointerButtonEvent(InputBindingKey key, float value)
|
bool ImGuiManager::ProcessPointerButtonEvent(InputBindingKey key, float value)
|
||||||
{
|
{
|
||||||
if (!ImGui::GetCurrentContext() || (key.data - 1u) >= std::size(ImGui::GetIO().MouseDown))
|
if (!ImGui::GetCurrentContext() || key.data >= std::size(ImGui::GetIO().MouseDown))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// still update state anyway
|
// still update state anyway
|
||||||
ImGui::GetIO().AddMouseButtonEvent(key.data - 1, value != 0.0f);
|
ImGui::GetIO().AddMouseButtonEvent(key.data, value != 0.0f);
|
||||||
|
|
||||||
return s_imgui_wants_mouse.load(std::memory_order_acquire);
|
return s_imgui_wants_mouse.load(std::memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue