Commit d82ffa5a authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Fix refresh rate reported for my laptop monitor

kscreen was reporting 120Hz for some modes while xrandr and the manufacturer agree it's
60Hz only so i got inspired by the
   static double mode_refresh (const XRRModeInfo *mode_info)
function in xrandr and now kscreen reports 60Hz for all the modes

(cherry picked from commit 10ef0d4d)
parent 936ed91a
......@@ -28,7 +28,20 @@ XRandRMode::XRandRMode(const xcb_randr_mode_info_t &modeInfo, XRandROutput *outp
// m_name = QString::fromUtf8(modeInfo->name);
m_size = QSize(modeInfo.width, modeInfo.height);
m_refreshRate = (float)modeInfo.dot_clock / ((float)modeInfo.htotal * (float)modeInfo.vtotal);
double vTotal = modeInfo.vtotal;
if (modeInfo.mode_flags & XCB_RANDR_MODE_FLAG_DOUBLE_SCAN) {
/* doublescan doubles the number of lines */
vTotal *= 2;
if (modeInfo.mode_flags & XCB_RANDR_MODE_FLAG_INTERLACE) {
/* interlace splits the frame into two fields */
/* the field rate is what is typically reported by monitors */
vTotal /= 2;
m_refreshRate = (float)modeInfo.dot_clock / ((float)modeInfo.htotal * vTotal);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment