Qt: Fix Linux build
This commit is contained in:
parent
ae529a6195
commit
722771fff6
|
@ -54,8 +54,7 @@ bool InputBindingDialog::eventFilter(QObject* watched, QEvent* event)
|
||||||
else if (event_type == QEvent::MouseButtonPress || event_type == QEvent::MouseButtonDblClick)
|
else if (event_type == QEvent::MouseButtonPress || event_type == QEvent::MouseButtonDblClick)
|
||||||
{
|
{
|
||||||
// double clicks get triggered if we click bind, then click again quickly.
|
// double clicks get triggered if we click bind, then click again quickly.
|
||||||
unsigned long button_index;
|
unsigned button_index = CountTrailingZeros(static_cast<u32>(static_cast<const QMouseEvent*>(event)->button()));
|
||||||
if (_BitScanForward(&button_index, static_cast<u32>(static_cast<const QMouseEvent*>(event)->button())))
|
|
||||||
m_new_bindings.push_back(InputManager::MakePointerButtonKey(0, button_index));
|
m_new_bindings.push_back(InputManager::MakePointerButtonKey(0, button_index));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,8 +111,7 @@ bool InputBindingWidget::eventFilter(QObject* watched, QEvent* event)
|
||||||
else if (event_type == QEvent::MouseButtonPress || event_type == QEvent::MouseButtonDblClick)
|
else if (event_type == QEvent::MouseButtonPress || event_type == QEvent::MouseButtonDblClick)
|
||||||
{
|
{
|
||||||
// double clicks get triggered if we click bind, then click again quickly.
|
// double clicks get triggered if we click bind, then click again quickly.
|
||||||
unsigned long button_index;
|
const u32 button_index = CountTrailingZeros(static_cast<u32>(static_cast<const QMouseEvent*>(event)->button()));
|
||||||
if (_BitScanForward(&button_index, static_cast<u32>(static_cast<const QMouseEvent*>(event)->button())))
|
|
||||||
m_new_bindings.push_back(InputManager::MakePointerButtonKey(0, button_index));
|
m_new_bindings.push_back(InputManager::MakePointerButtonKey(0, button_index));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "sdl_input_source.h"
|
#include "sdl_input_source.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/bitutils.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/host.h"
|
#include "core/host.h"
|
||||||
|
@ -718,8 +719,7 @@ bool SDLInputSource::HandleJoystickHatEvent(const SDL_JoyHatEvent* ev)
|
||||||
unsigned long changed_direction = last_direction ^ ev->value;
|
unsigned long changed_direction = last_direction ^ ev->value;
|
||||||
while (changed_direction != 0)
|
while (changed_direction != 0)
|
||||||
{
|
{
|
||||||
unsigned long pos;
|
const u32 pos = CountTrailingZeros(changed_direction);
|
||||||
_BitScanForward(&pos, changed_direction);
|
|
||||||
|
|
||||||
const unsigned long mask = (1u << pos);
|
const unsigned long mask = (1u << pos);
|
||||||
changed_direction &= ~mask;
|
changed_direction &= ~mask;
|
||||||
|
|
Loading…
Reference in New Issue