void RemoveScreen(CheckOutMessage checkOut) { ScreenConfiguration screenConfiguration = _screen.ScreenConfiguration; if (screenConfiguration.Remove(checkOut.ClientName)) { if (screenConfiguration.ValidVirtualCoordinate(state.VirtualX, state.VirtualY) != null) { return; } //coordinates are invalid, grab a screen var s = screenConfiguration.GetFurthestLeft(); state.VirtualX = s.X; state.VirtualY = s.Y; if (s.Client != state.ClientName) { return; } //set this local client to have 0,0 coords. then update the other clients with the new virtual position. state.LastPositionX = 0; state.LastPositionY = 0; _hook.SetMousePos(0, 0); } }
void OnScreenConfig(IReadOnlyList <VirtualScreen> screens) { ScreenConfiguration screenConfiguration = _screen.ScreenConfiguration; screenConfiguration.AddScreensRight(screens); if (screenConfiguration.ValidVirtualCoordinate(state.VirtualX, state.VirtualY) != null) { return; } //coordinates are invalid, grab a screen var s = screenConfiguration.GetFurthestLeft(); state.VirtualX = s.X; state.VirtualY = s.Y; if (s.Client != state.ClientName) { return; } //set this local client to have 0,0 coords. then update the other clients with the new virtual position. state.LastPositionX = 0; state.LastPositionY = 0; _hook.SetMousePos(0, 0); }