[Sugar-devel] [PATCH] Set the DISPLAY env var once Xephyr has been launched
Tomeu Vizoso
tomeu.vizoso at collabora.co.uk
Wed May 19 08:34:57 EDT 2010
From: Tomeu Vizoso <tomeu at sugarlabs.org>
---
src/jarabe/util/emulator.py | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/jarabe/util/emulator.py b/src/jarabe/util/emulator.py
index 3eb817f..4155985 100644
--- a/src/jarabe/util/emulator.py
+++ b/src/jarabe/util/emulator.py
@@ -71,8 +71,6 @@ def _run_xephyr(display, dpi, dimensions, fullscreen):
sys.stderr.write('Error executing server: %s\n' % (exc, ))
return None
- os.environ['DISPLAY'] = ":%d" % (display)
- os.environ['SUGAR_EMULATOR_PID'] = str(pipe.pid)
return pipe
@@ -98,17 +96,17 @@ def _start_xephyr(dpi, dimensions, fullscreen):
if not _check_server(display):
pipe = _run_xephyr(display, dpi, dimensions, fullscreen)
if not pipe:
- return None
+ return None, None
for i_ in range(10):
if _check_server(display):
- return pipe
+ return pipe, display
time.sleep(0.1)
_kill_pipe(pipe)
- return None
+ return None, None
def _start_window_manager():
@@ -152,11 +150,14 @@ def main():
_setup_env()
- server = _start_xephyr(options.dpi, options.dimensions, options.fullscreen)
+ server, display = _start_xephyr(options.dpi, options.dimensions, options.fullscreen)
if not server:
sys.stderr.write('Failed to start server.\n')
return ERROR_NO_SERVER
+ os.environ['DISPLAY'] = ":%d" % (display)
+ os.environ['SUGAR_EMULATOR_PID'] = str(server.pid)
+
if options.scaling:
os.environ['SUGAR_SCALING'] = options.scaling
--
1.6.6.1
More information about the Sugar-devel
mailing list