diff --git a/rdp_client.py b/rdp_client.py index 2f9beeb..a50f178 100755 --- a/rdp_client.py +++ b/rdp_client.py @@ -917,10 +917,16 @@ Multi-Monitor Support: color_depth = conn.get("color_depth", 32) cmd.append(f"/bpp:{color_depth}") - # Multiple monitors - use /monitors: for specific selection + # Multiple monitors - try different approaches for better compatibility if use_specific_monitors: + # Method 1: Try /monitors: without /size for better compatibility cmd.append(f"/monitors:{monitor_list}") - self.logger.info(f"Using specific monitors for {multimon}: {monitor_list}") + self.logger.info(f"Using specific monitors for {multimon}: {monitor_list} (Method 1: /monitors: only)") + + # Remove the /size: parameter we added earlier - let /monitors: handle sizing + cmd = [x for x in cmd if not x.startswith('/size:')] + self.logger.info("Removed /size: parameter to avoid conflict with /monitors:") + elif multimon == "All Monitors": cmd.append("/multimon") self.logger.info("Using all available monitors") diff --git a/test_new_monitor_approach.py b/test_new_monitor_approach.py new file mode 100644 index 0000000..3c49981 --- /dev/null +++ b/test_new_monitor_approach.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 + +def test_new_monitor_approach(): + print("=== Testing New Monitor Approach ===") + print() + + # Simulate the command building process + cmd = ["xfreerdp", "/v:test-server", "/u:testuser", "/p:password"] + + # Test scenario: 2 Monitors with Full Screen + multimon = "2 Monitors" + resolution = "Full Screen" + use_specific_monitors = multimon in ["2 Monitors", "3 Monitors", "4 Monitors"] + monitor_list = "1,2" # Simulated result + + print(f"Testing: {multimon} with {resolution}") + print(f"Monitor list: {monitor_list}") + print() + + # Original resolution handling + if resolution == "Full Screen" and not use_specific_monitors: + cmd.append("/f") + print("Step 1: Added /f") + elif resolution == "Full Screen" and use_specific_monitors: + combined_res = "3840x1080" # Simulated calculation + cmd.append(f"/size:{combined_res}") + print(f"Step 1: Added /size:{combined_res}") + else: + cmd.append(f"/size:{resolution}") + print(f"Step 1: Added /size:{resolution}") + + cmd.append("/bpp:32") + print("Step 2: Added /bpp:32") + + # New monitor handling approach + if use_specific_monitors: + cmd.append(f"/monitors:{monitor_list}") + print(f"Step 3: Added /monitors:{monitor_list}") + + # Remove /size: to avoid conflicts + cmd = [x for x in cmd if not x.startswith('/size:')] + print("Step 4: Removed /size: parameter to avoid conflict") + + print() + print("Final command:") + cmd_str = ' '.join(cmd).replace("/p:password", "/p:***") + print(cmd_str) + print() + print("Expected behavior: /monitors:1,2 should span across monitors 1 and 2") + print("without /size: interference") + +if __name__ == "__main__": + test_new_monitor_approach() \ No newline at end of file