Provide reasonable hTotal, vTotal and dotClock for the display mode

gtk3 programs crash when they divide dotClock by hTotal and vTotal to
calculate the refresh rate.
This commit is contained in:
Pavel Roskin 2016-12-02 01:52:03 +00:00
parent fb892c7d80
commit a40be19c7b

View File

@ -321,11 +321,15 @@ rdpRRAddOutput(const char *aname, int x, int y, int width, int height)
RROutputPtr output;
xRRModeInfo modeInfo;
char name[64];
const int vfreq = 50;
sprintf (name, "%dx%d", width, height);
memset (&modeInfo, 0, sizeof(modeInfo));
modeInfo.width = width;
modeInfo.height = height;
modeInfo.hTotal = width;
modeInfo.vTotal = height;
modeInfo.dotClock = vfreq * width * height;
modeInfo.nameLength = strlen(name);
mode = RRModeGet(&modeInfo, name);
if (mode == 0)