Re-enabled input

This commit is contained in:
Yoshi Askharoun
2021-10-04 10:20:26 -05:00
parent 0940e968a2
commit 714234fcd7
4 changed files with 8 additions and 96 deletions
@@ -30,13 +30,13 @@ namespace Microsoft.Iris.Render.Internal
private IRawInputCallbacks m_inputHandlers;
private InputHandlerFlags m_maskInputHandlers;
internal InputSystem(RenderSession session, RenderWindow window)
internal InputSystem(RenderSession session, RenderWindowBase window)
{
this.m_session = session;
this.Initialize(window);
}
internal void Initialize(RenderWindow window) => this.m_remoteInputRouter = this.m_session.BuildRemoteInputRouter(this, window);
internal void Initialize(RenderWindowBase window) => this.m_remoteInputRouter = this.m_session.BuildRemoteInputRouter(this, window);
protected override void Dispose(bool fInDispose)
{
@@ -91,7 +91,7 @@ namespace Microsoft.Iris.Render.Internal
m_typeSound = typeSound;
m_renderSession.Initialize();
// TODO: Set up input system
//m_inputSystem = new InputSystem(this.m_renderSession, this.m_renderWindow);
m_inputSystem = new InputSystem(this.m_renderSession, this.m_renderWindow);
m_renderWindow.CreateGraphicsDevice(m_renderSession, m_typeGraphics, renderingQuality);
}
@@ -106,7 +106,7 @@ namespace Microsoft.Iris.Render.Internal
IDisplayManager IRenderEngine.DisplayManager => null;
public InputSystem InputSystem => throw new NotImplementedException("Skia does not support input yet");// m_inputSystem;
public InputSystem InputSystem => m_inputSystem;
internal SoundDevice SoundDevice => m_soundDevice;
@@ -268,11 +268,11 @@ namespace Microsoft.Iris.Render.Internal
internal RemoteInputRouter BuildRemoteInputRouter(
InputSystem inputSystem,
RenderWindow window)
RenderWindowBase window)
{
Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread");
RemoteInputRouter remoteInputRouter = this.DesktopProtocol.BuildRemoteInputRouter(inputSystem, this.DesktopProtocol.LocalInputCallbackHandle);
remoteInputRouter?.SendRegisterWithInputSource(this.WindowingPort.DefaultGroupID, ((IRenderHandleOwner)window).RenderHandle);
remoteInputRouter?.SendRegisterWithInputSource(this.WindowingPort.DefaultGroupID, RENDERHANDLE.NULL);
return remoteInputRouter;
}
@@ -12,10 +12,6 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Desktop
{
internal class RemoteInputRouter : RemoteObject
{
private static ushort[] s_priv_ByteOrder_Msg2_Create;
private static ushort[] s_priv_ByteOrder_Msg0_UnRegisterWithInputSource;
private static ushort[] s_priv_ByteOrder_Msg1_RegisterWithInputSource;
protected RemoteInputRouter()
{
}
@@ -28,73 +24,17 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Desktop
RenderPort port = _priv_protocolInstance.Port;
RENDERHANDLE routerClassHandle = _priv_protocolInstance.InputRouter_ClassHandle;
RemoteInputRouter remoteInputRouter = new RemoteInputRouter(port, _priv_owner);
uint num = (uint)sizeof(RemoteInputRouter.Msg2_Create);
// ISSUE: untyped stack allocation
byte* pMem = stackalloc byte[(int)num];
RemoteInputRouter.Msg2_Create* msg2CreatePtr = (RemoteInputRouter.Msg2_Create*)pMem;
msg2CreatePtr->_priv_size = num;
msg2CreatePtr->_priv_msgid = 2U;
msg2CreatePtr->_priv_objic = ic.RenderHandle;
msg2CreatePtr->_priv_ctxic = port.Session.LocalContext;
msg2CreatePtr->_priv_idObjectSubject = remoteInputRouter.m_renderHandle;
if (port.ForeignByteOrder)
MarshalHelper.SwapByteOrder(pMem, ref s_priv_ByteOrder_Msg2_Create, typeof(RemoteInputRouter.Msg2_Create), 0, 0);
port.CreateRemoteObject(routerClassHandle, remoteInputRouter.m_renderHandle, (Message*)msg2CreatePtr);
return remoteInputRouter;
}
public unsafe void BuildUnRegisterWithInputSource(
out RenderPort _priv_portUse,
out Message* _priv_pmsgUse)
{
Debug2.Throw(this.IsValid, "Non-static method call requires an instance");
_priv_portUse = this.m_renderPort;
_priv_portUse.ValidateHandle(this.m_renderHandle);
uint size = (uint)sizeof(RemoteInputRouter.Msg0_UnRegisterWithInputSource);
RemoteInputRouter.Msg0_UnRegisterWithInputSource* registerWithInputSourcePtr = (RemoteInputRouter.Msg0_UnRegisterWithInputSource*)_priv_portUse.AllocMessageBuffer(size);
registerWithInputSourcePtr->_priv_size = size;
registerWithInputSourcePtr->_priv_msgid = 0U;
registerWithInputSourcePtr->_priv_idObjectSubject = this.m_renderHandle;
if (_priv_portUse.ForeignByteOrder)
MarshalHelper.SwapByteOrder((byte*)registerWithInputSourcePtr, ref s_priv_ByteOrder_Msg0_UnRegisterWithInputSource, typeof(RemoteInputRouter.Msg0_UnRegisterWithInputSource), 0, 0);
_priv_pmsgUse = (Message*)registerWithInputSourcePtr;
}
public unsafe void SendUnRegisterWithInputSource()
{
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildUnRegisterWithInputSource(out _priv_portUse, out _priv_pmsgUse);
_priv_portUse.SendRemoteMessage(_priv_pmsgUse);
}
public unsafe void BuildRegisterWithInputSource(
out RenderPort _priv_portUse,
out Message* _priv_pmsgUse,
uint idGroup,
RENDERHANDLE idSource)
{
Debug2.Throw(this.IsValid, "Non-static method call requires an instance");
_priv_portUse = this.m_renderPort;
_priv_portUse.ValidateHandle(this.m_renderHandle);
uint size = (uint)sizeof(RemoteInputRouter.Msg1_RegisterWithInputSource);
RemoteInputRouter.Msg1_RegisterWithInputSource* registerWithInputSourcePtr = (RemoteInputRouter.Msg1_RegisterWithInputSource*)_priv_portUse.AllocMessageBuffer(size);
registerWithInputSourcePtr->_priv_size = size;
registerWithInputSourcePtr->_priv_msgid = 1U;
registerWithInputSourcePtr->idGroup = idGroup;
registerWithInputSourcePtr->idSource = idSource;
registerWithInputSourcePtr->_priv_idObjectSubject = this.m_renderHandle;
if (_priv_portUse.ForeignByteOrder)
MarshalHelper.SwapByteOrder((byte*)registerWithInputSourcePtr, ref s_priv_ByteOrder_Msg1_RegisterWithInputSource, typeof(RemoteInputRouter.Msg1_RegisterWithInputSource), 0, 0);
_priv_pmsgUse = (Message*)registerWithInputSourcePtr;
// TODO: Unregister with source
}
public unsafe void SendRegisterWithInputSource(uint idGroup, RENDERHANDLE idSource)
{
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildRegisterWithInputSource(out _priv_portUse, out _priv_pmsgUse, idGroup, idSource);
_priv_portUse.SendRemoteMessage(_priv_pmsgUse);
// TODO: Register with source
}
public static RemoteInputRouter CreateFromHandle(
@@ -126,33 +66,5 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Desktop
public override bool Equals(object other) => other is RemoteInputRouter && this.m_renderHandle == ((RemoteObject)other).m_renderHandle;
public override int GetHashCode() => base.GetHashCode();
[ComVisible(false)]
private struct Msg2_Create
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
public RENDERHANDLE _priv_objic;
public ContextID _priv_ctxic;
}
[ComVisible(false)]
private struct Msg0_UnRegisterWithInputSource
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
}
[ComVisible(false)]
private struct Msg1_RegisterWithInputSource
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
public uint idGroup;
public RENDERHANDLE idSource;
}
}
}