Qt: Forward text input to aux render windows
Fixes text input in freecam window.
This commit is contained in:
parent
dcd439e7d8
commit
1d63648d68
|
@ -497,12 +497,32 @@ bool AuxiliaryDisplayWidget::event(QEvent* event)
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
case QEvent::KeyRelease:
|
case QEvent::KeyRelease:
|
||||||
{
|
{
|
||||||
|
const QKeyEvent* key_event = static_cast<const QKeyEvent*>(event);
|
||||||
|
|
||||||
|
if (type == QEvent::KeyPress)
|
||||||
|
{
|
||||||
|
// note this won't work for emojis.. deal with that if it's ever needed
|
||||||
|
for (const QChar& ch : key_event->text())
|
||||||
|
{
|
||||||
|
// Don't forward backspace characters. We send the backspace as a normal key event,
|
||||||
|
// so if we send the character too, it double-deletes.
|
||||||
|
if (ch == QChar('\b'))
|
||||||
|
break;
|
||||||
|
|
||||||
|
g_emu_thread->queueAuxiliaryRenderWindowInputEvent(
|
||||||
|
m_userdata, Host::AuxiliaryRenderWindowEvent::TextEntered,
|
||||||
|
Host::AuxiliaryRenderWindowEventParam{.uint_param = static_cast<u32>(ch.unicode())});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key_event->isAutoRepeat())
|
||||||
|
return true;
|
||||||
|
|
||||||
g_emu_thread->queueAuxiliaryRenderWindowInputEvent(
|
g_emu_thread->queueAuxiliaryRenderWindowInputEvent(
|
||||||
m_userdata,
|
m_userdata,
|
||||||
(type == QEvent::KeyPress) ? Host::AuxiliaryRenderWindowEvent::KeyPressed :
|
(type == QEvent::KeyPress) ? Host::AuxiliaryRenderWindowEvent::KeyPressed :
|
||||||
Host::AuxiliaryRenderWindowEvent::KeyReleased,
|
Host::AuxiliaryRenderWindowEvent::KeyReleased,
|
||||||
Host::AuxiliaryRenderWindowEventParam{.uint_param =
|
Host::AuxiliaryRenderWindowEventParam{.uint_param = static_cast<u32>(key_event->key())});
|
||||||
static_cast<u32>(static_cast<const QKeyEvent*>(event)->key())});
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1534,6 +1534,12 @@ void ImGuiManager::ProcessAuxiliaryRenderWindowInputEvent(Host::AuxiliaryRenderW
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Host::AuxiliaryRenderWindowEvent::TextEntered:
|
||||||
|
{
|
||||||
|
io.AddInputCharacter(param1.uint_param);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Host::AuxiliaryRenderWindowEvent::MouseMoved:
|
case Host::AuxiliaryRenderWindowEvent::MouseMoved:
|
||||||
{
|
{
|
||||||
io.MousePos.x = param1.float_param;
|
io.MousePos.x = param1.float_param;
|
||||||
|
|
|
@ -33,6 +33,7 @@ enum class AuxiliaryRenderWindowEvent : u8
|
||||||
Resized,
|
Resized,
|
||||||
KeyPressed,
|
KeyPressed,
|
||||||
KeyReleased,
|
KeyReleased,
|
||||||
|
TextEntered,
|
||||||
MouseMoved,
|
MouseMoved,
|
||||||
MousePressed,
|
MousePressed,
|
||||||
MouseReleased,
|
MouseReleased,
|
||||||
|
|
Loading…
Reference in New Issue