From 714234fcd7ad60a2fa146718aa4a1e1863af66d6 Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Mon, 4 Oct 2021 10:20:26 -0500 Subject: [PATCH] Re-enabled input --- .../Iris/Render/Internal/InputSystem.cs | 4 +- .../Iris/Render/Internal/RenderEngine.cs | 4 +- .../Iris/Render/Internal/RenderSession.cs | 4 +- .../Splash/Desktop/RemoteInputRouter.cs | 92 +------------------ 4 files changed, 8 insertions(+), 96 deletions(-) diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs index 232891f..a6cced5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs @@ -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) { diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs index 90686cf..0a46c0a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs @@ -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; diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs index d500fc6..0b4a3b5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs @@ -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; } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs index 7d79cf6..480d11c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs @@ -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; - } } }