Chromium Code Reviews| Index: remoting/tools/me2me_virtual_host.py |
| diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py |
| index eda56485241f35cd9d8ddc310a0f40da2423b34e..899710da5cc842a80e4ee6ca430d4b1d45c15cdc 100755 |
| --- a/remoting/tools/me2me_virtual_host.py |
| +++ b/remoting/tools/me2me_virtual_host.py |
| @@ -329,22 +329,28 @@ class Desktop: |
| label = "%dx%d" % (width, height) |
| args = ["xrandr", "--newmode", label, "0", str(width), "0", "0", "0", |
| str(height), "0", "0", "0"] |
| - proc = subprocess.Popen(args, env=self.child_env, stdout=devnull, |
| - stderr=devnull) |
| - proc.wait() |
| + subprocess.call(args, env=self.child_env, stdout=devnull, stderr=devnull) |
|
Lambros
2013/01/04 22:21:37
call() takes same args as Popen() so I decided to
|
| args = ["xrandr", "--addmode", "screen", label] |
| - proc = subprocess.Popen(args, env=self.child_env, stdout=devnull, |
| - stderr=devnull) |
| - proc.wait() |
| + subprocess.call(args, env=self.child_env, stdout=devnull, stderr=devnull) |
| # Set the initial mode to the first size specified, otherwise the X server |
| # would default to (max_width, max_height), which might not even be in the |
| # list. |
| - label = "%dx%d" % self.sizes[0] |
| + (width, height) = self.sizes[0] |
| + label = "%dx%d" % (width, height) |
| args = ["xrandr", "-s", label] |
| - proc = subprocess.Popen(args, env=self.child_env, stdout=devnull, |
| - stderr=devnull) |
| - proc.wait() |
| + subprocess.call(args, env=self.child_env, stdout=devnull, stderr=devnull) |
| + |
| + # Set the physical size of the display so that the initial mode is running |
| + # at approximately 96 DPI, since some desktops require the DPI to be set to |
| + # something realistic. |
| + DPI = 96.0 |
| + MM_PER_INCH = 25.4 |
| + # width / DPI is width in inches. Multiplying by MM_PER_INCH converts to mm. |
| + width_mm = int(width / DPI * MM_PER_INCH) |
|
Wez
2013/01/04 22:32:57
nit: Bracket width / DPI for readability.
|
| + height_mm = int(height / DPI * MM_PER_INCH) |
| + args = ["xrandr", "--fbmm", "%dx%d" % (width_mm, height_mm)] |
|
Sergey Ulanov
2013/01/04 22:28:33
why not use --dpi here?
Wez
2013/01/04 23:36:02
Good point; xrandr --dpi 96/screen should work.
|
| + subprocess.call(args, env=self.child_env, stdout=devnull, stderr=devnull) |
| devnull.close() |