mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-24 19:38:32 -06:00
Qt/Input: trace gui pad navigation button presses
This commit is contained in:
parent
07f5b0aa5b
commit
1d05cf9ce5
@ -38,6 +38,39 @@
|
||||
|
||||
LOG_CHANNEL(gui_log, "GUI");
|
||||
|
||||
template <>
|
||||
void fmt_class_string<gui_pad_thread::mouse_button>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](gui_pad_thread::mouse_button value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case gui_pad_thread::mouse_button::none: return "Mouse none";
|
||||
case gui_pad_thread::mouse_button::left: return "Mouse left";
|
||||
case gui_pad_thread::mouse_button::right: return "Mouse right";
|
||||
case gui_pad_thread::mouse_button::middle: return "Mouse middle";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
});
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<gui_pad_thread::mouse_wheel>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](gui_pad_thread::mouse_wheel value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case gui_pad_thread::mouse_wheel::none: return "Wheel none";
|
||||
case gui_pad_thread::mouse_wheel::vertical: return "Wheel vertical";
|
||||
case gui_pad_thread::mouse_wheel::horizontal: return "Wheel horizontal";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
});
|
||||
}
|
||||
|
||||
atomic_t<bool> gui_pad_thread::m_reset = false;
|
||||
|
||||
gui_pad_thread::gui_pad_thread()
|
||||
@ -294,8 +327,10 @@ void gui_pad_thread::process_input()
|
||||
|
||||
constexpr u64 ms_threshold = 500;
|
||||
|
||||
const auto on_button_pressed = [this](pad_button button_id, bool pressed, u16 value)
|
||||
const auto on_button_pressed = [this](pad_button button_id, bool pressed, bool auto_repeat, u16 value)
|
||||
{
|
||||
gui_log.trace("gui_pad_thread::on_button_pressed: btn=%s, pressed=%d, auto_repeat=%d, value=%d", button_id, pressed, auto_repeat, value);
|
||||
|
||||
if (button_id == m_mouse_boost_button)
|
||||
{
|
||||
m_boost_mouse = pressed;
|
||||
@ -390,7 +425,7 @@ void gui_pad_thread::process_input()
|
||||
m_last_auto_repeat_button = is_auto_repeat_button ? button_id : pad_button::pad_button_max_enum;
|
||||
}
|
||||
|
||||
on_button_pressed(static_cast<pad_button>(button_id), true, value);
|
||||
on_button_pressed(static_cast<pad_button>(button_id), true, false, value);
|
||||
}
|
||||
else if (is_auto_repeat_button)
|
||||
{
|
||||
@ -400,7 +435,7 @@ void gui_pad_thread::process_input()
|
||||
{
|
||||
// The auto-repeat button was pressed for at least the given threshold in ms and will trigger at an interval.
|
||||
m_timestamp = steady_clock::now();
|
||||
on_button_pressed(static_cast<pad_button>(button_id), true, value);
|
||||
on_button_pressed(static_cast<pad_button>(button_id), true, true, value);
|
||||
}
|
||||
else if (m_last_auto_repeat_button == pad_button::pad_button_max_enum)
|
||||
{
|
||||
@ -410,7 +445,7 @@ void gui_pad_thread::process_input()
|
||||
}
|
||||
else if (is_mouse_move_button)
|
||||
{
|
||||
on_button_pressed(static_cast<pad_button>(button_id), pressed, value);
|
||||
on_button_pressed(static_cast<pad_button>(button_id), true, false, value);
|
||||
}
|
||||
}
|
||||
else if (last_state)
|
||||
@ -421,7 +456,7 @@ void gui_pad_thread::process_input()
|
||||
m_last_auto_repeat_button = pad_button::pad_button_max_enum;
|
||||
}
|
||||
|
||||
on_button_pressed(static_cast<pad_button>(button_id), false, value);
|
||||
on_button_pressed(static_cast<pad_button>(button_id), false, false, value);
|
||||
}
|
||||
|
||||
last_state = pressed;
|
||||
@ -618,7 +653,7 @@ void gui_pad_thread::send_key_event(u32 key, bool pressed)
|
||||
|
||||
void gui_pad_thread::send_mouse_button_event(mouse_button btn, bool pressed)
|
||||
{
|
||||
gui_log.trace("gui_pad_thread::send_mouse_button_event: btn=%d, pressed=%d", static_cast<int>(btn), pressed);
|
||||
gui_log.trace("gui_pad_thread::send_mouse_button_event: btn=%s, pressed=%d", btn, pressed);
|
||||
|
||||
#ifdef _WIN32
|
||||
INPUT input{};
|
||||
@ -684,7 +719,7 @@ void gui_pad_thread::send_mouse_button_event(mouse_button btn, bool pressed)
|
||||
|
||||
void gui_pad_thread::send_mouse_wheel_event(mouse_wheel wheel, int delta)
|
||||
{
|
||||
gui_log.trace("gui_pad_thread::send_mouse_wheel_event: wheel=%d, delta=%d", static_cast<int>(wheel), delta);
|
||||
gui_log.trace("gui_pad_thread::send_mouse_wheel_event: wheel=%s, delta=%d", wheel, delta);
|
||||
|
||||
if (!delta)
|
||||
{
|
||||
|
||||
@ -27,12 +27,6 @@ public:
|
||||
m_reset = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool init();
|
||||
void run();
|
||||
|
||||
void process_input();
|
||||
|
||||
enum class mouse_button
|
||||
{
|
||||
none,
|
||||
@ -48,6 +42,12 @@ protected:
|
||||
horizontal
|
||||
};
|
||||
|
||||
protected:
|
||||
bool init();
|
||||
void run();
|
||||
|
||||
void process_input();
|
||||
|
||||
void send_key_event(u32 key, bool pressed);
|
||||
void send_mouse_button_event(mouse_button btn, bool pressed);
|
||||
void send_mouse_wheel_event(mouse_wheel wheel, int delta);
|
||||
@ -73,7 +73,7 @@ protected:
|
||||
|
||||
static constexpr u64 auto_repeat_ms_interval_default = 200;
|
||||
pad_button m_last_auto_repeat_button = pad_button::pad_button_max_enum;
|
||||
std::map<pad_button, u64> m_auto_repeat_buttons = {
|
||||
const std::map<pad_button, u64> m_auto_repeat_buttons = {
|
||||
{ pad_button::dpad_up, auto_repeat_ms_interval_default },
|
||||
{ pad_button::dpad_down, auto_repeat_ms_interval_default },
|
||||
{ pad_button::dpad_left, auto_repeat_ms_interval_default },
|
||||
@ -85,7 +85,7 @@ protected:
|
||||
};
|
||||
|
||||
// Mouse movement should just work without delays
|
||||
std::map<pad_button, u64> m_mouse_move_buttons = {
|
||||
const std::map<pad_button, u64> m_mouse_move_buttons = {
|
||||
{ pad_button::ls_up, 1 },
|
||||
{ pad_button::ls_down, 1 },
|
||||
{ pad_button::ls_left, 1 },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user