Skip to content

Commit

Permalink
screen: Get monitor refresh rates from xrandr
Browse files Browse the repository at this point in the history
  • Loading branch information
jaszhix committed Sep 8, 2018
1 parent fd0631a commit 1d38120
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/screen-private.h
Expand Up @@ -48,6 +48,7 @@ struct _MetaMonitorInfo
gboolean is_primary;
gboolean in_fullscreen;
XID output; /* The primary or first output for this crtc, None if no xrandr */
float refresh_rate;
};

typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window,
Expand Down
11 changes: 9 additions & 2 deletions src/core/screen.c
Expand Up @@ -605,8 +605,8 @@ reload_monitor_infos (MetaScreen *screen)
{
XineramaScreenInfo *infos;
int n_infos;
int i;
int i, j;

n_infos = 0;
infos = XineramaQueryScreens (display->xdisplay, &n_infos);

Expand Down Expand Up @@ -657,6 +657,13 @@ reload_monitor_infos (MetaScreen *screen)

crtc = XRRGetCrtcInfo (display->xdisplay, resources, resources->crtcs[i]);
info = find_monitor_with_rect (screen, crtc->x, crtc->y, (int)crtc->width, (int)crtc->height);
for (j = 0; j < resources->nmode; j++)
{
if (resources->modes[j].id == crtc->mode)
info->refresh_rate = (resources->modes[j].dotClock /
((float)resources->modes[j].hTotal *
resources->modes[j].vTotal));
}
if (info)
info->output = find_main_output_for_crtc (screen, resources, crtc);

Expand Down

0 comments on commit 1d38120

Please sign in to comment.