From 1077b09bb71ac899157455ba2e578dd613b4280d Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 30 Dec 2021 16:58:07 +0000 Subject: [PATCH] gesture - vm (vbox) detect hack to work around xorg no display bug so... you go through wizard - only in vbox it seems (or maybe other vm's - don't know - only tried vbox - this doesnt happen on real systems). at the end e restarts... and it's blank. e is actually rendering. you can screengrab (eg import -window root out.png) and see the screen drawn just fine. xrandr is all set up right - everything is kosher... but nothing will display except the curosr. xorg is just not displaying rendered content. somehow e's gesture code and use of logind/libinput to get inpiut devices for gestures tickles this xorg bug. i don't quite know why as xorg doesnt seem to be complaining. once you restart the xorg process everything works fine from there on. it's some bug inside xorg that just refuses to display output. manually changing resolution with xrandr will reset things and have things render... until e restarts. a fukll xorg re-run is needed to fix it... there just is nothing i can see that e is doing wrong or to fix in e... so this is a workaround the xorg side by just not using the gesture support if on a vm. they won't have touchpads anyway and emulate mice so ... no real loss. this won't affect peolpe on real systems and it may not always work as a workaround as it relies on systemd-detect-virt or hostnamectl. @fix --- src/bin/e_gesture.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/bin/e_gesture.c b/src/bin/e_gesture.c index f447d38c8..9d2d48e24 100644 --- a/src/bin/e_gesture.c +++ b/src/bin/e_gesture.c @@ -208,10 +208,41 @@ _shutdown_for_x11(void) elput_shutdown(); } +static int +_detect_vm(void) +{ + static int on_vm = -1; + int ret; + + if (on_vm >= 0) return on_vm; + ret = system("systemd-detect-virt"); + if (ret == 0) on_vm = 1; + else if (ret == 1) on_vm = 0; + else + { + ret = system("hostnamectl status | grep 'Chassis: vm'"); + if (ret == 0) on_vm = 1; + else if (ret == 1) on_vm = 0; + // fallback to assuming not on vm + else on_vm = 0; + } + return on_vm; +} E_API int e_gesture_init(void) { + // we have some bizarre bug on vbox -> this causes xorg to stop displaying + // the screen output even though it's rendered and you can grab it through + // screenshots, xrandr reports a perfectly well configured display. + // somehow using elput to get input devices from logind causes xorg + // internally to not handle e's first restart after wizard - as if + // the xserver goes into some bixarre internal state - it doesn't report + // any errors though. this works around that by just avoiding the gesture + // support on vm's - they wont have touchpads anyway as they will emulate + // a normal mouse mostly... :) + if (_detect_vm()) return 1; + if (e_comp->comp_type == E_PIXMAP_TYPE_X) { _init_for_x11(); @@ -230,6 +261,8 @@ e_gesture_init(void) E_API int e_gesture_shutdown(void) { +// if (_detect_vm()) return 1; + if (e_comp->comp_type == E_PIXMAP_TYPE_X) { _shutdown_for_x11();