mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
input: implement raw_mouse_handler
This commit is contained in:
parent
f6f8996aa9
commit
68f3df4975
18 changed files with 654 additions and 52 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include "Emu/Io/Null/null_camera_handler.h"
|
||||
#include "Emu/Io/Null/null_music_handler.h"
|
||||
#include "Emu/vfs_config.h"
|
||||
#include "Input/raw_mouse_handler.h"
|
||||
#include "trophy_notification_helper.h"
|
||||
#include "save_data_dialog.h"
|
||||
#include "msg_dialog_frame.h"
|
||||
|
|
@ -174,6 +175,11 @@ bool gui_application::Init()
|
|||
}
|
||||
#endif
|
||||
|
||||
// Install native event filter
|
||||
#ifdef _WIN32 // Currently only needed for raw mouse input on windows
|
||||
installNativeEventFilter(&m_native_event_filter);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -974,3 +980,26 @@ void gui_application::OnAppStateChanged(Qt::ApplicationState state)
|
|||
// Delay pause so it won't immediately pause the emulated application
|
||||
QTimer::singleShot(1000, this, pause_callback);
|
||||
}
|
||||
|
||||
bool gui_application::native_event_filter::nativeEventFilter([[maybe_unused]] const QByteArray& eventType, [[maybe_unused]] void* message, [[maybe_unused]] qintptr* result)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!Emu.IsRunning())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (eventType == "windows_generic_MSG")
|
||||
{
|
||||
if (MSG* msg = static_cast<MSG*>(message); msg && msg->message == WM_INPUT)
|
||||
{
|
||||
if (auto* handler = g_fxo->try_get<MouseHandlerBase>(); handler && handler->type == mouse_handler::raw)
|
||||
{
|
||||
static_cast<raw_mouse_handler*>(handler)->handle_native_event(*msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue