When run from within 'ssh -X' or 'ssh -Y', MIT-SHM will appear to be
available even though it won't work: the shared memory will be on the
machine running vncviewer, not on the machine running the X server it
displays to. Depending on what shm segments are available on the
machine running the X server, the failure may not be apparent when
checking that MIT-SHM works.
Avoid this by not using MIT-SHM when XDisplayName() indicates we may
not be running locally.
Original bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=
1072733
Bool pixmaps;
XErrorHandler old_handler;
Status status;
+ const char *display_name = XDisplayName (NULL);
+
+ /* Don't use MIT-SHM on remote displays */
+ if (*display_name && *display_name != ':')
+ return 0;
if (!XShmQueryVersion(fl_display, &major, &minor, &pixmaps))
return 0;