[Xfce4-commits] [xfce/xfwm4] 01/02: common: Add API to get the refresh rate.

noreply at xfce.org noreply at xfce.org
Sun May 12 19:18:24 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit 0f29217475698540f4ea2dbfdae4e603f158afa5
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Sun May 12 18:56:56 2019 +0200

    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 at xfce.org>
---
 common/xfwm-common.c | 18 ++++++++++++++++++
 common/xfwm-common.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/common/xfwm-common.c b/common/xfwm-common.c
index 04f45e0..740451a 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 3cd2b62..667caff 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);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list