On headless systems, Wine can still run through a VNC connection even though no outputs are connected. Fallback to using the Xinerama display device handler in this case to report at least one monitor.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49500 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/winex11.drv/xrandr.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 78ad98acd49..fa748c2af04 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -1555,6 +1555,38 @@ void X11DRV_XRandR_Init(void) #ifdef HAVE_XRRGETPROVIDERRESOURCES if (ret >= 4 && (major > 1 || (major == 1 && minor >= 4))) { + XRRScreenResources *screen_resources; + XRROutputInfo *output_info; + BOOL found_output = FALSE; + INT i; + + screen_resources = xrandr_get_screen_resources(); + if (!screen_resources) + return; + + for (i = 0; i < screen_resources->noutput; ++i) + { + output_info = pXRRGetOutputInfo( gdi_display, screen_resources, screen_resources->outputs[i] ); + if (!output_info) + continue; + + if (output_info->connection == RR_Connected) + { + pXRRFreeOutputInfo( output_info ); + found_output = TRUE; + break; + } + + pXRRFreeOutputInfo( output_info ); + } + pXRRFreeScreenResources( screen_resources ); + + if (!found_output) + { + WARN("No connected outputs found.\n"); + return; + } + display_handler.name = "XRandR 1.4"; display_handler.priority = 200; display_handler.get_gpus = xrandr14_get_gpus;
On Fri, 1 Jan 2021 at 06:01, Zhiyi Zhang zzhang@codeweavers.com wrote:
On headless systems, Wine can still run through a VNC connection even though no outputs are connected. Fallback to using the Xinerama display device handler in this case to report at least one monitor.
Mostly out of curiosity, how does that work on Windows? Also, what happens if the display is removed after the application has already been started?
On 1/5/21 12:41 AM, Henri Verbeet wrote:
On Fri, 1 Jan 2021 at 06:01, Zhiyi Zhang zzhang@codeweavers.com wrote:
On headless systems, Wine can still run through a VNC connection even though no outputs are connected. Fallback to using the Xinerama display device handler in this case to report at least one monitor.
Mostly out of curiosity, how does that work on Windows? Also, what happens if the display is removed after the application has already been started?
I haven't tried it on real hardware. But I am guessing without a connected output, a VNC client/server won't be able to display anything on Windows. Using Remote Desktop service, Windows will report an emulated display using remote desktop client dimensions.
If the only display is removed after the application has already started, Wine will send a WM_DISPLAYCHANGE message with a fallback emulated display of size 640x480 and report the the real size once the display is reconnected.
Thanks, Zhiyi