From 7cc282008622fd484c6d00a66b76fcbef6213608 Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Fri, 3 Apr 2020 10:52:17 -0700 Subject: [PATCH] Refactor BitBlt and DirectX capturer into one service. --- .../ViewModels/MainWindowViewModel.cs | 10 +- Desktop.Win/ViewModels/MainWindowViewModel.cs | 32 +-- ScreenCast.Core/Communication/CasterSocket.cs | 9 +- .../{ICapturer.cs => IScreenCapturer.cs} | 18 +- ScreenCast.Core/Models/Viewer.cs | 5 +- .../{Capture => Services}/ScreenCasterBase.cs | 9 +- .../{Capture => Utilities}/ImageUtils.cs | 2 +- ScreenCast.Linux/Program.cs | 9 +- ...AudioCapturer.cs => AudioCapturerLinux.cs} | 2 +- ...ardService.cs => ClipboardServiceLinux.cs} | 2 +- ...uxScreenCaster.cs => ScreenCasterLinux.cs} | 6 +- .../{Capture => Services}/X11Capture.cs | 58 ++-- ScreenCast.Linux/Services/X11Input.cs | 3 +- ScreenCast.Win/Capture/BitBltCapture.cs | 99 ------- ScreenCast.Win/Program.cs | 32 +-- ScreenCast.Win/ScreenCast.Win.csproj | 4 + ...inAudioCapturer.cs => AudioCapturerWin.cs} | 2 +- ...boardService.cs => ClipboardServiceWin.cs} | 2 +- .../{WinInput.cs => KeyboardMouseInputWin.cs} | 8 +- .../ScreenCapturerWin.cs} | 260 +++++++++++------- ...{WinScreenCaster.cs => ScreenCasterWin.cs} | 8 +- Server/Services/BrowserSocketHub.cs | 4 + Server/Services/RCBrowserSocketHub.cs | 4 +- Server/Services/RCDeviceSocketHub.cs | 6 +- .../scripts/RemoteControl/RCBrowserSockets.js | 12 +- .../RemoteControl/RCBrowserSockets.js.map | 2 +- .../scripts/RemoteControl/RCBrowserSockets.ts | 12 +- 27 files changed, 276 insertions(+), 344 deletions(-) rename ScreenCast.Core/Interfaces/{ICapturer.cs => IScreenCapturer.cs} (70%) rename ScreenCast.Core/{Capture => Services}/ScreenCasterBase.cs (96%) rename ScreenCast.Core/{Capture => Utilities}/ImageUtils.cs (99%) rename ScreenCast.Linux/Services/{LinuxAudioCapturer.cs => AudioCapturerLinux.cs} (83%) rename ScreenCast.Linux/Services/{LinuxClipboardService.cs => ClipboardServiceLinux.cs} (94%) rename ScreenCast.Linux/Services/{LinuxScreenCaster.cs => ScreenCasterLinux.cs} (85%) rename ScreenCast.Linux/{Capture => Services}/X11Capture.cs (75%) delete mode 100644 ScreenCast.Win/Capture/BitBltCapture.cs rename ScreenCast.Win/Services/{WinAudioCapturer.cs => AudioCapturerWin.cs} (98%) rename ScreenCast.Win/Services/{WinClipboardService.cs => ClipboardServiceWin.cs} (98%) rename ScreenCast.Win/Services/{WinInput.cs => KeyboardMouseInputWin.cs} (98%) rename ScreenCast.Win/{Capture/DXCapture.cs => Services/ScreenCapturerWin.cs} (57%) rename ScreenCast.Win/Services/{WinScreenCaster.cs => ScreenCasterWin.cs} (86%) diff --git a/Desktop.Linux/ViewModels/MainWindowViewModel.cs b/Desktop.Linux/ViewModels/MainWindowViewModel.cs index 34683efc0..b309164f1 100644 --- a/Desktop.Linux/ViewModels/MainWindowViewModel.cs +++ b/Desktop.Linux/ViewModels/MainWindowViewModel.cs @@ -6,12 +6,10 @@ using Remotely.Desktop.Linux.Services; using Remotely.Desktop.Linux.Views; using Remotely.ScreenCast.Core; -using Remotely.ScreenCast.Core.Capture; using Remotely.ScreenCast.Core.Interfaces; using Remotely.ScreenCast.Core.Models; using Remotely.ScreenCast.Core.Services; using Remotely.ScreenCast.Core.Communication; -using Remotely.ScreenCast.Linux.Capture; using Remotely.ScreenCast.Linux.Services; using Remotely.Shared.Models; using Remotely.Shared.Services; @@ -225,14 +223,14 @@ private void BuildServices() builder.AddConsole().AddEventLog(); }); - serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); - serviceCollection.AddTransient(); + serviceCollection.AddTransient(); ServiceContainer.Instance = serviceCollection.BuildServiceProvider(); diff --git a/Desktop.Win/ViewModels/MainWindowViewModel.cs b/Desktop.Win/ViewModels/MainWindowViewModel.cs index a67aea08e..dee0d9c09 100644 --- a/Desktop.Win/ViewModels/MainWindowViewModel.cs +++ b/Desktop.Win/ViewModels/MainWindowViewModel.cs @@ -2,10 +2,8 @@ using Remotely.Desktop.Win.Services; using Remotely.Shared.Models; using Remotely.ScreenCast.Core; -using Remotely.ScreenCast.Core.Capture; using Remotely.ScreenCast.Core.Models; using Remotely.ScreenCast.Core.Services; -using Remotely.ScreenCast.Win.Capture; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -255,34 +253,14 @@ private void BuildServices() }); serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); - serviceCollection.AddTransient(provider => - { - try - { - var dxCapture = new DXCapture(); - if (dxCapture.GetScreenCount() == Screen.AllScreens.Length) - { - return dxCapture; - } - else - { - Logger.Write("DX screen count doesn't match. Using CPU capturer instead."); - dxCapture.Dispose(); - return new BitBltCapture(); - } - } - catch - { - return new BitBltCapture(); - } - }); + serviceCollection.AddTransient(); ServiceContainer.Instance = serviceCollection.BuildServiceProvider(); diff --git a/ScreenCast.Core/Communication/CasterSocket.cs b/ScreenCast.Core/Communication/CasterSocket.cs index 008c12847..b59917df5 100644 --- a/ScreenCast.Core/Communication/CasterSocket.cs +++ b/ScreenCast.Core/Communication/CasterSocket.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Remotely.ScreenCast.Core.Capture; using System.Diagnostics; using System.IO; using System.Net; @@ -129,9 +128,9 @@ public async Task SendScreenCapture(byte[] captureBytes, string viewerID, int le await Connection.SendAsync("SendScreenCapture", captureBytes, viewerID, left, top, width, height, captureTime); } - public async Task SendScreenCount(int primaryScreenIndex, int screenCount, string viewerID) + public async Task SendScreenData(string selectedScreen, string[] displayNames, string viewerID) { - await Connection.SendAsync("SendScreenCountToBrowser", primaryScreenIndex, screenCount, viewerID); + await Connection.SendAsync("SendScreenDataToBrowser", selectedScreen, displayNames, viewerID); } public async Task SendScreenSize(int width, int height, string viewerID) @@ -332,11 +331,11 @@ private void ApplyConnectionHandlers() } }); - Connection.On("SelectScreen", (int screenIndex, string viewerID) => + Connection.On("SelectScreen", (string displayName, string viewerID) => { if (conductor.Viewers.TryGetValue(viewerID, out var viewer)) { - viewer.Capturer.SetSelectedScreen(screenIndex); + viewer.Capturer.SetSelectedScreen(displayName); } }); diff --git a/ScreenCast.Core/Interfaces/ICapturer.cs b/ScreenCast.Core/Interfaces/IScreenCapturer.cs similarity index 70% rename from ScreenCast.Core/Interfaces/ICapturer.cs rename to ScreenCast.Core/Interfaces/IScreenCapturer.cs index e911e4431..40df87b42 100644 --- a/ScreenCast.Core/Interfaces/ICapturer.cs +++ b/ScreenCast.Core/Interfaces/IScreenCapturer.cs @@ -7,19 +7,27 @@ namespace Remotely.ScreenCast.Core.Interfaces { - public interface ICapturer : IDisposable + public interface IScreenCapturer : IDisposable { + event EventHandler ScreenChanged; + bool CaptureFullscreen { get; set; } Bitmap CurrentFrame { get; set; } Rectangle CurrentScreenBounds { get; } Bitmap PreviousFrame { get; set; } - event EventHandler ScreenChanged; - int SelectedScreen { get; } - void SetSelectedScreen(int screenNumber); + string SelectedScreen { get; } + + IEnumerable GetDisplayNames(); + + void GetNextFrame(); + int GetScreenCount(); + + int GetSelectedScreenIndex(); Rectangle GetVirtualScreenBounds(); - void GetNextFrame(); void Init(); + + void SetSelectedScreen(string displayName); } } diff --git a/ScreenCast.Core/Models/Viewer.cs b/ScreenCast.Core/Models/Viewer.cs index 26f1f80c8..4735c2405 100644 --- a/ScreenCast.Core/Models/Viewer.cs +++ b/ScreenCast.Core/Models/Viewer.cs @@ -1,5 +1,4 @@ -using Remotely.ScreenCast.Core.Capture; -using Remotely.ScreenCast.Core.Communication; +using Remotely.ScreenCast.Core.Communication; using Remotely.ScreenCast.Core.Interfaces; using Remotely.ScreenCast.Core.Services; using System; @@ -20,7 +19,7 @@ public Viewer() ImageQuality = 75; } public bool AutoAdjustQuality { get; internal set; } = true; - public ICapturer Capturer { get; set; } + public IScreenCapturer Capturer { get; set; } public bool DisconnectRequested { get; set; } public EncoderParameters EncoderParams { get; private set; } public bool FullScreenRefreshNeeded { get; internal set; } diff --git a/ScreenCast.Core/Capture/ScreenCasterBase.cs b/ScreenCast.Core/Services/ScreenCasterBase.cs similarity index 96% rename from ScreenCast.Core/Capture/ScreenCasterBase.cs rename to ScreenCast.Core/Services/ScreenCasterBase.cs index 9660bb9fe..f7a0a04f0 100644 --- a/ScreenCast.Core/Capture/ScreenCasterBase.cs +++ b/ScreenCast.Core/Services/ScreenCasterBase.cs @@ -17,14 +17,15 @@ using System.Threading; using System.Drawing.Imaging; using Microsoft.Extensions.DependencyInjection; +using Remotely.ScreenCast.Core.Utilities; -namespace Remotely.ScreenCast.Core.Capture +namespace Remotely.ScreenCast.Core.Services { public class ScreenCasterBase { public async Task BeginScreenCasting(string viewerID, string requesterName, - ICapturer capturer) + IScreenCapturer capturer) { var conductor = ServiceContainer.Instance.GetRequiredService(); var viewers = conductor.Viewers; @@ -59,9 +60,9 @@ public async Task BeginScreenCasting(string viewerID, await casterSocket.SendMachineName(Environment.MachineName, viewerID); - await casterSocket.SendScreenCount( + await casterSocket.SendScreenData( capturer.SelectedScreen, - capturer.GetScreenCount(), + capturer.GetDisplayNames().ToArray(), viewerID); await casterSocket.SendScreenSize(capturer.CurrentScreenBounds.Width, capturer.CurrentScreenBounds.Height, viewerID); diff --git a/ScreenCast.Core/Capture/ImageUtils.cs b/ScreenCast.Core/Utilities/ImageUtils.cs similarity index 99% rename from ScreenCast.Core/Capture/ImageUtils.cs rename to ScreenCast.Core/Utilities/ImageUtils.cs index 719b392f3..3b909a301 100644 --- a/ScreenCast.Core/Capture/ImageUtils.cs +++ b/ScreenCast.Core/Utilities/ImageUtils.cs @@ -10,7 +10,7 @@ using System.Text; using System.Threading.Tasks; -namespace Remotely.ScreenCast.Core.Capture +namespace Remotely.ScreenCast.Core.Utilities { public class ImageUtils { diff --git a/ScreenCast.Linux/Program.cs b/ScreenCast.Linux/Program.cs index 49a001dfe..7c0bc683f 100644 --- a/ScreenCast.Linux/Program.cs +++ b/ScreenCast.Linux/Program.cs @@ -3,7 +3,6 @@ using System; using System.Threading; using Remotely.ScreenCast.Linux.Services; -using Remotely.ScreenCast.Linux.Capture; using Remotely.ScreenCast.Core.Communication; using Remotely.ScreenCast.Core.Interfaces; using Microsoft.Extensions.DependencyInjection; @@ -60,15 +59,15 @@ private static void BuildServices() builder.AddConsole().AddEventLog(); }); - serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); - serviceCollection.AddTransient(); + serviceCollection.AddTransient(); ServiceContainer.Instance = serviceCollection.BuildServiceProvider(); } diff --git a/ScreenCast.Linux/Services/LinuxAudioCapturer.cs b/ScreenCast.Linux/Services/AudioCapturerLinux.cs similarity index 83% rename from ScreenCast.Linux/Services/LinuxAudioCapturer.cs rename to ScreenCast.Linux/Services/AudioCapturerLinux.cs index 4db6ac7ef..a6f1b0367 100644 --- a/ScreenCast.Linux/Services/LinuxAudioCapturer.cs +++ b/ScreenCast.Linux/Services/AudioCapturerLinux.cs @@ -5,7 +5,7 @@ namespace Remotely.ScreenCast.Linux.Services { - public class LinuxAudioCapturer : IAudioCapturer + public class AudioCapturerLinux : IAudioCapturer { public void ToggleAudio(bool toggleOn) { diff --git a/ScreenCast.Linux/Services/LinuxClipboardService.cs b/ScreenCast.Linux/Services/ClipboardServiceLinux.cs similarity index 94% rename from ScreenCast.Linux/Services/LinuxClipboardService.cs rename to ScreenCast.Linux/Services/ClipboardServiceLinux.cs index f3c91458f..3b0e080a0 100644 --- a/ScreenCast.Linux/Services/LinuxClipboardService.cs +++ b/ScreenCast.Linux/Services/ClipboardServiceLinux.cs @@ -8,7 +8,7 @@ namespace Remotely.ScreenCast.Linux.Services { - public class LinuxClipboardService : IClipboardService + public class ClipboardServiceLinux : IClipboardService { public event EventHandler ClipboardTextChanged; diff --git a/ScreenCast.Linux/Services/LinuxScreenCaster.cs b/ScreenCast.Linux/Services/ScreenCasterLinux.cs similarity index 85% rename from ScreenCast.Linux/Services/LinuxScreenCaster.cs rename to ScreenCast.Linux/Services/ScreenCasterLinux.cs index 333991a6f..1b4cfe4f1 100644 --- a/ScreenCast.Linux/Services/LinuxScreenCaster.cs +++ b/ScreenCast.Linux/Services/ScreenCasterLinux.cs @@ -1,9 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Remotely.ScreenCast.Core; -using Remotely.ScreenCast.Core.Capture; using Remotely.ScreenCast.Core.Interfaces; using Remotely.ScreenCast.Core.Services; -using Remotely.ScreenCast.Linux.Capture; using Remotely.Shared.Models; using System; using System.Collections.Generic; @@ -13,7 +11,7 @@ namespace Remotely.ScreenCast.Linux.Services { - public class LinuxScreenCaster : ScreenCasterBase, IScreenCaster + public class ScreenCasterLinux : ScreenCasterBase, IScreenCaster { public async Task BeginScreenCasting(ScreenCastRequest screenCastRequest) { @@ -21,7 +19,7 @@ public async Task BeginScreenCasting(ScreenCastRequest screenCastRequest) { var conductor = ServiceContainer.Instance.GetRequiredService(); await conductor.CasterSocket.SendCursorChange(new CursorInfo(null, Point.Empty, "default"), new List() { screenCastRequest.ViewerID }); - _ = BeginScreenCasting(screenCastRequest.ViewerID, screenCastRequest.RequesterName, ServiceContainer.Instance.GetRequiredService()); + _ = BeginScreenCasting(screenCastRequest.ViewerID, screenCastRequest.RequesterName, ServiceContainer.Instance.GetRequiredService()); } catch (Exception ex) { diff --git a/ScreenCast.Linux/Capture/X11Capture.cs b/ScreenCast.Linux/Services/X11Capture.cs similarity index 75% rename from ScreenCast.Linux/Capture/X11Capture.cs rename to ScreenCast.Linux/Services/X11Capture.cs index abf910bac..f6fb76c0d 100644 --- a/ScreenCast.Linux/Capture/X11Capture.cs +++ b/ScreenCast.Linux/Services/X11Capture.cs @@ -1,31 +1,42 @@ -using Remotely.ScreenCast.Core.Capture; -using Remotely.ScreenCast.Core.Interfaces; +using Remotely.ScreenCast.Core.Interfaces; using Remotely.ScreenCast.Core.Services; using Remotely.ScreenCast.Linux.X11Interop; using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; +using System.Linq; using System.Runtime.InteropServices; using System.Text; -namespace Remotely.ScreenCast.Linux.Capture +namespace Remotely.ScreenCast.Linux.Services { - public class X11Capture : ICapturer + public class X11Capture : IScreenCapturer { + private readonly Dictionary x11Screens = new Dictionary(); public X11Capture() { Display = LibX11.XOpenDisplay(null); Init(); } + public event EventHandler ScreenChanged; + public bool CaptureFullscreen { get; set; } public Bitmap CurrentFrame { get; set; } public Rectangle CurrentScreenBounds { get; private set; } public IntPtr Display { get; private set; } public Bitmap PreviousFrame { get; set; } - public event EventHandler ScreenChanged; - public int SelectedScreen { get; private set; } = -1; + public string SelectedScreen { get; private set; } = "0"; + public void Dispose() + { + //Graphic.Dispose(); + CurrentFrame.Dispose(); + PreviousFrame.Dispose(); + } + + public IEnumerable GetDisplayNames() => x11Screens.Keys; + public void GetNextFrame() { try @@ -40,19 +51,13 @@ public void GetNextFrame() Init(); } } - - public void Dispose() - { - //Graphic.Dispose(); - CurrentFrame.Dispose(); - PreviousFrame.Dispose(); - } - public int GetScreenCount() { return LibX11.XScreenCount(Display); } + public int GetSelectedScreenIndex() => x11Screens[SelectedScreen]; + public Rectangle GetVirtualScreenBounds() { int width = 0; @@ -72,8 +77,14 @@ public void Init() { try { + x11Screens.Clear(); + + for (var i = 0; i < GetScreenCount(); i++) + { + x11Screens.Add(i.ToString(), i); + } var defaultScreen = LibX11.XDefaultScreen(Display); - SetSelectedScreen(defaultScreen); + SetSelectedScreen(defaultScreen.ToString()); CurrentFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb); PreviousFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb); } @@ -82,25 +93,24 @@ public void Init() Logger.Write(ex); } } - - public void SetSelectedScreen(int screenNumber) + public void SetSelectedScreen(string displayName) { - if (screenNumber == SelectedScreen) + if (displayName == SelectedScreen) { return; } try { - if (GetScreenCount() >= screenNumber + 1) + if (x11Screens.ContainsKey(displayName)) { - SelectedScreen = screenNumber; + SelectedScreen = displayName; } else { - SelectedScreen = 0; + SelectedScreen = x11Screens.Keys.First(); } - var width = LibX11.XDisplayWidth(Display, SelectedScreen); - var height = LibX11.XDisplayHeight(Display, SelectedScreen); + var width = LibX11.XDisplayWidth(Display, x11Screens[SelectedScreen]); + var height = LibX11.XDisplayHeight(Display, x11Screens[SelectedScreen]); CurrentScreenBounds = new Rectangle(0, 0, width, height); CaptureFullscreen = true; Init(); @@ -115,7 +125,7 @@ public void SetSelectedScreen(int screenNumber) private void RefreshCurrentFrame() { - var window = LibX11.XRootWindow(Display, SelectedScreen); + var window = LibX11.XRootWindow(Display, x11Screens[SelectedScreen]); var imagePointer = LibX11.XGetImage(Display, window, 0, 0, CurrentScreenBounds.Width, CurrentScreenBounds.Height, ~0, 2); var image = Marshal.PtrToStructure(imagePointer); diff --git a/ScreenCast.Linux/Services/X11Input.cs b/ScreenCast.Linux/Services/X11Input.cs index 4b83a286d..b11cf963a 100644 --- a/ScreenCast.Linux/Services/X11Input.cs +++ b/ScreenCast.Linux/Services/X11Input.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Text; using System.Linq; -using Remotely.ScreenCast.Linux.Capture; using Remotely.ScreenCast.Core.Models; namespace Remotely.ScreenCast.Linux.Services @@ -98,7 +97,7 @@ public void SendMouseMove(double percentX, double percentY, Viewer viewer) try { LibXtst.XTestFakeMotionEvent(Display, - viewer.Capturer.SelectedScreen, + viewer.Capturer.GetSelectedScreenIndex(), (int)(viewer.Capturer.CurrentScreenBounds.Width * percentX), (int)(viewer.Capturer.CurrentScreenBounds.Height * percentY), 0); diff --git a/ScreenCast.Win/Capture/BitBltCapture.cs b/ScreenCast.Win/Capture/BitBltCapture.cs deleted file mode 100644 index b0bc4516b..000000000 --- a/ScreenCast.Win/Capture/BitBltCapture.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Forms; -using System.Linq; -using System.Threading.Tasks; -using System.Collections.Generic; -using Remotely.ScreenCast.Core.Services; -using System.Threading; -using Remotely.ScreenCast.Core.Interfaces; -using Remotely.Shared.Win32; - -namespace Remotely.ScreenCast.Win.Capture -{ - public class BitBltCapture : ICapturer - { - public BitBltCapture() - { - Init(); - } - - public event EventHandler ScreenChanged; - - public bool CaptureFullscreen { get; set; } = true; - public Bitmap CurrentFrame { get; set; } - public Rectangle CurrentScreenBounds { get; set; } = Screen.PrimaryScreen.Bounds; - public Bitmap PreviousFrame { get; set; } - public int SelectedScreen { get; private set; } = Screen.AllScreens.ToList().IndexOf(Screen.PrimaryScreen); - private Graphics Graphic { get; set; } - public void Dispose() - { - Graphic.Dispose(); - CurrentFrame.Dispose(); - PreviousFrame.Dispose(); - } - - public void GetNextFrame() - { - try - { - Win32Interop.SwitchToInputDesktop(); - PreviousFrame.Dispose(); - PreviousFrame = (Bitmap)CurrentFrame.Clone(); - Graphic.CopyFromScreen(CurrentScreenBounds.Left, CurrentScreenBounds.Top, 0, 0, new Size(CurrentScreenBounds.Width, CurrentScreenBounds.Height)); - } - catch (Exception ex) - { - Logger.Write(ex); - Logger.Write("Capturer error. Trying to switch desktops in BitBltCapture."); - if (Win32Interop.SwitchToInputDesktop()) - { - Win32Interop.GetCurrentDesktop(out var desktopName); - Logger.Write($"Switch to desktop {desktopName} after capture error in BitBltCapture."); - } - Init(); - } - } - public int GetScreenCount() - { - return Screen.AllScreens.Length; - } - - public Rectangle GetVirtualScreenBounds() - { - return SystemInformation.VirtualScreen; - } - - public void Init() - { - CurrentFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb); - PreviousFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb); - Graphic = Graphics.FromImage(CurrentFrame); - } - - public void SetSelectedScreen(int screenNumber) - { - if (screenNumber == SelectedScreen) - { - return; - } - - if (GetScreenCount() >= screenNumber + 1) - { - SelectedScreen = screenNumber; - } - else - { - SelectedScreen = 0; - } - CurrentScreenBounds = Screen.AllScreens[SelectedScreen].Bounds; - CaptureFullscreen = true; - Init(); - ScreenChanged?.Invoke(this, CurrentScreenBounds); - } - } -} diff --git a/ScreenCast.Win/Program.cs b/ScreenCast.Win/Program.cs index 41ad74c74..e5997a39f 100644 --- a/ScreenCast.Win/Program.cs +++ b/ScreenCast.Win/Program.cs @@ -9,7 +9,6 @@ using System.Threading; using Remotely.ScreenCast.Win.Services; using Remotely.ScreenCast.Core.Interfaces; -using Remotely.ScreenCast.Win.Capture; using Remotely.ScreenCast.Core.Communication; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -70,36 +69,15 @@ private static void BuildServices() }); serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); - serviceCollection.AddTransient(provider => - { - try - { - var dxCapture = new DXCapture(); - if (dxCapture.GetScreenCount() == Screen.AllScreens.Length) - { - return dxCapture; - } - else - { - Logger.Write("DX screen count doesn't match. Using CPU capturer instead."); - dxCapture.Dispose(); - return new BitBltCapture(); - } - } - catch (Exception ex) - { - Logger.Write(ex); - return new BitBltCapture(); - } - }); + serviceCollection.AddTransient(); ServiceContainer.Instance = serviceCollection.BuildServiceProvider(); } diff --git a/ScreenCast.Win/ScreenCast.Win.csproj b/ScreenCast.Win/ScreenCast.Win.csproj index 2ffecd490..47ffb26bf 100644 --- a/ScreenCast.Win/ScreenCast.Win.csproj +++ b/ScreenCast.Win/ScreenCast.Win.csproj @@ -36,6 +36,10 @@ + + + + diff --git a/ScreenCast.Win/Services/WinAudioCapturer.cs b/ScreenCast.Win/Services/AudioCapturerWin.cs similarity index 98% rename from ScreenCast.Win/Services/WinAudioCapturer.cs rename to ScreenCast.Win/Services/AudioCapturerWin.cs index 06753f080..59f546403 100644 --- a/ScreenCast.Win/Services/WinAudioCapturer.cs +++ b/ScreenCast.Win/Services/AudioCapturerWin.cs @@ -13,7 +13,7 @@ namespace Remotely.ScreenCast.Win.Services { - public class WinAudioCapturer : IAudioCapturer + public class AudioCapturerWin : IAudioCapturer { private WasapiLoopbackCapture Capturer { get; set; } private Stopwatch SendTimer { get; set; } diff --git a/ScreenCast.Win/Services/WinClipboardService.cs b/ScreenCast.Win/Services/ClipboardServiceWin.cs similarity index 98% rename from ScreenCast.Win/Services/WinClipboardService.cs rename to ScreenCast.Win/Services/ClipboardServiceWin.cs index 2dde8109b..e5b21029b 100644 --- a/ScreenCast.Win/Services/WinClipboardService.cs +++ b/ScreenCast.Win/Services/ClipboardServiceWin.cs @@ -12,7 +12,7 @@ namespace Remotely.ScreenCast.Win.Services { - public class WinClipboardService : IClipboardService + public class ClipboardServiceWin : IClipboardService { public event EventHandler ClipboardTextChanged; diff --git a/ScreenCast.Win/Services/WinInput.cs b/ScreenCast.Win/Services/KeyboardMouseInputWin.cs similarity index 98% rename from ScreenCast.Win/Services/WinInput.cs rename to ScreenCast.Win/Services/KeyboardMouseInputWin.cs index f1db82eb8..79cfbcdab 100644 --- a/ScreenCast.Win/Services/WinInput.cs +++ b/ScreenCast.Win/Services/KeyboardMouseInputWin.cs @@ -12,9 +12,9 @@ namespace Remotely.ScreenCast.Win.Services { - public class WinInput : IKeyboardMouseInput + public class KeyboardMouseInputWin : IKeyboardMouseInput { - public WinInput() + public KeyboardMouseInputWin() { StartInputActionThread(); Application.ApplicationExit += Application_ApplicationExit; @@ -30,14 +30,14 @@ public WinInput() private bool ShutdownStarted { get; set; } - public Tuple GetAbsolutePercentFromRelativePercent(double percentX, double percentY, ICapturer capturer) + public Tuple GetAbsolutePercentFromRelativePercent(double percentX, double percentY, IScreenCapturer capturer) { var absoluteX = (capturer.CurrentScreenBounds.Width * percentX) + capturer.CurrentScreenBounds.Left - capturer.GetVirtualScreenBounds().Left; var absoluteY = (capturer.CurrentScreenBounds.Height * percentY) + capturer.CurrentScreenBounds.Top - capturer.GetVirtualScreenBounds().Top; return new Tuple(absoluteX / capturer.GetVirtualScreenBounds().Width, absoluteY / capturer.GetVirtualScreenBounds().Height); } - public Tuple GetAbsolutePointFromRelativePercent(double percentX, double percentY, ICapturer capturer) + public Tuple GetAbsolutePointFromRelativePercent(double percentX, double percentY, IScreenCapturer capturer) { var absoluteX = (capturer.CurrentScreenBounds.Width * percentX) + capturer.CurrentScreenBounds.Left; var absoluteY = (capturer.CurrentScreenBounds.Height * percentY) + capturer.CurrentScreenBounds.Top; diff --git a/ScreenCast.Win/Capture/DXCapture.cs b/ScreenCast.Win/Services/ScreenCapturerWin.cs similarity index 57% rename from ScreenCast.Win/Capture/DXCapture.cs rename to ScreenCast.Win/Services/ScreenCapturerWin.cs index 40acd9f16..ea4caebad 100644 --- a/ScreenCast.Win/Capture/DXCapture.cs +++ b/ScreenCast.Win/Services/ScreenCapturerWin.cs @@ -1,4 +1,5 @@ -// Much of this class was taken from the SharpDX samples. +// The DirectX capture code is based off examples from the +// SharpDX Samples at https://github.com/sharpdx/SharpDX. // Copyright (c) 2010-2013 SharpDX - Alexandre Mutel // @@ -29,6 +30,7 @@ using SharpDX.DXGI; using SharpDX.Mathematics.Interop; using System; +using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; @@ -36,13 +38,14 @@ using System.Threading; using System.Windows.Forms; -namespace Remotely.ScreenCast.Win.Capture +namespace Remotely.ScreenCast.Win.Services { - public class DXCapture : ICapturer + public class ScreenCapturerWin : IScreenCapturer { + private readonly Dictionary bitBltScreens = new Dictionary(); + private readonly Dictionary directxScreens = new Dictionary(); private Adapter1 adapter; private SharpDX.Direct3D11.Device device; - private OutputDuplication duplicatedOutput; private Factory1 factory; private FeatureLevel[] featureLevels = new FeatureLevel[] { @@ -57,24 +60,39 @@ public class DXCapture : ICapturer FeatureLevel.Level_12_1 }; private int height; - private Output output; - private Output1 output1; private Texture2D screenTexture; private Texture2DDescription textureDesc; private int width; + public ScreenCapturerWin() + { + Init(); + } + + public event EventHandler ScreenChanged; + public bool CaptureFullscreen { get; set; } = true; public Bitmap CurrentFrame { get; set; } - public Rectangle CurrentScreenBounds { get; private set; } + public Rectangle CurrentScreenBounds { get; private set; } = Screen.PrimaryScreen.Bounds; public bool NeedsInit { get; set; } = true; public Bitmap PreviousFrame { get; set; } - public event EventHandler ScreenChanged; - public int SelectedScreen { get; private set; } = 0; - - public DXCapture() + public string SelectedScreen { get; private set; } = Screen.PrimaryScreen.DeviceName; + private Graphics Graphic { get; set; } + public void Dispose() { - Init(); + foreach (var output in directxScreens.Values) + { + output.Dispose(); + } + directxScreens.Clear(); + device?.Dispose(); + adapter?.Dispose(); + factory?.Dispose(); + CurrentFrame?.Dispose(); + PreviousFrame?.Dispose(); } + public IEnumerable GetDisplayNames() => Screen.AllScreens.Select(x => x.DeviceName); + public void GetNextFrame() { try @@ -90,12 +108,96 @@ public void GetNextFrame() Init(); } + Win32Interop.SwitchToInputDesktop(); + + PreviousFrame.Dispose(); + PreviousFrame = (Bitmap)CurrentFrame.Clone(); + + if (directxScreens.ContainsKey(SelectedScreen)) + { + try + { + GetDirectXFrame(); + } + catch + { + GetBitBltFrame(); + } + } + } + catch (Exception e) + { + Logger.Write(e); + NeedsInit = true; + } + } + + public int GetScreenCount() => Screen.AllScreens.Length; + + public int GetSelectedScreenIndex() => bitBltScreens[SelectedScreen]; + + public Rectangle GetVirtualScreenBounds() => SystemInformation.VirtualScreen; + + public void Init() + { + CurrentFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb); + PreviousFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb); + + InitBitBlt(); + InitDirectX(); + } + public void SetSelectedScreen(string displayName) + { + if (displayName == SelectedScreen) + { + return; + } + + if (bitBltScreens.ContainsKey(displayName)) + { + SelectedScreen = displayName; + } + else + { + SelectedScreen = bitBltScreens.Keys.First(); + } + CurrentScreenBounds = Screen.AllScreens[bitBltScreens[SelectedScreen]].Bounds; + CaptureFullscreen = true; + NeedsInit = true; + ScreenChanged?.Invoke(this, CurrentScreenBounds); + } + + private void GetBitBltFrame() + { + try + { + Win32Interop.SwitchToInputDesktop(); PreviousFrame.Dispose(); PreviousFrame = (Bitmap)CurrentFrame.Clone(); + Graphic.CopyFromScreen(CurrentScreenBounds.Left, CurrentScreenBounds.Top, 0, 0, new Size(CurrentScreenBounds.Width, CurrentScreenBounds.Height)); + } + catch (Exception ex) + { + Logger.Write(ex); + Logger.Write("Capturer error. Trying to switch desktops in BitBltCapture."); + if (Win32Interop.SwitchToInputDesktop()) + { + Win32Interop.GetCurrentDesktop(out var desktopName); + Logger.Write($"Switch to desktop {desktopName} after capture error in BitBltCapture."); + } + NeedsInit = true; + } + } + private void GetDirectXFrame() + { + try + { SharpDX.DXGI.Resource screenResource; OutputDuplicateFrameInformation duplicateFrameInformation; + var duplicatedOutput = directxScreens[SelectedScreen]; + // Try to get duplicated frame within given time is ms var result = duplicatedOutput.TryAcquireNextFrame(100, out duplicateFrameInformation, out screenResource); @@ -121,16 +223,16 @@ public void GetNextFrame() //RawRectangle[] dirtyRectsBuffer = new RawRectangle[duplicateFrameInformation.TotalMetadataBufferSize]; //duplicatedOutput.GetFrameDirtyRects(duplicateFrameInformation.TotalMetadataBufferSize, dirtyRectsBuffer, out var dirtyRectsSizeRequired); - + // copy resource into memory that can be accessed by the CPU using (var screenTexture2D = screenResource.QueryInterface()) { device.ImmediateContext.CopyResource(screenTexture2D, screenTexture); } - + // Get the desktop capture texture var mapSource = device.ImmediateContext.MapSubresource(screenTexture, 0, MapMode.Read, SharpDX.Direct3D11.MapFlags.None); - + var boundsRect = new Rectangle(0, 0, width, height); // Copy pixels from screen capture Texture to GDI bitmap @@ -162,36 +264,17 @@ public void GetNextFrame() NeedsInit = true; } } - catch (Exception e) - { - Logger.Write(e); - NeedsInit = true; - } - } - - public void Dispose() - { - duplicatedOutput?.Dispose(); - output1?.Dispose(); - output?.Dispose(); - device?.Dispose(); - adapter?.Dispose(); - factory?.Dispose(); - CurrentFrame?.Dispose(); - PreviousFrame?.Dispose(); - } - - public int GetScreenCount() - { - return adapter.GetOutputCount(); } - public Rectangle GetVirtualScreenBounds() + private void InitBitBlt() { - return SystemInformation.VirtualScreen; + Graphic = Graphics.FromImage(CurrentFrame); + for (var i = 0; i < Screen.AllScreens.Length; i++) + { + bitBltScreens.Add(Screen.AllScreens[i].DeviceName, i); + } } - - public void Init() + private void InitDirectX() { Dispose(); @@ -201,72 +284,47 @@ public void Init() adapter = factory.Adapters1.FirstOrDefault(x => x.Outputs.Length > 0); //Get device from adapter device = new SharpDX.Direct3D11.Device(adapter); - //Get front buffer of the adapter - if (adapter.GetOutputCount() < SelectedScreen + 1) - { - SelectedScreen = 0; - } - output = adapter.GetOutput(SelectedScreen); - output1 = output.QueryInterface(); - - // Width/Height of desktop to capture - var bounds = output1.Description.DesktopBounds; - var newWidth = bounds.Right - bounds.Left; - var newHeight = bounds.Bottom - bounds.Top; - CurrentScreenBounds = new Rectangle(bounds.Left, bounds.Top, newWidth, newHeight); - if (newWidth != width || newHeight != height) - { - ScreenChanged?.Invoke(this, CurrentScreenBounds); - } - width = newWidth; - height = newHeight; - CurrentFrame = new Bitmap(width, height, PixelFormat.Format32bppArgb); - PreviousFrame = new Bitmap(width, height, PixelFormat.Format32bppArgb); - - // Create Staging texture CPU-accessible - textureDesc = new Texture2DDescription + for (var i = 0; i < adapter.GetOutputCount(); i++) { - CpuAccessFlags = CpuAccessFlags.Read, - BindFlags = BindFlags.None, - Format = Format.B8G8R8A8_UNorm, - Width = width, - Height = height, - OptionFlags = ResourceOptionFlags.None, - MipLevels = 1, - ArraySize = 1, - SampleDescription = { Count = 1, Quality = 0 }, - Usage = ResourceUsage.Staging - }; - screenTexture = new Texture2D(device, textureDesc); - duplicatedOutput = output1.DuplicateOutput(device); + using (var output = adapter.GetOutput(i)) + using (var output1 = output.QueryInterface()) + { + // Width/Height of desktop to capture + var bounds = output1.Description.DesktopBounds; + var newWidth = bounds.Right - bounds.Left; + var newHeight = bounds.Bottom - bounds.Top; + CurrentScreenBounds = new Rectangle(bounds.Left, bounds.Top, newWidth, newHeight); + if (newWidth != width || newHeight != height) + { + ScreenChanged?.Invoke(this, CurrentScreenBounds); + } + width = newWidth; + height = newHeight; - NeedsInit = false; - } + CurrentFrame = new Bitmap(width, height, PixelFormat.Format32bppArgb); + PreviousFrame = new Bitmap(width, height, PixelFormat.Format32bppArgb); - public void SetSelectedScreen(int screenNumber) - { - if (screenNumber == SelectedScreen) - { - return; - } - if (adapter == null) - { - SelectedScreen = 0; - } - else - { - if (adapter.Outputs.Length >= screenNumber + 1) - { - SelectedScreen = screenNumber; - } - else - { - SelectedScreen = 0; + // Create Staging texture CPU-accessible + textureDesc = new Texture2DDescription + { + CpuAccessFlags = CpuAccessFlags.Read, + BindFlags = BindFlags.None, + Format = Format.B8G8R8A8_UNorm, + Width = width, + Height = height, + OptionFlags = ResourceOptionFlags.None, + MipLevels = 1, + ArraySize = 1, + SampleDescription = { Count = 1, Quality = 0 }, + Usage = ResourceUsage.Staging + }; + screenTexture = new Texture2D(device, textureDesc); + directxScreens.Add(output1.Description.DeviceName, output1.DuplicateOutput(device)); } } - CaptureFullscreen = true; - NeedsInit = true; + + NeedsInit = false; } } } diff --git a/ScreenCast.Win/Services/WinScreenCaster.cs b/ScreenCast.Win/Services/ScreenCasterWin.cs similarity index 86% rename from ScreenCast.Win/Services/WinScreenCaster.cs rename to ScreenCast.Win/Services/ScreenCasterWin.cs index 872265081..3fe6ba215 100644 --- a/ScreenCast.Win/Services/WinScreenCaster.cs +++ b/ScreenCast.Win/Services/ScreenCasterWin.cs @@ -6,20 +6,18 @@ using System.Threading.Tasks; using Remotely.ScreenCast.Core.Enums; using Remotely.ScreenCast.Core.Services; -using Remotely.ScreenCast.Core.Capture; using Remotely.ScreenCast.Core; using Remotely.ScreenCast.Core.Models; using Remotely.Shared.Models; -using Remotely.ScreenCast.Win.Capture; using Remotely.Shared.Win32; using Microsoft.Extensions.DependencyInjection; using System.Threading; namespace Remotely.ScreenCast.Win.Services { - public class WinScreenCaster : ScreenCasterBase, IScreenCaster + public class ScreenCasterWin : ScreenCasterBase, IScreenCaster { - public WinScreenCaster(CursorIconWatcher cursorIconWatcher) + public ScreenCasterWin(CursorIconWatcher cursorIconWatcher) { CursorIconWatcher = cursorIconWatcher; } @@ -40,7 +38,7 @@ public async Task BeginScreenCasting(ScreenCastRequest screenCastRequest) var conductor = ServiceContainer.Instance.GetRequiredService(); await conductor.CasterSocket.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List() { screenCastRequest.ViewerID }); - _ = BeginScreenCasting(screenCastRequest.ViewerID, screenCastRequest.RequesterName, ServiceContainer.Instance.GetRequiredService()); + _ = BeginScreenCasting(screenCastRequest.ViewerID, screenCastRequest.RequesterName, ServiceContainer.Instance.GetRequiredService()); } } } diff --git a/Server/Services/BrowserSocketHub.cs b/Server/Services/BrowserSocketHub.cs index 093b6ce05..f0b257b92 100644 --- a/Server/Services/BrowserSocketHub.cs +++ b/Server/Services/BrowserSocketHub.cs @@ -135,6 +135,10 @@ public override async Task OnDisconnectedAsync(Exception exception) public Task RemoteControl(string deviceID) { var targetDevice = DeviceSocketHub.ServiceConnections.FirstOrDefault(x => x.Value.ID == deviceID); + if (targetDevice.Value is null) + { + return Clients.Caller.SendAsync("DisplayMessage", $"The selected device is not online.", "Device is not online."); ; + } if (DataService.DoesUserHaveAccessToDevice(deviceID, RemotelyUser)) { var currentUsers = RCDeviceSocketHub.SessionInfoList.Count(x => x.Value.OrganizationID == RemotelyUser.OrganizationID); diff --git a/Server/Services/RCBrowserSocketHub.cs b/Server/Services/RCBrowserSocketHub.cs index 69c5890c5..f0d4c26ef 100644 --- a/Server/Services/RCBrowserSocketHub.cs +++ b/Server/Services/RCBrowserSocketHub.cs @@ -132,9 +132,9 @@ public override Task OnDisconnectedAsync(Exception exception) return base.OnDisconnectedAsync(exception); } - public Task SelectScreen(int screenIndex) + public Task SelectScreen(string displayName) { - return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("SelectScreen", screenIndex, Context.ConnectionId); + return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("SelectScreen", displayName, Context.ConnectionId); } public Task SendClipboardTransfer(string transferText, bool typeText) diff --git a/Server/Services/RCDeviceSocketHub.cs b/Server/Services/RCDeviceSocketHub.cs index e186618e8..e920d383c 100644 --- a/Server/Services/RCDeviceSocketHub.cs +++ b/Server/Services/RCDeviceSocketHub.cs @@ -210,13 +210,13 @@ public Task SendScreenCapture(byte[] captureBytes, string rcBrowserHubConnection return RCBrowserHub.Clients.Client(rcBrowserHubConnectionID).SendAsync("ScreenCapture", captureBytes, left, top, width, height, captureTime); } - public Task SendScreenCountToBrowser(int primaryScreenIndex, int screenCount, string rcBrowserHubConnectionID) + public Task SendScreenDataToBrowser(string selectedDisplay, string[] displayNames, string browserHubConnectionId) { lock (ViewerList) { - ViewerList.Add(rcBrowserHubConnectionID); + ViewerList.Add(browserHubConnectionId); } - return RCBrowserHub.Clients.Client(rcBrowserHubConnectionID).SendAsync("ScreenCount", primaryScreenIndex, screenCount); + return RCBrowserHub.Clients.Client(browserHubConnectionId).SendAsync("ScreenData", selectedDisplay, displayNames); } public Task SendScreenSize(int width, int height, string rcBrowserHubConnectionID) diff --git a/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js b/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js index 0b577ae0d..c39484bdb 100644 --- a/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js +++ b/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js @@ -54,8 +54,8 @@ export class RCBrowserSockets { SendLatencyUpdate(sentTime, bytesReceived) { this.Connection.invoke("SendLatencyUpdate", sentTime, bytesReceived); } - SendSelectScreen(index) { - this.Connection.invoke("SelectScreen", index); + SendSelectScreen(displayName) { + this.Connection.invoke("SelectScreen", displayName); } SendMouseMove(percentX, percentY) { this.Connection.invoke("MouseMove", percentX, percentY); @@ -120,18 +120,18 @@ export class RCBrowserSockets { Remotely.ClipboardWatcher.SetClipboardText(clipboardText); PopupMessage("Clipboard updated."); }); - hubConnection.on("ScreenCount", (primaryScreenIndex, screenCount) => { + hubConnection.on("ScreenData", (selectedDisplay, displayNames) => { document.querySelector("#screenSelectBar").innerHTML = ""; - for (let i = 0; i < screenCount; i++) { + for (let i = 0; i < displayNames.length; i++) { var button = document.createElement("button"); button.innerHTML = `Monitor ${i}`; button.classList.add("horizontal-bar-button"); - if (i == primaryScreenIndex) { + if (displayNames[i] == selectedDisplay) { button.classList.add("toggled"); } document.querySelector("#screenSelectBar").appendChild(button); button.onclick = (ev) => { - this.SendSelectScreen(i); + this.SendSelectScreen(displayNames[i]); document.querySelectorAll("#screenSelectBar .horizontal-bar-button").forEach(button => { button.classList.remove("toggled"); }); diff --git a/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js.map b/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js.map index eb089e5dd..9b22b9d1e 100644 --- a/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js.map +++ b/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.js.map @@ -1 +1 @@ -{"version":3,"file":"RCBrowserSockets.js","sourceRoot":"","sources":["RCBrowserSockets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,IAAI,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAShC,MAAM,OAAO,gBAAgB;IAA7B;QAEI,aAAQ,GAAkB,EAAE,CAAC;IA2OjC,CAAC;IA1OG,OAAO;QACH,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,CAAC,oBAAoB,EAAE;aAC/C,OAAO,CAAC,eAAe,CAAC;aACxB,eAAe,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;aACvE,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;aAC9C,KAAK,EAAE,CAAC;QAEb,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE3C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC9B,IAAI,CAAC,6BAA6B,EAAE,CAAC;YACrC,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAC7C,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YACrC,EA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AAC;QACd,CAAC,CAAC,CAAC;QACH,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,OAAe,EAAE,EAAE;YAChD,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"} \ No newline at end of file diff --git a/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.ts b/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.ts index b95a90224..faa643eab 100644 --- a/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.ts +++ b/Server/wwwroot/scripts/RemoteControl/RCBrowserSockets.ts @@ -68,8 +68,8 @@ export class RCBrowserSockets { SendLatencyUpdate(sentTime: Date, bytesReceived: number) { this.Connection.invoke("SendLatencyUpdate", sentTime, bytesReceived); } - SendSelectScreen(index: number) { - this.Connection.invoke("SelectScreen", index); + SendSelectScreen(displayName: string) { + this.Connection.invoke("SelectScreen", displayName); } SendMouseMove(percentX: number, percentY: number): any { this.Connection.invoke("MouseMove", percentX, percentY); @@ -134,18 +134,18 @@ export class RCBrowserSockets { Remotely.ClipboardWatcher.SetClipboardText(clipboardText); PopupMessage("Clipboard updated."); }); - hubConnection.on("ScreenCount", (primaryScreenIndex: number, screenCount: number) => { + hubConnection.on("ScreenData", (selectedDisplay: string, displayNames: string[]) => { document.querySelector("#screenSelectBar").innerHTML = ""; - for (let i = 0; i < screenCount; i++) { + for (let i = 0; i < displayNames.length; i++) { var button = document.createElement("button"); button.innerHTML = `Monitor ${i}`; button.classList.add("horizontal-bar-button"); - if (i == primaryScreenIndex) { + if (displayNames[i] == selectedDisplay) { button.classList.add("toggled"); } document.querySelector("#screenSelectBar").appendChild(button); button.onclick = (ev: MouseEvent) => { - this.SendSelectScreen(i); + this.SendSelectScreen(displayNames[i]); document.querySelectorAll("#screenSelectBar .horizontal-bar-button").forEach(button => { button.classList.remove("toggled"); });