Fix Qt over VNC with broken VisualInfo

It appears some VNC servers reports incorrect masks in their visuals.
This patch recognizes this unlikely set of masks and interprets it as
RGB16 which VNC expects.

Task-number: QTBUG-44147
Change-Id: Ia374edcd5f0a5ce0188157ac1d328f888cfa260c
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Allan Sandfeld Jensen 2015-01-27 16:36:10 +01:00 committed by Jani Heikkinen
parent 012a7ab912
commit 8e0f56280a

View File

@ -215,6 +215,18 @@ static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, q
break;
}
qWarning("Unsupported screen format: depth: %d, red_mask: %x, blue_mask: %x", depth, red_mask, blue_mask);
switch (depth) {
case 24:
qWarning("Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.");
return QImage::Format_RGB32;
case 16:
qWarning("Using RGB16 fallback, if this works your X11 server is reporting a bad screen format.");
return QImage::Format_RGB16;
default:
break;
}
return QImage::Format_Invalid;
}