[Sugar-devel] [PATCH] Set the DISPLAY env var once Xephyr has been launched

Sascha Silbe sascha-ml-ui-sugar-devel at silbe.org
Thu May 27 02:13:31 EDT 2010


Excerpts from Tomeu Vizoso's message of Wed May 19 12:34:57 +0000 2010:

> From: Tomeu Vizoso <tomeu at sugarlabs.org>
> 
> ---

Please provide a more complete patch description. Only after Bernie
posted his version of your patch did I understand what the point of it was.

[src/jarabe/util/emulator.py]
> @@ -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
>  

I'd prefer DISPLAY and SUGAR_EMULATOR_PID to be set in _setup_env(). In fact
that's the way I already did it in my VNC branch:

def _setup_env(display, scaling):
    """Set up environment variables for running Sugar inside the new X server.
    """
    os.environ['SUGAR_EMULATOR'] = 'yes'
    os.environ['GABBLE_LOGFILE'] = os.path.join(
            env.get_profile_path(), 'logs', 'telepathy-gabble.log')
    os.environ['SALUT_LOGFILE'] = os.path.join(
            env.get_profile_path(), 'logs', 'telepathy-salut.log')
    os.environ['STREAM_ENGINE_LOGFILE'] = os.path.join(
            env.get_profile_path(), 'logs', 'telepathy-stream-engine.log')
    os.environ['DISPLAY'] = ':%d' % (display, )
    if scaling:
        os.environ['SUGAR_SCALING'] = scaling

[...]

def main():
    """Script-level operations"""
    global server

    options, args = _parse_args()
    display, server = _start_server(options.dpi, options.dimensions,
        options.fullscreen)
    viewer = _start_viewer(display, options.fullscreen)
    _setup_env(display, options.scaling)
[...]

Sascha
-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100527/b52b8e3b/attachment.pgp 


More information about the Sugar-devel mailing list