From 21fb45ddaf9efd066bad87073d2ae459c9bb04bf Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Mon, 20 Apr 2015 13:40:32 +0000 Subject: [PATCH] libxl: set DISPLAY and XAUTHORITY if sdl is enabled With this change the following domU.cfg will show the VM window on the local dom0 display, instead of the remote side (it via ssh -X login): vnc=0 sdl=1 display=":0" xauthority="/run/gdm/auth-for-olaf-nMXhOi/database" Signed-off-by: Olaf Hering Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Cc: Wei Liu Acked-by: Ian Campbell --- docs/man/xl.cfg.pod.5 | 7 ++----- tools/libxl/libxl_dm.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index a189091f7b..0bbd3c3b30 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -577,15 +577,12 @@ Simple DirectMedia Layer). The default is to not enable this mode. =item C Specifies the X Window display that should be used when the sdl option -is used. Note: passing this value to the device-model is not currently -implemented, so providing this option will have no effect. +is used. =item C Specifies the path to the X authority file that should be used to -connect to the X server when the sdl option is used. Note: passing -this value to the device-model is not currently implemented, so -providing this option will have no effect. +connect to the X server when the sdl option is used. =item C diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 95660b849d..3dd7c0454c 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -196,7 +196,10 @@ static int libxl__build_device_model_args_old(libxl__gc *gc, if (!libxl_defbool_val(sdl->opengl)) { flexarray_append(dm_args, "-disable-opengl"); } - /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */ + if (sdl->display) + flexarray_append_pair(dm_envs, "DISPLAY", sdl->display); + if (sdl->xauthority) + flexarray_append_pair(dm_envs, "XAUTHORITY", sdl->xauthority); } if (keymap) { flexarray_vappend(dm_args, "-k", keymap, NULL); @@ -562,7 +565,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, if (sdl) { flexarray_append(dm_args, "-sdl"); - /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */ + if (sdl->display) + flexarray_append_pair(dm_envs, "DISPLAY", sdl->display); + if (sdl->xauthority) + flexarray_append_pair(dm_envs, "XAUTHORITY", sdl->xauthority); } if (keymap) { -- 2.30.2