Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1071)

Unified Diff: remoting/tools/me2me_virtual_host.py

Issue 11782006: Set Virtual Me2Me desktop's initial DPI to 96 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698