aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-11-03 20:16:38 +0100
committerDavid Robillard <d@drobilla.net>2019-11-03 20:16:38 +0100
commitb4e7a7cc20eec3784a70e53bd772f401d61acdb7 (patch)
treed6dda586d7d403e1cc5ef4c70392751512626b85
parente05826ac5d24d916be78cd594f172041f8dcc8bf (diff)
downloadjalv-b4e7a7cc20eec3784a70e53bd772f401d61acdb7.tar.gz
jalv-b4e7a7cc20eec3784a70e53bd772f401d61acdb7.tar.bz2
jalv-b4e7a7cc20eec3784a70e53bd772f401d61acdb7.zip
Use screen refresh rate with Gtk3 and Qt5
-rw-r--r--NEWS6
-rw-r--r--src/jalv.c3
-rw-r--r--src/jalv_console.c6
-rw-r--r--src/jalv_gtk.c13
-rw-r--r--src/jalv_gtkmm2.cpp6
-rw-r--r--src/jalv_internal.h3
-rw-r--r--src/jalv_qt.cpp11
m---------waflib0
-rw-r--r--wscript2
9 files changed, 47 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 4ca13cd..bc2ee2a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+jalv (1.6.3) unstable;
+
+ * Use screen refresh rate with Gtk3 and Qt5
+
+ -- David Robillard <d@drobilla.net> Sun, 03 Nov 2019 19:15:04 +0000
+
jalv (1.6.2) stable;
* Fix compilation with recent Gtkmm versions that require C++11
diff --git a/src/jalv.c b/src/jalv.c
index 1b4365c..adee072 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -1019,8 +1019,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
if (jalv->opts.update_rate == 0.0) {
/* Calculate a reasonable UI update frequency. */
- jalv->ui_update_hz = jalv->sample_rate / jalv->midi_buf_size * 2.0f;
- jalv->ui_update_hz = MAX(25.0f, jalv->ui_update_hz);
+ jalv->ui_update_hz = jalv_ui_refresh_rate(jalv);
} else {
/* Use user-specified UI update rate. */
jalv->ui_update_hz = jalv->opts.update_rate;
diff --git a/src/jalv_console.c b/src/jalv_console.c
index 413a524..7d11714 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -250,6 +250,12 @@ jalv_run_custom_ui(Jalv* jalv)
return false;
}
+float
+jalv_ui_refresh_rate(Jalv* jalv)
+{
+ return 30.0f;
+}
+
int
jalv_open_ui(Jalv* jalv)
{
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index dca5241..8ca8258 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -1153,6 +1153,19 @@ jalv_discover_ui(ZIX_UNUSED Jalv* jalv)
return TRUE;
}
+float
+jalv_ui_refresh_rate(Jalv* jalv)
+{
+#if GTK_MAJOR_VERSION == 2
+ return 30.0f;
+#else
+ GdkDisplay* const display = gdk_display_get_default();
+ GdkMonitor* const monitor = gdk_display_get_primary_monitor(display);
+
+ return (float)gdk_monitor_get_refresh_rate(monitor);
+#endif
+}
+
int
jalv_open_ui(Jalv* jalv)
{
diff --git a/src/jalv_gtkmm2.cpp b/src/jalv_gtkmm2.cpp
index 49b9aa9..3f5a0e9 100644
--- a/src/jalv_gtkmm2.cpp
+++ b/src/jalv_gtkmm2.cpp
@@ -58,6 +58,12 @@ jalv_discover_ui(Jalv* jalv)
return true;
}
+float
+jalv_ui_refresh_rate(Jalv* jalv)
+{
+ return 30.0f;
+}
+
int
jalv_open_ui(Jalv* jalv)
{
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 3fd7b05..4d25109 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -392,6 +392,9 @@ jalv_native_ui_type(void);
bool
jalv_discover_ui(Jalv* jalv);
+float
+jalv_ui_refresh_rate(Jalv* jalv);
+
int
jalv_open_ui(Jalv* jalv);
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index 80141f2..5084c03 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -31,6 +31,7 @@
# include <QMainWindow>
# include <QMenu>
# include <QMenuBar>
+# include <QScreen>
# include <QScrollArea>
# include <QStyle>
# include <QTimer>
@@ -673,6 +674,16 @@ jalv_discover_ui(Jalv* jalv)
return true;
}
+float
+jalv_ui_refresh_rate(Jalv* jalv)
+{
+#if QT_VERSION >= 0x050000
+ return (float)QGuiApplication::primaryScreen()->refreshRate();
+#else
+ return 30.0f;
+#endif
+}
+
int
jalv_open_ui(Jalv* jalv)
{
diff --git a/waflib b/waflib
-Subproject de76b89dc1039e2f7d6c6b229a8950156b0e5c9
+Subproject 0bde0c2e022c479b8c7e3933eca0cbc01282562
diff --git a/wscript b/wscript
index a994e3f..29efcb7 100644
--- a/wscript
+++ b/wscript
@@ -7,7 +7,7 @@ from waflib import Options
from waflib.extras import autowaf as autowaf
# Version of this package (even if built as a child)
-JALV_VERSION = '1.6.2'
+JALV_VERSION = '1.6.3'
# Variables for 'waf dist'
APPNAME = 'jalv'