From: Wei Xie xiewei@uniontech.com
Wine applications crash in VNC/headless environments due to invalid all-zero monitor coordinates.
The root cause is: Environment Issue: VNC systems report all displays as RR_Disconnected Faulty Fallback: Wine incorrectly reverts to legacy XRandR 1.0 API when no "connected" displays are detected API Incompatibility: Modern XRandR 1.6 doesn't support Wine's XRandR 1.0 implementation, causing XRRSizes() to return empty display modes Uninitialized Data: This leaves critical display fields (dmPelsWidth/Height) at initialization value 0 --- server/window.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/server/window.c b/server/window.c index c59b8646118..8d75482940d 100644 --- a/server/window.c +++ b/server/window.c @@ -315,6 +315,8 @@ static void map_point_raw_to_virt( struct desktop *desktop, int *x, int *y ) width_from = monitor->raw.right - monitor->raw.left; height_from = monitor->raw.bottom - monitor->raw.top;
+ if (width_from == 0 || height_from == 0) return; + *x = *x * 2 - (monitor->raw.left * 2 + width_from); *x = (*x * width_to * 2 + width_from) / (width_from * 2); *x = (*x + monitor->virt.left * 2 + width_to) / 2;