diff options
author | Olivier Fourdan <fourdan@xfce.org> | 2019-05-12 18:56:56 +0200 |
---|---|---|
committer | Olivier Fourdan <fourdan@xfce.org> | 2019-05-12 19:01:35 +0200 |
commit | 0f29217475698540f4ea2dbfdae4e603f158afa5 (patch) | |
tree | 70b39bd2476e3507e73ee2e7955c62b3e61147d3 /common | |
parent | 14cd399a6e518a52e0d9944711f97e8e1741e2a4 (diff) | |
download | xfwm4-0f29217475698540f4ea2dbfdae4e603f158afa5.tar.gz |
common: Add API to get the refresh rate.
Bug 15391
Return the primary monitor refresh rate in Hertz if available from GDK,
or 60 as the default value.
Signed-off-by: Olivier Fourdan <fourdan@xfce.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/xfwm-common.c | 18 | ||||
-rw-r--r-- | common/xfwm-common.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/common/xfwm-common.c b/common/xfwm-common.c index 04f45e0dc..740451a96 100644 --- a/common/xfwm-common.c +++ b/common/xfwm-common.c @@ -126,6 +126,24 @@ xfwm_get_primary_monitor_geometry (GdkScreen *screen, gint +xfwm_get_primary_refresh_rate (GdkScreen *screen) +{ +#if GTK_CHECK_VERSION(3, 22, 0) + GdkDisplay *display; + GdkMonitor *monitor; + + display = gdk_screen_get_display (screen); + monitor = gdk_display_get_primary_monitor (display); + + return gdk_monitor_get_refresh_rate (monitor) / 1000; +#else + return 60; +#endif +} + + + +gint xfwm_get_n_monitors (GdkScreen *screen) { #if GTK_CHECK_VERSION(3, 22, 0) diff --git a/common/xfwm-common.h b/common/xfwm-common.h index 3cd2b6279..667caff3a 100644 --- a/common/xfwm-common.h +++ b/common/xfwm-common.h @@ -37,6 +37,8 @@ void xfwm_get_monitor_geometry (GdkScreen *screen, void xfwm_get_primary_monitor_geometry (GdkScreen *screen, GdkRectangle *geometry); +gint xfwm_get_primary_refresh_rate (GdkScreen *screen); + gint xfwm_get_n_monitors (GdkScreen *screen); gchar *xfwm_make_display_name (GdkScreen *screen); |